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.
 
 
 

31 lines
980 B

# -*- 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',
)