Register Product and override MissingFunction fields

issue5087
This commit is contained in:
Cédric Krier
2016-01-02 10:24:35 +01:00
parent 26b1b04236
commit c95c876c4e
2 changed files with 11 additions and 1 deletions
+1
View File
@@ -14,5 +14,6 @@ def register():
Template,
TemplateCustomerTax,
TemplateSupplierTax,
Product,
Configuration,
module='account_product', type_='model')
+10 -1
View File
@@ -9,7 +9,7 @@ from trytond.transaction import Transaction
from trytond.pool import PoolMeta
__all__ = ['Category', 'CategoryCustomerTax', 'CategorySupplierTax',
'Template', 'TemplateCustomerTax', 'TemplateSupplierTax',
'Template', 'TemplateCustomerTax', 'TemplateSupplierTax', 'Product',
'MissingFunction']
__metaclass__ = PoolMeta
@@ -307,3 +307,12 @@ class TemplateSupplierTax(ModelSQL):
ondelete='CASCADE', select=True, required=True)
tax = fields.Many2One('account.tax', 'Tax', ondelete='RESTRICT',
required=True)
class Product:
__name__ = 'product.product'
# Avoid raise of UserError from MissingFunction
account_expense_used = fields.Function(fields.Many2One('account.account',
'Account Expense Used'), 'get_template')
account_revenue_used = fields.Function(fields.Many2One('account.account',
'Account Revenue Used'), 'get_template')