[IMP] nfu_product,nfu_product_bnn_attributes: add multi-company to product.packagings
This commit is contained in:
parent
870c8c7a80
commit
142ce7f48a
12 changed files with 86 additions and 27 deletions
|
|
@ -32,7 +32,8 @@ NFU Product
|
|||
Changelog
|
||||
=========
|
||||
|
||||
* 1.0.0: Initial module.
|
||||
- 16.0.1.0.0: Initial module.
|
||||
- 16.0.1.1.0: Add multi company to product packagings
|
||||
|
||||
|
||||
Bug Tracker
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@
|
|||
"author": "BAKEUP",
|
||||
"website": "https://www.bakeup.org",
|
||||
"category": "product",
|
||||
"version": "16.0.1.0.0",
|
||||
"depends": ["product", "product_multi_company"],
|
||||
"data": ["views/product_product_views.xml", "views/product_template_views.xml"],
|
||||
"version": "16.0.1.1.0",
|
||||
"depends": ["product_multi_company"],
|
||||
"data": [
|
||||
"views/product_packaging_views.xml",
|
||||
"views/product_product_views.xml",
|
||||
"views/product_template_views.xml",
|
||||
],
|
||||
"license": "LGPL-3",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
from . import product_packaging
|
||||
14
nfu_product/models/product_packaging.py
Normal file
14
nfu_product/models/product_packaging.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from odoo import api, models
|
||||
|
||||
|
||||
class ProductPackaging(models.Model):
|
||||
_inherit = ["multi.company.abstract", "product.packaging"]
|
||||
_name = "product.packaging"
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
res = super().create(vals_list)
|
||||
for packaging in res:
|
||||
product = packaging.product_id
|
||||
packaging.company_ids = product.company_ids
|
||||
return res
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
* 1.0.0: Initial module.
|
||||
- 16.0.1.0.0: Initial module.
|
||||
- 16.0.1.1.0: Add multi company to product packagings
|
||||
|
||||
|
|
|
|||
|
|
@ -389,7 +389,8 @@ ul.auto-toc {
|
|||
<div class="section" id="changelog">
|
||||
<h1><a class="toc-backref" href="#toc-entry-1">Changelog</a></h1>
|
||||
<ul class="simple">
|
||||
<li>1.0.0: Initial module.</li>
|
||||
<li>16.0.1.0.0: Initial module.</li>
|
||||
<li>16.0.1.1.0: Add multi company to product packagings</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
|
|
|
|||
41
nfu_product/views/product_packaging_views.xml
Normal file
41
nfu_product/views/product_packaging_views.xml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="product_packaging_tree_view" model="ir.ui.view">
|
||||
<field name="name">product.packaging.tree.inherit.companies</field>
|
||||
<field name="model">product.packaging</field>
|
||||
<field name="inherit_id" ref="product.product_packaging_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='company_id']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='company_id']" position="after">
|
||||
<field
|
||||
name="company_ids"
|
||||
options="{'no_create': True}"
|
||||
groups="base.group_multi_company"
|
||||
optional="hide"
|
||||
widget="many2many_tags"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_packaging_form_view" model="ir.ui.view">
|
||||
<field name="name">product.packaging.form.inherit.companies</field>
|
||||
<field name="model">product.packaging</field>
|
||||
<field name="inherit_id" ref="product.product_packaging_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group[@name='qty']/field[@name='company_id']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="////group[@name='qty']/field[@name='company_id']" position="after">
|
||||
<field
|
||||
name="company_ids"
|
||||
options="{'no_create': True}"
|
||||
groups="base.group_multi_company"
|
||||
widget="many2many_tags"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -33,9 +33,10 @@ Changelog
|
|||
=========
|
||||
|
||||
|
||||
:1.0.0: Initial module.
|
||||
:1.1.0: Add packaging
|
||||
:1.1.1: inherit package company if from product
|
||||
- 16.0.1.0.0: Initial module.
|
||||
- 16.0.1.1.0: Add packaging
|
||||
- 16.0.1.1.1: inherit package company if from product
|
||||
- 16.0.1.2.0: Add Multi company to packaging
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
"author": "BAKEUP",
|
||||
"website": "https://www.bakeup.org",
|
||||
"category": "Product",
|
||||
"version": "16.0.1.1.1",
|
||||
"depends": ["product"],
|
||||
"version": "16.0.1.2.0",
|
||||
"depends": ["nfu_product"],
|
||||
"data": ["views/product_bnn_views.xml"],
|
||||
"assets": {},
|
||||
"license": "LGPL-3",
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class ProductTemplate(models.Model):
|
|||
"qty": qty,
|
||||
"product_id": product_product.id,
|
||||
"sales": True,
|
||||
"company_id": product_product.company_id.id,
|
||||
"company_ids": product_product.company_ids.ids,
|
||||
}
|
||||
)
|
||||
return res
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
:1.0.0: Initial module.
|
||||
:1.1.0: Add packaging
|
||||
:1.1.1: inherit package company if from product
|
||||
- 16.0.1.0.0: Initial module.
|
||||
- 16.0.1.1.0: Add packaging
|
||||
- 16.0.1.1.1: inherit package company if from product
|
||||
- 16.0.1.2.0: Add Multi company to packaging
|
||||
|
|
@ -386,18 +386,12 @@ ul.auto-toc {
|
|||
</div>
|
||||
<div class="section" id="changelog">
|
||||
<h1><a class="toc-backref" href="#toc-entry-1">Changelog</a></h1>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field"><th class="field-name">1.0.0:</th><td class="field-body">Initial module.</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">1.1.0:</th><td class="field-body">Add packaging</td>
|
||||
</tr>
|
||||
<tr class="field"><th class="field-name">1.1.1:</th><td class="field-body">inherit package company if from product</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<ul class="simple">
|
||||
<li>16.0.1.0.0: Initial module.</li>
|
||||
<li>16.0.1.1.0: Add packaging</li>
|
||||
<li>16.0.1.1.1: inherit package company if from product</li>
|
||||
<li>16.0.1.2.0: Add Multi company to packaging</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
|
||||
|
|
|
|||
Loading…
Reference in a new issue