# -*- coding: utf-8 -*-

from odoo import models, fields, api
import re
import json


# class accountMoveInherit(models.Model):
#     _inherit = 'account.move'
#
#     sales_team_id = fields.Many2one(comodel_name="crm.team", string="Sale Team", required=False, )
#
#     sales_domain = fields.Char(compute='_compute_sales_domain', string='Sales Domain', store=True)
#
#     sales_man_id = fields.Many2one(comodel_name="res.partner",
#                                    string="Sales Man",
#                                    # domain="[('id', 'in', order_ids)]",
#                                    required=False, tracking=True)
#
#     @api.depends('sales_team_id')
#     def _compute_sales_domain(self):
#         for record in self:
#             record.sales_domain = False
#             record.sales_man_id = False
#             if record.sales_team_id:
#                 team_id = self.env['crm.team.member'].sudo().search([('crm_team_id', '=', record.sales_team_id.id)])
#                 record.sales_domain = json.dumps([('id', '=', team_id.salesperson_id.ids)])
#             else:
#                 team_id = self.env['crm.team.member'].sudo().search([('crm_team_id.name', '=', 'Sales')])
#                 record.sales_domain = json.dumps([('id', 'in', team_id.salesperson_id.ids)])
