增加功能:当为非“自提”单时,必须进行物流下单才能进行出库操作。增加对字段的显隐控制
This commit is contained in:
@@ -46,9 +46,20 @@ class JdEclp(models.Model):
|
|||||||
is_bill = fields.Boolean(string='是否下了快递单', default=False)
|
is_bill = fields.Boolean(string='是否下了快递单', default=False)
|
||||||
# 物流状态
|
# 物流状态
|
||||||
logistics_status = fields.Selection([('0', '未下单'), ('1', '已下单'), ('2', '已获取物流面单'), ('3', '已打印物流单')],
|
logistics_status = fields.Selection([('0', '未下单'), ('1', '已下单'), ('2', '已获取物流面单'), ('3', '已打印物流单')],
|
||||||
string='物流状态', default='0')
|
string='物流状态', default='0', readonly=True)
|
||||||
|
|
||||||
logistics_way = fields.Selection([('自提', '自提'), ('到付', '到付'), ('在线支付', '在线支付')], string='物流方式')
|
logistics_way = fields.Selection([('自提', '自提'), ('到付', '到付'), ('在线支付', '在线支付')], string='物流方式', readonly=True)
|
||||||
|
|
||||||
|
def button_validate(self):
|
||||||
|
"""
|
||||||
|
重写出库方法,获取物流面单
|
||||||
|
"""
|
||||||
|
res = super(JdEclp, self).button_validate()
|
||||||
|
if self.check_out == 'OUT':
|
||||||
|
if self.logistics_way != '自提':
|
||||||
|
if self.logistics_status != '3':
|
||||||
|
raise ValidationError('非自提订单,必须先下物流单,并获取物流面单后才可出库!')
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
@api.depends('name')
|
@api.depends('name')
|
||||||
|
|||||||
@@ -31,10 +31,11 @@
|
|||||||
<xpath expr="//form//header//button[@name='action_assign']" position="after">
|
<xpath expr="//form//header//button[@name='action_assign']" position="after">
|
||||||
<field name="is_bill" invisible="True"/>
|
<field name="is_bill" invisible="True"/>
|
||||||
<field name="logistics_status" invisible="True"/>
|
<field name="logistics_status" invisible="True"/>
|
||||||
|
<field name="logistics_way" invisible="True"/>
|
||||||
<button string="京东物流下单" name="create_order" type="object" confirm="是否确认物流下单" class="btn-primary"
|
<button string="京东物流下单" name="create_order" type="object" confirm="是否确认物流下单" class="btn-primary"
|
||||||
attrs="{'invisible': ['|', '|', '|', ('check_out', '!=', 'OUT'), ('state', '!=', 'assigned'), ('is_bill', '=', True), ('logistics_way', '=', '自提']}"/>
|
attrs="{'invisible': ['|', '|', '|', ('check_out', '!=', 'OUT'), ('state', '!=', 'assigned'), ('is_bill', '=', True), ('logistics_way', '=', '自提')]}"/>
|
||||||
<button string="获取物流面单" name="get_bill" type="object" confirm="是否获取物流面单" class="btn-primary"
|
<button string="获取物流面单" name="get_bill" type="object" confirm="是否获取物流面单" class="btn-primary"
|
||||||
attrs="{'invisible': ['|', '|', '|', ('check_out', '!=', 'OUT'), ('state', '!=', 'assigned'), ('is_bill', '=', False), ('logistics_way', '=', '自提']]}"/>
|
attrs="{'invisible': ['|', '|', '|', ('check_out', '!=', 'OUT'), ('state', '!=', 'assigned'), ('is_bill', '=', False), ('logistics_way', '=', '自提')]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -46,8 +47,8 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
|
||||||
<field name="location_id" position="after">
|
<field name="location_id" position="after">
|
||||||
<field name="logistics_status"/>
|
<field name="logistics_status" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||||
<field name="logistics_way"/>
|
<field name="logistics_way" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||||
</field>
|
</field>
|
||||||
|
|
||||||
<xpath expr="//group//field[@name='carrier_id']" position="after">
|
<xpath expr="//group//field[@name='carrier_id']" position="after">
|
||||||
|
|||||||
Reference in New Issue
Block a user