diff options
Diffstat (limited to 'addons/pos_sale/models/pos_config.py')
| -rw-r--r-- | addons/pos_sale/models/pos_config.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/addons/pos_sale/models/pos_config.py b/addons/pos_sale/models/pos_config.py new file mode 100644 index 00000000..c6a8dd7c --- /dev/null +++ b/addons/pos_sale/models/pos_config.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models, api +from odoo.exceptions import AccessError + + +class PosConfig(models.Model): + _inherit = 'pos.config' + + + crm_team_id = fields.Many2one( + 'crm.team', string="Sales Team", + help="This Point of sale's sales will be related to this Sales Team.") + + @api.onchange('company_id') + def _get_default_pos_team(self): + default_sale_team = self.env.ref('sales_team.pos_sales_team', raise_if_not_found=False) + if default_sale_team and (not default_sale_team.company_id or default_sale_team.company_id == self.company_id): + self.crm_team_id = default_sale_team + else: + self.crm_team_id = self.env['crm.team'].search(['|', ('company_id', '=', self.company_id.id), ('company_id', '=', False)], limit=1) |
