@ -0,0 +1,49 @@ |
|||
.. 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 |
|||
|
|||
Product Dynamic Pricelist |
|||
========================= |
|||
This module enhances the functionality of the product management system by providing a comprehensive view of the price list in a tree view format. |
|||
|
|||
Configuration |
|||
============= |
|||
* Enable "Show dynamic pricelist" from Users and choose fixed price type. |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
Affero General Public License, Version 3 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developer: (V16) Shonima, |
|||
(V17) Anjhana A K, |
|||
(V18) Aysha Shalin, |
|||
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: Aysha Shalin (odoo@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,47 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@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': 'Product Dynamic Pricelist', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Sales', |
|||
'summary': """This module offers a concise, intuitive way to view price |
|||
lists while ensuring secure management of pricing data through customizable |
|||
access controls.""", |
|||
'description': """This module enriches the product management system with |
|||
a clear, tree-view presentation of price lists. It also integrates advanced |
|||
security features, enabling precise control over access to intricate |
|||
pricing rules.""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['sale_management'], |
|||
'data': [ |
|||
'security/dynamic_product_pricelist_groups.xml', |
|||
'views/product_pricelist_views.xml', |
|||
], |
|||
'images': ['static/description/banner.png'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <dynamic_product_pricelist> |
|||
|
|||
#### 02.11.2024 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial commit for Product Dynamic Pricelist |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@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 product_pricelist |
@ -0,0 +1,141 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@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 ProductPriceList(models.Model): |
|||
""" Inherit product pricelist to add field for showing the pricelist in |
|||
product tree view. """ |
|||
_inherit = 'product.pricelist' |
|||
|
|||
is_show_product_pricelist = fields.Boolean( |
|||
string='Show the pricelist in product view', default=False, groups='product.group_product_pricelist', |
|||
help='If set then product pricelist could be seen as a field in product and product variant') |
|||
|
|||
def check_pricelist_condition(self): |
|||
""" Displays the pricelist in product view """ |
|||
if self.item_ids: |
|||
for rec in self.item_ids: |
|||
variant = False |
|||
pricelist_name = self.name.replace(" ", "_") |
|||
if rec.applied_on == '3_global': |
|||
products = self.env['product.template'].search([]) |
|||
elif rec.applied_on == '2_product_category': |
|||
products = self.env['product.template'].search([('categ_id', '=', rec.categ_id.id)]) |
|||
elif rec.applied_on == '0_product_variant': |
|||
variant = True |
|||
products = rec.product_id |
|||
else: |
|||
products = rec.product_tmpl_id |
|||
if variant: |
|||
model = 'product.product' |
|||
inherit_id = self.env.ref( |
|||
'product.product_product_tree_view') |
|||
model_id = self.env.ref( |
|||
'product.model_product_product').id |
|||
name = 'variant_' |
|||
else: |
|||
model = 'product.template' |
|||
inherit_id = self.env.ref( |
|||
'product.product_template_tree_view') |
|||
model_id = self.env.ref( |
|||
'product.model_product_template').id |
|||
name = 'temp_' |
|||
field_id = self.env['ir.model.fields'].search( |
|||
[('model_id', '=', model_id), |
|||
('name', 'ilike', 'x_' + str(name) + str(self.id))]) |
|||
if not field_id: |
|||
field_id = self.env['ir.model.fields'].sudo().create({ |
|||
'name': 'x_' + str(name) + str(self.id) + pricelist_name, |
|||
'field_description': pricelist_name, |
|||
'model_id': model_id, |
|||
'ttype': 'float', |
|||
}) |
|||
view = self.env['ir.ui.view'].search([('name', '=', 'product.dynamic.fields.%s' % pricelist_name), |
|||
('model', '=', model)]) |
|||
if not view: |
|||
arch_base = _('<?xml version="1.0"?>' |
|||
'<data>' |
|||
'<field name="standard_price" position="after" ' |
|||
'groups="dynamic_product_pricelist.group_show_sale_pricelist">' |
|||
'<field name="%s" />' |
|||
'</field>' |
|||
'</data>') % ( |
|||
'x_' + str(name) + str(self.id) + pricelist_name) |
|||
self.env['ir.ui.view'].sudo().create({ |
|||
'name': 'product.dynamic.fields.%s' % pricelist_name, |
|||
'type': 'list', |
|||
'model': model, |
|||
'mode': 'extension', |
|||
'inherit_id': inherit_id.id, |
|||
'arch_base': arch_base, |
|||
'active': True |
|||
}) |
|||
if rec.compute_price == 'fixed': |
|||
products.update({ |
|||
field_id.name: rec.fixed_price |
|||
}) |
|||
|
|||
@api.model |
|||
def create(self, vals): |
|||
res = super().create(vals) |
|||
if res.is_show_product_pricelist: |
|||
res.check_pricelist_condition() |
|||
return res |
|||
|
|||
def write(self, vals): |
|||
res = super().write(vals) |
|||
if self.is_show_product_pricelist: |
|||
self.check_pricelist_condition() |
|||
return res |
|||
|
|||
def unlink(self): |
|||
for res in self: |
|||
for rec in res.item_ids: |
|||
if rec.applied_on == '0_product_variant': |
|||
name = 'variant_' |
|||
model = 'product.product' |
|||
inherit_id = self.env.ref( |
|||
'product.product_product_tree_view') |
|||
model_id = self.env.ref( |
|||
'product.model_product_product').id |
|||
else: |
|||
name = 'temp_' |
|||
model = 'product.template' |
|||
inherit_id = self.env.ref( |
|||
'product.product_template_tree_view') |
|||
model_id = self.env.ref( |
|||
'product.model_product_template').id |
|||
pricelist_name = res.name.replace(" ", "_") |
|||
views = self.env['ir.ui.view'].search( |
|||
[( |
|||
'name', '=', 'product.dynamic.fields.%s' % pricelist_name), |
|||
('type', '=', 'list'), |
|||
('model', '=', model), |
|||
('inherit_id', '=', inherit_id.id)]) |
|||
for view in views: |
|||
view.active = False |
|||
self.env['ir.model.fields'].search( |
|||
[('model_id', '=', model_id), |
|||
('name', '=', 'x_' + str(name) + str( |
|||
res.id) + pricelist_name)]).unlink() |
|||
return super().unlink() |
@ -0,0 +1,11 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<data> |
|||
<!-- Adds a new user group for showing pricelist in product view --> |
|||
<record id="group_show_sale_pricelist" model="res.groups"> |
|||
<field name="name">Show dynamic pricelist</field> |
|||
<field name="category_id" ref="base.module_category_sales_sales"/> |
|||
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/> |
|||
</record> |
|||
</data> |
|||
</odoo> |
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: 92 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 395 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 285 KiB |
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Adds a field in product price list for making it visible in product list view --> |
|||
<record id="product_pricelist_view" model="ir.ui.view"> |
|||
<field name="name">product.pricelist.view.form.inherited.dynamic.product.pricelist</field> |
|||
<field name="model">product.pricelist</field> |
|||
<field name="inherit_id" ref="product.product_pricelist_view"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="company_id" position="after"> |
|||
<field name="is_show_product_pricelist" groups="dynamic_product_pricelist.group_show_sale_pricelist,product.group_product_pricelist"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
</odoo> |