mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] - Link contract line to sale order line
This commit is contained in:
committed by
Thomas Binsfeld
parent
16f480c04c
commit
44b7798a80
@@ -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
Normal file
16
product_contract/models/contract_line.py
Normal file
@@ -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,
|
||||
)
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user