mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-26 20:52:00 +02:00
Initial commit: Sale packages
This commit is contained in:
commit
14e3d26998
6469 changed files with 2479670 additions and 0 deletions
7
odoo-bringout-oca-ocb-product/product/__init__.py
Normal file
7
odoo-bringout-oca-ocb-product/product/__init__.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
from . import report
|
||||
from . import populate
|
||||
from . import wizard
|
||||
73
odoo-bringout-oca-ocb-product/product/__manifest__.py
Normal file
73
odoo-bringout-oca-ocb-product/product/__manifest__.py
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name': 'Products & Pricelists',
|
||||
'version': '1.2',
|
||||
'category': 'Sales/Sales',
|
||||
'depends': ['base', 'mail', 'uom'],
|
||||
'description': """
|
||||
This is the base module for managing products and pricelists in Odoo.
|
||||
========================================================================
|
||||
|
||||
Products support variants, different pricing methods, vendors information,
|
||||
make to stock/order, different units of measure, packaging and properties.
|
||||
|
||||
Pricelists support:
|
||||
-------------------
|
||||
* Multiple-level of discount (by product, category, quantities)
|
||||
* Compute price based on different criteria:
|
||||
* Other pricelist
|
||||
* Cost price
|
||||
* List price
|
||||
* Vendor price
|
||||
|
||||
Pricelists preferences by product and/or partners.
|
||||
|
||||
Print product labels with barcode.
|
||||
""",
|
||||
'data': [
|
||||
'data/product_data.xml',
|
||||
'security/product_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
||||
'wizard/product_label_layout_views.xml',
|
||||
|
||||
'views/product_views.xml',
|
||||
|
||||
'views/res_config_settings_views.xml',
|
||||
'views/product_attribute_views.xml',
|
||||
'views/product_category_views.xml',
|
||||
'views/product_packaging_views.xml',
|
||||
'views/product_pricelist_item_views.xml',
|
||||
'views/product_pricelist_views.xml',
|
||||
'views/product_supplierinfo_views.xml',
|
||||
'views/product_template_views.xml',
|
||||
'views/product_tag_views.xml',
|
||||
'views/res_country_group_views.xml',
|
||||
'views/res_partner_views.xml',
|
||||
|
||||
'report/product_reports.xml',
|
||||
'report/product_product_templates.xml',
|
||||
'report/product_template_templates.xml',
|
||||
'report/product_packaging.xml',
|
||||
'report/product_pricelist_report_templates.xml',
|
||||
],
|
||||
'demo': [
|
||||
'data/product_demo.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'assets': {
|
||||
'web.assets_backend': [
|
||||
'product/static/src/js/**/*',
|
||||
'product/static/src/xml/**/*',
|
||||
],
|
||||
'web.report_assets_common': [
|
||||
'product/static/src/scss/report_label_sheet.scss',
|
||||
],
|
||||
'web.qunit_suite_tests': [
|
||||
'product/static/tests/**/*',
|
||||
],
|
||||
},
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
Binary file not shown.
57
odoo-bringout-oca-ocb-product/product/data/product_data.xml
Normal file
57
odoo-bringout-oca-ocb-product/product/data/product_data.xml
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="product_category_all" model="product.category">
|
||||
<field name="name">All</field>
|
||||
</record>
|
||||
<record id="product_category_1" model="product.category">
|
||||
<field name="parent_id" ref="product_category_all"/>
|
||||
<field name="name">Saleable</field>
|
||||
</record>
|
||||
<record id="cat_expense" model="product.category">
|
||||
<field name="parent_id" ref="product_category_all"/>
|
||||
<field name="name">Expenses</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Precisions
|
||||
-->
|
||||
<record forcecreate="True" id="decimal_price" model="decimal.precision">
|
||||
<field name="name">Product Price</field>
|
||||
<field name="digits">2</field>
|
||||
</record>
|
||||
<record forcecreate="True" id="decimal_discount" model="decimal.precision">
|
||||
<field name="name">Discount</field>
|
||||
<field name="digits">2</field>
|
||||
</record>
|
||||
<record forcecreate="True" id="decimal_stock_weight" model="decimal.precision">
|
||||
<field name="name">Stock Weight</field>
|
||||
<field name="digits">2</field>
|
||||
</record>
|
||||
<record forcecreate="True" id="decimal_volume" model="decimal.precision">
|
||||
<field name="name">Volume</field>
|
||||
<field name="digits">2</field>
|
||||
</record>
|
||||
<record forcecreate="True" id="decimal_product_uom" model="decimal.precision">
|
||||
<field name="name">Product Unit of Measure</field>
|
||||
<field name="digits" eval="2"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
... to here, it should be in product_demo but we cant just move it
|
||||
there yet otherwise people who have installed the server (even with the without-demo
|
||||
parameter) will see those record just disappear.
|
||||
-->
|
||||
|
||||
<!-- Price list -->
|
||||
<record id="list0" model="product.pricelist">
|
||||
<field name="name">Public Pricelist</field>
|
||||
<field name="sequence">1</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Property
|
||||
-->
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
793
odoo-bringout-oca-ocb-product/product/data/product_demo.xml
Normal file
793
odoo-bringout-oca-ocb-product/product/data/product_demo.xml
Normal file
|
|
@ -0,0 +1,793 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<!-- We want to activate product variant by default for easier demoing. -->
|
||||
<record id="base.group_user" model="res.groups">
|
||||
<field name="implied_ids" eval="[(4, ref('product.group_product_variant'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="product_category_2" model="product.category">
|
||||
<field name="parent_id" ref="product.product_category_all"/>
|
||||
<field name="name">Internal</field>
|
||||
</record>
|
||||
<record id="product_category_3" model="product.category">
|
||||
<field name="parent_id" ref="product.product_category_1"/>
|
||||
<field name="name">Services</field>
|
||||
</record>
|
||||
<record id="product_category_6" model="product.category">
|
||||
<field name="parent_id" ref="product.product_category_3"/>
|
||||
<field name="name">Saleable</field>
|
||||
</record>
|
||||
<record id="product_category_4" model="product.category">
|
||||
<field name="parent_id" ref="product.product_category_1"/>
|
||||
<field name="name">Software</field>
|
||||
</record>
|
||||
<record id="product_category_5" model="product.category">
|
||||
<field name="parent_id" ref="product_category_1"/>
|
||||
<field name="name">Office Furniture</field>
|
||||
</record>
|
||||
<record id="product_category_consumable" model="product.category">
|
||||
<field name="parent_id" ref="product_category_all"/>
|
||||
<field name="name">Consumable</field>
|
||||
</record>
|
||||
|
||||
<!-- Expensable products -->
|
||||
<record id="expense_product" model="product.product">
|
||||
<field name="name">Restaurant Expenses</field>
|
||||
<field name="list_price">14.0</field>
|
||||
<field name="standard_price">8.0</field>
|
||||
<field name="detailed_type">service</field>
|
||||
<field name="categ_id" ref="product.cat_expense"/>
|
||||
</record>
|
||||
|
||||
<record id="expense_hotel" model="product.product">
|
||||
<field name="name">Hotel Accommodation</field>
|
||||
<field name="list_price">400.0</field>
|
||||
<field name="standard_price">400.0</field>
|
||||
<field name="detailed_type">service</field>
|
||||
<field name="uom_id" ref="uom.product_uom_day"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_day"/>
|
||||
<field name="categ_id" ref="cat_expense"/>
|
||||
</record>
|
||||
|
||||
<!-- Service products -->
|
||||
<record id="product_product_1" model="product.product">
|
||||
<field name="name">Virtual Interior Design</field>
|
||||
<field name="categ_id" ref="product_category_3"/>
|
||||
<field name="standard_price">20.5</field>
|
||||
<field name="list_price">30.75</field>
|
||||
<field name="detailed_type">service</field>
|
||||
<field name="uom_id" ref="uom.product_uom_hour"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_hour"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_2" model="product.product">
|
||||
<field name="name">Virtual Home Staging</field>
|
||||
<field name="categ_id" ref="product_category_3"/>
|
||||
<field name="standard_price">25.5</field>
|
||||
<field name="list_price">38.25</field>
|
||||
<field name="detailed_type">service</field>
|
||||
<field name="uom_id" ref="uom.product_uom_hour"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_hour"/>
|
||||
</record>
|
||||
|
||||
<!-- Physical Products -->
|
||||
|
||||
<record id="product_delivery_01" model="product.product">
|
||||
<field name="name">Office Chair</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">55.0</field>
|
||||
<field name="list_price">70.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">FURN_7777</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_chair.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="product_delivery_02" model="product.product">
|
||||
<field name="name">Office Lamp</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">35.0</field>
|
||||
<field name="list_price">40.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">FURN_8888</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_lamp.png"/>
|
||||
</record>
|
||||
|
||||
<record id="product_order_01" model="product.product">
|
||||
<field name="name">Office Design Software</field>
|
||||
<field name="categ_id" ref="product_category_4"/>
|
||||
<field name="standard_price">235.0</field>
|
||||
<field name="list_price">280.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">FURN_9999</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_43-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_3" model="product.product">
|
||||
<field name="name">Desk Combination</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="list_price">450.0</field>
|
||||
<field name="standard_price">300.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="description_sale">Desk combination, black-brown: chair + desk + drawer.</field>
|
||||
<field name="default_code">FURN_7800</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_3-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<!-- Variants -->
|
||||
|
||||
<record id="product_attribute_1" model="product.attribute">
|
||||
<field name="name">Legs</field>
|
||||
<field name="sequence">10</field>
|
||||
</record>
|
||||
<record id="product_attribute_value_1" model="product.attribute.value">
|
||||
<field name="name">Steel</field>
|
||||
<field name="attribute_id" ref="product_attribute_1"/>
|
||||
<field name="sequence">1</field>
|
||||
</record>
|
||||
<record id="product_attribute_value_2" model="product.attribute.value">
|
||||
<field name="name">Aluminium</field>
|
||||
<field name="attribute_id" ref="product_attribute_1"/>
|
||||
<field name="sequence">2</field>
|
||||
</record>
|
||||
|
||||
<record id="product_attribute_2" model="product.attribute">
|
||||
<field name="name">Color</field>
|
||||
<field name="sequence">20</field>
|
||||
</record>
|
||||
<record id="product_attribute_value_3" model="product.attribute.value">
|
||||
<field name="name">White</field>
|
||||
<field name="attribute_id" ref="product_attribute_2"/>
|
||||
<field name="sequence">1</field>
|
||||
</record>
|
||||
<record id="product_attribute_value_4" model="product.attribute.value">
|
||||
<field name="name">Black</field>
|
||||
<field name="attribute_id" ref="product_attribute_2"/>
|
||||
<field name="sequence">2</field>
|
||||
</record>
|
||||
|
||||
<record id="product_attribute_3" model="product.attribute">
|
||||
<field name="name">Duration</field>
|
||||
<field name="sequence">30</field>
|
||||
</record>
|
||||
<record id="product_attribute_value_5" model="product.attribute.value">
|
||||
<field name="name">1 year</field>
|
||||
<field name="attribute_id" ref="product_attribute_3"/>
|
||||
</record>
|
||||
<record id="product_attribute_value_6" model="product.attribute.value">
|
||||
<field name="name">2 year</field>
|
||||
<field name="attribute_id" ref="product_attribute_3"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_4_product_template" model="product.template">
|
||||
<field name="name">Customizable Desk</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">500.0</field>
|
||||
<field name="list_price">750.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="description_sale">160x80cm, with large legs.</field>
|
||||
</record>
|
||||
|
||||
<!-- the product template attribute lines have to be defined before creating the variants -->
|
||||
<record id="product_4_attribute_1_product_template_attribute_line" model="product.template.attribute.line">
|
||||
<field name="product_tmpl_id" ref="product_product_4_product_template"/>
|
||||
<field name="attribute_id" ref="product_attribute_1"/>
|
||||
<field name="value_ids" eval="[(6, 0, [ref('product.product_attribute_value_1'), ref('product.product_attribute_value_2')])]"/>
|
||||
</record>
|
||||
<record id="product_4_attribute_2_product_template_attribute_line" model="product.template.attribute.line">
|
||||
<field name="product_tmpl_id" ref="product_product_4_product_template"/>
|
||||
<field name="attribute_id" ref="product_attribute_2"/>
|
||||
<field name="value_ids" eval="[(6, 0, [ref('product.product_attribute_value_3'), ref('product.product_attribute_value_4')])]"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Handle automatically created product.template.attribute.value.
|
||||
Meaning that the combination between the "customizable desk" and the attribute value "black" will be materialized
|
||||
into a "product.template.attribute.value" with the ref "product.product_4_attribute_1_value_1".
|
||||
This will allow setting fields like "price_extra" and "exclude_for"
|
||||
-->
|
||||
<function model="ir.model.data" name="_update_xmlids">
|
||||
<value model="base" eval="[{
|
||||
'xml_id': 'product.product_4_attribute_1_value_1',
|
||||
'record': obj().env.ref('product.product_4_attribute_1_product_template_attribute_line').product_template_value_ids[0],
|
||||
'noupdate': True,
|
||||
}, {
|
||||
'xml_id': 'product.product_4_attribute_1_value_2',
|
||||
'record': obj().env.ref('product.product_4_attribute_1_product_template_attribute_line').product_template_value_ids[1],
|
||||
'noupdate': True,
|
||||
}, {
|
||||
'xml_id': 'product.product_4_attribute_2_value_1',
|
||||
'record': obj().env.ref('product.product_4_attribute_2_product_template_attribute_line').product_template_value_ids[0],
|
||||
'noupdate': True,
|
||||
}, {
|
||||
'xml_id': 'product.product_4_attribute_2_value_2',
|
||||
'record': obj().env.ref('product.product_4_attribute_2_product_template_attribute_line').product_template_value_ids[1],
|
||||
'noupdate': True,
|
||||
},]"/>
|
||||
</function>
|
||||
|
||||
<function model="ir.model.data" name="_update_xmlids">
|
||||
<value model="base" eval="[{
|
||||
'xml_id': 'product.product_product_4',
|
||||
'record': obj().env.ref('product.product_product_4_product_template')._get_variant_for_combination(obj().env.ref('product.product_4_attribute_1_value_1') + obj().env.ref('product.product_4_attribute_2_value_1')),
|
||||
'noupdate': True,
|
||||
}, {
|
||||
'xml_id': 'product.product_product_4b',
|
||||
'record': obj().env.ref('product.product_product_4_product_template')._get_variant_for_combination(obj().env.ref('product.product_4_attribute_1_value_1') + obj().env.ref('product.product_4_attribute_2_value_2')),
|
||||
'noupdate': True,
|
||||
}, {
|
||||
'xml_id': 'product.product_product_4c',
|
||||
'record': obj().env.ref('product.product_product_4_product_template')._get_variant_for_combination(obj().env.ref('product.product_4_attribute_1_value_2') + obj().env.ref('product.product_4_attribute_2_value_1')),
|
||||
'noupdate': True,
|
||||
},]"/>
|
||||
</function>
|
||||
|
||||
<record id="product_product_4" model="product.product">
|
||||
<field name="default_code">FURN_0096</field>
|
||||
<field name="standard_price">500.0</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/table02.jpg"/>
|
||||
</record>
|
||||
<record id="product_product_4b" model="product.product">
|
||||
<field name="default_code">FURN_0097</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="standard_price">500.0</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/table04.jpg"/>
|
||||
</record>
|
||||
<record id="product_product_4c" model="product.product">
|
||||
<field name="default_code">FURN_0098</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="standard_price">500.0</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/table03.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_5" model="product.product">
|
||||
<field name="name">Corner Desk Right Sit</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">600.0</field>
|
||||
<field name="list_price">147.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">E-COM06</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_5-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_6" model="product.product">
|
||||
<field name="name">Large Cabinet</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">800.0</field>
|
||||
<field name="list_price">320.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">E-COM07</field>
|
||||
<field name='weight'>0.330</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_6-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_7" model="product.product">
|
||||
<field name="name">Storage Box</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">14.0</field>
|
||||
<field name="list_price">15.8</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">E-COM08</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_7-image.png"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_8" model="product.product">
|
||||
<field name="name">Large Desk</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">1299.0</field>
|
||||
<field name="list_price">1799.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">E-COM09</field>
|
||||
<field name='weight'>9.54</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_8-image.png"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_9" model="product.product">
|
||||
<field name="name">Pedal Bin</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">10.0</field>
|
||||
<field name="list_price">47.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">E-COM10</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_9-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_10" model="product.product">
|
||||
<field name="name">Cabinet with Doors</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">120.50</field>
|
||||
<field name="list_price">140</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">E-COM11</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_10-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_11_product_template" model="product.template">
|
||||
<field name="name">Conference Chair</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">28</field>
|
||||
<field name="list_price">33</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_11-image.png"/>
|
||||
</record>
|
||||
|
||||
<!-- the product template attribute lines have to be defined before creating the variants -->
|
||||
<record id="product_11_attribute_1_product_template_attribute_line" model="product.template.attribute.line">
|
||||
<field name="product_tmpl_id" ref="product_product_11_product_template"/>
|
||||
<field name="attribute_id" ref="product_attribute_1"/>
|
||||
<field name="value_ids" eval="[(6,0,[ref('product.product_attribute_value_1'), ref('product.product_attribute_value_2')])]"/>
|
||||
</record>
|
||||
|
||||
<function model="ir.model.data" name="_update_xmlids">
|
||||
<value model="base" eval="[{
|
||||
'xml_id': 'product.product_11_attribute_1_value_1',
|
||||
'record': obj().env.ref('product.product_11_attribute_1_product_template_attribute_line').product_template_value_ids[0],
|
||||
'noupdate': True,
|
||||
}, {
|
||||
'xml_id': 'product.product_11_attribute_1_value_2',
|
||||
'record': obj().env.ref('product.product_11_attribute_1_product_template_attribute_line').product_template_value_ids[1],
|
||||
'noupdate': True,
|
||||
}]"/>
|
||||
</function>
|
||||
|
||||
<function model="ir.model.data" name="_update_xmlids">
|
||||
<value model="base" eval="[{
|
||||
'xml_id': 'product.product_product_11',
|
||||
'record': obj().env.ref('product.product_product_11_product_template')._get_variant_for_combination(obj().env.ref('product.product_11_attribute_1_value_1')),
|
||||
'noupdate': True,
|
||||
}, {
|
||||
'xml_id': 'product.product_product_11b',
|
||||
'record': obj().env.ref('product.product_product_11_product_template')._get_variant_for_combination(obj().env.ref('product.product_11_attribute_1_value_2')),
|
||||
'noupdate': True,
|
||||
},]"/>
|
||||
</function>
|
||||
|
||||
<record id="product_product_11" model="product.product">
|
||||
<field name="default_code">E-COM12</field>
|
||||
<field name="weight">0.01</field>
|
||||
</record>
|
||||
<record id="product_product_11b" model="product.product">
|
||||
<field name="default_code">E-COM13</field>
|
||||
<field name="weight">0.01</field>
|
||||
</record>
|
||||
|
||||
<record id="product.product_4_attribute_1_value_2" model="product.template.attribute.value">
|
||||
<field name="price_extra">50.40</field>
|
||||
</record>
|
||||
|
||||
<record id="product.product_11_attribute_1_value_2" model="product.template.attribute.value">
|
||||
<field name="price_extra">6.40</field>
|
||||
</record>
|
||||
|
||||
<!-- MRP Demo Data-->
|
||||
|
||||
<record id="product_product_12" model="product.product">
|
||||
<field name="name">Office Chair Black</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">180</field>
|
||||
<field name="list_price">120.50</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">FURN_0269</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_12-image.png"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_13" model="product.product">
|
||||
<field name="name">Corner Desk Left Sit</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">78.0</field>
|
||||
<field name="list_price">85.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">FURN_1118</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_13-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_16" model="product.product">
|
||||
<field name="name">Drawer Black</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">20.0</field>
|
||||
<field name="list_price">25.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">FURN_8900</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_16-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_20" model="product.product">
|
||||
<field name="name">Flipover</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">1700.0</field>
|
||||
<field name="list_price">1950.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">FURN_9001</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_20-image.png"/>
|
||||
</record>
|
||||
<record id="product_product_22" model="product.product">
|
||||
<field name="name">Desk Stand with Screen</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">2010.0</field>
|
||||
<field name="list_price">2100.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">FURN_7888</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_22-image.png"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_24" model="product.product">
|
||||
<field name="name">Individual Workplace</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">876.0</field>
|
||||
<field name="list_price">885.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">FURN_0789</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_24-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_25" model="product.product">
|
||||
<field name="name">Acoustic Bloc Screens</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">287.0</field>
|
||||
<field name="list_price">295.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="default_code">FURN_6666</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_25-image.png"/>
|
||||
</record>
|
||||
|
||||
<record id="product_product_27" model="product.product">
|
||||
<field name="name">Drawer</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">100.0</field>
|
||||
<field name="list_price">110.50</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="description">Drawer with two routing possiblities.</field>
|
||||
<field name="default_code">FURN_8855</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_27-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="consu_delivery_03" model="product.product">
|
||||
<field name="name">Four Person Desk</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">2500.0</field>
|
||||
<field name="list_price">2350.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="description_sale">Four person modern office workstation</field>
|
||||
<field name="default_code">FURN_8220</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_d03-image.png"/>
|
||||
</record>
|
||||
|
||||
<record id="consu_delivery_02" model="product.product">
|
||||
<field name="name">Large Meeting Table</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">4500.0</field>
|
||||
<field name="list_price">4000.0</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="description_sale">Conference room table</field>
|
||||
<field name="default_code">FURN_6741</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_46-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="consu_delivery_01" model="product.product">
|
||||
<field name="name">Three-Seat Sofa</field>
|
||||
<field name="categ_id" ref="product_category_5"/>
|
||||
<field name="standard_price">1000</field>
|
||||
<field name="list_price">1500</field>
|
||||
<field name="detailed_type">consu</field>
|
||||
<field name="weight">0.01</field>
|
||||
<field name="uom_id" ref="uom.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="uom.product_uom_unit"/>
|
||||
<field name="description_sale">Three Seater Sofa with Lounger in Steel Grey Colour</field>
|
||||
<field name="default_code">FURN_8999</field>
|
||||
<field name="image_1920" type="base64" file="product/static/img/product_product_d01-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Resource: product.supplierinfo
|
||||
-->
|
||||
|
||||
<record id="product_supplierinfo_1" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_6_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="delay">3</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">750</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_2" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_6_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_4"/>
|
||||
<field name="delay">3</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">790</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_2bis" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_6_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_4"/>
|
||||
<field name="delay">3</field>
|
||||
<field name="min_qty">3</field>
|
||||
<field name="price">785</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_3" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_7_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="delay">3</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">13.0</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_4" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_7_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_4"/>
|
||||
<field name="delay">3</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">14.4</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_5" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_8_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="delay">2</field>
|
||||
<field name="min_qty">5</field>
|
||||
<field name="price">1299</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_6" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_8_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_12"/>
|
||||
<field name="delay">4</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">1399</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_7" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_10_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="delay">2</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">120.50</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_8" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_11_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="delay">2</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">28</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_9" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_13_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_4"/>
|
||||
<field name="delay">5</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">78</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_10" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_16_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="delay">1</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">20</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_12" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_20_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_4"/>
|
||||
<field name="delay">3</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">1700</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_13" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_20_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="delay">4</field>
|
||||
<field name="min_qty">5</field>
|
||||
<field name="price">1720</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_14" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_22_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_2"/>
|
||||
<field name="delay">3</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">2010</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_15" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_24_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_2"/>
|
||||
<field name="delay">3</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">876</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_16" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_25_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="delay">8</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">287</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_17" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_delivery_02_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_2"/>
|
||||
<field name="delay">4</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">390</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_18" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_delivery_01_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="delay">2</field>
|
||||
<field name="min_qty">12</field>
|
||||
<field name="price">90</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_19" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_delivery_01_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="delay">4</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">66</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_20" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_delivery_02_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="delay">5</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">35</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_21" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_delivery_01_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_12"/>
|
||||
<field name="delay">7</field>
|
||||
<field name="min_qty">1</field>
|
||||
<field name="price">55</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_22" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_9_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_12"/>
|
||||
<field name="delay">4</field>
|
||||
<field name="min_qty">0</field>
|
||||
<field name="price">10</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_23" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_27_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="delay">10</field>
|
||||
<field name="min_qty">0</field>
|
||||
<field name="price">95.50</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_24" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_12_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="delay">3</field>
|
||||
<field name="min_qty">0</field>
|
||||
<field name="price">120.50</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_25" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_12_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_4"/>
|
||||
<field name="delay">2</field>
|
||||
<field name="min_qty">0</field>
|
||||
<field name="price">130.50</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_26" model="product.supplierinfo">
|
||||
<field name="product_tmpl_id" ref="product_product_5_product_template"/>
|
||||
<field name="partner_id" ref="base.res_partner_10"/>
|
||||
<field name="delay">1</field>
|
||||
<field name="min_qty">0</field>
|
||||
<field name="price">145</field>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record forcecreate="True" id="property_product_pricelist_demo" model="ir.property">
|
||||
<field name="name">property_product_pricelist</field>
|
||||
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_product_pricelist')]"/>
|
||||
<field name="value" eval="'product.pricelist,'+str(ref('list0'))"/>
|
||||
<field name="res_id" eval="'res.partner,'+str(ref('base.partner_demo'))"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
3253
odoo-bringout-oca-ocb-product/product/i18n/af.po
Normal file
3253
odoo-bringout-oca-ocb-product/product/i18n/af.po
Normal file
File diff suppressed because it is too large
Load diff
3249
odoo-bringout-oca-ocb-product/product/i18n/am.po
Normal file
3249
odoo-bringout-oca-ocb-product/product/i18n/am.po
Normal file
File diff suppressed because it is too large
Load diff
3403
odoo-bringout-oca-ocb-product/product/i18n/ar.po
Normal file
3403
odoo-bringout-oca-ocb-product/product/i18n/ar.po
Normal file
File diff suppressed because it is too large
Load diff
3267
odoo-bringout-oca-ocb-product/product/i18n/az.po
Normal file
3267
odoo-bringout-oca-ocb-product/product/i18n/az.po
Normal file
File diff suppressed because it is too large
Load diff
3253
odoo-bringout-oca-ocb-product/product/i18n/be.po
Normal file
3253
odoo-bringout-oca-ocb-product/product/i18n/be.po
Normal file
File diff suppressed because it is too large
Load diff
3315
odoo-bringout-oca-ocb-product/product/i18n/bg.po
Normal file
3315
odoo-bringout-oca-ocb-product/product/i18n/bg.po
Normal file
File diff suppressed because it is too large
Load diff
3253
odoo-bringout-oca-ocb-product/product/i18n/bs.po
Normal file
3253
odoo-bringout-oca-ocb-product/product/i18n/bs.po
Normal file
File diff suppressed because it is too large
Load diff
3460
odoo-bringout-oca-ocb-product/product/i18n/ca.po
Normal file
3460
odoo-bringout-oca-ocb-product/product/i18n/ca.po
Normal file
File diff suppressed because it is too large
Load diff
3425
odoo-bringout-oca-ocb-product/product/i18n/cs.po
Normal file
3425
odoo-bringout-oca-ocb-product/product/i18n/cs.po
Normal file
File diff suppressed because it is too large
Load diff
3401
odoo-bringout-oca-ocb-product/product/i18n/da.po
Normal file
3401
odoo-bringout-oca-ocb-product/product/i18n/da.po
Normal file
File diff suppressed because it is too large
Load diff
3456
odoo-bringout-oca-ocb-product/product/i18n/de.po
Normal file
3456
odoo-bringout-oca-ocb-product/product/i18n/de.po
Normal file
File diff suppressed because it is too large
Load diff
2714
odoo-bringout-oca-ocb-product/product/i18n/el.po
Normal file
2714
odoo-bringout-oca-ocb-product/product/i18n/el.po
Normal file
File diff suppressed because it is too large
Load diff
3393
odoo-bringout-oca-ocb-product/product/i18n/en_GB.po
Normal file
3393
odoo-bringout-oca-ocb-product/product/i18n/en_GB.po
Normal file
File diff suppressed because it is too large
Load diff
3448
odoo-bringout-oca-ocb-product/product/i18n/es.po
Normal file
3448
odoo-bringout-oca-ocb-product/product/i18n/es.po
Normal file
File diff suppressed because it is too large
Load diff
3313
odoo-bringout-oca-ocb-product/product/i18n/es_BO.po
Normal file
3313
odoo-bringout-oca-ocb-product/product/i18n/es_BO.po
Normal file
File diff suppressed because it is too large
Load diff
3362
odoo-bringout-oca-ocb-product/product/i18n/es_CL.po
Normal file
3362
odoo-bringout-oca-ocb-product/product/i18n/es_CL.po
Normal file
File diff suppressed because it is too large
Load diff
3818
odoo-bringout-oca-ocb-product/product/i18n/es_CO.po
Normal file
3818
odoo-bringout-oca-ocb-product/product/i18n/es_CO.po
Normal file
File diff suppressed because it is too large
Load diff
3324
odoo-bringout-oca-ocb-product/product/i18n/es_CR.po
Normal file
3324
odoo-bringout-oca-ocb-product/product/i18n/es_CR.po
Normal file
File diff suppressed because it is too large
Load diff
3843
odoo-bringout-oca-ocb-product/product/i18n/es_DO.po
Normal file
3843
odoo-bringout-oca-ocb-product/product/i18n/es_DO.po
Normal file
File diff suppressed because it is too large
Load diff
3830
odoo-bringout-oca-ocb-product/product/i18n/es_EC.po
Normal file
3830
odoo-bringout-oca-ocb-product/product/i18n/es_EC.po
Normal file
File diff suppressed because it is too large
Load diff
3442
odoo-bringout-oca-ocb-product/product/i18n/es_MX.po
Normal file
3442
odoo-bringout-oca-ocb-product/product/i18n/es_MX.po
Normal file
File diff suppressed because it is too large
Load diff
3346
odoo-bringout-oca-ocb-product/product/i18n/es_PE.po
Normal file
3346
odoo-bringout-oca-ocb-product/product/i18n/es_PE.po
Normal file
File diff suppressed because it is too large
Load diff
3323
odoo-bringout-oca-ocb-product/product/i18n/es_PY.po
Normal file
3323
odoo-bringout-oca-ocb-product/product/i18n/es_PY.po
Normal file
File diff suppressed because it is too large
Load diff
3330
odoo-bringout-oca-ocb-product/product/i18n/es_VE.po
Normal file
3330
odoo-bringout-oca-ocb-product/product/i18n/es_VE.po
Normal file
File diff suppressed because it is too large
Load diff
3429
odoo-bringout-oca-ocb-product/product/i18n/et.po
Normal file
3429
odoo-bringout-oca-ocb-product/product/i18n/et.po
Normal file
File diff suppressed because it is too large
Load diff
3349
odoo-bringout-oca-ocb-product/product/i18n/eu.po
Normal file
3349
odoo-bringout-oca-ocb-product/product/i18n/eu.po
Normal file
File diff suppressed because it is too large
Load diff
3319
odoo-bringout-oca-ocb-product/product/i18n/fa.po
Normal file
3319
odoo-bringout-oca-ocb-product/product/i18n/fa.po
Normal file
File diff suppressed because it is too large
Load diff
3442
odoo-bringout-oca-ocb-product/product/i18n/fi.po
Normal file
3442
odoo-bringout-oca-ocb-product/product/i18n/fi.po
Normal file
File diff suppressed because it is too large
Load diff
3459
odoo-bringout-oca-ocb-product/product/i18n/fr.po
Normal file
3459
odoo-bringout-oca-ocb-product/product/i18n/fr.po
Normal file
File diff suppressed because it is too large
Load diff
3178
odoo-bringout-oca-ocb-product/product/i18n/fr_BE.po
Normal file
3178
odoo-bringout-oca-ocb-product/product/i18n/fr_BE.po
Normal file
File diff suppressed because it is too large
Load diff
3294
odoo-bringout-oca-ocb-product/product/i18n/gl.po
Normal file
3294
odoo-bringout-oca-ocb-product/product/i18n/gl.po
Normal file
File diff suppressed because it is too large
Load diff
3257
odoo-bringout-oca-ocb-product/product/i18n/gu.po
Normal file
3257
odoo-bringout-oca-ocb-product/product/i18n/gu.po
Normal file
File diff suppressed because it is too large
Load diff
3401
odoo-bringout-oca-ocb-product/product/i18n/he.po
Normal file
3401
odoo-bringout-oca-ocb-product/product/i18n/he.po
Normal file
File diff suppressed because it is too large
Load diff
3263
odoo-bringout-oca-ocb-product/product/i18n/hi.po
Normal file
3263
odoo-bringout-oca-ocb-product/product/i18n/hi.po
Normal file
File diff suppressed because it is too large
Load diff
3346
odoo-bringout-oca-ocb-product/product/i18n/hr.po
Normal file
3346
odoo-bringout-oca-ocb-product/product/i18n/hr.po
Normal file
File diff suppressed because it is too large
Load diff
3335
odoo-bringout-oca-ocb-product/product/i18n/hu.po
Normal file
3335
odoo-bringout-oca-ocb-product/product/i18n/hu.po
Normal file
File diff suppressed because it is too large
Load diff
3249
odoo-bringout-oca-ocb-product/product/i18n/hy.po
Normal file
3249
odoo-bringout-oca-ocb-product/product/i18n/hy.po
Normal file
File diff suppressed because it is too large
Load diff
3415
odoo-bringout-oca-ocb-product/product/i18n/id.po
Normal file
3415
odoo-bringout-oca-ocb-product/product/i18n/id.po
Normal file
File diff suppressed because it is too large
Load diff
3261
odoo-bringout-oca-ocb-product/product/i18n/is.po
Normal file
3261
odoo-bringout-oca-ocb-product/product/i18n/is.po
Normal file
File diff suppressed because it is too large
Load diff
3444
odoo-bringout-oca-ocb-product/product/i18n/it.po
Normal file
3444
odoo-bringout-oca-ocb-product/product/i18n/it.po
Normal file
File diff suppressed because it is too large
Load diff
3327
odoo-bringout-oca-ocb-product/product/i18n/ja.po
Normal file
3327
odoo-bringout-oca-ocb-product/product/i18n/ja.po
Normal file
File diff suppressed because it is too large
Load diff
3502
odoo-bringout-oca-ocb-product/product/i18n/kab.po
Normal file
3502
odoo-bringout-oca-ocb-product/product/i18n/kab.po
Normal file
File diff suppressed because it is too large
Load diff
3310
odoo-bringout-oca-ocb-product/product/i18n/km.po
Normal file
3310
odoo-bringout-oca-ocb-product/product/i18n/km.po
Normal file
File diff suppressed because it is too large
Load diff
3338
odoo-bringout-oca-ocb-product/product/i18n/ko.po
Normal file
3338
odoo-bringout-oca-ocb-product/product/i18n/ko.po
Normal file
File diff suppressed because it is too large
Load diff
2479
odoo-bringout-oca-ocb-product/product/i18n/lb.po
Normal file
2479
odoo-bringout-oca-ocb-product/product/i18n/lb.po
Normal file
File diff suppressed because it is too large
Load diff
3260
odoo-bringout-oca-ocb-product/product/i18n/lo.po
Normal file
3260
odoo-bringout-oca-ocb-product/product/i18n/lo.po
Normal file
File diff suppressed because it is too large
Load diff
3376
odoo-bringout-oca-ocb-product/product/i18n/lt.po
Normal file
3376
odoo-bringout-oca-ocb-product/product/i18n/lt.po
Normal file
File diff suppressed because it is too large
Load diff
3339
odoo-bringout-oca-ocb-product/product/i18n/lv.po
Normal file
3339
odoo-bringout-oca-ocb-product/product/i18n/lv.po
Normal file
File diff suppressed because it is too large
Load diff
3559
odoo-bringout-oca-ocb-product/product/i18n/mk.po
Normal file
3559
odoo-bringout-oca-ocb-product/product/i18n/mk.po
Normal file
File diff suppressed because it is too large
Load diff
3258
odoo-bringout-oca-ocb-product/product/i18n/ml.po
Normal file
3258
odoo-bringout-oca-ocb-product/product/i18n/ml.po
Normal file
File diff suppressed because it is too large
Load diff
3320
odoo-bringout-oca-ocb-product/product/i18n/mn.po
Normal file
3320
odoo-bringout-oca-ocb-product/product/i18n/mn.po
Normal file
File diff suppressed because it is too large
Load diff
3259
odoo-bringout-oca-ocb-product/product/i18n/ms.po
Normal file
3259
odoo-bringout-oca-ocb-product/product/i18n/ms.po
Normal file
File diff suppressed because it is too large
Load diff
3325
odoo-bringout-oca-ocb-product/product/i18n/nb.po
Normal file
3325
odoo-bringout-oca-ocb-product/product/i18n/nb.po
Normal file
File diff suppressed because it is too large
Load diff
3440
odoo-bringout-oca-ocb-product/product/i18n/nl.po
Normal file
3440
odoo-bringout-oca-ocb-product/product/i18n/nl.po
Normal file
File diff suppressed because it is too large
Load diff
3249
odoo-bringout-oca-ocb-product/product/i18n/no.po
Normal file
3249
odoo-bringout-oca-ocb-product/product/i18n/no.po
Normal file
File diff suppressed because it is too large
Load diff
3456
odoo-bringout-oca-ocb-product/product/i18n/pl.po
Normal file
3456
odoo-bringout-oca-ocb-product/product/i18n/pl.po
Normal file
File diff suppressed because it is too large
Load diff
3250
odoo-bringout-oca-ocb-product/product/i18n/product.pot
Normal file
3250
odoo-bringout-oca-ocb-product/product/i18n/product.pot
Normal file
File diff suppressed because it is too large
Load diff
3325
odoo-bringout-oca-ocb-product/product/i18n/pt.po
Normal file
3325
odoo-bringout-oca-ocb-product/product/i18n/pt.po
Normal file
File diff suppressed because it is too large
Load diff
3436
odoo-bringout-oca-ocb-product/product/i18n/pt_BR.po
Normal file
3436
odoo-bringout-oca-ocb-product/product/i18n/pt_BR.po
Normal file
File diff suppressed because it is too large
Load diff
3436
odoo-bringout-oca-ocb-product/product/i18n/ro.po
Normal file
3436
odoo-bringout-oca-ocb-product/product/i18n/ro.po
Normal file
File diff suppressed because it is too large
Load diff
3447
odoo-bringout-oca-ocb-product/product/i18n/ru.po
Normal file
3447
odoo-bringout-oca-ocb-product/product/i18n/ru.po
Normal file
File diff suppressed because it is too large
Load diff
3319
odoo-bringout-oca-ocb-product/product/i18n/sk.po
Normal file
3319
odoo-bringout-oca-ocb-product/product/i18n/sk.po
Normal file
File diff suppressed because it is too large
Load diff
3308
odoo-bringout-oca-ocb-product/product/i18n/sl.po
Normal file
3308
odoo-bringout-oca-ocb-product/product/i18n/sl.po
Normal file
File diff suppressed because it is too large
Load diff
3249
odoo-bringout-oca-ocb-product/product/i18n/sq.po
Normal file
3249
odoo-bringout-oca-ocb-product/product/i18n/sq.po
Normal file
File diff suppressed because it is too large
Load diff
3388
odoo-bringout-oca-ocb-product/product/i18n/sr.po
Normal file
3388
odoo-bringout-oca-ocb-product/product/i18n/sr.po
Normal file
File diff suppressed because it is too large
Load diff
3385
odoo-bringout-oca-ocb-product/product/i18n/sr@latin.po
Normal file
3385
odoo-bringout-oca-ocb-product/product/i18n/sr@latin.po
Normal file
File diff suppressed because it is too large
Load diff
3420
odoo-bringout-oca-ocb-product/product/i18n/sv.po
Normal file
3420
odoo-bringout-oca-ocb-product/product/i18n/sv.po
Normal file
File diff suppressed because it is too large
Load diff
3249
odoo-bringout-oca-ocb-product/product/i18n/sw.po
Normal file
3249
odoo-bringout-oca-ocb-product/product/i18n/sw.po
Normal file
File diff suppressed because it is too large
Load diff
3249
odoo-bringout-oca-ocb-product/product/i18n/ta.po
Normal file
3249
odoo-bringout-oca-ocb-product/product/i18n/ta.po
Normal file
File diff suppressed because it is too large
Load diff
3389
odoo-bringout-oca-ocb-product/product/i18n/th.po
Normal file
3389
odoo-bringout-oca-ocb-product/product/i18n/th.po
Normal file
File diff suppressed because it is too large
Load diff
3435
odoo-bringout-oca-ocb-product/product/i18n/tr.po
Normal file
3435
odoo-bringout-oca-ocb-product/product/i18n/tr.po
Normal file
File diff suppressed because it is too large
Load diff
3427
odoo-bringout-oca-ocb-product/product/i18n/uk.po
Normal file
3427
odoo-bringout-oca-ocb-product/product/i18n/uk.po
Normal file
File diff suppressed because it is too large
Load diff
3425
odoo-bringout-oca-ocb-product/product/i18n/vi.po
Normal file
3425
odoo-bringout-oca-ocb-product/product/i18n/vi.po
Normal file
File diff suppressed because it is too large
Load diff
3339
odoo-bringout-oca-ocb-product/product/i18n/zh_CN.po
Normal file
3339
odoo-bringout-oca-ocb-product/product/i18n/zh_CN.po
Normal file
File diff suppressed because it is too large
Load diff
3332
odoo-bringout-oca-ocb-product/product/i18n/zh_TW.po
Normal file
3332
odoo-bringout-oca-ocb-product/product/i18n/zh_TW.po
Normal file
File diff suppressed because it is too large
Load diff
24
odoo-bringout-oca-ocb-product/product/models/__init__.py
Normal file
24
odoo-bringout-oca-ocb-product/product/models/__init__.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
# flake8: noqa: F401
|
||||
|
||||
# don't try to be a good boy and sort imports alphabetically.
|
||||
# `product.template` should be initialised before `product.product`
|
||||
from . import product_template
|
||||
from . import product_product
|
||||
|
||||
from . import decimal_precision
|
||||
from . import product_attribute
|
||||
from . import product_category
|
||||
from . import product_packaging
|
||||
from . import product_pricelist
|
||||
from . import product_pricelist_item
|
||||
from . import product_supplierinfo
|
||||
from . import product_tag
|
||||
from . import res_company
|
||||
from . import res_config_settings
|
||||
from . import res_country_group
|
||||
from . import res_currency
|
||||
from . import res_partner
|
||||
from . import uom_uom
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,40 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, models, tools, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class DecimalPrecision(models.Model):
|
||||
_inherit = 'decimal.precision'
|
||||
|
||||
@api.constrains('digits')
|
||||
def _check_main_currency_rounding(self):
|
||||
if any(precision.name == 'Account' and
|
||||
tools.float_compare(self.env.company.currency_id.rounding, 10 ** - precision.digits, precision_digits=6) == -1
|
||||
for precision in self):
|
||||
raise ValidationError(_("You cannot define the decimal precision of 'Account' as greater than the rounding factor of the company's main currency"))
|
||||
return True
|
||||
|
||||
@api.onchange('digits')
|
||||
def _onchange_digits(self):
|
||||
if self.name != "Product Unit of Measure": # precision_get() relies on this name
|
||||
return
|
||||
# We are changing the precision of UOM fields; check whether the
|
||||
# precision is equal or higher than existing units of measure.
|
||||
rounding = 1.0 / 10.0**self.digits
|
||||
dangerous_uom = self.env['uom.uom'].search([('rounding', '<', rounding)])
|
||||
if dangerous_uom:
|
||||
uom_descriptions = [
|
||||
" - %s (id=%s, precision=%s)" % (uom.name, uom.id, uom.rounding)
|
||||
for uom in dangerous_uom
|
||||
]
|
||||
return {'warning': {
|
||||
'title': _('Warning!'),
|
||||
'message': _(
|
||||
"You are setting a Decimal Accuracy less precise than the UOMs:\n"
|
||||
"%s\n"
|
||||
"This may cause inconsistencies in computations.\n"
|
||||
"Please increase the rounding of those units of measure, or the digits of this Decimal Accuracy."
|
||||
) % ('\n'.join(uom_descriptions)),
|
||||
}}
|
||||
|
|
@ -0,0 +1,644 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from random import randint
|
||||
|
||||
from odoo import api, fields, models, tools, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.osv import expression
|
||||
|
||||
|
||||
class ProductAttribute(models.Model):
|
||||
_name = "product.attribute"
|
||||
_description = "Product Attribute"
|
||||
# if you change this _order, keep it in sync with the method
|
||||
# `_sort_key_attribute_value` in `product.template`
|
||||
_order = 'sequence, id'
|
||||
|
||||
name = fields.Char('Attribute', required=True, translate=True)
|
||||
value_ids = fields.One2many('product.attribute.value', 'attribute_id', 'Values', copy=True)
|
||||
sequence = fields.Integer('Sequence', help="Determine the display order", index=True, default=20)
|
||||
attribute_line_ids = fields.One2many('product.template.attribute.line', 'attribute_id', 'Lines')
|
||||
create_variant = fields.Selection([
|
||||
('always', 'Instantly'),
|
||||
('dynamic', 'Dynamically'),
|
||||
('no_variant', 'Never (option)')],
|
||||
default='always',
|
||||
string="Variants Creation Mode",
|
||||
help="""- Instantly: All possible variants are created as soon as the attribute and its values are added to a product.
|
||||
- Dynamically: Each variant is created only when its corresponding attributes and values are added to a sales order.
|
||||
- Never: Variants are never created for the attribute.
|
||||
Note: the variants creation mode cannot be changed once the attribute is used on at least one product.""",
|
||||
required=True)
|
||||
number_related_products = fields.Integer(compute='_compute_number_related_products')
|
||||
product_tmpl_ids = fields.Many2many('product.template', string="Related Products", compute='_compute_products', store=True)
|
||||
display_type = fields.Selection([
|
||||
('radio', 'Radio'),
|
||||
('pills', 'Pills'),
|
||||
('select', 'Select'),
|
||||
('color', 'Color')], default='radio', required=True, help="The display type used in the Product Configurator.")
|
||||
|
||||
@api.depends('product_tmpl_ids')
|
||||
def _compute_number_related_products(self):
|
||||
for pa in self:
|
||||
pa.number_related_products = len(pa.product_tmpl_ids)
|
||||
|
||||
@api.depends('attribute_line_ids.active', 'attribute_line_ids.product_tmpl_id')
|
||||
def _compute_products(self):
|
||||
for pa in self:
|
||||
pa.with_context(active_test=False).product_tmpl_ids = pa.attribute_line_ids.product_tmpl_id
|
||||
|
||||
def _without_no_variant_attributes(self):
|
||||
return self.filtered(lambda pa: pa.create_variant != 'no_variant')
|
||||
|
||||
def write(self, vals):
|
||||
"""Override to make sure attribute type can't be changed if it's used on
|
||||
a product template.
|
||||
|
||||
This is important to prevent because changing the type would make
|
||||
existing combinations invalid without recomputing them, and recomputing
|
||||
them might take too long and we don't want to change products without
|
||||
the user knowing about it."""
|
||||
if 'create_variant' in vals:
|
||||
for pa in self:
|
||||
if vals['create_variant'] != pa.create_variant and pa.number_related_products:
|
||||
raise UserError(
|
||||
_("You cannot change the Variants Creation Mode of the attribute %s because it is used on the following products:\n%s") %
|
||||
(pa.display_name, ", ".join(pa.product_tmpl_ids.mapped('display_name')))
|
||||
)
|
||||
invalidate = 'sequence' in vals and any(record.sequence != vals['sequence'] for record in self)
|
||||
res = super(ProductAttribute, self).write(vals)
|
||||
if invalidate:
|
||||
# prefetched o2m have to be resequenced
|
||||
# (eg. product.template: attribute_line_ids)
|
||||
self.env.flush_all()
|
||||
self.env.invalidate_all()
|
||||
return res
|
||||
|
||||
@api.ondelete(at_uninstall=False)
|
||||
def _unlink_except_used_on_product(self):
|
||||
for pa in self:
|
||||
if pa.number_related_products:
|
||||
raise UserError(
|
||||
_("You cannot delete the attribute %s because it is used on the following products:\n%s") %
|
||||
(pa.display_name, ", ".join(pa.product_tmpl_ids.mapped('display_name')))
|
||||
)
|
||||
|
||||
def action_open_related_products(self):
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _("Related Products"),
|
||||
'res_model': 'product.template',
|
||||
'view_mode': 'tree,form',
|
||||
'domain': [('id', 'in', self.with_context(active_test=False).product_tmpl_ids.ids)],
|
||||
}
|
||||
|
||||
|
||||
class ProductAttributeValue(models.Model):
|
||||
_name = "product.attribute.value"
|
||||
# if you change this _order, keep it in sync with the method
|
||||
# `_sort_key_variant` in `product.template'
|
||||
_order = 'attribute_id, sequence, id'
|
||||
_description = 'Attribute Value'
|
||||
|
||||
def _get_default_color(self):
|
||||
return randint(1, 11)
|
||||
|
||||
name = fields.Char(string='Value', required=True, translate=True)
|
||||
sequence = fields.Integer(string='Sequence', help="Determine the display order", index=True)
|
||||
attribute_id = fields.Many2one('product.attribute', string="Attribute", ondelete='cascade', required=True, index=True,
|
||||
help="The attribute cannot be changed once the value is used on at least one product.")
|
||||
|
||||
pav_attribute_line_ids = fields.Many2many('product.template.attribute.line', string="Lines",
|
||||
relation='product_attribute_value_product_template_attribute_line_rel', copy=False)
|
||||
is_used_on_products = fields.Boolean('Used on Products', compute='_compute_is_used_on_products')
|
||||
|
||||
is_custom = fields.Boolean('Is custom value', help="Allow users to input custom values for this attribute value")
|
||||
html_color = fields.Char(
|
||||
string='Color',
|
||||
help="Here you can set a specific HTML color index (e.g. #ff0000) to display the color if the attribute type is 'Color'.")
|
||||
display_type = fields.Selection(related='attribute_id.display_type', readonly=True)
|
||||
color = fields.Integer('Color Index', default=_get_default_color)
|
||||
|
||||
_sql_constraints = [
|
||||
('value_company_uniq', 'unique (name, attribute_id)', "You cannot create two values with the same name for the same attribute.")
|
||||
]
|
||||
|
||||
@api.depends('pav_attribute_line_ids')
|
||||
def _compute_is_used_on_products(self):
|
||||
for pav in self:
|
||||
pav.is_used_on_products = bool(pav.pav_attribute_line_ids)
|
||||
|
||||
def name_get(self):
|
||||
"""Override because in general the name of the value is confusing if it
|
||||
is displayed without the name of the corresponding attribute.
|
||||
Eg. on product list & kanban views, on BOM form view
|
||||
|
||||
However during variant set up (on the product template form) the name of
|
||||
the attribute is already on each line so there is no need to repeat it
|
||||
on every value.
|
||||
"""
|
||||
if not self._context.get('show_attribute', True):
|
||||
return super(ProductAttributeValue, self).name_get()
|
||||
return [(value.id, "%s: %s" % (value.attribute_id.name, value.name)) for value in self]
|
||||
|
||||
def write(self, values):
|
||||
if 'attribute_id' in values:
|
||||
for pav in self:
|
||||
if pav.attribute_id.id != values['attribute_id'] and pav.is_used_on_products:
|
||||
raise UserError(
|
||||
_("You cannot change the attribute of the value %s because it is used on the following products:%s") %
|
||||
(pav.display_name, ", ".join(pav.pav_attribute_line_ids.product_tmpl_id.mapped('display_name')))
|
||||
)
|
||||
|
||||
invalidate = 'sequence' in values and any(record.sequence != values['sequence'] for record in self)
|
||||
res = super(ProductAttributeValue, self).write(values)
|
||||
if invalidate:
|
||||
# prefetched o2m have to be resequenced
|
||||
# (eg. product.template.attribute.line: value_ids)
|
||||
self.env.flush_all()
|
||||
self.env.invalidate_all()
|
||||
return res
|
||||
|
||||
@api.ondelete(at_uninstall=False)
|
||||
def _unlink_except_used_on_product(self):
|
||||
for pav in self:
|
||||
if pav.is_used_on_products:
|
||||
raise UserError(
|
||||
_("You cannot delete the value %s because it is used on the following products:"
|
||||
"\n%s\n If the value has been associated to a product in the past, you will "
|
||||
"not be able to delete it.") %
|
||||
(pav.display_name, ", ".join(
|
||||
pav.pav_attribute_line_ids.product_tmpl_id.mapped('display_name')
|
||||
))
|
||||
)
|
||||
linked_products = pav.env['product.template.attribute.value'].search(
|
||||
[('product_attribute_value_id', '=', pav.id)]
|
||||
).with_context(active_test=False).ptav_product_variant_ids
|
||||
unlinkable_products = linked_products._filter_to_unlink()
|
||||
if linked_products != unlinkable_products:
|
||||
raise UserError(_(
|
||||
"You cannot delete value %s because it was used in some products.",
|
||||
pav.display_name
|
||||
))
|
||||
|
||||
def _without_no_variant_attributes(self):
|
||||
return self.filtered(lambda pav: pav.attribute_id.create_variant != 'no_variant')
|
||||
|
||||
|
||||
class ProductTemplateAttributeLine(models.Model):
|
||||
"""Attributes available on product.template with their selected values in a m2m.
|
||||
Used as a configuration model to generate the appropriate product.template.attribute.value"""
|
||||
|
||||
_name = "product.template.attribute.line"
|
||||
_rec_name = 'attribute_id'
|
||||
_rec_names_search = ['attribute_id', 'value_ids']
|
||||
_description = 'Product Template Attribute Line'
|
||||
_order = 'attribute_id, id'
|
||||
|
||||
active = fields.Boolean(default=True)
|
||||
product_tmpl_id = fields.Many2one('product.template', string="Product Template", ondelete='cascade', required=True, index=True)
|
||||
attribute_id = fields.Many2one('product.attribute', string="Attribute", ondelete='restrict', required=True, index=True)
|
||||
value_ids = fields.Many2many('product.attribute.value', string="Values", domain="[('attribute_id', '=', attribute_id)]",
|
||||
relation='product_attribute_value_product_template_attribute_line_rel', ondelete='restrict')
|
||||
value_count = fields.Integer(compute='_compute_value_count', store=True, readonly=True)
|
||||
product_template_value_ids = fields.One2many('product.template.attribute.value', 'attribute_line_id', string="Product Attribute Values")
|
||||
|
||||
@api.depends('value_ids')
|
||||
def _compute_value_count(self):
|
||||
for record in self:
|
||||
record.value_count = len(record.value_ids)
|
||||
|
||||
@api.onchange('attribute_id')
|
||||
def _onchange_attribute_id(self):
|
||||
self.value_ids = self.value_ids.filtered(lambda pav: pav.attribute_id == self.attribute_id)
|
||||
|
||||
@api.constrains('active', 'value_ids', 'attribute_id')
|
||||
def _check_valid_values(self):
|
||||
for ptal in self:
|
||||
if ptal.active and not ptal.value_ids:
|
||||
raise ValidationError(
|
||||
_("The attribute %s must have at least one value for the product %s.") %
|
||||
(ptal.attribute_id.display_name, ptal.product_tmpl_id.display_name)
|
||||
)
|
||||
for pav in ptal.value_ids:
|
||||
if pav.attribute_id != ptal.attribute_id:
|
||||
raise ValidationError(
|
||||
_("On the product %s you cannot associate the value %s with the attribute %s because they do not match.") %
|
||||
(ptal.product_tmpl_id.display_name, pav.display_name, ptal.attribute_id.display_name)
|
||||
)
|
||||
return True
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
"""Override to:
|
||||
- Activate archived lines having the same configuration (if they exist)
|
||||
instead of creating new lines.
|
||||
- Set up related values and related variants.
|
||||
|
||||
Reactivating existing lines allows to re-use existing variants when
|
||||
possible, keeping their configuration and avoiding duplication.
|
||||
"""
|
||||
create_values = []
|
||||
activated_lines = self.env['product.template.attribute.line']
|
||||
for value in vals_list:
|
||||
vals = dict(value, active=value.get('active', True))
|
||||
# While not ideal for peformance, this search has to be done at each
|
||||
# step to exclude the lines that might have been activated at a
|
||||
# previous step. Since `vals_list` will likely be a small list in
|
||||
# all use cases, this is an acceptable trade-off.
|
||||
archived_ptal = self.search([
|
||||
('active', '=', False),
|
||||
('product_tmpl_id', '=', vals.pop('product_tmpl_id', 0)),
|
||||
('attribute_id', '=', vals.pop('attribute_id', 0)),
|
||||
], limit=1)
|
||||
if archived_ptal:
|
||||
# Write given `vals` in addition of `active` to ensure
|
||||
# `value_ids` or other fields passed to `create` are saved too,
|
||||
# but change the context to avoid updating the values and the
|
||||
# variants until all the expected lines are created/updated.
|
||||
archived_ptal.with_context(update_product_template_attribute_values=False).write(vals)
|
||||
activated_lines += archived_ptal
|
||||
else:
|
||||
create_values.append(value)
|
||||
res = activated_lines + super(ProductTemplateAttributeLine, self).create(create_values)
|
||||
res._update_product_template_attribute_values()
|
||||
return res
|
||||
|
||||
def write(self, values):
|
||||
"""Override to:
|
||||
- Add constraints to prevent doing changes that are not supported such
|
||||
as modifying the template or the attribute of existing lines.
|
||||
- Clean up related values and related variants when archiving or when
|
||||
updating `value_ids`.
|
||||
"""
|
||||
if 'product_tmpl_id' in values:
|
||||
for ptal in self:
|
||||
if ptal.product_tmpl_id.id != values['product_tmpl_id']:
|
||||
raise UserError(
|
||||
_("You cannot move the attribute %s from the product %s to the product %s.") %
|
||||
(ptal.attribute_id.display_name, ptal.product_tmpl_id.display_name, values['product_tmpl_id'])
|
||||
)
|
||||
|
||||
if 'attribute_id' in values:
|
||||
for ptal in self:
|
||||
if ptal.attribute_id.id != values['attribute_id']:
|
||||
raise UserError(
|
||||
_("On the product %s you cannot transform the attribute %s into the attribute %s.") %
|
||||
(ptal.product_tmpl_id.display_name, ptal.attribute_id.display_name, values['attribute_id'])
|
||||
)
|
||||
# Remove all values while archiving to make sure the line is clean if it
|
||||
# is ever activated again.
|
||||
if not values.get('active', True):
|
||||
values['value_ids'] = [(5, 0, 0)]
|
||||
res = super(ProductTemplateAttributeLine, self).write(values)
|
||||
if 'active' in values:
|
||||
self.env.flush_all()
|
||||
self.env['product.template'].invalidate_model(['attribute_line_ids'])
|
||||
# If coming from `create`, no need to update the values and the variants
|
||||
# before all lines are created.
|
||||
if self.env.context.get('update_product_template_attribute_values', True):
|
||||
self._update_product_template_attribute_values()
|
||||
return res
|
||||
|
||||
def unlink(self):
|
||||
"""Override to:
|
||||
- Archive the line if unlink is not possible.
|
||||
- Clean up related values and related variants.
|
||||
|
||||
Archiving is typically needed when the line has values that can't be
|
||||
deleted because they are referenced elsewhere (on a variant that can't
|
||||
be deleted, on a sales order line, ...).
|
||||
"""
|
||||
# Try to remove the values first to remove some potentially blocking
|
||||
# references, which typically works:
|
||||
# - For single value lines because the values are directly removed from
|
||||
# the variants.
|
||||
# - For values that are present on variants that can be deleted.
|
||||
self.product_template_value_ids._only_active().unlink()
|
||||
# Keep a reference to the related templates before the deletion.
|
||||
templates = self.product_tmpl_id
|
||||
# Now delete or archive the lines.
|
||||
ptal_to_archive = self.env['product.template.attribute.line']
|
||||
for ptal in self:
|
||||
try:
|
||||
with self.env.cr.savepoint(), tools.mute_logger('odoo.sql_db'):
|
||||
super(ProductTemplateAttributeLine, ptal).unlink()
|
||||
except Exception:
|
||||
# We catch all kind of exceptions to be sure that the operation
|
||||
# doesn't fail.
|
||||
ptal_to_archive += ptal
|
||||
ptal_to_archive.action_archive() # only calls write if there are records
|
||||
# For archived lines `_update_product_template_attribute_values` is
|
||||
# implicitly called during the `write` above, but for products that used
|
||||
# unlinked lines `_create_variant_ids` has to be called manually.
|
||||
(templates - ptal_to_archive.product_tmpl_id)._create_variant_ids()
|
||||
return True
|
||||
|
||||
def _update_product_template_attribute_values(self):
|
||||
"""Create or unlink `product.template.attribute.value` for each line in
|
||||
`self` based on `value_ids`.
|
||||
|
||||
The goal is to delete all values that are not in `value_ids`, to
|
||||
activate those in `value_ids` that are currently archived, and to create
|
||||
those in `value_ids` that didn't exist.
|
||||
|
||||
This is a trick for the form view and for performance in general,
|
||||
because we don't want to generate in advance all possible values for all
|
||||
templates, but only those that will be selected.
|
||||
"""
|
||||
ProductTemplateAttributeValue = self.env['product.template.attribute.value']
|
||||
ptav_to_create = []
|
||||
ptav_to_unlink = ProductTemplateAttributeValue
|
||||
for ptal in self:
|
||||
ptav_to_activate = ProductTemplateAttributeValue
|
||||
remaining_pav = ptal.value_ids
|
||||
for ptav in ptal.product_template_value_ids:
|
||||
if ptav.product_attribute_value_id not in remaining_pav:
|
||||
# Remove values that existed but don't exist anymore, but
|
||||
# ignore those that are already archived because if they are
|
||||
# archived it means they could not be deleted previously.
|
||||
if ptav.ptav_active:
|
||||
ptav_to_unlink += ptav
|
||||
else:
|
||||
# Activate corresponding values that are currently archived.
|
||||
remaining_pav -= ptav.product_attribute_value_id
|
||||
if not ptav.ptav_active:
|
||||
ptav_to_activate += ptav
|
||||
|
||||
for pav in remaining_pav:
|
||||
# The previous loop searched for archived values that belonged to
|
||||
# the current line, but if the line was deleted and another line
|
||||
# was recreated for the same attribute, we need to expand the
|
||||
# search to those with matching `attribute_id`.
|
||||
# While not ideal for peformance, this search has to be done at
|
||||
# each step to exclude the values that might have been activated
|
||||
# at a previous step. Since `remaining_pav` will likely be a
|
||||
# small list in all use cases, this is an acceptable trade-off.
|
||||
ptav = ProductTemplateAttributeValue.search([
|
||||
('ptav_active', '=', False),
|
||||
('product_tmpl_id', '=', ptal.product_tmpl_id.id),
|
||||
('attribute_id', '=', ptal.attribute_id.id),
|
||||
('product_attribute_value_id', '=', pav.id),
|
||||
], limit=1)
|
||||
if ptav:
|
||||
ptav.write({'ptav_active': True, 'attribute_line_id': ptal.id})
|
||||
# If the value was marked for deletion, now keep it.
|
||||
ptav_to_unlink -= ptav
|
||||
else:
|
||||
# create values that didn't exist yet
|
||||
ptav_to_create.append({
|
||||
'product_attribute_value_id': pav.id,
|
||||
'attribute_line_id': ptal.id
|
||||
})
|
||||
# Handle active at each step in case a following line might want to
|
||||
# re-use a value that was archived at a previous step.
|
||||
ptav_to_activate.write({'ptav_active': True})
|
||||
ptav_to_unlink.write({'ptav_active': False})
|
||||
if ptav_to_unlink:
|
||||
ptav_to_unlink.unlink()
|
||||
ProductTemplateAttributeValue.create(ptav_to_create)
|
||||
self.product_tmpl_id._create_variant_ids()
|
||||
|
||||
def _without_no_variant_attributes(self):
|
||||
return self.filtered(lambda ptal: ptal.attribute_id.create_variant != 'no_variant')
|
||||
|
||||
def action_open_attribute_values(self):
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _("Product Variant Values"),
|
||||
'res_model': 'product.template.attribute.value',
|
||||
'view_mode': 'tree,form',
|
||||
'domain': [('id', 'in', self.product_template_value_ids.ids)],
|
||||
'views': [
|
||||
(self.env.ref('product.product_template_attribute_value_view_tree').id, 'list'),
|
||||
(self.env.ref('product.product_template_attribute_value_view_form').id, 'form'),
|
||||
],
|
||||
'context': {
|
||||
'search_default_active': 1,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
class ProductTemplateAttributeValue(models.Model):
|
||||
"""Materialized relationship between attribute values
|
||||
and product template generated by the product.template.attribute.line"""
|
||||
|
||||
_name = "product.template.attribute.value"
|
||||
_description = "Product Template Attribute Value"
|
||||
_order = 'attribute_line_id, product_attribute_value_id, id'
|
||||
|
||||
def _get_default_color(self):
|
||||
return randint(1, 11)
|
||||
|
||||
# Not just `active` because we always want to show the values except in
|
||||
# specific case, as opposed to `active_test`.
|
||||
ptav_active = fields.Boolean("Active", default=True)
|
||||
name = fields.Char('Value', related="product_attribute_value_id.name")
|
||||
|
||||
# defining fields: the product template attribute line and the product attribute value
|
||||
product_attribute_value_id = fields.Many2one(
|
||||
'product.attribute.value', string='Attribute Value',
|
||||
required=True, ondelete='cascade', index=True)
|
||||
attribute_line_id = fields.Many2one('product.template.attribute.line', required=True, ondelete='cascade', index=True)
|
||||
# configuration fields: the price_extra and the exclusion rules
|
||||
price_extra = fields.Float(
|
||||
string="Value Price Extra",
|
||||
default=0.0,
|
||||
digits='Product Price',
|
||||
help="Extra price for the variant with this attribute value on sale price. eg. 200 price extra, 1000 + 200 = 1200.")
|
||||
currency_id = fields.Many2one(related='attribute_line_id.product_tmpl_id.currency_id')
|
||||
|
||||
exclude_for = fields.One2many(
|
||||
'product.template.attribute.exclusion',
|
||||
'product_template_attribute_value_id',
|
||||
string="Exclude for",
|
||||
help="Make this attribute value not compatible with "
|
||||
"other values of the product or some attribute values of optional and accessory products.")
|
||||
|
||||
# related fields: product template and product attribute
|
||||
product_tmpl_id = fields.Many2one('product.template', string="Product Template", related='attribute_line_id.product_tmpl_id', store=True, index=True)
|
||||
attribute_id = fields.Many2one('product.attribute', string="Attribute", related='attribute_line_id.attribute_id', store=True, index=True)
|
||||
ptav_product_variant_ids = fields.Many2many('product.product', relation='product_variant_combination', string="Related Variants", readonly=True)
|
||||
|
||||
html_color = fields.Char('HTML Color Index', related="product_attribute_value_id.html_color")
|
||||
is_custom = fields.Boolean('Is custom value', related="product_attribute_value_id.is_custom")
|
||||
display_type = fields.Selection(related='product_attribute_value_id.display_type', readonly=True)
|
||||
color = fields.Integer('Color', default=_get_default_color)
|
||||
|
||||
_sql_constraints = [
|
||||
('attribute_value_unique', 'unique(attribute_line_id, product_attribute_value_id)', "Each value should be defined only once per attribute per product."),
|
||||
]
|
||||
|
||||
@api.constrains('attribute_line_id', 'product_attribute_value_id')
|
||||
def _check_valid_values(self):
|
||||
for ptav in self:
|
||||
if ptav.product_attribute_value_id not in ptav.attribute_line_id.value_ids:
|
||||
raise ValidationError(
|
||||
_("The value %s is not defined for the attribute %s on the product %s.") %
|
||||
(ptav.product_attribute_value_id.display_name, ptav.attribute_id.display_name, ptav.product_tmpl_id.display_name)
|
||||
)
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
if any('ptav_product_variant_ids' in v for v in vals_list):
|
||||
# Force write on this relation from `product.product` to properly
|
||||
# trigger `_compute_combination_indices`.
|
||||
raise UserError(_("You cannot update related variants from the values. Please update related values from the variants."))
|
||||
return super(ProductTemplateAttributeValue, self).create(vals_list)
|
||||
|
||||
def write(self, values):
|
||||
if 'ptav_product_variant_ids' in values:
|
||||
# Force write on this relation from `product.product` to properly
|
||||
# trigger `_compute_combination_indices`.
|
||||
raise UserError(_("You cannot update related variants from the values. Please update related values from the variants."))
|
||||
pav_in_values = 'product_attribute_value_id' in values
|
||||
product_in_values = 'product_tmpl_id' in values
|
||||
if pav_in_values or product_in_values:
|
||||
for ptav in self:
|
||||
if pav_in_values and ptav.product_attribute_value_id.id != values['product_attribute_value_id']:
|
||||
raise UserError(
|
||||
_("You cannot change the value of the value %s set on product %s.") %
|
||||
(ptav.display_name, ptav.product_tmpl_id.display_name)
|
||||
)
|
||||
if product_in_values and ptav.product_tmpl_id.id != values['product_tmpl_id']:
|
||||
raise UserError(
|
||||
_("You cannot change the product of the value %s set on product %s.") %
|
||||
(ptav.display_name, ptav.product_tmpl_id.display_name)
|
||||
)
|
||||
res = super(ProductTemplateAttributeValue, self).write(values)
|
||||
if 'exclude_for' in values:
|
||||
self.product_tmpl_id._create_variant_ids()
|
||||
return res
|
||||
|
||||
def unlink(self):
|
||||
"""Override to:
|
||||
- Clean up the variants that use any of the values in self:
|
||||
- Remove the value from the variant if the value belonged to an
|
||||
attribute line with only one value.
|
||||
- Unlink or archive all related variants.
|
||||
- Archive the value if unlink is not possible.
|
||||
|
||||
Archiving is typically needed when the value is referenced elsewhere
|
||||
(on a variant that can't be deleted, on a sales order line, ...).
|
||||
"""
|
||||
# Directly remove the values from the variants for lines that had single
|
||||
# value (counting also the values that are archived).
|
||||
single_values = self.filtered(lambda ptav: len(ptav.attribute_line_id.product_template_value_ids) == 1)
|
||||
for ptav in single_values:
|
||||
ptav.ptav_product_variant_ids.write({'product_template_attribute_value_ids': [(3, ptav.id, 0)]})
|
||||
# Try to remove the variants before deleting to potentially remove some
|
||||
# blocking references.
|
||||
self.ptav_product_variant_ids._unlink_or_archive()
|
||||
# Now delete or archive the values.
|
||||
ptav_to_archive = self.env['product.template.attribute.value']
|
||||
for ptav in self:
|
||||
try:
|
||||
with self.env.cr.savepoint(), tools.mute_logger('odoo.sql_db'):
|
||||
super(ProductTemplateAttributeValue, ptav).unlink()
|
||||
except Exception:
|
||||
# We catch all kind of exceptions to be sure that the operation
|
||||
# doesn't fail.
|
||||
ptav_to_archive += ptav
|
||||
ptav_to_archive.write({'ptav_active': False})
|
||||
return True
|
||||
|
||||
def name_get(self):
|
||||
"""Override because in general the name of the value is confusing if it
|
||||
is displayed without the name of the corresponding attribute.
|
||||
Eg. on exclusion rules form
|
||||
"""
|
||||
return [(value.id, "%s: %s" % (value.attribute_id.name, value.name)) for value in self]
|
||||
|
||||
def _only_active(self):
|
||||
return self.filtered(lambda ptav: ptav.ptav_active)
|
||||
|
||||
def _without_no_variant_attributes(self):
|
||||
return self.filtered(lambda ptav: ptav.attribute_id.create_variant != 'no_variant')
|
||||
|
||||
def _ids2str(self):
|
||||
return ','.join([str(i) for i in sorted(self.ids)])
|
||||
|
||||
def _get_combination_name(self):
|
||||
"""Exclude values from single value lines or from no_variant attributes."""
|
||||
ptavs = self._without_no_variant_attributes().with_prefetch(self._prefetch_ids)
|
||||
ptavs = ptavs._filter_single_value_lines().with_prefetch(self._prefetch_ids)
|
||||
return ", ".join([ptav.name for ptav in ptavs])
|
||||
|
||||
def _filter_single_value_lines(self):
|
||||
"""Return `self` with values from single value lines filtered out
|
||||
depending on the active state of all the values in `self`.
|
||||
|
||||
If any value in `self` is archived, archived values are also taken into
|
||||
account when checking for single values.
|
||||
This allows to display the correct name for archived variants.
|
||||
|
||||
If all values in `self` are active, only active values are taken into
|
||||
account when checking for single values.
|
||||
This allows to display the correct name for active combinations.
|
||||
"""
|
||||
only_active = all(ptav.ptav_active for ptav in self)
|
||||
return self.filtered(lambda ptav: not ptav._is_from_single_value_line(only_active))
|
||||
|
||||
def _is_from_single_value_line(self, only_active=True):
|
||||
"""Return whether `self` is from a single value line, counting also
|
||||
archived values if `only_active` is False.
|
||||
"""
|
||||
self.ensure_one()
|
||||
all_values = self.attribute_line_id.product_template_value_ids
|
||||
if only_active:
|
||||
all_values = all_values._only_active()
|
||||
return len(all_values) == 1
|
||||
|
||||
|
||||
class ProductTemplateAttributeExclusion(models.Model):
|
||||
_name = "product.template.attribute.exclusion"
|
||||
_description = 'Product Template Attribute Exclusion'
|
||||
_order = 'product_tmpl_id, id'
|
||||
|
||||
product_template_attribute_value_id = fields.Many2one(
|
||||
'product.template.attribute.value', string="Attribute Value", ondelete='cascade', index=True)
|
||||
product_tmpl_id = fields.Many2one(
|
||||
'product.template', string='Product Template', ondelete='cascade', required=True, index=True)
|
||||
value_ids = fields.Many2many(
|
||||
'product.template.attribute.value', relation="product_attr_exclusion_value_ids_rel",
|
||||
string='Attribute Values', domain="[('product_tmpl_id', '=', product_tmpl_id), ('ptav_active', '=', True)]")
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
exclusions = super().create(vals_list)
|
||||
exclusions.product_tmpl_id._create_variant_ids()
|
||||
return exclusions
|
||||
|
||||
def unlink(self):
|
||||
# Keep a reference to the related templates before the deletion.
|
||||
templates = self.product_tmpl_id
|
||||
res = super().unlink()
|
||||
templates._create_variant_ids()
|
||||
return res
|
||||
|
||||
def write(self, values):
|
||||
templates = self.env['product.template']
|
||||
if 'product_tmpl_id' in values:
|
||||
templates = self.product_tmpl_id
|
||||
res = super().write(values)
|
||||
(templates | self.product_tmpl_id)._create_variant_ids()
|
||||
return res
|
||||
|
||||
|
||||
class ProductAttributeCustomValue(models.Model):
|
||||
_name = "product.attribute.custom.value"
|
||||
_description = 'Product Attribute Custom Value'
|
||||
_order = 'custom_product_template_attribute_value_id, id'
|
||||
|
||||
name = fields.Char("Name", compute='_compute_name')
|
||||
custom_product_template_attribute_value_id = fields.Many2one('product.template.attribute.value', string="Attribute Value", required=True, ondelete='restrict')
|
||||
custom_value = fields.Char("Custom Value")
|
||||
|
||||
@api.depends('custom_product_template_attribute_value_id.name', 'custom_value')
|
||||
def _compute_name(self):
|
||||
for record in self:
|
||||
name = (record.custom_value or '').strip()
|
||||
if record.custom_product_template_attribute_value_id.display_name:
|
||||
name = "%s: %s" % (record.custom_product_template_attribute_value_id.display_name, name)
|
||||
record.name = name
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue