优化采购:一个制造订单对应一个采购单

This commit is contained in:
jinling.yang
2024-11-28 09:59:01 +08:00
parent ecf683e663
commit c22b91f9d9
9 changed files with 71 additions and 61 deletions

View File

@@ -842,7 +842,7 @@ class MrpProduction(models.Model):
# workorder.picking_ids.move_ids = False
workorder.picking_ids = False
purchase_order = self.env['purchase.order'].search(
[('state', '=', 'draft'), ('origin', '=', ','.join(production_process)),
[('state', '=', 'draft'), ('origin', '=', item.name),
('purchase_type', '=', 'consignment')])
for line in purchase_order.order_line:
server_template = self.env['product.template'].search(
@@ -850,7 +850,7 @@ class MrpProduction(models.Model):
('detailed_type', '=', 'service')])
purchase_order_line = self.env['purchase.order.line'].search(
[('product_id', '=', server_template.product_variant_id.id), ('id', '=', line.id),
('product_qty', '=', len(production_process))], limit=1, order='id desc')
('product_qty', '=', 1)], limit=1, order='id desc')
if purchase_order_line:
line.unlink()