Accept Merge Request #2105: (feature/采购申请优化 -> develop)
Merge Request: 采购申请数量修改过滤取消 Created By: @管欢 Reviewed By: @胡尧 Approved By: @胡尧 Accepted By: @管欢 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2105
This commit is contained in:
@@ -114,7 +114,10 @@ class PurchaseRequestLine(models.Model):
|
|||||||
|
|
||||||
def _compute_qty_to_buy(self):
|
def _compute_qty_to_buy(self):
|
||||||
for pr in self:
|
for pr in self:
|
||||||
qty_to_buy = sum(pr.mapped("product_qty")) - sum(pr.mapped("qty_done")) - sum(pr.mapped("qty_in_progress"))
|
qty_to_buy = sum(pr.mapped("product_qty"))
|
||||||
|
if pr.purchase_count > 0:
|
||||||
|
qty_to_buy -= sum(pr.mapped("purchase_lines").filtered(lambda po: po.state != 'cancel').mapped(
|
||||||
|
"product_qty"))
|
||||||
pr.qty_to_buy = qty_to_buy > 0.0
|
pr.qty_to_buy = qty_to_buy > 0.0
|
||||||
pr.pending_qty_to_receive = qty_to_buy
|
pr.pending_qty_to_receive = qty_to_buy
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user