Skip to content

[16.0][REF] sale_quotation: refactor the quotation mechanism. - #1594

Closed
nicolas-delbovier-acsone wants to merge 3 commits into
shopinvader:16.0from
acsone:16.0-refactor-shopinvader-quotations
Closed

[16.0][REF] sale_quotation: refactor the quotation mechanism.#1594
nicolas-delbovier-acsone wants to merge 3 commits into
shopinvader:16.0from
acsone:16.0-refactor-shopinvader-quotations

Conversation

@nicolas-delbovier-acsone

Copy link
Copy Markdown

Following up on the work in #1573 and addressing feedback from @lmignon, this PR:

  1. Separates the quotation state and the "quotation only" logic for sales orders into distinct.
  2. Allows products to have a shop order mode of either direct sale, quotation, or a combination of both.

* Extracts the shop_order_mode of products in a new module
* Enables to choose a combined shop order mode (quotation or direct sale)
* Adds a migration script to translate the products and templates order mode infos from the old to the new fields
@nicolas-delbovier-acsone
nicolas-delbovier-acsone marked this pull request as draft May 16, 2025 14:56
@nicolas-delbovier-acsone nicolas-delbovier-acsone changed the title [REF] sale_quotation: refactor the quotation mechanism. [16.0][REF] sale_quotation: refactor the quotation mechanism. May 16, 2025
@lmignon
lmignon marked this pull request as ready for review May 28, 2025 12:20
@sebastienbeau sebastienbeau added this to the 16.0 milestone Jun 2, 2025

# if product order mode goes from unabled to disabled on variants, put back all variants
# to the value of the template
@api.model

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hacking the write, we could add this field in the dependency of the compute on the variant and set the value of the template on the variante ?

Comment on lines +27 to +33
@api.depends("product_tmpl_id.shop_order_mode")
def _compute_shop_order_mode(self):
for product in self:
if product.product_tmpl_id:
product.shop_order_mode = product.product_tmpl_id.shop_order_mode
else:
product.shop_order_mode = False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this you should not need to hack the write anymore

Suggested change
@api.depends("product_tmpl_id.shop_order_mode")
def _compute_shop_order_mode(self):
for product in self:
if product.product_tmpl_id:
product.shop_order_mode = product.product_tmpl_id.shop_order_mode
else:
product.shop_order_mode = False
@api.depends(
"product_tmpl_id.shop_order_mode",
"product_tmpl_id.is_shop_order_mode_unabled_on_variant"
)
def _compute_shop_order_mode(self):
for product in self:
if product.product_tmpl_id:
if product_tmpl_id.is_shop_order_mode_unabled_on_variant:
product.shop_order_mode = product.product_tmpl_id.shop_order_mode
else:
product.shop_order_mode = False

@lmignon

lmignon commented Jul 14, 2025

Copy link
Copy Markdown
Collaborator

included into #1597

@lmignon lmignon closed this Jul 14, 2025
@lmignon
lmignon deleted the 16.0-refactor-shopinvader-quotations branch July 14, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants