res_partner.py 902 B

123456789101112131415161718192021222324
  1. # -*- coding: utf-8 -*-
  2. from openerp import api, fields, models
  3. class ResPartner(models.Model):
  4. """Add some fields related to commissions"""
  5. _inherit = "res.partner"
  6. agents = fields.Many2many(
  7. comodel_name="res.partner", relation="partner_agent_rel",
  8. column1="partner_id", column2="agent_id",
  9. domain="[('agent', '=', True)]")
  10. agent = fields.Boolean(
  11. string="Creditor/Agent",
  12. help="Check this field if the partner is a creditor or an agent.")
  13. agent_type = fields.Selection(
  14. selection=[("agent", "Agente")], string="Type", required=True,
  15. default="agent")
  16. commission = fields.Many2one(
  17. string="Commission", comodel_name="sale.commission",
  18. help="This is the default commission used in the sales where this "
  19. "agent is assigned. It can be changed on each operation if "
  20. "needed.")