mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[ADD] contract_price_revision: new module to update contract prices easily
This commit is contained in:
17
contract_price_revision/models/account_analytic_account.py
Normal file
17
contract_price_revision/models/account_analytic_account.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Copyright 2019 Tecnativa <vicent.cubells@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class AccountAnalyticAccount(models.Model):
|
||||
_inherit = "account.analytic.account"
|
||||
|
||||
@api.model
|
||||
def _prepare_invoice_line(self, line, invoice_id):
|
||||
line_obj = self.env['account.invoice.line']
|
||||
invoice = self.env['account.invoice'].browse(invoice_id)
|
||||
# Line with automatic price are not taken into account
|
||||
if (line.date_start and invoice.date_invoice < line.date_start) or \
|
||||
(line.date_end and invoice.date_invoice > line.date_end):
|
||||
return line_obj
|
||||
return super()._prepare_invoice_line(line, invoice_id)
|
||||
Reference in New Issue
Block a user