1.修复销售总监看不到销售订单2.优化销售审核向导3.优化销售
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="crm_team_rule_director">
|
||||
<field name="name">销售总监查看所有的订单</field>
|
||||
<field name="name">销售总监查看所有团队</field>
|
||||
<field name="model_id" ref="sales_team.model_crm_team"/>
|
||||
<field name="domain_force">[(1,'=',1)]</field>
|
||||
<field name="groups" eval="[(4, ref('sf_base.group_sale_director'))]"/>
|
||||
@@ -41,11 +41,11 @@
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.rule" id="sale_order_rule_salemanager">
|
||||
<field name="name">销售经理查看自己的订单</field>
|
||||
<record model="ir.rule" id="sale_order_rule_director">
|
||||
<field name="name">销售总监查看所有订单</field>
|
||||
<field name="model_id" ref="model_sale_order"/>
|
||||
<field name="domain_force">[('user_id', '=',user.id)]</field>
|
||||
<field name="groups" eval="[(4, ref('sf_base.group_sale_salemanager'))]"/>
|
||||
<field name="domain_force">[(1,'=',1)]</field>
|
||||
<field name="groups" eval="[(4, ref('sf_base.group_sale_director'))]"/>
|
||||
<field name="perm_read" eval="1"/>
|
||||
<field name="perm_write" eval="1"/>
|
||||
<field name="perm_create" eval="1"/>
|
||||
|
||||
@@ -1,46 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- <record id="sale_order_view_search_inherit_quotation_inherit_sf" model="ir.ui.view">-->
|
||||
<!-- <field name="name">sale.order.search.quotation.inherit.sf</field>-->
|
||||
<!-- <field name="model">sale.order</field>-->
|
||||
<!-- <!– <field name="inherit_id" ref="sale.view_sales_order_filter"/>–>-->
|
||||
|
||||
<!-- <field name="inherit_id" ref="sale.sale_order_view_search_inherit_quotation"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <xpath expr="//filter[@name='my_sale_orders_filter']" position="replace">-->
|
||||
<!-- <!– <field name="campaign_id"/>–>-->
|
||||
<!-- <!– <separator/>–>-->
|
||||
<!-- <!– <filter string="Quotations" name="draft" domain="[('state','in',('draft', 'sent'))]"/>–>-->
|
||||
<!-- <!– <filter string="Sales Orders" name="sales" domain="[('state','in',('sale','done'))]"/>–>-->
|
||||
<!-- <!– <separator/>–>-->
|
||||
<!-- <filter string="Create Date" name="filter_create_date" date="create_date"/>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_sale_order_form_inherit_sf">
|
||||
<field name="name">sale.order.form.inherit.sf</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form/header/button[@name='action_quotation_send'][1]" position="replace">
|
||||
<button name="action_quotation_send" string="通过EMAIL发送" type="object"
|
||||
class="btn-primary" data-hotkey="g" context="{'validate_analytic': True}"
|
||||
attrs="{'invisible': [('check_status', 'not in', ['approved',False]),('state', 'in', ['draft'])]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='action_confirm']" position="after">
|
||||
<field name="check_status" invisible="1"/>
|
||||
<button name="sf_sale.action_sale_order_check_wizard" string="审核" type="action"
|
||||
<button name="submit" string="提交" type="object"
|
||||
context="{'default_order_id':active_id}"
|
||||
attrs="{'invisible': [('check_status','=', 'checked')]}"
|
||||
attrs="{'invisible': [('check_status','!=', False)]}"
|
||||
class="oe_highlight"/>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='action_confirm'][1]" position="attributes">
|
||||
<attribute name="attrs">{'invisible': [('check_status', '=', 'unchecked'),('state', 'not in',
|
||||
['sent'])]}
|
||||
</attribute>
|
||||
<xpath expr="//form/header/button[@name='action_confirm']" position="after">
|
||||
<field name="check_status"/>
|
||||
<field name="state"/>
|
||||
<button name="sf_sale.action_sale_order_check_wizard" string="审核" type="action"
|
||||
context="{'default_order_id':active_id}" groups="sf_base.group_sale_director"
|
||||
attrs="{'invisible': [('check_status','in', ['approved',False])]}"
|
||||
class="oe_highlight"/>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='action_confirm'][2]" position="attributes">
|
||||
<attribute name="attrs">{'invisible': [('check_status', '=', 'unchecked'),('state', 'in',
|
||||
['draft'])]}
|
||||
<!-- <xpath expr="//form/header/button[@name='action_confirm'][1]" position="attributes">-->
|
||||
<!-- <attribute name="attrs">{'invisible': [('check_status', '!=', 'approved'),('state', 'not in',-->
|
||||
<!-- ['sent'])]}-->
|
||||
<!-- </attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<xpath expr="//form/header/button[@name='action_confirm'][2]" position="replace">
|
||||
<button name="action_confirm" data-hotkey="v"
|
||||
string="确认" type="object" context="{'validate_analytic': True}"
|
||||
attrs="{'invisible': [('check_status', 'not in', ['approved']),('state', 'in',['draft','sale'])]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='action_cancel']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': [('check_status', '!=', 'approved')]}
|
||||
</attribute>
|
||||
</xpath>
|
||||
<field name="partner_id" position="replace">
|
||||
@@ -73,16 +69,10 @@
|
||||
<attribute name="string">下单日期</attribute>
|
||||
</field>
|
||||
<field name="sale_order_template_id" position="after">
|
||||
<!-- <label for="person_of_delivery" string="交货信息"/>-->
|
||||
<!-- <div>-->
|
||||
<field name="person_of_delivery" string="交货人"/>
|
||||
<!-- <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
|
||||
<!-- </span>-->
|
||||
<field name="telephone_of_delivery" string="交货人联系方式"/>
|
||||
<!-- <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-->
|
||||
<!-- </span>-->
|
||||
<field name="address_of_delivery" string="交货人地址"/>
|
||||
<!-- </div>-->
|
||||
<field name="remark"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import models, api, fields
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class saleOrderCheckWizard(models.TransientModel):
|
||||
@@ -8,9 +9,17 @@ class saleOrderCheckWizard(models.TransientModel):
|
||||
_description = '报价/销售订单审核向导'
|
||||
|
||||
order_id = fields.Many2one('sale.order')
|
||||
check_state = fields.Selection([('pass', '通过'), ('back', '退回')], '审核状态', default='pass')
|
||||
# check_state = fields.Selection([('pass', '通过'), ('back', '退回')], '处理意见', default='pass')
|
||||
check_audit = fields.Text('审核意见')
|
||||
|
||||
def submit(self):
|
||||
self.order_id.check_status = 'unchecked' if not self.check_state == 'pass' else 'checked'
|
||||
self.order_id.message_ids = '1'
|
||||
self.order_id.check_status = 'approved'
|
||||
self.order_id.remark = self.check_audit
|
||||
|
||||
def back(self):
|
||||
if not self.check_audit:
|
||||
raise UserError('请输入原因')
|
||||
else:
|
||||
self.order_id.check_status = 'fail'
|
||||
self.order_id.remark = self.check_audit
|
||||
|
||||
|
||||
@@ -6,20 +6,22 @@
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<field name="order_id" invisible="True"/>
|
||||
<group>
|
||||
<field name="check_state" required="True"/>
|
||||
<field name="check_audit" attrs="{'required': [('check_state', '=', 'back')]}"/>
|
||||
</group>
|
||||
<group>
|
||||
<!-- <field name="check_state" widget="radio" options="{'horizontal': true}" required="True" string=""/>-->
|
||||
<field name="check_audit" placeholder="原因.." nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="提交" name="submit" type="object" class="oe_highlight"/>
|
||||
<button string="取消" class="btn btn-secondary" special="cancel"/>
|
||||
<button string="通过" name="submit" type="object" class="oe_highlight"/>
|
||||
<button string="退回" name="back" type="object" class="btn btn-secondary" />
|
||||
<!-- <button string="提交" name="submit" type="object" class="oe_highlight"/>-->
|
||||
<!-- <button string="取消" class="btn btn-secondary" special="cancel"/>-->
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_sale_order_check_wizard" model="ir.actions.act_window">
|
||||
<field name="name">销售订单审核向导</field>
|
||||
<field name="name">审核</field>
|
||||
<field name="res_model">sale.order.check.wizard</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
|
||||
Reference in New Issue
Block a user