@ -0,0 +1,52 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
Multiple Reference Per Product |
||||
|
============================== |
||||
|
Allowing multiple references for each product. |
||||
|
|
||||
|
Features |
||||
|
======== |
||||
|
* Multiple reference code for a product template or product variant |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
Nothing to configure. |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
Affero General Public License, v3.0 (AGPL v3). |
||||
|
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developers: (V17) Farhana Jahan PT, |
||||
|
(V18) Nivedhya T |
||||
|
Contact: odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import models |
@ -0,0 +1,46 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
{ |
||||
|
'name': "Multiple Reference Per Product", |
||||
|
'version': '18.0.1.0.0', |
||||
|
'summary': 'Allowing multiple references for each product.', |
||||
|
'description': "Add multiple reference code for a product template or " |
||||
|
"product variant. Easily manage between the " |
||||
|
"different codes as default code for the product.", |
||||
|
'category': 'Warehouse', |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'depends': ['stock'], |
||||
|
'website': "https://cybrosys.com/", |
||||
|
'data': [ |
||||
|
'security/ir.model.access.csv', |
||||
|
'views/multiple_reference_per_product.xml', |
||||
|
'views/product_product.xml', |
||||
|
'views/product_template.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
## Module <multiple_reference_per_products> |
||||
|
|
||||
|
#### 13.11.2024 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
#### ADD |
||||
|
- Initial commit for Multiple Reference Per Product |
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import multiple_reference_per_product |
||||
|
from . import product_product |
||||
|
from . import product_template |
@ -0,0 +1,96 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class MultipleReferencePerProduct(models.Model): |
||||
|
"""Create a new model for managing multiple references.""" |
||||
|
_name = 'multiple.reference.per.product' |
||||
|
_description = 'Multiple Reference Per Product' |
||||
|
_rec_name = 'multiple_references_name' |
||||
|
|
||||
|
multiple_references_name = fields.Char(string='Multiple References', |
||||
|
required=True, |
||||
|
help="Name for Multiple Reference") |
||||
|
product_id = fields.Many2one('product.product', string="Product", |
||||
|
required=True, |
||||
|
help="Choose Product for Multiple Reference") |
||||
|
is_default_reference = fields.Boolean(string="Is Default Reference", |
||||
|
compute='_is_default_reference', |
||||
|
help="Checks it is Default Reference" |
||||
|
" or not") |
||||
|
|
||||
|
def _is_default_reference(self): |
||||
|
"""Check if the current code is default code for the product""" |
||||
|
for reference in self: |
||||
|
if reference.product_id: |
||||
|
reference.is_default_reference = True if reference.product_id.default_code == reference.multiple_references_name else False |
||||
|
|
||||
|
def action_set_as_default(self): |
||||
|
"""Set the current code as default code for the product""" |
||||
|
self.ensure_one() |
||||
|
self.product_id.default_code = self.multiple_references_name |
||||
|
|
||||
|
def create_reference(self, reference_code, product_id): |
||||
|
"""Add existing default code into the reference model""" |
||||
|
reference = self.create({ |
||||
|
'multiple_references_name': reference_code, |
||||
|
'product_id': product_id, |
||||
|
}) |
||||
|
return True if reference else False |
||||
|
|
||||
|
@api.model |
||||
|
def create(self, values): |
||||
|
"""Function to prevent the creation of duplicate references when |
||||
|
adding a new record.""" |
||||
|
if values.get('multiple_references_name') and values.get('product_id'): |
||||
|
reference_code = self.search([('multiple_references_name', '=', |
||||
|
values.get( |
||||
|
'multiple_references_name')), ( |
||||
|
'product_id', '=', |
||||
|
values.get('product_id'))]) |
||||
|
if reference_code: |
||||
|
res = reference_code[0] |
||||
|
else: |
||||
|
return super(MultipleReferencePerProduct, self).create(values) |
||||
|
if not res.product_id.default_code: |
||||
|
res.product_id.default_code = res.multiple_references_name |
||||
|
return res |
||||
|
else: |
||||
|
res = super(MultipleReferencePerProduct, self).create(values) |
||||
|
return res |
||||
|
|
||||
|
def write(self, values): |
||||
|
"""Function to eliminate duplicate references when editing details.""" |
||||
|
multiple_references_name = values.get('multiple_references_name') |
||||
|
multiple_references_name = [ |
||||
|
multiple_references_name] if multiple_references_name else self.mapped( |
||||
|
'name') |
||||
|
product_id = values.get('product_id') |
||||
|
product_ids = [product_id] if product_id else self.mapped( |
||||
|
'product_id').ids |
||||
|
reference_code = self.search( |
||||
|
[('multiple_references_name', 'in', multiple_references_name), |
||||
|
('product_id', 'in', product_ids)]) |
||||
|
if reference_code: |
||||
|
return False |
||||
|
return super(MultipleReferencePerProduct, self).write(values) |
@ -0,0 +1,83 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class ProductProductInherit(models.Model): |
||||
|
"""Inherit the 'product_product' model to include Multiple References in |
||||
|
the form view.""" |
||||
|
_inherit = 'product.product' |
||||
|
|
||||
|
multiple_references_ids = fields.One2many("multiple.reference.per.product", |
||||
|
"product_id", |
||||
|
string="Multiple References", |
||||
|
help="Choose Multiple Reference" |
||||
|
" per Product and checks " |
||||
|
"simultaneously") |
||||
|
multiple_references_code = fields.Char(string="Multiple References", |
||||
|
related="multiple_references_ids" |
||||
|
".multiple_references_name", |
||||
|
help="Enter Code for Multiple " |
||||
|
"Reference") |
||||
|
multiple_product_references_ids = fields.Many2many( |
||||
|
"multiple.reference.per.product", |
||||
|
string="Multiple References", |
||||
|
compute="_get_multiple_reference", |
||||
|
help="Choose Multiple Reference" |
||||
|
"per Product") |
||||
|
multiple_references_count = fields.Integer(string="Number of references", |
||||
|
compute="_get_multiple_reference_count", |
||||
|
help="Enter Number of Reference") |
||||
|
|
||||
|
@api.depends('multiple_product_references_ids') |
||||
|
def _get_multiple_reference_count(self): |
||||
|
"""Function to get the count of reference code""" |
||||
|
self.multiple_references_count = len(self.multiple_references_ids) |
||||
|
|
||||
|
def _get_multiple_reference(self): |
||||
|
"""Function for getting all Multiple References""" |
||||
|
self.multiple_product_references_ids = self.multiple_references_ids.filtered( |
||||
|
lambda |
||||
|
references: references.multiple_references_name != self.default_code).ids |
||||
|
|
||||
|
def multiple_references_list(self): |
||||
|
"""Function to open the Multiple References form and tree view |
||||
|
when clicking the 'Add More' button.""" |
||||
|
return { |
||||
|
'name': "Multiple References", |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'target': 'current', |
||||
|
'res_model': 'multiple.reference.per.product', |
||||
|
'views': [[False, "list"], [False, "form"]], |
||||
|
'context': {'default_product_id': self.id}, |
||||
|
'domain': [('product_id', '=', self.id)], |
||||
|
} |
||||
|
|
||||
|
def write(self, values): |
||||
|
"""Function for update the Product Reference""" |
||||
|
if values.get('default_code'): |
||||
|
if self.default_code: |
||||
|
self.env[ |
||||
|
'multiple.reference.per.product'].sudo().create_reference( |
||||
|
self.default_code, self.id) |
||||
|
res = super(ProductProductInherit, self).write(values) |
||||
|
return res |
@ -0,0 +1,68 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class ProductTemplateInherit(models.Model): |
||||
|
"""Inherit product_template model for adding multiple_reference_code""" |
||||
|
_inherit = 'product.template' |
||||
|
|
||||
|
multiple_references_code = fields.Char(string="Multiple References", |
||||
|
related="product_variant_ids" |
||||
|
".multiple_references_ids" |
||||
|
".multiple_references_name", |
||||
|
help="Enter Code for Multiple " |
||||
|
"Reference") |
||||
|
multiple_product_references_ids = fields.Many2many( |
||||
|
"multiple.reference.per.product", |
||||
|
string="Multiple References", |
||||
|
compute="_get_multiple_reference", |
||||
|
help="Choose Multiple Reference" |
||||
|
" per Product") |
||||
|
multiple_references_count = fields.Integer(string="Number of References", |
||||
|
compute="_get_multiple_reference_count", |
||||
|
help="Enter Number of Reference") |
||||
|
|
||||
|
@api.depends('multiple_product_references_ids') |
||||
|
def _get_multiple_reference_count(self): |
||||
|
"""Function for getting total count of References""" |
||||
|
self.multiple_references_count = len( |
||||
|
self.multiple_product_references_ids) |
||||
|
|
||||
|
def _get_multiple_reference(self): |
||||
|
"""Function for getting all Multiple References""" |
||||
|
self.multiple_product_references_ids = self.product_variant_ids.mapped( |
||||
|
'multiple_product_references_ids').filtered(lambda |
||||
|
references: references.multiple_references_name != self.default_code).ids |
||||
|
|
||||
|
def multiple_references_list(self): |
||||
|
"""Function to open the Multiple References form and tree view |
||||
|
when clicking the 'Add More' button.""" |
||||
|
return { |
||||
|
'name': "Multiple References", |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'target': 'current', |
||||
|
'res_model': 'multiple.reference.per.product', |
||||
|
'views': [[False, "list"], [False, "form"]], |
||||
|
'context': {'default_product_id': self.product_variant_id.id}, |
||||
|
'domain': [('product_id', '=', self.product_variant_id.id)], |
||||
|
} |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.0 MiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 1.0 MiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 723 KiB |
After Width: | Height: | Size: 41 KiB |
@ -0,0 +1,37 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
|
<odoo> |
||||
|
<!--Multiple References Tree View--> |
||||
|
<record id="multiple_references_per_product_view_tree" model="ir.ui.view"> |
||||
|
<field name="name">multiple.reference.per.product.view.tree</field> |
||||
|
<field name="model">multiple.reference.per.product</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<list string="Multiple References"> |
||||
|
<field name="multiple_references_name"/> |
||||
|
<field name="product_id"/> |
||||
|
</list> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!--Multiple References Form View--> |
||||
|
<record id="multiple_references_per_product_view_form" model="ir.ui.view"> |
||||
|
<field name="name">multiple.reference.per.product.view.form</field> |
||||
|
<field name="model">multiple.reference.per.product</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form string="Multiple References"> |
||||
|
<sheet> |
||||
|
<group> |
||||
|
<group> |
||||
|
<field name="multiple_references_name"/> |
||||
|
<field name="product_id"/> |
||||
|
<field name="is_default_reference" invisible="1"/> |
||||
|
<button name="action_set_as_default" |
||||
|
type="object" string="Set as default" |
||||
|
class="oe_highlight" |
||||
|
invisible="is_default_reference == True"/> |
||||
|
</group> |
||||
|
|
||||
|
</group> |
||||
|
</sheet> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,26 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
|
<odoo> |
||||
|
<!--Multiple References In Product Variant--> |
||||
|
<record id="product_normal_form_view" model="ir.ui.view"> |
||||
|
<field name="name"> |
||||
|
product.product.view.form.inherit.multiple.reference.per.product |
||||
|
</field> |
||||
|
<field name="model">product.product</field> |
||||
|
<field name="inherit_id" ref="product.product_normal_form_view"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="default_code" position="replace"> |
||||
|
<label for="default_code"/> |
||||
|
<div class="o_row"> |
||||
|
<span style="display:contents!important"> |
||||
|
<field name="default_code"/> |
||||
|
</span> |
||||
|
<button type="object" title="Multiple References" |
||||
|
name="multiple_references_list" string="Add More" |
||||
|
class="oe_highlight"/> |
||||
|
</div> |
||||
|
<field name="multiple_references_count" invisible="1"/> |
||||
|
<field name="multiple_product_references_ids" widget="many2many_tags"/> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,41 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
|
<odoo> |
||||
|
<!--Multiple References In Product Template--> |
||||
|
<record id="product_template_only_form_view" model="ir.ui.view"> |
||||
|
<field name="name"> |
||||
|
product.template.view.form.inherit.multiple.reference.per.product |
||||
|
</field> |
||||
|
<field name="model">product.template</field> |
||||
|
<field name="inherit_id" ref="product.product_template_only_form_view"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="default_code" position="replace"> |
||||
|
<label for="default_code" invisible="product_variant_count>1"/> |
||||
|
<div invisible="product_variant_count>1" class="o_row"> |
||||
|
<span style="display:contents!important"> |
||||
|
<field name="default_code"/> |
||||
|
</span> |
||||
|
<button type="object" title="Multiple References" |
||||
|
name="multiple_references_list" string="Add More" |
||||
|
class="oe_highlight"/> |
||||
|
</div> |
||||
|
<field name="multiple_references_count" invisible="1"/> |
||||
|
<field name="multiple_product_references_ids" widget="many2many_tags" invisible="multiple_references_count == 0"/> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!--Search with multiple reference inside product view--> |
||||
|
<record id="product_template_search_view" model="ir.ui.view"> |
||||
|
<field name="name"> |
||||
|
product.product.view.search.inherit.multiple.reference.product |
||||
|
</field> |
||||
|
<field name="model">product.template</field> |
||||
|
<field name="inherit_id" ref="product.product_template_search_view"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="name" position="replace"> |
||||
|
<field name="name" string="Product" |
||||
|
filter_domain="['|','|','|',('default_code','ilike',self),('name','ilike',self),('barcode','ilike',self),('multiple_references_code','ilike',self)]"/> |
||||
|
<field name="multiple_references_code"/> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |