Skip to content

Commit

Permalink
[MIG] product_configurator_sale: Migrated in v17
Browse files Browse the repository at this point in the history
  • Loading branch information
Chirag-OSI committed Feb 23, 2024
1 parent db5132e commit b5d9c31
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 18 deletions.
14 changes: 7 additions & 7 deletions product_configurator_sale/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Product Configurator Sale
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--configurator-lightgray.png?logo=github
:target: https://github.com/OCA/product-configurator/tree/14.0/product_configurator_sale
:target: https://github.com/OCA/product-configurator/tree/17.0/product_configurator_sale
:alt: OCA/product-configurator
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-configurator-14-0/product-configurator-14-0-product_configurator_sale
:target: https://translation.odoo-community.org/projects/product-configurator-17-0/product-configurator-17-0-product_configurator_sale
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-configurator&target_branch=14.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-configurator&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -41,20 +41,20 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-configurator/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/product-configurator/issues/new?body=module:%20product_configurator_sale%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/product-configurator/issues/new?body=module:%20product_configurator_sale%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~
-------

* Pledra

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -74,6 +74,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-PCatinean|

This module is part of the `OCA/product-configurator <https://github.com/OCA/product-configurator/tree/14.0/product_configurator_sale>`_ project on GitHub.
This module is part of the `OCA/product-configurator <https://github.com/OCA/product-configurator/tree/17.0/product_configurator_sale>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion product_configurator_sale/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Product Configurator Sale",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Generic Modules/Sale",
"summary": "Product configuration interface modules for Sale",
"author": "Pledra, Odoo Community Association (OCA)",
Expand Down
3 changes: 3 additions & 0 deletions product_configurator_sale/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
6 changes: 3 additions & 3 deletions product_configurator_sale/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Product Configurator Sale</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2a027575c211693ed3abf41ce8b330ac9c76a6431a4175a21b77b26cff61350a
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-configurator/tree/14.0/product_configurator_sale"><img alt="OCA/product-configurator" src="https://img.shields.io/badge/github-OCA%2Fproduct--configurator-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-configurator-14-0/product-configurator-14-0-product_configurator_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/product-configurator&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/product-configurator/tree/17.0/product_configurator_sale"><img alt="OCA/product-configurator" src="https://img.shields.io/badge/github-OCA%2Fproduct--configurator-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/product-configurator-17-0/product-configurator-17-0-product_configurator_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/product-configurator&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Product Configurator wizard available on Sales Orders.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand All @@ -387,7 +387,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/product-configurator/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/product-configurator/issues/new?body=module:%20product_configurator_sale%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/product-configurator/issues/new?body=module:%20product_configurator_sale%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -407,7 +407,7 @@ <h2><a class="toc-backref" href="#toc-entry-4">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/PCatinean"><img alt="PCatinean" src="https://github.com/PCatinean.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-configurator/tree/14.0/product_configurator_sale">OCA/product-configurator</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-configurator/tree/17.0/product_configurator_sale">OCA/product-configurator</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion product_configurator_sale/tests/test_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class SaleOrder(TC.ProductConfiguratorTestCases):
def setUp(self):
super(SaleOrder, self).setUp()
super().setUp()
self.SaleOrderId = self.env["sale.order"]
self.productPricelist = self.env["product.pricelist"]
self.resPartner = self.env.ref("product_configurator_sale.partenr_sale_1")
Expand Down
3 changes: 1 addition & 2 deletions product_configurator_sale/views/sale_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
class="oe_highlight"
groups="product_configurator.group_product_configurator"
name="action_config_start"
states="draft,sent"
string="Configure Product"
style="margin-top: 15px;"
type="object"
Expand All @@ -29,7 +28,7 @@
>
<field invisible="1" name="config_ok" />
<button
attrs="{ 'invisible': [ '|', ('config_ok','=',False), ('state','not in',['draft','sent']) ] }"
invisible="not config_ok or state not in ['draft','sent']"
class="fa-lg"
groups="product_configurator.group_product_configurator"
help="Reconfigure"
Expand Down
31 changes: 27 additions & 4 deletions product_configurator_sale/wizard/product_configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,24 @@ class ProductConfiguratorSale(models.TransientModel):
order_id = fields.Many2one(comodel_name="sale.order", required=True, readonly=True)
order_line_id = fields.Many2one(comodel_name="sale.order.line", readonly=True)

domain_attr_ids = fields.Many2many(
"product.attribute.value",
"domain_attrs_values_sale_rel",
"wiz_id",
"attribute_id",
string="Domain",
)
dyn_field_value = fields.Char()

domain_attr_2_ids = fields.Many2many(
"product.attribute.value",
"domain_attrs_2_values_sale_rel",
"wiz_id",
"attribute_id",
string="Domain",
)
dyn_field_2_value = fields.Char()

def _get_order_line_vals(self, product_id):
"""Hook to allow custom line values to be put on the newly
created or edited lines."""
Expand All @@ -37,7 +55,7 @@ def _get_order_line_vals(self, product_id):

def action_config_done(self):
"""Parse values and execute final code before closing the wizard"""
res = super(ProductConfiguratorSale, self).action_config_done()
res = super().action_config_done()
if res.get("res_model") == self._name:
return res
model_name = "sale.order.line"
Expand All @@ -47,8 +65,13 @@ def action_config_done(self):
# will not trigger onchange automatically
order_line_obj = self.env[model_name]
cfg_session = self.config_session_id
specs = cfg_session.get_onchange_specifications(model=model_name)
updates = order_line_obj.onchange(line_vals, ["product_id"], specs)
fields_spec = cfg_session.get_onchange_specifications(model=model_name)
fields_spec = {
key: val
for key, val in fields_spec.items()
if key in list(line_vals.keys()) and key != "tax_id"
}
updates = order_line_obj.onchange(line_vals, ["product_id"], fields_spec)
values = updates.get("value", {})
values = cfg_session.get_vals_to_write(values=values, model=model_name)
values.update(line_vals)
Expand All @@ -70,7 +93,7 @@ def create(self, vals_list):
vals["custom_value_ids"] = self._get_custom_values(
sale_line.config_session_id
)
return super(ProductConfiguratorSale, self).create(vals_list)
return super().create(vals_list)

def _get_custom_values(self, session):
custom_values = [(5,)] + [
Expand Down

0 comments on commit b5d9c31

Please sign in to comment.