[IMP] stock_account: add hook for eligible for COGS
Let people be able to customize how to filter the condition closes odoo/odoo#70418 Signed-off-by: Steve Van Essche <svs-odoo@users.noreply.github.com>
This commit is contained in:
@@ -112,7 +112,7 @@ class AccountMove(models.Model):
|
||||
for line in move.invoice_line_ids:
|
||||
|
||||
# Filter out lines being not eligible for COGS.
|
||||
if line.product_id.type != 'product' or line.product_id.valuation != 'real_time':
|
||||
if not line._eligible_for_cogs():
|
||||
continue
|
||||
|
||||
# Retrieve accounts needed to generate the COGS.
|
||||
@@ -232,6 +232,10 @@ class AccountMoveLine(models.Model):
|
||||
return accounts['stock_input']
|
||||
return super(AccountMoveLine, self)._get_computed_account()
|
||||
|
||||
def _eligible_for_cogs(self):
|
||||
self.ensure_one()
|
||||
return self.product_id.type == 'product' and self.product_id.valuation == 'real_time'
|
||||
|
||||
def _stock_account_get_anglo_saxon_price_unit(self):
|
||||
self.ensure_one()
|
||||
if not self.product_id:
|
||||
|
||||
Reference in New Issue
Block a user