[IMP] - Contract product are ignored on invoicing process

- Sale order line for contract product pass to nothing to invoice on order confirmation
- Contract Invoices are linked to sale order line
This commit is contained in:
sbejaoui
2018-11-05 11:40:58 +01:00
committed by Denis Roussel
parent 6b59233c36
commit c9915a121a
4 changed files with 68 additions and 3 deletions

View File

@@ -24,9 +24,11 @@ class SaleOrder(models.Model):
contract_env = self.env['account.analytic.account']
for rec in self.filtered('is_contract'):
line_to_create_contract = rec.order_line.filtered(
lambda r: not r.contract_id
lambda r: not r.contract_id and r.product_id.is_contract
)
line_to_update_contract = rec.order_line.filtered(
lambda r: r.contract_id and r.product_id.is_contract
)
line_to_update_contract = rec.order_line.filtered('contract_id')
for contract_template in line_to_create_contract.mapped(
'product_id.contract_template_id'
):