summaryrefslogtreecommitdiff
path: root/addons/stock_account/models/stock_location.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/models/stock_location.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/stock_account/models/stock_location.py')
-rw-r--r--addons/stock_account/models/stock_location.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/addons/stock_account/models/stock_location.py b/addons/stock_account/models/stock_location.py
new file mode 100644
index 00000000..731e31b3
--- /dev/null
+++ b/addons/stock_account/models/stock_location.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import fields, models
+
+
+class StockLocation(models.Model):
+ _inherit = "stock.location"
+
+ valuation_in_account_id = fields.Many2one(
+ 'account.account', 'Stock Valuation Account (Incoming)',
+ domain=[('internal_type', '=', 'other'), ('deprecated', '=', False)],
+ help="Used for real-time inventory valuation. When set on a virtual location (non internal type), "
+ "this account will be used to hold the value of products being moved from an internal location "
+ "into this location, instead of the generic Stock Output Account set on the product. "
+ "This has no effect for internal locations.")
+ valuation_out_account_id = fields.Many2one(
+ 'account.account', 'Stock Valuation Account (Outgoing)',
+ domain=[('internal_type', '=', 'other'), ('deprecated', '=', False)],
+ help="Used for real-time inventory valuation. When set on a virtual location (non internal type), "
+ "this account will be used to hold the value of products being moved out of this location "
+ "and into an internal location, instead of the generic Stock Output Account set on the product. "
+ "This has no effect for internal locations.")
+
+ def _should_be_valued(self):
+ """ This method returns a boolean reflecting whether the products stored in `self` should
+ be considered when valuating the stock of a company.
+ """
+ self.ensure_one()
+ if self.usage == 'internal' or (self.usage == 'transit' and self.company_id):
+ return True
+ return False
+