[12.0][IMP] - sale line linked to contracts must not be invoiced from sale order

This commit is contained in:
sbejaoui
2019-10-01 10:51:50 +02:00
committed by Rad0van
parent 5659a97553
commit 1b20b6e5c0
3 changed files with 27 additions and 1 deletions

View File

@@ -107,7 +107,7 @@ class SaleOrder(models.Model):
def action_show_contracts(self):
self.ensure_one()
action = self.env.ref(
"contract.contract_contract_customer_form_view"
"contract.action_customer_contract"
).read()[0]
contracts = (
self.env['contract.line']

View File

@@ -231,3 +231,18 @@ class SaleOrderLine(models.Model):
return super(
SaleOrderLine, self.filtered(lambda l: not l.contract_id)
).invoice_line_create(invoice_id, qty)
@api.depends(
'qty_invoiced',
'qty_delivered',
'product_uom_qty',
'order_id.state',
'product_id.is_contract',
)
def _get_to_invoice_qty(self):
"""
sale line linked to contracts must not be invoiced from sale order
"""
res = super()._get_to_invoice_qty()
self.filtered('product_id.is_contract').update({'qty_to_invoice': 0.0})
return res