From 6668e0ee2f32cc92ffe6d7b9d05ef44c61bb138c Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Wed, 21 Aug 2024 14:43:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=98=E5=8E=9FOCC=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 11 +++++++---- sf_manufacturing/models/mrp_workorder.py | 6 ------ sf_manufacturing/models/product_template.py | 4 ++-- sf_manufacturing/models/stock.py | 3 ++- sf_sale/models/quick_easy_order.py | 4 ++-- sf_sale/models/quick_easy_order_old.py | 4 ++-- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 66a4ddc2..466e9a62 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -987,17 +987,20 @@ class MrpProduction(models.Model): move = self.env['stock.move'].search([('origin', '=', productions.name)], order='id desc') for mo in move: print(mo.id) - if mo.name in ['/', '拉']: + if mo.procure_method == 'make_to_order' and mo.name != productions.name: if mo.name == '/': domain = [('barcode', '=', 'WH-PC'), ('sequence_code', '=', 'PC')] elif mo.name == '拉': domain = [('barcode', '=', 'WH-INTERNAL'), ('sequence_code', '=', 'INT')] picking_type = self.env['stock.picking.type'].search(domain) - mo.picking_type_id = picking_type.id + mo.write({'picking_type_id': picking_type.id}) mo._assign_picking() - mo.reference = mo.picking_id.name else: - mo.reference = productions.name + if mo.reference != productions.name: + mo.reference = productions.name + if mo.production_id: + if mo.production_id != productions: + mo.production_id = False productions.write({'programming_no': self.programming_no, 'is_remanufacture': True}) productions.procurement_group_id.mrp_production_ids.move_dest_ids.write( {'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])}) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index c49b3c70..cb1719f4 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1094,9 +1094,7 @@ class ResMrpWorkOrder(models.Model): # move_out._action_assign() if self.state == 'waiting' or self.state == 'ready' or self.state == 'progress': - print(self.production_id.move_raw_ids) self.move_raw_ids = self.production_id.move_raw_ids - print(self.move_raw_ids) self.move_raw_ids[0].write({ 'materiel_length': self.move_raw_ids[0].product_id.length, 'materiel_width': self.move_raw_ids[0].product_id.width, @@ -1266,7 +1264,6 @@ class ResMrpWorkOrder(models.Model): 'is_trayed': False }) - # 将FTP的检测报告文件下载到临时目录 def download_reportfile_tmp(self, workorder, reportpath): logging.info('reportpath/ftp地址:%s' % reportpath) @@ -1661,7 +1658,6 @@ class WorkPieceDelivery(models.Model): agv_scheduling_id = fields.Many2one('sf.agv.scheduling', 'AGV任务调度') - @api.model def create(self, vals): if vals.get('route_id') and vals.get('type') is None: @@ -1751,7 +1747,6 @@ class WorkPieceDelivery(models.Model): 'default_confirm_button': '确认配送' }} - # 验证agv站点是否可用 def _check_avgsite_state(self): is_free = False @@ -1856,7 +1851,6 @@ class WorkPieceDelivery(models.Model): obj.delivery_duration = 0.0 - class CMMprogram(models.Model): _name = 'sf.cmm.program' _description = "CMM程序" diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 37fa02bd..071f1167 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError, UserError from odoo.modules import get_resource_path -# from OCC.Extend.DataExchange import read_step_file -# from OCC.Extend.DataExchange import write_stl_file +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file class ResProductMo(models.Model): diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index db07ab91..f53d7056 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -178,7 +178,8 @@ class StockRule(models.Model): # create the move as SUPERUSER because the current user may not have the rights to do it (mto product # launched by a sale for example) logging.info(moves_values) - moves = self.env['stock.move'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(moves_values) + moves = self.env['stock.move'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create( + moves_values) logging.info(moves) # Since action_confirm launch following procurement_group we should activate it. moves._action_confirm() diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py index cb1886a1..081807a4 100644 --- a/sf_sale/models/quick_easy_order.py +++ b/sf_sale/models/quick_easy_order.py @@ -8,8 +8,8 @@ from datetime import datetime import requests from odoo import http from odoo.http import request -# from OCC.Extend.DataExchange import read_step_file -# from OCC.Extend.DataExchange import write_stl_file +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file from odoo import models, fields, api from odoo.modules import get_resource_path from odoo.exceptions import ValidationError, UserError diff --git a/sf_sale/models/quick_easy_order_old.py b/sf_sale/models/quick_easy_order_old.py index 92f6cda2..3ae65db3 100644 --- a/sf_sale/models/quick_easy_order_old.py +++ b/sf_sale/models/quick_easy_order_old.py @@ -6,8 +6,8 @@ import os from datetime import datetime from stl import mesh # from OCC.Core.GProp import GProp_GProps -# from OCC.Extend.DataExchange import read_step_file -# from OCC.Extend.DataExchange import write_stl_file +from OCC.Extend.DataExchange import read_step_file +from OCC.Extend.DataExchange import write_stl_file from odoo.addons.sf_base.commons.common import Common from odoo import models, fields, api from odoo.modules import get_resource_path