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.

27 lines
1.1 KiB

  1. # Copyright 2018 ACSONE SA/NV
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import api, models, fields
  4. class AccountAbstractAnalyticContractLine(models.AbstractModel):
  5. _inherit = 'account.abstract.analytic.contract.line'
  6. @api.onchange('product_id')
  7. def onchange_product(self):
  8. if self.product_id.is_contract:
  9. self.recurring_rule_type = self.product_id.recurring_rule_type
  10. self.recurring_invoicing_type = (
  11. self.product_id.recurring_invoicing_type
  12. )
  13. self.recurring_interval = self.product_id.recurring_interval
  14. self.date_start = fields.Date.today()
  15. self.is_auto_renew = self.product_id.is_auto_renew
  16. self.auto_renew_interval = self.product_id.auto_renew_interval
  17. self.auto_renew_rule_type = self.product_id.auto_renew_rule_type
  18. self.termination_notice_interval = (
  19. self.product_id.termination_notice_interval
  20. )
  21. self.termination_notice_rule_type = (
  22. self.product_id.termination_notice_rule_type
  23. )