[16.0] [REF] sale_quotation: Avoid unnecessary ping pong calls - #9
Conversation
* 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
… hacking the write.
…in a separate module
…der as a quotation
…nce API - put shopinvader_sale_state as a dependency in order to remove sale_cart because we need the field sale.order.shopinvader_state This commit introduces significant enhancements to the REST API for quotation management, including: - **Create Method:** Added a new endpoint to create quotations. - **Line Management Methods:** Implemented dedicated endpoints for adding, deleting, or updating single or multiple lines within a quotation. - **Update Extension:** Extended the existing update method to support the addition of new lines
…ic of transforming a cart to a quotation.
…tion" action in the form view of sale.order + refine module description
- Remove typology field from quotation create request - Implement following logic in the update process: -If the line has an id -> update existing line (raise if not found) -If the line has no id -> create a new one -All existing lines not found in lines should be removed - Small refactoring to avoid code dup - Test invalid line ids in unit tests
Deletes an obsolete unit test that was migrated to the `sale_cart_quotation` module.
…ional custom workflow This commit addresses a critical regression where the standard Odoo sales order confirmation flow was unintentionally broken, making it impossible to directly confirm a newly created SO. The previous logic implicitly forced a custom quotation process even when not desired. This refactor introduces an explicit opt-in mechanism for the new quotation workflow. Key changes: - **Default Typology:** Removed a redundant test in `sale_typology` as the `typology` field's default value is now correctly handled and overridden by `sale_quotation`. - **Workflow Toggle:** Added a `use_customer_quotation_workflow` boolean field to `sale.order`, allowing users to enable or disable the custom quotation stages. - **Controlled Confirmation:** When `use_customer_quotation_workflow` is active, a UI wizard now prompts the user to confirm their intent if they attempt to confirm a quotation not yet in the 'waiting_acceptation' state. This preserves the standard Odoo workflow for non-workflow-enabled orders while providing a gentle warning for custom flows.
* add a button to accept the quotation * add some margin to the workflow text * Show quotation_state in the title instead of messing with the status bar
Changes `action_confirm_quotation` to `action_accept_quotation`.
Normal quotations are sale.order with an other typology than 'cart'. This allows the use of others values for typology than 'cart' and 'sale'.
Ensures menu are properly working if sale_cart or sale_quoration are installed but not the orher one
Use a switch button to activate / deactivate the user workflow for quotation. All the logic is now driven by the field and we no more need to manipulate the typology
Add methods triggered by the cutomer to manage the requested quotation. Ensures that methods called by customer are allowed according the the quotation state
…customer use only
Adds customer methods used to manage the quotation flow. Ensures proper http status is returned in case where the called method is not allowed according to the quotation state
…ot sent to the customer
The customer can only fill the client ref as rederence. The name is reserved for Odoo
Allows to search on quotation_state and client_order_ref
complete pot files are required to get the translations working. Indeed, when a transation file is loaded by the polib, the entry is marked as obsolete if it's not present into the pot file. obsolete entries are not loaded by odoo
…d upon creation When a quotation is created via the API client, the assigned salesperson (user_id) was not automatically added as a follower. This occurred because the Odoo core mechanism for auto-subscribing the user_id is only triggered when the 'user_id' value is explicitly present in the create values dictionary. Since the API relies on Odoo's default value computation to assign the salesperson, the auto-subscription logic was incorrectly bypassed. This commit explicitly calls message_subscribe for the assigned user_id.partner_id during the API creation flow, ensuring the salesperson receives relevant Chatter notifications as expected.
120a825 to
f408b88
Compare
| return { | ||
| "name": _("Confirm Sale Order"), | ||
| "type": "ir.actions.act_window", | ||
| "res_model": "sale.order.confirm.warning.wizard", | ||
| "views": [[False, "form"]], | ||
| "target": "new", | ||
| "context": { | ||
| "default_sale_order_ids": self.ids, | ||
| "default_message": _( | ||
| "The selected quotation(s) are not in 'Waiting Acceptation' " | ||
| "state. Are you sure you want to confirm them?" | ||
| ), | ||
| }, | ||
| } |
There was a problem hiding this comment.
We should use it the raise RedirectWarning. It will avoid to commit stuff that have been added before
f408b88 to
e2a5577
Compare
Use RedirectWarning to avoid unwanted commit
|
@nicolas-delbovier-acsone it should be ready |
|
Thanks for your contribution! I am going to cherry-pick your simplification commit onto our branch so I can re-run the tests. Regarding the To avoid this double execution and ensure proper transaction safety, I have refactored the logic to use the native |
137ba42 to
a70632f
Compare
|
Included in shopinvader#1597 |
Following the @sebastienbeau review of shopinvader#1597, here's our proposal for a simplfied workflow/logic.
New sale.order actions are checked on quotation state.
Sale original actions are not, except confirm that has a confirmation popup that is now working.