Add module contract_invoice_start_end_dates

This commit is contained in:
Florian da Costa
2019-04-04 20:29:44 +02:00
committed by chafique.delli
parent c8b6024437
commit b57e01ba8f
9 changed files with 553 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2019 - Akretion
# 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):
vals = super(AccountAnalyticAccount, self)._prepare_invoice_line(
line, invoice_id)
if line.product_id.must_have_dates:
vals.update({
'start_date': self.env.context['date_from'],
'end_date': self.env.context['date_to'],
})
return vals