投料齐套检查修改
This commit is contained in:
@@ -272,18 +272,15 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
else:
|
else:
|
||||||
record.actual_end_date = None
|
record.actual_end_date = None
|
||||||
|
|
||||||
@api.depends('sale_order_id.mrp_production_ids.move_raw_ids.forecast_availability',
|
@api.depends('sale_order_id.mrp_production_ids.move_raw_ids.reserved_availability')
|
||||||
'sale_order_id.mrp_production_ids.move_raw_ids.quantity_done')
|
|
||||||
def _compute_material_check(self):
|
def _compute_material_check(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
if record.sale_order_id and record.sale_order_id.mrp_production_ids:
|
if record.sale_order_id and record.sale_order_id.mrp_production_ids:
|
||||||
manufacturing_orders = record.sale_order_id.mrp_production_ids.filtered(
|
manufacturing_orders = record.sale_order_id.mrp_production_ids.filtered(
|
||||||
lambda mo: mo.product_id == record.product_id)
|
lambda mo: mo.product_id == record.product_id)
|
||||||
if manufacturing_orders and manufacturing_orders.move_raw_ids:
|
if manufacturing_orders and manufacturing_orders.move_raw_ids:
|
||||||
total_forecast_availability = sum(manufacturing_orders.mapped('move_raw_ids.forecast_availability'))
|
total_reserved_availability = sum(manufacturing_orders.mapped('move_raw_ids.reserved_availability'))
|
||||||
total_quantity_done = sum(manufacturing_orders.mapped('move_raw_ids.quantity_done'))
|
if float_compare(total_reserved_availability, record.product_uom_qty,
|
||||||
total_sum = total_forecast_availability + total_quantity_done
|
|
||||||
if float_compare(total_sum, record.product_uom_qty,
|
|
||||||
precision_rounding=record.product_id.uom_id.rounding) >= 0:
|
precision_rounding=record.product_id.uom_id.rounding) >= 0:
|
||||||
record.material_check = '1' # 已齐套
|
record.material_check = '1' # 已齐套
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ class SfDemandPlanPrintWizard(models.TransientModel):
|
|||||||
workorder_id = fields.Many2one('mrp.workorder', string='工单')
|
workorder_id = fields.Many2one('mrp.workorder', string='工单')
|
||||||
cnc_worksheet = fields.Binary('程序单')
|
cnc_worksheet = fields.Binary('程序单')
|
||||||
|
|
||||||
def demand_plan_print(self):
|
def demand_plan_print(self, print_ids):
|
||||||
for record in self:
|
plan_print_ids = self.env['sf.demand.plan.print.wizard'].sudo().search(
|
||||||
|
[('id', 'in', print_ids)])
|
||||||
|
for record in plan_print_ids:
|
||||||
pdf_data = record.machining_drawings if record.type == '1' else record.cnc_worksheet
|
pdf_data = record.machining_drawings if record.type == '1' else record.cnc_worksheet
|
||||||
if pdf_data:
|
if pdf_data:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user