summaryrefslogtreecommitdiff
path: root/addons/stock_account/wizard/stock_quantity_history.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/stock_account/wizard/stock_quantity_history.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/stock_account/wizard/stock_quantity_history.py')
-rw-r--r--addons/stock_account/wizard/stock_quantity_history.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/addons/stock_account/wizard/stock_quantity_history.py b/addons/stock_account/wizard/stock_quantity_history.py
new file mode 100644
index 00000000..1026e7bd
--- /dev/null
+++ b/addons/stock_account/wizard/stock_quantity_history.py
@@ -0,0 +1,18 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import models
+from odoo.tools.misc import format_datetime
+
+
+class StockQuantityHistory(models.TransientModel):
+ _inherit = 'stock.quantity.history'
+
+ def open_at_date(self):
+ active_model = self.env.context.get('active_model')
+ if active_model == 'stock.valuation.layer':
+ action = self.env["ir.actions.actions"]._for_xml_id("stock_account.stock_valuation_layer_action")
+ action['domain'] = [('create_date', '<=', self.inventory_datetime), ('product_id.type', '=', 'product')]
+ action['display_name'] = format_datetime(self.env, self.inventory_datetime)
+ return action
+
+ return super(StockQuantityHistory, self).open_at_date()