1.修复销售总监看不到销售订单2.优化销售审核向导3.优化销售

This commit is contained in:
jinling.yang
2023-12-20 17:45:29 +08:00
parent ef47597cf9
commit bbb5ddb177
5 changed files with 69 additions and 57 deletions

View File

@@ -13,14 +13,17 @@ class ReSaleOrder(models.Model):
address_of_delivery = fields.Char('交货人地址')
payments_way = fields.Selection([('现结', '现结'), ('月结', '月结')], '结算方式', default='现结', tracking=True)
pay_way = fields.Selection([('转账', '转账'), ('微信', '微信'), ('支付宝', '支付宝')], '支付方式')
check_status = fields.Selection([('unchecked', '审核'), ('checked', '已审核')], '审核状态', default='unchecked')
check_status = fields.Selection([('pending', '审核'), ('approved', '已审核'), ('fail', '不通过')], '审核状态')
schedule_status = fields.Selection(
[('schedule', '待排程'), ('process', '待加工'), ('deliver', '待发货'), ('receive', '待收货'), ('received', '已收货')],
'进度状态')
payment_term_id = fields.Many2one(
comodel_name='account.payment.term',
string="交付条件",
compute='_compute_payment_term_id',
store=True, readonly=False, precompute=True, check_company=True, tracking=True,
domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")
remark = fields.Text('备注')
# 业务平台分配工厂后在智能工厂先创建销售订单
def sale_order_create(self, company_id, delivery_name, delivery_telephone, delivery_address,
@@ -43,6 +46,10 @@ class ReSaleOrder(models.Model):
})
return order_id
# 提交
def submit(self):
self.check_status = 'pending'
# 审核
def action_check(self):
self.check_status = 'checked'
@@ -108,9 +115,13 @@ class ResPartnerToSale(models.Model):
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
if self._context.get('is_customer'):
if self.env.user.has_group('sf_base.group_sale_director'):
domain = [('customer_rank', '=', 1)]
else:
domain = [('user_id', '=', self.env.user.id)]
domain = [('customer_rank', '>', 0)]
elif self.env.user.has_group('sf_base.group_sale_salemanager'):
customer = self.env['res.partner'].search(
[('customer_rank', '>', 0), ('user_id', '=', self.env.user.id)])
if customer:
ids = [t.id for t in customer]
domain = [('id', 'in', ids)]
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
return super()._name_search(name, args, operator, limit, name_get_uid)