[FIX] product_contract: Compute date_start and date_end correctly. Make fields computed

This commit is contained in:
sergio-teruel
2025-01-24 22:26:10 +01:00
committed by Carlos Roca
parent f7223188d9
commit 0ae4fab56d
10 changed files with 162 additions and 87 deletions

View File

@@ -444,6 +444,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<li>Ernesto Tejeda</li>
<li>Pedro M. Baeza</li>
<li>Carlos Roca</li>
<li>Sergio Teruel</li>
</ul>
</li>
<li>David Jaen &lt;<a class="reference external" href="mailto:david.jaen.revert&#64;gmail.com">david.jaen.revert&#64;gmail.com</a>&gt;</li>

View File

@@ -21,6 +21,7 @@ export class ProductContractConfiguratorController extends formView.Controller {
is_auto_renew,
auto_renew_interval,
auto_renew_rule_type,
recurring_interval,
} = record.data;
return this.action.doAction({
type: "ir.actions.act_window_close",
@@ -34,6 +35,7 @@ export class ProductContractConfiguratorController extends formView.Controller {
is_auto_renew,
auto_renew_interval,
auto_renew_rule_type,
recurring_interval,
},
},
});

View File

@@ -44,6 +44,7 @@ patch(SaleOrderLineProductField.prototype, {
default_company_id: this.props.record.model.root.data.company_id[0],
default_product_uom_qty: this.props.record.data.product_uom_qty,
default_contract_id: this.props.record.data.contract_id[0],
default_recurring_interval: this.props.record.data.recurring_interval,
default_date_start: this.props.record.data.date_start,
default_date_end: this.props.record.data.date_end,
default_is_auto_renew: this.props.record.data.is_auto_renew,
@@ -54,7 +55,9 @@ patch(SaleOrderLineProductField.prototype, {
additionalContext: actionContext,
onClose: async (closeInfo) => {
if (closeInfo && !closeInfo.special) {
this.props.record.update(closeInfo.productContractConfiguration);
this.props.record._update(closeInfo.productContractConfiguration, {
withoutOnchange: true,
});
} else if (isNew) {
this.props.record.update({
[this.props.name]: undefined,