From 22b9d1cc0085da87a8c37d9eae52582f098230c0 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Tue, 4 Dec 2018 12:58:30 +0100 Subject: [PATCH] [IMP] - get contract line default data onchange product_id --- product_contract_variable_quantity/models/contract_line.py | 6 ++++-- .../models/sale_order_line.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/product_contract_variable_quantity/models/contract_line.py b/product_contract_variable_quantity/models/contract_line.py index a28b5b9b..29343c43 100644 --- a/product_contract_variable_quantity/models/contract_line.py +++ b/product_contract_variable_quantity/models/contract_line.py @@ -9,8 +9,10 @@ class AccountAnalyticInvoiceLine(models.Model): _inherit = 'account.analytic.invoice.line' @api.onchange('product_id') - def onchange_product(self): - super(AccountAnalyticInvoiceLine, self).onchange_product() + def _onchange_product_id_recurring_info(self): + super( + AccountAnalyticInvoiceLine, self + )._onchange_product_id_recurring_info() if self.product_id.is_contract: self.qty_type = self.product_id.qty_type self.qty_formula_id = self.product_id.qty_formula_id diff --git a/product_contract_variable_quantity/models/sale_order_line.py b/product_contract_variable_quantity/models/sale_order_line.py index 63d0c89c..2f211edb 100644 --- a/product_contract_variable_quantity/models/sale_order_line.py +++ b/product_contract_variable_quantity/models/sale_order_line.py @@ -32,9 +32,11 @@ class SaleOrderLine(models.Model): rec.qty_formula_id = rec.product_id.qty_formula_id @api.multi - def _prepare_contract_line_values(self, contract): + def _prepare_contract_line_values( + self, contract, predecessor_contract_line=False + ): values = super(SaleOrderLine, self)._prepare_contract_line_values( - contract + contract, predecessor_contract_line ) values['qty_type'] = self.qty_type values['qty_formula_id'] = self.qty_formula_id.id