You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
780 B

  1. # Copyright 2019 Tecnativa <vicent.cubells@tecnativa.com>
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import api, models
  4. class AccountAnalyticAccount(models.Model):
  5. _inherit = "account.analytic.account"
  6. @api.model
  7. def _prepare_invoice_line(self, line, invoice_id):
  8. line_obj = self.env['account.invoice.line']
  9. invoice = self.env['account.invoice'].browse(
  10. invoice_id, prefetch=self._prefetch,
  11. )
  12. # Line with automatic price are not taken into account
  13. if (line.date_start and invoice.date_invoice < line.date_start) or \
  14. (line.date_end and invoice.date_invoice > line.date_end):
  15. return line_obj
  16. return super()._prepare_invoice_line(line, invoice_id)