-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] product_configurator_sale_blanket_order: Added in v17
- Loading branch information
Showing
16 changed files
with
868 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
======================================== | ||
Product Configurator Sales Blanket Order | ||
======================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:8ac72b616a5da10e2b4aba32514c4f59ff147e3834228a7e281ae7c723d8c496 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Alpha | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
: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/17.0/product_configurator_sale_blanket_order | ||
: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-17-0/product-configurator-17-0-product_configurator_sale_blanket_order | ||
: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=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Product Configurator wizard available on Sale Blanket Orders. | ||
|
||
.. IMPORTANT:: | ||
This is an alpha version, the data model and design can change at any time without warning. | ||
Only for development or testing purpose, do not use in production. | ||
`More details on development status <https://odoo-community.org/page/development-status>`_ | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
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_blanket_order%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 | ||
------- | ||
|
||
* Open Source Integrators | ||
|
||
Contributors | ||
------------ | ||
|
||
- `Open Source Integrators <https://opensourceintegrators.com>`__. | ||
|
||
- Patrick Wilson <[email protected]> | ||
- Nikul Chaudhary <[email protected]> | ||
|
||
Maintainers | ||
----------- | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
.. |maintainer-dreispt| image:: https://github.com/dreispt.png?size=40px | ||
:target: https://github.com/dreispt | ||
:alt: dreispt | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-dreispt| | ||
|
||
This module is part of the `OCA/product-configurator <https://github.com/OCA/product-configurator/tree/17.0/product_configurator_sale_blanket_order>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright (C) 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright (C) 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Product Configurator Sales Blanket Order", | ||
"version": "17.0.1.0.0", | ||
"category": "Sale", | ||
"summary": "Product configuration interface modules for Sales Blanket Order", | ||
"author": "Open Source Integrators, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"website": "https://github.com/OCA/product-configurator", | ||
"depends": ["sale_blanket_order", "product_configurator"], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"views/sale_blanket_order_view.xml", | ||
], | ||
"installable": True, | ||
"auto_install": True, | ||
"development_status": "Alpha", | ||
"maintainers": ["dreispt"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright (C) 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import sale_blanket_order | ||
from . import sale_blanket_order_line |
18 changes: 18 additions & 0 deletions
18
product_configurator_sale_blanket_order/models/sale_blanket_order.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (C) 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import models | ||
|
||
|
||
class SaleBlanketOrder(models.Model): | ||
_inherit = "sale.blanket.order" | ||
|
||
def action_config_start(self): | ||
"""Return action to start configuration wizard""" | ||
configurator_obj = self.env["product.configurator.sale.blanket.order"] | ||
ctx = dict( | ||
self.env.context, | ||
default_order_id=self.id, | ||
wizard_model="product.configurator.sale.blanket.order", | ||
allow_preset_selection=True, | ||
) | ||
return configurator_obj.with_context(**ctx).get_wizard_action() |
55 changes: 55 additions & 0 deletions
55
product_configurator_sale_blanket_order/models/sale_blanket_order_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright (C) 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
from odoo import api, fields, models | ||
|
||
|
||
class SaleBlanketOrderLine(models.Model): | ||
_inherit = "sale.blanket.order.line" | ||
|
||
custom_value_ids = fields.One2many( | ||
comodel_name="product.config.session.custom.value", | ||
inverse_name="cfg_session_id", | ||
related="config_session_id.custom_value_ids", | ||
string="Configurator Custom Values", | ||
) | ||
config_ok = fields.Boolean( | ||
related="product_id.config_ok", string="Configurable", readonly=True | ||
) | ||
config_session_id = fields.Many2one( | ||
comodel_name="product.config.session", string="Config Session" | ||
) | ||
state = fields.Selection(related="order_id.state") | ||
|
||
def reconfigure_product(self): | ||
"""Creates and launches a product configurator wizard with a linked | ||
template and variant in order to re-configure a existing product. It is | ||
esetially a shortcut to pre-fill configuration data of a variant""" | ||
wizard_model = "product.configurator.sale.blanket.order" | ||
|
||
extra_vals = { | ||
"order_id": self.order_id.id, | ||
"order_line_id": self.id, | ||
"product_id": self.product_id.id, | ||
} | ||
self = self.with_context( | ||
default_order_id=self.order_id.id, | ||
default_order_line_id=self.id, | ||
) | ||
return self.product_id.product_tmpl_id.create_config_wizard( | ||
model_name=wizard_model, extra_vals=extra_vals | ||
) | ||
|
||
@api.depends("product_id") | ||
def _compute_name(self): | ||
for line in self: | ||
name = "" | ||
custom_values = line.custom_value_ids | ||
if custom_values: | ||
name += "\n" + "\n".join( | ||
[f"{cv.display_name}: {cv.value}" for cv in custom_values] | ||
) | ||
else: | ||
if not line.product_id: | ||
continue | ||
name = self.product_id.get_product_multiline_description_sale() | ||
line.name = name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
4 changes: 4 additions & 0 deletions
4
product_configurator_sale_blanket_order/readme/CONTRIBUTORS.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- [Open Source Integrators](https://opensourceintegrators.com). | ||
|
||
- Patrick Wilson \<<[email protected]>\> | ||
- Nikul Chaudhary \<<[email protected]>\> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Product Configurator wizard available on Sale Blanket Orders. |
3 changes: 3 additions & 0 deletions
3
product_configurator_sale_blanket_order/security/ir.model.access.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_product_configurator_blanket_order,product_configurator_sale_blanket_order,model_product_configurator_sale_blanket_order,base.group_user,1,0,0,0 | ||
access_product_configurator_blanket_order_manager,product_configurator_sale_blanket_order,model_product_configurator_sale_blanket_order,product_configurator.group_product_configurator_manager,1,1,1,1 |
Oops, something went wrong.