[IMP] - get contract line default data onchange product_id

This commit is contained in:
sbejaoui
2018-12-04 12:58:30 +01:00
parent b13f0e29df
commit 22b9d1cc00
2 changed files with 8 additions and 4 deletions

View File

@@ -9,8 +9,10 @@ class AccountAnalyticInvoiceLine(models.Model):
_inherit = 'account.analytic.invoice.line' _inherit = 'account.analytic.invoice.line'
@api.onchange('product_id') @api.onchange('product_id')
def onchange_product(self): def _onchange_product_id_recurring_info(self):
super(AccountAnalyticInvoiceLine, self).onchange_product() super(
AccountAnalyticInvoiceLine, self
)._onchange_product_id_recurring_info()
if self.product_id.is_contract: if self.product_id.is_contract:
self.qty_type = self.product_id.qty_type self.qty_type = self.product_id.qty_type
self.qty_formula_id = self.product_id.qty_formula_id self.qty_formula_id = self.product_id.qty_formula_id

View File

@@ -32,9 +32,11 @@ class SaleOrderLine(models.Model):
rec.qty_formula_id = rec.product_id.qty_formula_id rec.qty_formula_id = rec.product_id.qty_formula_id
@api.multi @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( values = super(SaleOrderLine, self)._prepare_contract_line_values(
contract contract, predecessor_contract_line
) )
values['qty_type'] = self.qty_type values['qty_type'] = self.qty_type
values['qty_formula_id'] = self.qty_formula_id.id values['qty_formula_id'] = self.qty_formula_id.id