@ -0,0 +1,49 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
Product Internal Reference Generator |
||||
|
==================================== |
||||
|
This module allows to generate internal references for the products automatically based on the product details. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No Additional configuration is needed |
||||
|
|
||||
|
Company |
||||
|
======= |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
======= |
||||
|
Lesser General Public License, v3.0 (LGPL v3). |
||||
|
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developers: (V16) Megha K, |
||||
|
(V17) Javid A, |
||||
|
(V18) Ammu Raj |
||||
|
Contact: odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://www.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) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ammu Raj (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import models |
@ -0,0 +1,44 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ammu Raj (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
{ |
||||
|
"name": "Product Internal Reference Generator", |
||||
|
"version": "18.0.1.0.0", |
||||
|
"category": "Warehouse", |
||||
|
"summary": """Generate Internal References for the Products.""", |
||||
|
"description": """This module allows to generate internal references for the |
||||
|
products automatically based on the product details.""", |
||||
|
"author": "Cybrosys Techno Solutions", |
||||
|
"company": "Cybrosys Techno Solutions", |
||||
|
"maintainer": "Cybrosys Techno Solutions", |
||||
|
"website": "https://www.cybrosys.com", |
||||
|
"depends": ["sale_management"], |
||||
|
"data": [ |
||||
|
'data/ir_sequence_data.xml', |
||||
|
'data/ir_actions_server_data.xml', |
||||
|
'views/res_config_settings_views.xml', |
||||
|
], |
||||
|
"images": ["static/description/banner.jpg"], |
||||
|
"license": "LGPL-3", |
||||
|
"installable": True, |
||||
|
"auto_install": False, |
||||
|
"application": False, |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<!--Server Actions for product and its variant to create internal reference--> |
||||
|
<record id="action_generate_internal_ref_pro" model="ir.actions.server"> |
||||
|
<field name="name">Generate Internal Reference</field> |
||||
|
<field name="model_id" |
||||
|
ref="product_internal_ref_generator.model_product_product"/> |
||||
|
<field name="binding_model_id" ref="product.model_product_product"/> |
||||
|
<field name="binding_view_types">list,form</field> |
||||
|
<field name="state">code</field> |
||||
|
<field name="code"> |
||||
|
action = model.action_generate_internal_ref_pro() |
||||
|
</field> |
||||
|
</record> |
||||
|
<record id="action_generate_internal_ref" model="ir.actions.server"> |
||||
|
<field name="name">Generate Internal Reference</field> |
||||
|
<field name="model_id" |
||||
|
ref="product_internal_ref_generator.model_product_template"/> |
||||
|
<field name="binding_model_id" |
||||
|
ref="product.model_product_template"/> |
||||
|
<field name="binding_view_types">list,form</field> |
||||
|
<field name="state">code</field> |
||||
|
<field name="code">action = model.action_generate_internal_ref() |
||||
|
</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,22 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<!-- Sequence for products --> |
||||
|
<record id="product_sequence_ref" model="ir.sequence"> |
||||
|
<field name="name">Product Sequence</field> |
||||
|
<field name="code">product.sequence.ref</field> |
||||
|
<field eval="1" name="number_next"/> |
||||
|
<field eval="1" name="number_increment"/> |
||||
|
<field eval="True" name="use_date_range"/> |
||||
|
<field name="padding">5</field> |
||||
|
</record> |
||||
|
<record id="attribute_sequence_ref" model="ir.sequence"> |
||||
|
<field name="name">Attribute Sequence</field> |
||||
|
<field name="code">attribute.sequence.ref</field> |
||||
|
<field eval="1" name="number_next"/> |
||||
|
<field eval="1" name="number_increment"/> |
||||
|
<field eval="True" name="use_date_range"/> |
||||
|
<field name="padding">5</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,6 @@ |
|||||
|
## Module <product_internal_ref_generator> |
||||
|
|
||||
|
#### 09.04.2025 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial commit for Product Internal Reference Generator |
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ammu Raj (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import product_product |
||||
|
from . import product_template |
||||
|
from . import res_config_settings |
@ -0,0 +1,122 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ammu Raj (odoo@cybrosys.com) |
||||
|
#17 |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import api, models |
||||
|
|
||||
|
|
||||
|
class ProductProduct(models.Model): |
||||
|
""" Class for products to generate the internal reference """ |
||||
|
_inherit = 'product.product' |
||||
|
|
||||
|
@api.model_create_multi |
||||
|
def create(self, vals_list): |
||||
|
""" Supering the create function, generating the internal reference """ |
||||
|
res = super().create(vals_list) |
||||
|
if 'default_code' in vals_list: |
||||
|
pass |
||||
|
else: |
||||
|
auto_generate_internal_ref = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.auto_generate_internal_ref') |
||||
|
if auto_generate_internal_ref: |
||||
|
product_name_config = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.product_name_config') |
||||
|
pro_name_digit = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_name_digit') |
||||
|
pro_name_separator = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_name_separator') |
||||
|
pro_categ_config = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_config') |
||||
|
pro_categ_digit = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_digit') |
||||
|
pro_categ_separator = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_separator') |
||||
|
for rec in res: |
||||
|
default_code = '' |
||||
|
if rec.type == 'consu': |
||||
|
default_code += 'Goods:' |
||||
|
elif rec.type == 'service': |
||||
|
default_code += 'Service:' |
||||
|
elif rec.type == 'combo': |
||||
|
default_code += 'Combo:' |
||||
|
if product_name_config: |
||||
|
if rec.name: |
||||
|
default_code += rec.name[:int(pro_name_digit)] |
||||
|
default_code += pro_name_separator |
||||
|
if pro_categ_config: |
||||
|
if rec.categ_id.name: |
||||
|
default_code += rec.categ_id.name[ |
||||
|
:int(pro_categ_digit)] |
||||
|
default_code += pro_categ_separator |
||||
|
sequence_code = 'product.sequence.ref' |
||||
|
default_code += self.env['ir.sequence'].next_by_code( |
||||
|
sequence_code) |
||||
|
rec.default_code = default_code |
||||
|
return res |
||||
|
|
||||
|
@api.model |
||||
|
def action_generate_internal_ref_pro(self): |
||||
|
""" Creating the internal reference """ |
||||
|
active_ids = self.env.context.get('active_ids') |
||||
|
products = self.env['product.product'].browse(active_ids) |
||||
|
product_name_config = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.product_name_config') |
||||
|
pro_name_digit = self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_name_digit') |
||||
|
pro_name_separator = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_name_separator') |
||||
|
pro_categ_config = self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_config') |
||||
|
pro_categ_digit = self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_digit') |
||||
|
pro_categ_separator = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_separator') |
||||
|
for rec in products: |
||||
|
if not rec.default_code: |
||||
|
default_code = '' |
||||
|
if rec.type == 'consu': |
||||
|
default_code += 'Goods:' |
||||
|
elif rec.type == 'service': |
||||
|
default_code += 'Service:' |
||||
|
elif rec.type == 'combo': |
||||
|
default_code += 'Combo:' |
||||
|
if product_name_config: |
||||
|
if rec.name: |
||||
|
default_code += rec.name[:int(pro_name_digit)] |
||||
|
default_code += pro_name_separator |
||||
|
if pro_categ_config: |
||||
|
if rec.categ_id.name: |
||||
|
default_code += rec.categ_id.name[:int(pro_categ_digit)] |
||||
|
default_code += pro_categ_separator |
||||
|
sequence_code = 'product.sequence.ref' |
||||
|
default_code += self.env['ir.sequence'].next_by_code( |
||||
|
sequence_code) |
||||
|
rec.default_code = default_code |
||||
|
return self |
@ -0,0 +1,141 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ammu Raj (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import api, models |
||||
|
|
||||
|
|
||||
|
class ProductTemplate(models.Model): |
||||
|
""" Class for product template to generate internal reference """ |
||||
|
_inherit = 'product.template' |
||||
|
|
||||
|
@api.model_create_multi |
||||
|
def create(self, vals_list): |
||||
|
""" Supering the create function, generating the internal reference """ |
||||
|
res = super().create(vals_list) |
||||
|
if 'default_code' in vals_list: |
||||
|
pass |
||||
|
else: |
||||
|
auto_generate_internal_ref = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.auto_generate_internal_ref') |
||||
|
if auto_generate_internal_ref: |
||||
|
product_name_config = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.product_name_config') |
||||
|
pro_name_digit = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_name_digit') |
||||
|
pro_name_separator = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_name_separator') |
||||
|
pro_categ_config = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_config') |
||||
|
pro_categ_digit = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_digit') |
||||
|
pro_categ_separator = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_separator') |
||||
|
pro_template_config = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_template_config') |
||||
|
pro_template_digit = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_template_digit') |
||||
|
pro_template_separator = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_template_separator') |
||||
|
for rec in res: |
||||
|
default_code = '' |
||||
|
if rec.type == 'consu': |
||||
|
default_code += 'Goods:' |
||||
|
elif rec.type == 'service': |
||||
|
default_code += 'Service:' |
||||
|
elif rec.type == 'combo': |
||||
|
default_code += 'Combo:' |
||||
|
if product_name_config: |
||||
|
default_code += rec.name[:int(pro_name_digit)] |
||||
|
default_code += pro_name_separator |
||||
|
if pro_categ_config: |
||||
|
default_code += rec.categ_id.name[:int(pro_categ_digit)] |
||||
|
default_code += pro_categ_separator |
||||
|
if pro_template_config: |
||||
|
for attribute in rec.attribute_line_ids: |
||||
|
for value in attribute.value_ids: |
||||
|
default_code += value.name[ |
||||
|
:int(pro_template_digit)] |
||||
|
default_code += pro_template_separator |
||||
|
sequence_code = 'attribute.sequence.ref' |
||||
|
default_code += self.env['ir.sequence'].next_by_code( |
||||
|
sequence_code) |
||||
|
rec.default_code = default_code |
||||
|
return res |
||||
|
|
||||
|
@api.model |
||||
|
def action_generate_internal_ref(self): |
||||
|
""" Creating internal reference """ |
||||
|
active_ids = self.env.context.get('active_ids') |
||||
|
products = self.env['product.template'].browse(active_ids) |
||||
|
product_name_config = self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.product_name_config') |
||||
|
pro_name_digit = self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_name_digit') |
||||
|
pro_name_separator = self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_name_separator') |
||||
|
pro_categ_config = self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_config') |
||||
|
pro_categ_digit = self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_digit') |
||||
|
pro_categ_separator = self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_categ_separator') |
||||
|
pro_template_config = self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_template_config') |
||||
|
pro_template_digit = self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_template_digit') |
||||
|
pro_template_separator = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'product_internal_ref_generator.pro_template_separator') |
||||
|
for rec in products: |
||||
|
if not rec.default_code: |
||||
|
default_code = '' |
||||
|
if rec.type == 'consu': |
||||
|
default_code += 'Goods:' |
||||
|
elif rec.type == 'service': |
||||
|
default_code += 'Service:' |
||||
|
elif rec.type == 'combo': |
||||
|
default_code += 'Combo:' |
||||
|
if product_name_config: |
||||
|
default_code += rec.name[:int(pro_name_digit)] |
||||
|
default_code += pro_name_separator |
||||
|
if pro_categ_config: |
||||
|
default_code += rec.categ_id.name[:int(pro_categ_digit)] |
||||
|
default_code += pro_categ_separator |
||||
|
if pro_template_config: |
||||
|
for attribute in rec.attribute_line_ids: |
||||
|
for value in attribute.value_ids: |
||||
|
default_code += value.name[:int(pro_template_digit)] |
||||
|
default_code += pro_template_separator |
||||
|
sequence_code = 'attribute.sequence.ref' |
||||
|
default_code += self.env['ir.sequence'].next_by_code( |
||||
|
sequence_code) |
||||
|
rec.default_code = default_code |
||||
|
return self |
@ -0,0 +1,62 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Ammu Raj (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class ResConfigSettings(models.TransientModel): |
||||
|
""" Inherit the configuration settings to add fields """ |
||||
|
_inherit = 'res.config.settings' |
||||
|
|
||||
|
pro_internal_ref = fields.Boolean(string='Product Internal Ref', |
||||
|
help="Internal reference of products", |
||||
|
config_parameter='product_internal_ref_generator.pro_internal_ref') |
||||
|
auto_generate_internal_ref = fields.Boolean( |
||||
|
string='Auto Generate Product Internal Ref', |
||||
|
help="To auto generate the product internal reference.", |
||||
|
config_parameter='product_internal_ref_generator.auto_generate_internal_ref') |
||||
|
product_name_config = fields.Boolean(string='Product Name Config', |
||||
|
help="Name of the product config", |
||||
|
config_parameter='product_internal_ref_generator.product_name_config') |
||||
|
pro_name_digit = fields.Integer(string='Product Name Digit', |
||||
|
help="Number of digit of product name", |
||||
|
config_parameter='product_internal_ref_generator.pro_name_digit') |
||||
|
pro_name_separator = fields.Char(string='Product Name Separator', |
||||
|
help="Separator for product name", |
||||
|
config_parameter='product_internal_ref_generator.pro_name_separator') |
||||
|
pro_template_config = fields.Boolean(string='Product Attribute Config', |
||||
|
help="To add the product attribute config", |
||||
|
config_parameter='product_internal_ref_generator.pro_template_config') |
||||
|
pro_template_digit = fields.Integer(string='Product Attribute Digit', |
||||
|
help="Number of digit of product attribute", |
||||
|
config_parameter='product_internal_ref_generator.pro_template_digit') |
||||
|
pro_template_separator = fields.Char(string='Product Attribute Separator', |
||||
|
help="Separator for product attribute", |
||||
|
config_parameter="product_internal_ref_generator.pro_template_separator") |
||||
|
pro_categ_config = fields.Boolean(string='Product Category Config', |
||||
|
help="To add product category", |
||||
|
config_parameter="product_internal_ref_generator.pro_categ_config") |
||||
|
pro_categ_digit = fields.Integer(string='Product Category Digit', |
||||
|
help="Number of product category digit", |
||||
|
config_parameter='product_internal_ref_generator.pro_categ_digit') |
||||
|
pro_categ_separator = fields.Char(string='Product Category Separator', |
||||
|
help="Separator for product category", |
||||
|
config_parameter='product_internal_ref_generator.pro_categ_separator') |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 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: 738 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: 738 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 728 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 734 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 152 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 140 KiB |
After Width: | Height: | Size: 11 KiB |
@ -0,0 +1,112 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- View for res config settings --> |
||||
|
<record id="res_config_settings_view_form" model="ir.ui.view"> |
||||
|
<field name="name"> |
||||
|
res.config.settings.view.form.inherit.product.internal.ref.generator |
||||
|
</field> |
||||
|
<field name="model">res.config.settings</field> |
||||
|
<field name="priority" eval="0"/> |
||||
|
<field name="inherit_id" ref="base.res_config_settings_view_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<div id="companies" position="after"> |
||||
|
<h2>Product Internal Reference Generator</h2> |
||||
|
<div class="row mt16 o_settings_container" id="domain_setting"> |
||||
|
<div class="col-12 col-lg-6 o_setting_box" |
||||
|
id="website_settings"> |
||||
|
<div class="o_setting_left_pane"> |
||||
|
<field name="auto_generate_internal_ref"/> |
||||
|
</div> |
||||
|
<div class="o_setting_right_pane"> |
||||
|
<label for="auto_generate_internal_ref"/> |
||||
|
<div class="text-muted"> |
||||
|
Auto generate internal reference for New |
||||
|
Products. |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-12 col-lg-6 o_setting_box" |
||||
|
id="website_settings"> |
||||
|
<div class="o_setting_left_pane"> |
||||
|
<field name="product_name_config"/> |
||||
|
</div> |
||||
|
<div class="o_setting_right_pane"> |
||||
|
<label for="product_name_config"/> |
||||
|
<div class="text-muted"> |
||||
|
Product Name Configuration. |
||||
|
</div> |
||||
|
<div class="content-group" |
||||
|
invisible="not product_name_config"> |
||||
|
<div class="row mt16" id="pro_name_digit"> |
||||
|
<label for="pro_name_digit" |
||||
|
string="Product Name Digit" |
||||
|
class="col-lg-3"/> |
||||
|
<field name="pro_name_digit"/> |
||||
|
</div> |
||||
|
<div class="row mt16" id="pro_name_separator"> |
||||
|
<label for="pro_name_separator" |
||||
|
string="Product Name Separator" |
||||
|
class="col-lg-3"/> |
||||
|
<field name="pro_name_separator"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-12 col-lg-6 o_setting_box"> |
||||
|
<div class="o_setting_left_pane"> |
||||
|
<field name="pro_template_config"/> |
||||
|
</div> |
||||
|
<div class="o_setting_right_pane"> |
||||
|
<label for="pro_template_config"/> |
||||
|
<div class="text-muted"> |
||||
|
Product Attribute configuration. |
||||
|
</div> |
||||
|
<div class="content-group" |
||||
|
invisible="not pro_template_config"> |
||||
|
<div class="row mt16" id="pro_template_digit"> |
||||
|
<label for="pro_template_digit" |
||||
|
string="Attribute Name Digit" |
||||
|
class="col-lg-3"/> |
||||
|
<field name="pro_template_digit"/> |
||||
|
</div> |
||||
|
<div class="row mt16" |
||||
|
id="pro_template_separator"> |
||||
|
<label for="pro_template_separator" |
||||
|
string="Attribute Name Separator" |
||||
|
class="col-lg-3"/> |
||||
|
<field name="pro_template_separator"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-12 col-lg-6 o_setting_box"> |
||||
|
<div class="o_setting_left_pane"> |
||||
|
<field name="pro_categ_config"/> |
||||
|
</div> |
||||
|
<div class="o_setting_right_pane"> |
||||
|
<label for="pro_categ_config"/> |
||||
|
<div class="text-muted"> |
||||
|
Product Category Name configuration. |
||||
|
</div> |
||||
|
<div class="content-group" |
||||
|
invisible="not pro_categ_config"> |
||||
|
<div class="row mt16" id="pro_categ_digit"> |
||||
|
<label for="pro_categ_digit" |
||||
|
string="Product Category Name Digit" |
||||
|
class="col-lg-3"/> |
||||
|
<field name="pro_categ_digit"/> |
||||
|
</div> |
||||
|
<div class="row mt16" id="pro_categ_separator"> |
||||
|
<label for="pro_categ_separator" |
||||
|
string="Product Category Name Separator" |
||||
|
class="col-lg-3"/> |
||||
|
<field name="pro_categ_separator"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |