!10367 Merge branch 'dev' of <a href="https://gitee.com/jinan-pengyusen-data/gzth">https://gitee.com/jinan-pengyusen-data/gzth</a> into dev_wang
Merge pull request !10367 from 李鹏宇/dev_wang
This commit is contained in:
@@ -86,6 +86,29 @@ class InheritPurchaseOrder(models.Model):
|
||||
else:
|
||||
record.display_end_time = record.write_date
|
||||
|
||||
@api.depends('picking_ids', 'picking_ids.receipt_status', 'picking_ids.picking_type_code')
|
||||
def _compute_picking_receipt_state(self):
|
||||
"""根据关联入库单的 receipt_status 计算入库状态。
|
||||
|
||||
只考虑入库类型的调拨(picking_type_code == 'incoming'):
|
||||
- 任一为 receipt → 已入库
|
||||
- 否则任一为 certification → 证明入库
|
||||
- 否则任一为 acceptance → 待验收
|
||||
- 否则为空
|
||||
"""
|
||||
for order in self:
|
||||
state = False
|
||||
incoming_pickings = order.picking_ids.filtered(lambda p: p.picking_type_code == 'incoming')
|
||||
if incoming_pickings:
|
||||
statuses = set(incoming_pickings.mapped('receipt_status'))
|
||||
if 'receipt' in statuses:
|
||||
state = 'done'
|
||||
elif 'certification' in statuses:
|
||||
state = 'certification'
|
||||
elif 'acceptance' in statuses:
|
||||
state = 'waiting'
|
||||
order.picking_receipt_state = state
|
||||
|
||||
@api.depends_context('uid', 'company')
|
||||
@api.depends('company_id')
|
||||
def _compute_is_company(self):
|
||||
|
||||
@@ -40,6 +40,14 @@
|
||||
<xpath expr="//field[@name='amount_total']" position="after">
|
||||
<field name="display_end_time" string="办结时间" optional="show"/>
|
||||
</xpath>
|
||||
|
||||
<!-- 在display_end_time后添加入库状态徽标 -->
|
||||
<xpath expr="//field[@name='display_end_time']" position="after">
|
||||
<field name="picking_receipt_state" string="入库状态" widget="badge"
|
||||
decoration-info="picking_receipt_state == 'waiting'"
|
||||
decoration-warning="picking_receipt_state == 'certification'"
|
||||
decoration-success="picking_receipt_state == 'done'"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="inherit_purchase_order_kpis_tree" model="ir.ui.view">
|
||||
|
||||
Reference in New Issue
Block a user