From c95c876c4e7afda71b9086ade97e7d2af9f26b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 2 Jan 2016 10:24:35 +0100 Subject: [PATCH] Register Product and override MissingFunction fields issue5087 --- __init__.py | 1 + product.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/__init__.py b/__init__.py index e337cf158d..233a2ed85d 100644 --- a/__init__.py +++ b/__init__.py @@ -14,5 +14,6 @@ def register(): Template, TemplateCustomerTax, TemplateSupplierTax, + Product, Configuration, module='account_product', type_='model') diff --git a/product.py b/product.py index 4056249209..cf522739dc 100644 --- a/product.py +++ b/product.py @@ -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')