From 76d8c2f4720b98d28c3b6e16bce9940c393842eb Mon Sep 17 00:00:00 2001 From: Carlos Roca Date: Tue, 28 Jan 2025 08:46:57 +0100 Subject: [PATCH] [IMP] product_contract: Make configurator contract context heredable --- product_contract/README.rst | 24 +++++++++---------- .../static/src/js/sale_product_field.esm.js | 8 +++++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/product_contract/README.rst b/product_contract/README.rst index f9608b94c..99c575b7c 100644 --- a/product_contract/README.rst +++ b/product_contract/README.rst @@ -2,7 +2,7 @@ Recurring - Product Contract ============================ -.. +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! @@ -65,8 +65,8 @@ To use this module, you need to: Known issues / Roadmap ====================== -- There's no support right now for computing the start date for the - following recurrent types: daily, weekly and monthlylastday. +- There's no support right now for computing the start date for the + following recurrent types: daily, weekly and monthlylastday. Bug Tracker =========== @@ -90,16 +90,16 @@ Authors Contributors ------------ -- Ted Salmon -- Souheil Bejaoui -- `Tecnativa `__: +- Ted Salmon +- Souheil Bejaoui +- `Tecnativa `__: - - Ernesto Tejeda - - Pedro M. Baeza - - Carlos Roca - - Sergio Teruel + - Ernesto Tejeda + - Pedro M. Baeza + - Carlos Roca + - Sergio Teruel -- David Jaen +- David Jaen Maintainers ----------- @@ -120,7 +120,7 @@ promote its widespread use. Current `maintainer `__: -|maintainer-sbejaoui| +|maintainer-sbejaoui| This module is part of the `OCA/contract `_ project on GitHub. diff --git a/product_contract/static/src/js/sale_product_field.esm.js b/product_contract/static/src/js/sale_product_field.esm.js index 4ca2f763c..4e60db39c 100644 --- a/product_contract/static/src/js/sale_product_field.esm.js +++ b/product_contract/static/src/js/sale_product_field.esm.js @@ -37,8 +37,8 @@ patch(SaleOrderLineProductField.prototype, { return super.isConfigurableLine || this.props.record.data.is_contract; }, - async _openContractConfigurator(isNew = false) { - const actionContext = { + get contractContext() { + return { default_product_id: this.props.record.data.product_id[0], default_partner_id: this.props.record.model.root.data.partner_id[0], default_company_id: this.props.record.model.root.data.company_id[0], @@ -51,6 +51,10 @@ patch(SaleOrderLineProductField.prototype, { default_auto_renew_interval: this.props.record.data.auto_renew_interval, default_auto_renew_rule_type: this.props.record.data.auto_renew_rule_type, }; + }, + + async _openContractConfigurator(isNew = false) { + const actionContext = this.contractContext; this.action.doAction("product_contract.product_contract_configurator_action", { additionalContext: actionContext, onClose: async (closeInfo) => {