Register Product and override MissingFunction fields
issue5087
This commit is contained in:
@@ -14,5 +14,6 @@ def register():
|
||||
Template,
|
||||
TemplateCustomerTax,
|
||||
TemplateSupplierTax,
|
||||
Product,
|
||||
Configuration,
|
||||
module='account_product', type_='model')
|
||||
|
||||
+10
-1
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user