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.

39 lines
1.6 KiB

  1. # Copyright (C) 2018 - TODAY, Pavlov Media
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import fields, models, api
  4. class AgreementServiceProfile(models.Model):
  5. _name = 'agreement.serviceprofile'
  6. _description = 'Agreement Service Profiles'
  7. def _default_stage_id(self):
  8. return self.env.ref('agreement_serviceprofile.servpro_stage_draft')
  9. name = fields.Char(string="Name", required=True)
  10. stage_id = fields.Many2one('agreement.stage', string="Stage",
  11. default=_default_stage_id, copy=False,
  12. group_expand='_read_group_stage_ids',)
  13. agreement_id = fields.Many2one('agreement', string="Agreement",
  14. ondelete="cascade")
  15. active = fields.Boolean(string="Active",
  16. default=True,
  17. help="If unchecked, it will allow you " +
  18. "to hide this service profile"
  19. " without removing it.")
  20. notes = fields.Text(string="Notes")
  21. product_id = fields.Many2one('product.template', 'Service Product',
  22. domain="[('type', '=', 'service')]",
  23. required=True)
  24. partner_id = fields.Many2one(related='agreement_id.partner_id',
  25. string='Partner')
  26. # Used for Kanban grouped_by view
  27. @api.model
  28. def _read_group_stage_ids(self, stages, domain, order):
  29. stage_ids = self.env["agreement.stage"].search(
  30. [('stage_type', '=', 'serviceprofile')])
  31. return stage_ids