Add product mix

This commit is contained in:
Oscar Alvarez 2021-01-30 07:52:10 -05:00
parent 45343dcd89
commit 1fb257ceb2
5 changed files with 48 additions and 2 deletions

View File

@ -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(

21
product.py Normal file
View File

@ -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)

14
product.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!-- This file is part product_barcode module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="product_view_form">
<field name="model">product.product</field>
<field name="inherit" ref="product.product_view_form"/>
<field name="name">product_form</field>
</record>
</data>
</tryton>

View File

@ -9,3 +9,4 @@ depends:
xml:
restaurant.xml
sale.xml
product.xml

9
view/product_form.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/notebook/page[@id='general']/field[@name='categories']"
position="after">
<field name="product_mix" colspan="2"/>
</xpath>
</data>