diff options
| author | Simon Lejeune <sle@openerp.com> | 2019-09-02 09:51:07 +0000 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2019-09-03 15:05:04 +0000 |
| commit | 03925faa48e4a078cf9a6910b4e0fe4324adff20 (patch) | |
| tree | 9daef6be7706e9fd68fc94325d0f814d8ef5fd07 /addons | |
| parent | 13d6f64a7399d4b18903365b3d898a11e41afde6 (diff) | |
[REF] product: multi company
Add an optional company_id on product.packaging to be able to share
of restrict them, similar to what's done for product.product.
task-1985992
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/product/models/product.py | 10 | ||||
| -rw-r--r-- | addons/product/security/product_security.xml | 7 | ||||
| -rw-r--r-- | addons/product/views/product_views.xml | 2 |
3 files changed, 15 insertions, 4 deletions
diff --git a/addons/product/models/product.py b/addons/product/models/product.py index 7a6ba5f1a67..7f6113fc48a 100644 --- a/addons/product/models/product.py +++ b/addons/product/models/product.py @@ -697,13 +697,15 @@ class ProductPackaging(models.Model): _name = "product.packaging" _description = "Product Packaging" _order = 'sequence' + _check_company_auto = True name = fields.Char('Package Type', required=True) sequence = fields.Integer('Sequence', default=1, help="The first in the sequence is the default one.") - product_id = fields.Many2one('product.product', string='Product') + product_id = fields.Many2one('product.product', string='Product', check_company=True) qty = fields.Float('Contained Quantity', help="Quantity of products contained in the packaging.") barcode = fields.Char('Barcode', copy=False, help="Barcode used for packaging identification. Scan this packaging barcode from a transfer in the Barcode app to move all the contained units") product_uom_id = fields.Many2one('uom.uom', related='product_id.uom_id', readonly=True) + company_id = fields.Many2one('res.company', 'Company', index=True) class SupplierInfo(models.Model): @@ -714,7 +716,7 @@ class SupplierInfo(models.Model): name = fields.Many2one( 'res.partner', 'Vendor', ondelete='cascade', required=True, - help="Vendor of this product") + help="Vendor of this product", check_company=True) product_name = fields.Char( 'Vendor Product Name', help="This vendor's product name will be used when printing a request for quotation. Keep empty to use the internal one.") @@ -743,10 +745,10 @@ class SupplierInfo(models.Model): date_start = fields.Date('Start Date', help="Start date for this vendor price") date_end = fields.Date('End Date', help="End date for this vendor price") product_id = fields.Many2one( - 'product.product', 'Product Variant', + 'product.product', 'Product Variant', check_company=True, help="If not set, the vendor price will apply to all variants of this product.") product_tmpl_id = fields.Many2one( - 'product.template', 'Product Template', + 'product.template', 'Product Template', check_company=True, index=True, ondelete='cascade') product_variant_count = fields.Integer('Variant Count', related='product_tmpl_id.product_variant_count', readonly=False) delay = fields.Integer( diff --git a/addons/product/security/product_security.xml b/addons/product/security/product_security.xml index 8b6556304a5..6da657fca1a 100644 --- a/addons/product/security/product_security.xml +++ b/addons/product/security/product_security.xml @@ -59,5 +59,12 @@ <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field> </record> + <record model="ir.rule" id="product_packaging_comp_rule"> + <field name="name">product packaging company rule</field> + <field name="model_id" ref="model_product_packaging"/> + <field name="global" eval="True"/> + <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field> + </record> + </data> </odoo> diff --git a/addons/product/views/product_views.xml b/addons/product/views/product_views.xml index 525424c79c6..7941bb01f90 100644 --- a/addons/product/views/product_views.xml +++ b/addons/product/views/product_views.xml @@ -493,6 +493,7 @@ <field name="name" string="Packaging"/> <field name="qty"/> <field name="product_uom_id" options="{'no_open': True, 'no_create': True}" groups="uom.group_uom"/> + <field name="company_id" group="base.group_multi_company"/> </tree> </field> </record> @@ -530,6 +531,7 @@ <field name="product_uom_id" options="{'no_open': True, 'no_create': True}" groups="uom.group_uom"/> </div> <field name="barcode"/> + <field name="company_id" group="base.group_multi_company"/> </group> </group> </sheet> |
