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.

41 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. _inherit = 'mail.thread'
  7. _description = 'Agreement Service Profiles'
  8. def _default_stage_id(self):
  9. return self.env.ref('agreement_serviceprofile.servpro_stage_draft')
  10. name = fields.Char(string="Name", required=True)
  11. stage_id = fields.Many2one('agreement.stage', string="Stage",
  12. default=_default_stage_id, copy=False,
  13. group_expand='_read_group_stage_ids',)
  14. agreement_id = fields.Many2one('agreement', string="Agreement",
  15. ondelete="cascade")
  16. active = fields.Boolean(string="Active",
  17. default=True,
  18. help="If unchecked, it will allow you " +
  19. "to hide this service profile"
  20. " without removing it.")
  21. notes = fields.Text(string="Notes")
  22. product_id = fields.Many2one('product.template', 'Service Product',
  23. domain="[('is_serviceprofile', '=', True), "
  24. "('type', '=', 'service')]",
  25. required=True)
  26. partner_id = fields.Many2one(related='agreement_id.partner_id',
  27. string='Partner')
  28. # Used for Kanban grouped_by view
  29. @api.model
  30. def _read_group_stage_ids(self, stages, domain, order):
  31. stage_ids = self.env["agreement.stage"].search(
  32. [('stage_type', '=', 'serviceprofile')])
  33. return stage_ids