summaryrefslogtreecommitdiff
path: root/addons/pos_sale/models/pos_config.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/pos_sale/models/pos_config.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/pos_sale/models/pos_config.py')
-rw-r--r--addons/pos_sale/models/pos_config.py22
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)