Register Product and override MissingFunction fields

issue5087
This commit is contained in:
Cédric Krier
2016-01-02 10:24:53 +01:00
parent 1e80fecab2
commit b0c43f6f2f
2 changed files with 10 additions and 1 deletions
+1
View File
@@ -12,6 +12,7 @@ def register():
Pool.register(
Category,
Template,
Product,
Move,
InvoiceLine,
FiscalYear,
+9 -1
View File
@@ -6,7 +6,7 @@ from trytond.pool import PoolMeta
from trytond.modules.account_product import MissingFunction
__all__ = ['Category', 'Template']
__all__ = ['Category', 'Template', 'Product']
__metaclass__ = PoolMeta
@@ -45,3 +45,11 @@ class Template:
account_cogs_used = MissingFunction(fields.Many2One('account.account',
'Account Cost of Goods Sold Used'), 'missing_account',
'get_account')
class Product:
__name__ = 'product.product'
# Avoid raise of UserError from MissingFunction
account_cogs_used = fields.Function(
fields.Many2One('account.account', 'Account Cost of Goods Sold Used'),
'get_template')