mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[MIG] contract_invoice_start_end_dates to v12
This commit is contained in:
committed by
chafique.delli
parent
b57e01ba8f
commit
dd4f75a34c
@@ -1,3 +1 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# Copyright 2019-2020 Akretion France (http://www.akretion.com/)
|
||||||
# Copyright 2019 Akretion
|
|
||||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -8,13 +7,13 @@
|
|||||||
'category': 'Contract Management',
|
'category': 'Contract Management',
|
||||||
'author': 'Akretion, '
|
'author': 'Akretion, '
|
||||||
'Odoo Community Association (OCA)',
|
'Odoo Community Association (OCA)',
|
||||||
|
'maintainers': ['florian-dacosta'],
|
||||||
'website': 'https://github.com/OCA/contract',
|
'website': 'https://github.com/OCA/contract',
|
||||||
'depends': [
|
'depends': [
|
||||||
'account_invoice_start_end_dates',
|
'account_invoice_start_end_dates',
|
||||||
'contract',
|
'contract',
|
||||||
],
|
],
|
||||||
'data': [
|
'data': [],
|
||||||
],
|
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1 @@
|
|||||||
# -*- coding: utf-8 -*-
|
from . import contract_line
|
||||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
||||||
from . import account_analytic_account
|
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
# -*- 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
|
|
||||||
20
contract_invoice_start_end_dates/models/contract_line.py
Normal file
20
contract_invoice_start_end_dates/models/contract_line.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Copyright 2019-2020 Akretion France (http://www.akretion.com/)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import models
|
||||||
|
|
||||||
|
|
||||||
|
class ContractLine(models.Model):
|
||||||
|
_inherit = 'contract.line'
|
||||||
|
|
||||||
|
def _prepare_invoice_line(self, invoice_id=False, invoice_values=False):
|
||||||
|
vals = super(ContractLine, self)._prepare_invoice_line(
|
||||||
|
invoice_id=invoice_id, invoice_values=invoice_values)
|
||||||
|
if self.product_id.must_have_dates:
|
||||||
|
dates = self._get_period_to_invoice(
|
||||||
|
self.last_date_invoiced, self.recurring_next_date)
|
||||||
|
vals.update({
|
||||||
|
'start_date': dates[0],
|
||||||
|
'end_date': dates[1],
|
||||||
|
})
|
||||||
|
return vals
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
This module automatically adds start and end dates to the invoice line
|
This module automatically adds start and end dates to the invoice line
|
||||||
generated by a contract if the product is marked as 'must have date'.
|
generated by a contract if the product is marked as *Must have dates*.
|
||||||
|
|||||||
Reference in New Issue
Block a user