mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
32 lines
980 B
Python
32 lines
980 B
Python
# -*- coding: utf-8 -*-
|
|
# Copyright 2015 Tecnativa - Pedro M. Baeza
|
|
# Copyright 2017 Tecnativa - Vicent Cubells
|
|
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class AccountAnalyticAccount(models.Model):
|
|
_inherit = "account.analytic.account"
|
|
|
|
@api.model
|
|
def _prepare_invoice_line(self, line, invoice_id):
|
|
res = super(AccountAnalyticAccount, self)._prepare_invoice_line(
|
|
line, invoice_id)
|
|
if line.analytic_distribution_id:
|
|
res.update({
|
|
'account_analytic_id': False,
|
|
'analytic_distribution_id': line.analytic_distribution_id.id,
|
|
})
|
|
return res
|
|
|
|
|
|
class AccountAnalyticInvoiceLine(models.Model):
|
|
_inherit = "account.analytic.invoice.line"
|
|
|
|
analytic_distribution_id = fields.Many2one(
|
|
comodel_name='account.analytic.distribution',
|
|
string='Analytic Distribution',
|
|
oldname='analytics_id',
|
|
)
|