diff --git a/__init__.py b/__init__.py index ea4e609..3507933 100644 --- a/__init__.py +++ b/__init__.py @@ -1,5 +1,5 @@ from trytond.pool import Pool -from . import product, sale, production +from . import product, sale, production, invoice __all__ = ['register'] @@ -7,6 +7,7 @@ __all__ = ['register'] def register(): Pool.register( product.Product, + invoice.InvoiceLine, sale.Sale, sale.Line, production.Production, diff --git a/invoice.py b/invoice.py new file mode 100644 index 0000000..2a1928e --- /dev/null +++ b/invoice.py @@ -0,0 +1,16 @@ +from trytond.pool import Pool, PoolMeta +from trytond.model import ModelView, fields +from trytond.exceptions import UserError +from trytond.pyson import Eval + + +class InvoiceLine(metaclass=PoolMeta): + __name__ = 'account.invoice.line' + + @classmethod + def __setup__(cls): + super(InvoiceLine, cls).__setup__() + + cls.product.states['required'] = (Eval('type') == 'line') + cls.unit_price.domain = [] + diff --git a/tryton.cfg b/tryton.cfg index 8ef765c..7f7e30b 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -6,6 +6,7 @@ depends: sale sale_supply_production production + account_invoice xml: product.xml sale.xml diff --git a/view/sale_form.xml b/view/sale_form.xml index fe93f27..048d1d7 100644 --- a/view/sale_form.xml +++ b/view/sale_form.xml @@ -3,6 +3,7 @@ this repository contains the full copyright notices and license terms. --> +