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.

25 lines
964 B

  1. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  2. from odoo import api, fields, models
  3. class ContractContract(models.Model):
  4. _inherit = 'contract.contract'
  5. @api.multi
  6. def _prepare_recurring_invoices_values(self, date_ref=False):
  7. invoices_values = super(ContractContract, self)._prepare_recurring_invoices_values(date_ref=date_ref)
  8. return invoices_values
  9. def _compute_sale_order_count(self):
  10. super(ContractContract, self)._compute_sale_order_count()
  11. contract_count = self.contract_line_ids.mapped('sale_order_line_id.order_id.contract_id')
  12. self.sale_order_count += contract_count
  13. @api.multi
  14. def action_view_sales_orders(self):
  15. res = super(ContractContract, self).action_view_sales_orders()
  16. contracts = self.contract_line_ids.mapped(
  17. 'sale_order_line_id.order_id.contract_id'
  18. )
  19. res.get('domain')[0][2].extend(contracts)
  20. return res