修复采购
This commit is contained in:
@@ -1310,11 +1310,10 @@ class MrpProduction(models.Model):
|
||||
move = self.env['stock.move'].search([('origin', '=', productions.name)], order='id desc')
|
||||
for mo in move:
|
||||
domain = []
|
||||
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')]
|
||||
if mo.location_id.barcode == 'WH-POSTPRODUCTION' and mo.rule_id.picking_type_id.barcode == 'PC':
|
||||
domain = [('barcode', '=', 'WH-PC'), ('sequence_code', '=', 'PC')]
|
||||
elif mo.location_id.barcode == 'PL' and mo.rule_id.picking_type_id.barcode == 'INT':
|
||||
domain = [('barcode', '=', 'WH-INTERNAL'), ('sequence_code', '=', 'INT')]
|
||||
if domain:
|
||||
picking_type = self.env['stock.picking.type'].search(domain)
|
||||
mo.write({'picking_type_id': picking_type.id})
|
||||
|
||||
@@ -86,9 +86,12 @@ class ResMrpRoutingWorkcenter(models.Model):
|
||||
@api.model
|
||||
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
|
||||
if self._context.get('production_id'):
|
||||
route_ids = []
|
||||
technology_design = self.env['sf.technology.design'].search(
|
||||
[('production_id', '=', self._context.get('production_id'))])
|
||||
route_ids = [t.route_id.id for t in technology_design]
|
||||
domain = [('id', 'not in', route_ids)]
|
||||
for t in technology_design.filtered(lambda a: a.routing_tag == 'special'):
|
||||
if not t.process_parameters_id:
|
||||
route_ids.append(t.route_id.surface_technics_id.id)
|
||||
domain = [('id', 'not in', route_ids), ('routing_tag', '=', 'special')]
|
||||
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
||||
return super()._name_search(name, args, operator, limit, name_get_uid)
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -10,8 +10,14 @@ class SfProductionProcessParameter(models.Model):
|
||||
@api.model
|
||||
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
|
||||
if self._context.get('route_id'):
|
||||
parameter = []
|
||||
routing = self.env['mrp.routing.workcenter'].search([('id', '=', self._context.get('route_id'))])
|
||||
domain = [('process_id', '=', routing.surface_technics_id.id)]
|
||||
technology_design = self.env['sf.technology.design'].search(
|
||||
[('production_id', '=', self._context.get('production_id')), ('routing_tag', '=', 'special'),
|
||||
('route_id', '=', self._context.get('route_id'))])
|
||||
for t in technology_design:
|
||||
if t.process_parameters_id:
|
||||
parameter.append(t.process_parameters_id.id)
|
||||
domain = [('process_id', '=', routing.surface_technics_id.id), ('id', 'not in', parameter)]
|
||||
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
|
||||
return super()._name_search(name, args, operator, limit, name_get_uid)
|
||||
|
||||
|
||||
@@ -368,7 +368,8 @@
|
||||
attrs="{'readonly': [('id', '!=', False)]}" options="{'no_create': True}"/>
|
||||
<field name="process_parameters_id"
|
||||
attrs="{'readonly': [('id', '!=', False),('routing_tag', '=', 'standard')]}"
|
||||
string="参数" context="{'route_id':route_id}" options="{'no_create': True}"/>
|
||||
string="参数" context="{'route_id':route_id,'production_id': production_id}"
|
||||
options="{'no_create': True}"/>
|
||||
<field name="panel" readonly="1"/>
|
||||
<field name="routing_tag" readonly="1" widget="badge"
|
||||
decoration-success="routing_tag == 'standard'"
|
||||
|
||||
@@ -32,6 +32,12 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
||||
domain += [('state', 'in', ['confirmed', 'pending_cam'])]
|
||||
productions = request.env['mrp.production'].with_user(
|
||||
request.env.ref("base.user_admin")).search(domain)
|
||||
productions_technology_to_confirmed = request.env['mrp.production'].with_user(
|
||||
request.env.ref("base.user_admin")).search(
|
||||
[('programming_no', '=', ret['programming_no']), ('state', 'in', ['technology_to_confirmed'])])
|
||||
if productions_technology_to_confirmed:
|
||||
res = {'status': -2, 'message': '查询到待工艺确认的制造订单'}
|
||||
return json.JSONEncoder().encode(res)
|
||||
if productions:
|
||||
# 拉取所有加工面的程序文件
|
||||
for r in ret['processing_panel'].split(','):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -5,8 +5,8 @@ import requests
|
||||
import os
|
||||
from datetime import datetime
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user