Browse Source

[IMP] - Link contract line to sale order line

pull/208/head
sbejaoui 6 years ago
committed by Thomas Binsfeld
parent
commit
44b7798a80
  1. 1
      product_contract/models/__init__.py
  2. 16
      product_contract/models/contract_line.py
  3. 5
      product_contract/models/sale_order.py
  4. 1
      product_contract/models/sale_order_line.py

1
product_contract/models/__init__.py

@ -2,6 +2,7 @@
# Copyright 2017 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import contract_line
from . import product_template
from . import sale_order
from . import sale_order_line

16
product_contract/models/contract_line.py

@ -0,0 +1,16 @@
# Copyright 2017 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
class AccountAnalyticInvoiceLine(models.Model):
_inherit = 'account.analytic.invoice.line'
sale_order_line_id = fields.Many2one(
comodel_name="sale.order.line",
string="Sale Order Line",
required=False,
copy=False,
)

5
product_contract/models/sale_order.py

@ -64,7 +64,10 @@ class SaleOrder(models.Model):
action = self.env.ref(
"contract.action_account_analytic_sale_overdue_all"
).read()[0]
contracts = self.env['account.analytic.invoice.line'].search([
('sale_order_line', 'in', self.order_line.ids)
]).mapped('contract_id')
action["domain"] = [
("id", "in", self.order_line.mapped('contract_id').ids)
("id", "in", contracts.ids)
]
return action

1
product_contract/models/sale_order_line.py

@ -82,6 +82,7 @@ class SaleOrderLine(models.Model):
'recurring_invoicing_type': self.recurring_invoicing_type,
'recurring_rule_type': self.recurring_rule_type,
'contract_id': contract.id,
'sale_order_line_id': self.id,
}
@api.multi

Loading…
Cancel
Save