diff --git a/__init__.py b/__init__.py index ff6974a..3def078 100644 --- a/__init__.py +++ b/__init__.py @@ -5,7 +5,7 @@ from trytond.pool import Pool import restaurant import sale import production -# import bom +import product import invoice @@ -19,7 +19,8 @@ def register(): sale.SaleForceDraft, sale.SaleLine, production.Production, - # bom.BOM, + product.ProductMixOption, + product.Product, invoice.InvoiceLine, module='sale_pos_frontend_rest', type_='model') Pool.register( diff --git a/product.py b/product.py new file mode 100644 index 0000000..19c6db8 --- /dev/null +++ b/product.py @@ -0,0 +1,21 @@ +# This file is part of Tryton. The COPYRIGHT file at the top level of +# this repository contains the full copyright notices and license terms. +from trytond.model import fields, ModelSQL +from trytond.pool import PoolMeta + +__all__ = ['Product', 'ProductMixOption'] + + +class Product(metaclass=PoolMeta): + __name__ = 'product.product' + product_mix = fields.Many2Many('product.product-mix.option', + 'product', 'option', 'Mix') + + +class ProductMixOption(ModelSQL): + 'Product Mix Option' + __name__ = 'product.product-mix.option' + product = fields.Many2One('product.product', 'Product', + ondelete='CASCADE', required=True, select=True) + option = fields.Many2One('product.product', 'Product', + ondelete='CASCADE', required=True, select=True) diff --git a/product.xml b/product.xml new file mode 100644 index 0000000..3cd7f67 --- /dev/null +++ b/product.xml @@ -0,0 +1,14 @@ + + + + + + + product.product + + product_form + + + + diff --git a/tryton.cfg b/tryton.cfg index 25c3067..92089ac 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -9,3 +9,4 @@ depends: xml: restaurant.xml sale.xml + product.xml diff --git a/view/product_form.xml b/view/product_form.xml new file mode 100644 index 0000000..f6142c2 --- /dev/null +++ b/view/product_form.xml @@ -0,0 +1,9 @@ + + + + + + +