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.

40 lines
1.7 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="[('is_serviceprofile', '=', True), "
  23. "('type', '=', 'service')]",
  24. required=True)
  25. partner_id = fields.Many2one(related='agreement_id.partner_id',
  26. string='Partner')
  27. # Used for Kanban grouped_by view
  28. @api.model
  29. def _read_group_stage_ids(self, stages, domain, order):
  30. stage_ids = self.env["agreement.stage"].search(
  31. [('stage_type', '=', 'serviceprofile')])
  32. return stage_ids