diff --git a/sf_bf_connect/models/jd_eclp.py b/sf_bf_connect/models/jd_eclp.py
index 8961e482..49337083 100644
--- a/sf_bf_connect/models/jd_eclp.py
+++ b/sf_bf_connect/models/jd_eclp.py
@@ -46,9 +46,20 @@ class JdEclp(models.Model):
is_bill = fields.Boolean(string='是否下了快递单', default=False)
# 物流状态
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')
diff --git a/sf_bf_connect/views/view.xml b/sf_bf_connect/views/view.xml
index 90d36123..ce1cf437 100644
--- a/sf_bf_connect/views/view.xml
+++ b/sf_bf_connect/views/view.xml
@@ -31,10 +31,11 @@
+
+ attrs="{'invisible': ['|', '|', '|', ('check_out', '!=', 'OUT'), ('state', '!=', 'assigned'), ('is_bill', '=', True), ('logistics_way', '=', '自提')]}"/>
+ attrs="{'invisible': ['|', '|', '|', ('check_out', '!=', 'OUT'), ('state', '!=', 'assigned'), ('is_bill', '=', False), ('logistics_way', '=', '自提')]}"/>
@@ -46,8 +47,8 @@
-
-
+
+