新增如果采购订单类型为委外加工,则不进行供应商校验直接生成补给单

This commit is contained in:
yuxianghui
2025-06-18 10:50:13 +08:00
parent 531bc2e090
commit 71a0f39ec9
3 changed files with 31 additions and 0 deletions

View File

@@ -1216,6 +1216,20 @@ class ReStockMove(models.Model):
res['lot_id'] = self.subcontract_workorder_id.production_id.move_raw_ids.move_line_ids[0].lot_id.id
return res
def _get_subcontract_bom(self):
self.ensure_one()
purchase_type = getattr(self.picking_id.purchase_id, 'purchase_type', False)
if purchase_type:
self = self.with_context(stock_picking=purchase_type)
bom = self.env['mrp.bom'].sudo()._bom_subcontract_find(
self.product_id,
picking_type=self.picking_type_id,
company_id=self.company_id.id,
bom_type='subcontract',
subcontractor=self.picking_id.partner_id
)
return bom
class ReStockQuant(models.Model):
_inherit = 'stock.quant'