Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造代码优化
# Conflicts: # sf_manufacturing/models/stock.py
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from odoo import models
|
|
||||||
import time
|
import time
|
||||||
import hashlib
|
import hashlib
|
||||||
|
from odoo import models
|
||||||
|
|
||||||
|
|
||||||
class Common(models.Model):
|
class Common(models.Model):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import logging
|
import logging
|
||||||
import requests
|
|
||||||
import json
|
import json
|
||||||
|
import requests
|
||||||
from odoo import fields, models, api
|
from odoo import fields, models, api
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import logging
|
import logging
|
||||||
from odoo import fields, models
|
|
||||||
import requests
|
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
from odoo import fields, models
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import requests
|
||||||
|
import json
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
import requests
|
|
||||||
import json
|
|
||||||
|
|
||||||
|
|
||||||
class FunctionalFixtureType(models.Model):
|
class FunctionalFixtureType(models.Model):
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class Sf_Bf_Connect(http.Controller):
|
|||||||
self_machining_bom_line = self_machining_bom.with_user(
|
self_machining_bom_line = self_machining_bom.with_user(
|
||||||
request.env.ref("base.user_admin")).bom_create_line(
|
request.env.ref("base.user_admin")).bom_create_line(
|
||||||
self_machining_embryo)
|
self_machining_embryo)
|
||||||
if self_machining_bom_line == False:
|
if self_machining_bom_line is False:
|
||||||
res['status'] = 2
|
res['status'] = 2
|
||||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
||||||
request.cr.rollback()
|
request.cr.rollback()
|
||||||
@@ -84,7 +84,7 @@ class Sf_Bf_Connect(http.Controller):
|
|||||||
# 创建坯料的bom的组件
|
# 创建坯料的bom的组件
|
||||||
outsource_bom_line = outsource_bom.with_user(
|
outsource_bom_line = outsource_bom.with_user(
|
||||||
request.env.ref("base.user_admin")).bom_create_line(outsource_embryo)
|
request.env.ref("base.user_admin")).bom_create_line(outsource_embryo)
|
||||||
if outsource_bom_line == False:
|
if outsource_bom_line is False:
|
||||||
res['status'] = 2
|
res['status'] = 2
|
||||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
||||||
request.cr.rollback()
|
request.cr.rollback()
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import json
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
|
||||||
from odoo.exceptions import UserError
|
|
||||||
import logging
|
|
||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timedelta
|
||||||
import requests
|
import requests
|
||||||
import json
|
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
|
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||||
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
class SfMaintenanceEquipmentCategory(models.Model):
|
class SfMaintenanceEquipmentCategory(models.Model):
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
from odoo import api, fields, models, _
|
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
|
from odoo import api, fields, models, _
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MaintenanceEquipment(models.Model):
|
class MaintenanceEquipment(models.Model):
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class MrpProduction(models.Model):
|
|||||||
if i == 1 and route.routing_type == '获取CNC加工程序':
|
if i == 1 and route.routing_type == '获取CNC加工程序':
|
||||||
workorders_values.append(
|
workorders_values.append(
|
||||||
self.env['mrp.workorder'].json_workorder_str('', production, route))
|
self.env['mrp.workorder'].json_workorder_str('', production, route))
|
||||||
if route.is_repeat == True:
|
if route.is_repeat is True:
|
||||||
workorders_values.append(
|
workorders_values.append(
|
||||||
self.env['mrp.workorder'].json_workorder_str(k, production, route))
|
self.env['mrp.workorder'].json_workorder_str(k, production, route))
|
||||||
if i == processing_panel_len and route.routing_type == '解除装夹':
|
if i == processing_panel_len and route.routing_type == '解除装夹':
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from odoo import models, fields, api, _
|
|
||||||
from odoo.exceptions import ValidationError
|
|
||||||
from odoo.modules import get_resource_path
|
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
|
||||||
import logging
|
import logging
|
||||||
import base64
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import requests
|
from odoo import models, fields, api, _
|
||||||
import json
|
from odoo.exceptions import ValidationError
|
||||||
|
from odoo.modules import get_resource_path
|
||||||
|
from OCC.Extend.DataExchange import read_step_file
|
||||||
|
from OCC.Extend.DataExchange import write_stl_file
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ResProductMo(models.Model):
|
class ResProductMo(models.Model):
|
||||||
@@ -204,16 +203,6 @@ class ResProductMo(models.Model):
|
|||||||
self.cutting_tool_blade_depth = self.specification_id.blade_depth
|
self.cutting_tool_blade_depth = self.specification_id.blade_depth
|
||||||
self.cutting_tool_cut_depth = self.specification_id.cutting_depth
|
self.cutting_tool_cut_depth = self.specification_id.cutting_depth
|
||||||
self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids
|
self.cutting_speed_ids = self.cutting_tool_model_id.cutting_speed_ids
|
||||||
# # self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.
|
|
||||||
# for tooth in self.cutting_tool_model_id.feed_per_tooth_ids:
|
|
||||||
# print(int(tooth.blade_diameter))
|
|
||||||
# print(int(self.specification_id.blade_diameter))
|
|
||||||
# if int(tooth.blade_diameter) == int(self.specification_id.blade_diameter):
|
|
||||||
# self.feed_per_tooth_ids = [(0, 0, {
|
|
||||||
# 'cutting_speed': tooth.cutting_speed,
|
|
||||||
# 'machining_method': tooth.machining_method,
|
|
||||||
# 'blade_diameter': tooth.blade_diameter,
|
|
||||||
# 'materials_type_id': tooth.materials_type_id.id})]
|
|
||||||
self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
|
self.feed_per_tooth_ids = self.cutting_tool_model_id.feed_per_tooth_ids.filtered(
|
||||||
lambda r: int(r.blade_diameter) == int(self.specification_id.blade_diameter))
|
lambda r: int(r.blade_diameter) == int(self.specification_id.blade_diameter))
|
||||||
elif self.cutting_tool_type == '夹头':
|
elif self.cutting_tool_type == '夹头':
|
||||||
@@ -358,89 +347,33 @@ class ResProductMo(models.Model):
|
|||||||
self.cutting_speed_ids = False
|
self.cutting_speed_ids = False
|
||||||
self.feed_per_tooth_ids = False
|
self.feed_per_tooth_ids = False
|
||||||
|
|
||||||
# @api.constrains('suitable_machining_method_ids')
|
@api.constrains('fit_blade_shape_id', 'suitable_machining_method_ids', 'blade_tip_characteristics_id',
|
||||||
# def _check_suitable_machining_method_ids(self):
|
'handle_type_ids', 'cutting_direction_ids', 'suitable_coolant_ids', 'compaction_way_ids')
|
||||||
# for record in self:
|
def _check_cutting_tool_ability(self):
|
||||||
# if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
if self.cutting_tool_type in ['整体式刀具', '刀片', '刀杆', '刀盘']:
|
||||||
# raise ValidationError("适合加工方式不能为空!")
|
if self.cutting_tool_type in ['刀片', '刀杆', '刀盘']:
|
||||||
#
|
if not self.fit_blade_shape_id:
|
||||||
# @api.constrains('blade_tip_characteristics_ids')
|
raise ValidationError("请选择适配刀片形状")
|
||||||
# def _check_blade_tip_characteristics_ids(self):
|
if self.cutting_tool_type in ['刀杆', '刀盘']:
|
||||||
# for record in self:
|
if not self.compaction_way_ids:
|
||||||
# if len(record.blade_tip_characteristics_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
raise ValidationError("请选择压紧方式")
|
||||||
# raise ValidationError("刀尖特征不能为空!")
|
if self.cutting_tool_type == '刀片':
|
||||||
# if len(record.blade_tip_characteristics_ids) > 1 and self.cutting_tool_type == '整体式刀具':
|
if not self.suitable_coolant_ids:
|
||||||
# raise ValidationError("刀尖特征只能单选!")
|
raise ValidationError("请选择适合冷却液")
|
||||||
#
|
elif self.cutting_tool_type == '整体式刀具':
|
||||||
# @api.constrains('handle_type_ids')
|
if not self.handle_type_ids:
|
||||||
# def _check_handle_type_ids(self):
|
raise ValidationError("请选择柄部类型")
|
||||||
# for record in self:
|
if not self.suitable_coolant_ids:
|
||||||
# if len(record.handle_type_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
raise ValidationError("请选择适合冷却液")
|
||||||
# raise ValidationError("柄部类型不能为空!")
|
if not self.suitable_machining_method_ids:
|
||||||
# if len(record.handle_type_ids) > 1 and self.cutting_tool_type == '整体式刀具':
|
raise ValidationError("请选择适合加工方式")
|
||||||
# raise ValidationError("柄部类型只能单选!")
|
if not self.blade_tip_characteristics_id:
|
||||||
#
|
raise ValidationError("请选择刀尖特征")
|
||||||
# @api.constrains('cutting_direction_ids')
|
if not self.cutting_direction_ids:
|
||||||
# def _check_cutting_direction_ids(self):
|
raise ValidationError("请选择走刀方向")
|
||||||
# for record in self:
|
|
||||||
# if len(record.cutting_direction_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
|
||||||
# raise ValidationError("走刀方向不能为空!")
|
|
||||||
#
|
|
||||||
# @api.constrains('suitable_coolant_ids')
|
|
||||||
# def _check_suitable_coolant_ids(self):
|
|
||||||
# for record in self:
|
|
||||||
# if not record.suitable_coolant_ids and self.cutting_tool_type == '整体式刀具':
|
|
||||||
# raise ValidationError("适合冷却液不能为空!")
|
|
||||||
#
|
|
||||||
# @api.constrains('cutting_tool_total_length')
|
|
||||||
# def _check_cutting_tool_total_length(self):
|
|
||||||
# if self.cutting_tool_total_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
|
||||||
# raise ValidationError("总长度不能为0")
|
|
||||||
#
|
|
||||||
# @api.constrains('cutting_tool_shank_length')
|
|
||||||
# def _check_cutting_tool_shank_length(self):
|
|
||||||
# if self.cutting_tool_shank_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
|
||||||
# raise ValidationError("柄部长度不能为0")
|
|
||||||
#
|
|
||||||
# @api.constrains('cutting_tool_blade_length')
|
|
||||||
# def _check_cutting_tool_blade_length(self):
|
|
||||||
# if self.cutting_tool_blade_length <= 0 and self.cutting_tool_type == '整体式刀具':
|
|
||||||
# raise ValidationError("刃部长度不能为0")
|
|
||||||
#
|
|
||||||
# @api.constrains('cutting_tool_blade_number')
|
|
||||||
# def _check_cutting_tool_blade_number(self):
|
|
||||||
# if self.cutting_tool_blade_number <= 0 and self.cutting_tool_type == '整体式刀具':
|
|
||||||
# raise ValidationError("刃数不能为0")
|
|
||||||
#
|
|
||||||
# @api.constrains('integral_shank_diameter')
|
|
||||||
# def _check_integral_shank_diameter(self):
|
|
||||||
# if self.integral_shank_diameter <= 0 and self.cutting_tool_type == '整体式刀具':
|
|
||||||
# raise ValidationError("柄部直径不能为0")
|
|
||||||
#
|
|
||||||
# @api.constrains('integral_blade_diameter')
|
|
||||||
# def _check_integral_blade_diameter(self):
|
|
||||||
# if self.integral_blade_diameter <= 0 and self.cutting_tool_type == '整体式刀具':
|
|
||||||
# raise ValidationError("刃部直径不能为0")
|
|
||||||
#
|
|
||||||
# @api.constrains('integral_run_out_accuracy_min')
|
|
||||||
# def _check_integral_blade_diameter(self):
|
|
||||||
# if self.integral_run_out_accuracy_min <= 0 and self.cutting_tool_type == '整体式刀具':
|
|
||||||
# raise ValidationError("端跳精度最小(min)不能为0")
|
|
||||||
|
|
||||||
cutting_speed_ids = fields.One2many('sf.cutting.speed', 'product_template_id', string='切削速度Vc')
|
cutting_speed_ids = fields.One2many('sf.cutting.speed', 'product_template_id', string='切削速度Vc')
|
||||||
feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'product_template_id', string='每齿走刀量fz')
|
feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'product_template_id', string='每齿走刀量fz')
|
||||||
|
|
||||||
# @api.constrains('suitable_machining_method_ids')
|
|
||||||
# def _check_suitable_machining_method_ids(self):
|
|
||||||
# for record in self:
|
|
||||||
# if len(record.suitable_machining_method_ids) == 0 and self.cutting_tool_type == '整体式刀具':
|
|
||||||
# raise ValidationError("适合加工方式不能为空!")
|
|
||||||
|
|
||||||
# @api.constrains('integral_run_out_accuracy_max')
|
|
||||||
# def _check_integral_run_out_accuracy_max(self):
|
|
||||||
# if self.integral_run_out_accuracy_max <= 0 and self.cutting_tool_type == '整体式刀具':
|
|
||||||
# raise ValidationError("端跳精度最大(max)不能为0")
|
|
||||||
|
|
||||||
cutting_tool_diameter = fields.Float('直径(mm)')
|
cutting_tool_diameter = fields.Float('直径(mm)')
|
||||||
cutting_tool_rear_angle = fields.Integer('后角(°)')
|
cutting_tool_rear_angle = fields.Integer('后角(°)')
|
||||||
cutting_tool_main_included_angle = fields.Integer('主偏角(°)')
|
cutting_tool_main_included_angle = fields.Integer('主偏角(°)')
|
||||||
@@ -758,26 +691,19 @@ class ResProductMo(models.Model):
|
|||||||
'model_file': '' if not item['model_file'] else base64.b64decode(item['model_file']),
|
'model_file': '' if not item['model_file'] else base64.b64decode(item['model_file']),
|
||||||
'model_name': attachment.name,
|
'model_name': attachment.name,
|
||||||
'upload_model_file': [(6, 0, [attachment.id])],
|
'upload_model_file': [(6, 0, [attachment.id])],
|
||||||
# 'tag_ids': [(6, 0, [t.id for t in account_template.tag_ids])],
|
|
||||||
# 'single_manufacturing': True,
|
|
||||||
# 'tracking': 'serial',
|
|
||||||
'list_price': item['price'],
|
'list_price': item['price'],
|
||||||
# 'categ_id': self.env.ref('sf_dlm.product_category_finished_sf').id,
|
|
||||||
'materials_id': self.env['sf.production.materials'].search(
|
'materials_id': self.env['sf.production.materials'].search(
|
||||||
[('materials_no', '=', item['texture_code'])]).id,
|
[('materials_no', '=', item['texture_code'])]).id,
|
||||||
'materials_type_id': self.env['sf.materials.model'].search(
|
'materials_type_id': self.env['sf.materials.model'].search(
|
||||||
[('materials_no', '=', item['texture_type_code'])]).id,
|
[('materials_no', '=', item['texture_type_code'])]).id,
|
||||||
# 'model_surface_process_ids': self.get_production_process_id(item['surface_process_code']),
|
|
||||||
'model_process_parameters_ids': [(6, 0, [])] if not item.get(
|
'model_process_parameters_ids': [(6, 0, [])] if not item.get(
|
||||||
'process_parameters_code') else self.get_process_parameters_id(item['process_parameters_code']),
|
'process_parameters_code') else self.get_process_parameters_id(item['process_parameters_code']),
|
||||||
'model_remark': item['remark'],
|
'model_remark': item['remark'],
|
||||||
'default_code': '%s-%s' % (order_number, i),
|
'default_code': '%s-%s' % (order_number, i),
|
||||||
# 'barcode': item['barcode'],
|
|
||||||
'active': True,
|
'active': True,
|
||||||
# 'route_ids': self._get_routes('')
|
|
||||||
}
|
}
|
||||||
copy_product_id.sudo().write(vals)
|
copy_product_id.sudo().write(vals)
|
||||||
# product_id.product_tmpl_id.active = False
|
product_id.product_tmpl_id.active = False
|
||||||
return copy_product_id
|
return copy_product_id
|
||||||
|
|
||||||
def _get_ids(self, param):
|
def _get_ids(self, param):
|
||||||
@@ -833,12 +759,6 @@ class ResProductMo(models.Model):
|
|||||||
'materials_id': materials_id.id,
|
'materials_id': materials_id.id,
|
||||||
'materials_type_id': materials_type_id.id,
|
'materials_type_id': materials_type_id.id,
|
||||||
'is_bfm': True,
|
'is_bfm': True,
|
||||||
# 'route_ids': self._get_routes(route_type),
|
|
||||||
# 'categ_id': self.env.ref('sf_dlm.product_category_embryo_sf').id,
|
|
||||||
# 'model_surface_process_id': self.env['sf.production.process'].search(
|
|
||||||
# [('process_encode', '=', item['surface_process_code'])]).id,
|
|
||||||
# 'model_process_parameters_id': self.env['sf.processing.technology'].search(
|
|
||||||
# [('process_encode', '=', item['process_parameters_code'])]).id,
|
|
||||||
'active': True
|
'active': True
|
||||||
}
|
}
|
||||||
# 外协和采购生成的坯料需要根据材料型号绑定供应商
|
# 外协和采购生成的坯料需要根据材料型号绑定供应商
|
||||||
@@ -850,8 +770,6 @@ class ResProductMo(models.Model):
|
|||||||
partner = self.env['res.partner'].search([('id', '=', supplier.partner_id.id)])
|
partner = self.env['res.partner'].search([('id', '=', supplier.partner_id.id)])
|
||||||
partner.is_subcontractor = True
|
partner.is_subcontractor = True
|
||||||
no_bom_copy_product_id.write(vals)
|
no_bom_copy_product_id.write(vals)
|
||||||
logging.info('no_bom_copy_product_id-vals:%s' % vals)
|
|
||||||
# product_id.product_tmpl_id.active = False
|
|
||||||
return no_bom_copy_product_id
|
return no_bom_copy_product_id
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ from odoo import SUPERUSER_ID, _, api, fields, models
|
|||||||
from odoo.tools import float_compare
|
from odoo.tools import float_compare
|
||||||
from odoo.addons.stock.models.stock_rule import ProcurementException
|
from odoo.addons.stock.models.stock_rule import ProcurementException
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
from odoo.exceptions import ValidationError, UserError
|
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import requests
|
import logging
|
||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
|
import requests
|
||||||
from odoo import models
|
from odoo import models
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
import logging
|
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
from odoo import models, fields, api
|
|
||||||
from odoo.modules import get_resource_path
|
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
|
||||||
from odoo.exceptions import ValidationError, UserError
|
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
|
||||||
from datetime import datetime
|
|
||||||
import logging
|
import logging
|
||||||
import base64
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
from datetime import datetime
|
||||||
import requests
|
import requests
|
||||||
|
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
|
||||||
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QuickEasyOrder(models.Model):
|
class QuickEasyOrder(models.Model):
|
||||||
@@ -209,7 +212,7 @@ class QuickEasyOrder(models.Model):
|
|||||||
self_machining_bom = self.env['mrp.bom'].bom_create(self_machining_embryo, 'normal', False)
|
self_machining_bom = self.env['mrp.bom'].bom_create(self_machining_embryo, 'normal', False)
|
||||||
# 创建坯料里bom的组件
|
# 创建坯料里bom的组件
|
||||||
self_machining_bom_line = self_machining_bom.bom_create_line(self_machining_embryo)
|
self_machining_bom_line = self_machining_bom.bom_create_line(self_machining_embryo)
|
||||||
if self_machining_bom_line == False:
|
if self_machining_bom_line is False:
|
||||||
self.cr.rollback()
|
self.cr.rollback()
|
||||||
return UserError('该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配')
|
return UserError('该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配')
|
||||||
# 产品配置bom
|
# 产品配置bom
|
||||||
@@ -225,7 +228,7 @@ class QuickEasyOrder(models.Model):
|
|||||||
# 创建坯料的bom的组件
|
# 创建坯料的bom的组件
|
||||||
outsource_bom_line = outsource_bom.with_user(
|
outsource_bom_line = outsource_bom.with_user(
|
||||||
self.env.ref("base.user_admin")).bom_create_line(outsource_embryo)
|
self.env.ref("base.user_admin")).bom_create_line(outsource_embryo)
|
||||||
if outsource_bom_line == False:
|
if outsource_bom_line is False:
|
||||||
self.cr.rollback()
|
self.cr.rollback()
|
||||||
return UserError('该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配')
|
return UserError('该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配')
|
||||||
# 产品配置bom
|
# 产品配置bom
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from odoo import models, fields
|
|
||||||
import datetime
|
import datetime
|
||||||
import base64
|
import base64
|
||||||
import logging
|
import logging
|
||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
class ReSaleOrder(models.Model):
|
class ReSaleOrder(models.Model):
|
||||||
@@ -17,7 +17,6 @@ class ReSaleOrder(models.Model):
|
|||||||
# 业务平台分配工厂后在智能工厂先创建销售订单
|
# 业务平台分配工厂后在智能工厂先创建销售订单
|
||||||
def sale_order_create(self, company_id, delivery_name, delivery_telephone, delivery_address,
|
def sale_order_create(self, company_id, delivery_name, delivery_telephone, delivery_address,
|
||||||
deadline_of_delivery, payments_way, pay_way):
|
deadline_of_delivery, payments_way, pay_way):
|
||||||
logging.info('---------sale_order_create------')
|
|
||||||
now_time = datetime.datetime.now()
|
now_time = datetime.datetime.now()
|
||||||
partner = self.get_customer()
|
partner = self.get_customer()
|
||||||
order_id = self.env['sale.order'].sudo().create({
|
order_id = self.env['sale.order'].sudo().create({
|
||||||
|
|||||||
@@ -1,25 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import ast
|
|
||||||
import base64
|
|
||||||
import io
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import random
|
|
||||||
import time
|
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from stl import mesh
|
|
||||||
from werkzeug import urls
|
|
||||||
|
|
||||||
import odoo
|
|
||||||
from odoo.exceptions import ValidationError
|
|
||||||
import requests
|
import requests
|
||||||
from odoo import http
|
|
||||||
from odoo.http import request, Response
|
|
||||||
from odoo.modules import get_resource_path
|
|
||||||
from odoo.tools.translate import _
|
|
||||||
import logging
|
import logging
|
||||||
|
from odoo import http
|
||||||
|
from odoo.http import request
|
||||||
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import re
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
from odoo import fields, models
|
||||||
import requests
|
|
||||||
from datetime import datetime
|
|
||||||
import base64
|
|
||||||
import hashlib
|
|
||||||
from odoo import fields, models, api
|
|
||||||
import json
|
|
||||||
import requests
|
|
||||||
from odoo.http import request
|
|
||||||
from odoo.exceptions import ValidationError
|
|
||||||
from odoo.exceptions import UserError
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user