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.

26 lines
839 B

  1. # -*- coding: utf-8 -*-
  2. # (c) 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
  3. # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
  4. from openerp import models, fields, api
  5. class AccountAnalyticAccount(models.Model):
  6. _inherit = "account.analytic.account"
  7. @api.model
  8. def _prepare_invoice_line(self, line, invoice_id):
  9. res = super(AccountAnalyticAccount, self)._prepare_invoice_line(
  10. line, invoice_id)
  11. if line.analytics_id:
  12. res.update({'account_analytic_id': False,
  13. 'analytics_id': line.analytics_id.id})
  14. return res
  15. class AccountAnalyticInvoiceLine(models.Model):
  16. _inherit = "account.analytic.invoice.line"
  17. analytics_id = fields.Many2one(
  18. comodel_name='account.analytic.plan.instance',
  19. string='Analytic Distribution')