Files
test/stock_barcode/wizard/stock_backorder_confirmation.py
qihao.gong@jikimo.com 3c89404543 质量模块和库存扫码
2023-07-24 11:42:15 +08:00

17 lines
790 B
Python

from odoo import api, fields, models
class StockBackorderConfirmation(models.TransientModel):
_inherit = 'stock.backorder.confirmation'
empty_move_count = fields.Integer(compute="_compute_not_fully_processed_move_count")
partial_move_count = fields.Integer(compute="_compute_not_fully_processed_move_count")
@api.depends('pick_ids')
def _compute_not_fully_processed_move_count(self):
for backorder in self:
moves = backorder.pick_ids.move_ids
backorder.empty_move_count = len(moves.filtered(lambda mv: mv.product_uom_qty and not mv.quantity_done))
not_done_count = len(moves.filtered(lambda mv: mv.product_uom_qty > mv.quantity_done))
backorder.partial_move_count = not_done_count - backorder.empty_move_count