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.

33 lines
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2014-2019 Therp BV <https://therp.nl>.
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  4. # pylint: disable=no-member,too-few-public-methods
  5. from odoo import api, fields, models
  6. class AccountAnalyticInvoiceLine(models.Model):
  7. _inherit = 'account.analytic.invoice.line'
  8. partner_id = fields.Many2one(
  9. related='analytic_account_id.partner_id',
  10. store=True,
  11. readonly=True)
  12. publication = fields.Boolean(
  13. string='Subscription product line',
  14. related='product_id.publication',
  15. store=True)
  16. @api.multi
  17. def action_distribution_list(self):
  18. self.ensure_one()
  19. action = self.env.ref(
  20. 'publication.action_distribution_list').read()[0]
  21. action['context'] = {
  22. 'default_product_id': self.product_id.id,
  23. 'default_contract_partner_id': self.partner_id.id}
  24. action['domain'] = [
  25. ('contract_partner_id', '=', self.partner_id.id),
  26. ('product_id', '=', self.product_id.id)]
  27. action['view_mode'] = 'form'
  28. action['target'] = 'current'
  29. return action