还原OCC代码

This commit is contained in:
jinling.yang
2024-08-21 14:43:22 +08:00
parent 7b2908defa
commit 6668e0ee2f
6 changed files with 15 additions and 17 deletions

View File

@@ -987,17 +987,20 @@ class MrpProduction(models.Model):
move = self.env['stock.move'].search([('origin', '=', productions.name)], order='id desc') move = self.env['stock.move'].search([('origin', '=', productions.name)], order='id desc')
for mo in move: for mo in move:
print(mo.id) print(mo.id)
if mo.name in ['/', '']: if mo.procure_method == 'make_to_order' and mo.name != productions.name:
if mo.name == '/': if mo.name == '/':
domain = [('barcode', '=', 'WH-PC'), ('sequence_code', '=', 'PC')] domain = [('barcode', '=', 'WH-PC'), ('sequence_code', '=', 'PC')]
elif mo.name == '': elif mo.name == '':
domain = [('barcode', '=', 'WH-INTERNAL'), ('sequence_code', '=', 'INT')] domain = [('barcode', '=', 'WH-INTERNAL'), ('sequence_code', '=', 'INT')]
picking_type = self.env['stock.picking.type'].search(domain) 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._assign_picking()
mo.reference = mo.picking_id.name
else: 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.write({'programming_no': self.programming_no, 'is_remanufacture': True})
productions.procurement_group_id.mrp_production_ids.move_dest_ids.write( productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
{'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])}) {'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})

View File

@@ -1094,9 +1094,7 @@ class ResMrpWorkOrder(models.Model):
# move_out._action_assign() # move_out._action_assign()
if self.state == 'waiting' or self.state == 'ready' or self.state == 'progress': 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 self.move_raw_ids = self.production_id.move_raw_ids
print(self.move_raw_ids)
self.move_raw_ids[0].write({ self.move_raw_ids[0].write({
'materiel_length': self.move_raw_ids[0].product_id.length, 'materiel_length': self.move_raw_ids[0].product_id.length,
'materiel_width': self.move_raw_ids[0].product_id.width, 'materiel_width': self.move_raw_ids[0].product_id.width,
@@ -1266,7 +1264,6 @@ class ResMrpWorkOrder(models.Model):
'is_trayed': False 'is_trayed': False
}) })
# 将FTP的检测报告文件下载到临时目录 # 将FTP的检测报告文件下载到临时目录
def download_reportfile_tmp(self, workorder, reportpath): def download_reportfile_tmp(self, workorder, reportpath):
logging.info('reportpath/ftp地址:%s' % reportpath) logging.info('reportpath/ftp地址:%s' % reportpath)
@@ -1661,7 +1658,6 @@ class WorkPieceDelivery(models.Model):
agv_scheduling_id = fields.Many2one('sf.agv.scheduling', 'AGV任务调度') agv_scheduling_id = fields.Many2one('sf.agv.scheduling', 'AGV任务调度')
@api.model @api.model
def create(self, vals): def create(self, vals):
if vals.get('route_id') and vals.get('type') is None: if vals.get('route_id') and vals.get('type') is None:
@@ -1751,7 +1747,6 @@ class WorkPieceDelivery(models.Model):
'default_confirm_button': '确认配送' 'default_confirm_button': '确认配送'
}} }}
# 验证agv站点是否可用 # 验证agv站点是否可用
def _check_avgsite_state(self): def _check_avgsite_state(self):
is_free = False is_free = False
@@ -1856,7 +1851,6 @@ class WorkPieceDelivery(models.Model):
obj.delivery_duration = 0.0 obj.delivery_duration = 0.0
class CMMprogram(models.Model): class CMMprogram(models.Model):
_name = 'sf.cmm.program' _name = 'sf.cmm.program'
_description = "CMM程序" _description = "CMM程序"

View File

@@ -9,8 +9,8 @@ from odoo.exceptions import ValidationError, UserError
from odoo.modules import get_resource_path from odoo.modules import get_resource_path
# from OCC.Extend.DataExchange import read_step_file from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file from OCC.Extend.DataExchange import write_stl_file
class ResProductMo(models.Model): class ResProductMo(models.Model):

View File

@@ -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 # 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) # launched by a sale for example)
logging.info(moves_values) 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) logging.info(moves)
# Since action_confirm launch following procurement_group we should activate it. # Since action_confirm launch following procurement_group we should activate it.
moves._action_confirm() moves._action_confirm()

View File

@@ -8,8 +8,8 @@ from datetime import datetime
import requests import requests
from odoo import http from odoo import http
from odoo.http import request from odoo.http import request
# from OCC.Extend.DataExchange import read_step_file from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file from OCC.Extend.DataExchange import write_stl_file
from odoo import models, fields, api from odoo import models, fields, api
from odoo.modules import get_resource_path from odoo.modules import get_resource_path
from odoo.exceptions import ValidationError, UserError from odoo.exceptions import ValidationError, UserError

View File

@@ -6,8 +6,8 @@ import os
from datetime import datetime from datetime import datetime
from stl import mesh from stl import mesh
# from OCC.Core.GProp import GProp_GProps # from OCC.Core.GProp import GProp_GProps
# from OCC.Extend.DataExchange import read_step_file from OCC.Extend.DataExchange import read_step_file
# from OCC.Extend.DataExchange import write_stl_file from OCC.Extend.DataExchange import write_stl_file
from odoo.addons.sf_base.commons.common import Common from odoo.addons.sf_base.commons.common import Common
from odoo import models, fields, api from odoo import models, fields, api
from odoo.modules import get_resource_path from odoo.modules import get_resource_path