31 lines
1.8 KiB
Python
31 lines
1.8 KiB
Python
|
# -*- 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=[('account_type', 'not in', ('asset_receivable', 'liability_payable', 'asset_cash', 'liability_credit_card')), ('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=[('account_type', 'not in', ('asset_receivable', 'liability_payable', 'asset_cash', 'liability_credit_card')), ('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()
|
||
|
return self.usage == 'internal' or bool(self.usage == 'transit' and self.company_id)
|