1.新增销售和计划权限组2.优化代码格式
This commit is contained in:
@@ -5,7 +5,6 @@ from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
|
||||
class FunctionalFixtureType(models.Model):
|
||||
_name = 'sf.functional.fixture.type'
|
||||
_description = "功能夹具类型"
|
||||
@@ -63,7 +62,8 @@ class FunctionalFixture(models.Model):
|
||||
def _get_name(self):
|
||||
for record in self:
|
||||
if record.type:
|
||||
if not record.transfer_tray_model_ids and not record.pneumatic_tray_model_ids and not record.magnetic_tray_model_ids and not record.vice_tray_model_ids:
|
||||
if not record.transfer_tray_model_ids and not record.pneumatic_tray_model_ids and \
|
||||
not record.magnetic_tray_model_ids and not record.vice_tray_model_ids:
|
||||
record.name = ''
|
||||
if record.transfer_tray_model_ids:
|
||||
for i in record.transfer_tray_model_ids:
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
from odoo import fields, models, api
|
||||
|
||||
|
||||
# from datetime import datetime
|
||||
# from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
# 刀具物料
|
||||
class CuttingToolMaterial(models.Model):
|
||||
_name = 'sf.cutting.tool.material'
|
||||
_description = '刀具物料'
|
||||
@@ -28,57 +23,6 @@ class FunctionalCuttingTool(models.Model):
|
||||
mrs_cutting_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型')
|
||||
mrs_cutting_tool_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具型号')
|
||||
|
||||
# # 整体式刀具型号
|
||||
# mrs_cutting_tool_integral_model_ids = fields.Many2many('sf.cutting.tool.model', 'rel_integral_model_functional_sf',
|
||||
# string='整体式刀具型号', domain=
|
||||
# [('cutting_tool_type', '=', '整体式刀具')])
|
||||
# # 刀片型号
|
||||
# mrs_cutting_tool_blade_model_ids = fields.Many2many('sf.cutting.tool.model', 'rel_blade_model_functional_sf',
|
||||
# string='刀片型号', domain=
|
||||
# [('cutting_tool_type', '=', '刀片')])
|
||||
# # 刀杆型号
|
||||
# mrs_cutting_tool_cutterbar_model_ids = fields.Many2many('sf.cutting.tool.model',
|
||||
# 'rel_cutterbar_model_functional_sf',
|
||||
# string='刀杆型号', domain=
|
||||
# [('cutting_tool_type', '=', '刀杆')])
|
||||
# # 刀盘型号
|
||||
# mrs_cutting_tool_cutterpad_model_ids = fields.Many2many('sf.cutting.tool.model',
|
||||
# 'rel_cutterpad_model_functional_sf',
|
||||
# string='刀盘型号', domain=
|
||||
# [('cutting_tool_type', '=', '刀盘')])
|
||||
# # 刀柄型号
|
||||
# mrs_cutting_tool_cutterhandle_model_ids = fields.Many2many('sf.cutting.tool.model',
|
||||
# 'rel_cutterhandle_model_functional_sf',
|
||||
# string='刀柄型号',
|
||||
# domain=
|
||||
# [('cutting_tool_type', '=', '刀柄')])
|
||||
# # 夹头型号
|
||||
# mrs_cutting_tool_cutterhead_model_ids = fields.Many2many('sf.cutting.tool.model',
|
||||
# 'rel_cutterhead_model_functional_sf',
|
||||
# string='夹头型号', domain=
|
||||
# [('cutting_tool_type', '=', '夹头')])
|
||||
#
|
||||
# diameter = fields.Float('直径(mm)')
|
||||
# tool_grade = fields.Selection([('1', 'P1'), ('2', 'P2'), ('3', 'P3'), ('4', 'P4'), ('5', 'P5'), ('6', 'P6')],
|
||||
# string='刀具等级')
|
||||
# machining_accuracy = fields.Float('加工精度(mm)')
|
||||
# tool_length = fields.Float('装刀长')
|
||||
# blade_number = fields.Integer('刃数')
|
||||
# integral_blade_length = fields.Float('整体刃长(mm)')
|
||||
# effective_blade_length = fields.Float('有效刃长(mm)')
|
||||
# max_life = fields.Float('最大寿命值')
|
||||
# is_standard = fields.Boolean('是否标准刀')
|
||||
# applicable_range = fields.Char('适用范围')
|
||||
# image = fields.Binary('图片')
|
||||
# active = fields.Boolean('有效', default=True)
|
||||
#
|
||||
# def _get_functional_tool_model_ids(self, functional_tool_model_code):
|
||||
# functional_tool_model_ids = []
|
||||
# for item in functional_tool_model_code:
|
||||
# functional_tool_model = self.env['sf.cutting.tool.model'].search([('code', '=', item)])
|
||||
# functional_tool_model_ids.append(functional_tool_model.id)
|
||||
# return [(6, 0, functional_tool_model_ids)]
|
||||
|
||||
|
||||
# 功能刀具类型
|
||||
class FunctionalCuttingToolModel(models.Model):
|
||||
|
||||
@@ -53,7 +53,8 @@ class ToolMaterialsBasicParameters(models.Model):
|
||||
top_angle = fields.Integer('顶角(°)')
|
||||
blade_tip_dip_angle = fields.Integer('刀尖倾角(°)')
|
||||
side_cutting_edge_angle = fields.Integer('侧切削角(°)')
|
||||
thread_model = fields.Selection([('无', '无'), ('外螺纹', '外螺纹'), ('内螺纹', '内螺纹')], string='螺纹类型', default='无')
|
||||
thread_model = fields.Selection([('无', '无'), ('外螺纹', '外螺纹'), ('内螺纹', '内螺纹')], string='螺纹类型',
|
||||
default='无')
|
||||
thread_num = fields.Float('每英寸螺纹数(tpi)')
|
||||
blade_tip_height_tolerance = fields.Char('刀尖高度公差(mm)', size=20)
|
||||
inscribed_circle_tolerance = fields.Char('内接圆公差(mm)', size=20)
|
||||
@@ -199,8 +200,8 @@ class ToolMaterialsBasicParameters(models.Model):
|
||||
'is_cooling_hole': obj['is_cooling_hole'],
|
||||
'locating_slot_code': obj['locating_slot_code'],
|
||||
'installing_structure': obj['installing_structure'],
|
||||
'blade_ids': [(6, 0, [])] if not obj.get('blade_codes') else self.evn['sf.cutting_tool.standard.library']._get_ids(
|
||||
obj['blade_codes']),
|
||||
'blade_ids': [(6, 0, [])] if not obj.get('blade_codes') else
|
||||
self.evn['sf.cutting_tool.standard.library']._get_ids(obj['blade_codes']),
|
||||
'tool_shim': obj['tool_shim'],
|
||||
'cotter_pin': obj['cotter_pin'],
|
||||
'pressing_plate': obj['pressing_plate'],
|
||||
@@ -222,8 +223,8 @@ class ToolMaterialsBasicParameters(models.Model):
|
||||
'cutting_depth': obj['cutting_depth'],
|
||||
'main_included_angle': obj['main_included_angle'],
|
||||
'installing_structure': obj['installing_structure'],
|
||||
'blade_ids': [(6, 0, [])] if not obj.get('blade_codes') else self.evn['sf.cutting_tool.standard.library']._get_ids(
|
||||
obj['blade_codes']),
|
||||
'blade_ids': [(6, 0, [])] if not obj.get('blade_codes') else
|
||||
self.evn['sf.cutting_tool.standard.library']._get_ids(obj['blade_codes']),
|
||||
'screw': obj['screw'],
|
||||
'spanner': obj['spanner'],
|
||||
'cutting_blade_model': obj['cutting_blade_model'],
|
||||
|
||||
@@ -1,4 +1,32 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.module.category" id="module_category_plan">
|
||||
<field name="name">计划</field>
|
||||
<field name="sequence">20</field>
|
||||
</record>
|
||||
|
||||
<record id="sales_team.group_sale_manager" model="res.groups">
|
||||
<field name="name">销售经理</field>
|
||||
<field name="category_id" ref="base.module_category_sales_sales"/>
|
||||
<!-- <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>-->
|
||||
</record>
|
||||
|
||||
<!-- <record id="group_sale_director" model="res.groups">-->
|
||||
<!-- <field name="name">销售总监</field>-->
|
||||
<!-- <field name="category_id" ref="base.module_category_sales_sales"/>-->
|
||||
<!-- <field name="implied_ids" eval="[(4, ref('sf_base.group_sale_manager'))]"/>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<record id="group_plan_dispatch" model="res.groups">
|
||||
<field name="name">计划调度岗</field>
|
||||
<field name="category_id" ref="module_category_plan"/>
|
||||
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="group_plan_director" model="res.groups">
|
||||
<field name="name">计划总监</field>
|
||||
<field name="category_id" ref="module_category_plan"/>
|
||||
<field name="implied_ids" eval="[(4, ref('sf_base.group_plan_dispatch'))]"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -1,2 +1,3 @@
|
||||
from .import controllers
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class Sf_Bf_Connect(http.Controller):
|
||||
self_machining_bom_line = self_machining_bom.with_user(
|
||||
request.env.ref("base.user_admin")).bom_create_line(
|
||||
self_machining_embryo)
|
||||
if self_machining_bom_line is False:
|
||||
if not self_machining_bom_line:
|
||||
res['status'] = 2
|
||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
||||
request.cr.rollback()
|
||||
@@ -84,7 +84,7 @@ class Sf_Bf_Connect(http.Controller):
|
||||
# 创建坯料的bom的组件
|
||||
outsource_bom_line = outsource_bom.with_user(
|
||||
request.env.ref("base.user_admin")).bom_create_line(outsource_embryo)
|
||||
if outsource_bom_line is False:
|
||||
if not outsource_bom_line:
|
||||
res['status'] = 2
|
||||
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
|
||||
request.cr.rollback()
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
from datetime import datetime
|
||||
import logging
|
||||
import requests
|
||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.exceptions import ValidationError
|
||||
from collections import defaultdict, namedtuple
|
||||
from odoo import fields, models
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -197,7 +194,8 @@ class FinishStatusChange(models.Model):
|
||||
if self.user_has_groups('stock.group_reception_report') \
|
||||
and self.picking_type_id.auto_show_reception_report:
|
||||
lines = self.move_ids.filtered(lambda
|
||||
m: m.product_id.type == 'product' and m.state != 'cancel' and m.quantity_done and not m.move_dest_ids)
|
||||
m: m.product_id.type == 'product' and m.state != 'cancel'
|
||||
and m.quantity_done and not m.move_dest_ids)
|
||||
if lines:
|
||||
# don't show reception report if all already assigned/nothing to assign
|
||||
wh_location_ids = self.env['stock.location']._search(
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
from . import models
|
||||
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
from . import models
|
||||
|
||||
|
||||
|
||||
@@ -16,15 +16,12 @@
|
||||
'security/group_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'views/mrp_production_addional_change.xml',
|
||||
# 'views/mrp_maintenance_views.xml',
|
||||
'views/mrp_routing_workcenter_view.xml',
|
||||
'views/production_line_view.xml',
|
||||
'views/mrp_workcenter_views.xml',
|
||||
'views/mrp_workorder_view.xml',
|
||||
'views/model_type_view.xml',
|
||||
'views/sf_maintenance_equipment.xml',
|
||||
# 'views/kanban_change.xml'
|
||||
|
||||
],
|
||||
'assets': {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from odoo import fields, models
|
||||
import logging
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResMrpRoutingWorkcenter(models.Model):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from odoo import api, fields, models
|
||||
from datetime import datetime
|
||||
import datetime
|
||||
from collections import defaultdict
|
||||
from odoo import fields, models
|
||||
from odoo.addons.resource.models.resource import Intervals
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import os
|
||||
import json
|
||||
import base64
|
||||
import math
|
||||
import requests
|
||||
import logging
|
||||
import base64
|
||||
# import subprocess
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
@@ -304,7 +303,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
|
||||
# 验证坯料序列号是否正确
|
||||
def pro_code_is_ok(self, barcode):
|
||||
if barcode != False:
|
||||
if barcode is not False:
|
||||
if barcode != self.pro_code:
|
||||
raise UserError('坯料序列号错误')
|
||||
return False
|
||||
@@ -623,7 +622,7 @@ class CNCprocessing(models.Model):
|
||||
if os.path.splitext(f)[1] == ".pdf":
|
||||
full_path = os.path.join(serverdir, root, f)
|
||||
logging.info('pdf:%s' % full_path)
|
||||
if full_path != False:
|
||||
if full_path is not False:
|
||||
if not cnc_processing.workorder_id.cnc_worksheet:
|
||||
cnc_processing.workorder_id.cnc_worksheet = base64.b64encode(
|
||||
open(full_path, 'rb').read())
|
||||
|
||||
@@ -287,12 +287,12 @@ class ResProductMo(models.Model):
|
||||
self.cutting_tool_flange_length = self.specification_id.flange_shank_length
|
||||
self.cutting_tool_shank_outer_diameter = self.specification_id.handle_external_diameter
|
||||
self.cutting_tool_shank_inner_diameter = self.specification_id.handle_inside_diameter
|
||||
self.suitable_machining_method_ids = [(6, 0,
|
||||
[])] if not self.cutting_tool_model_id.suitable_machining_method_ids else [
|
||||
(6, 0, self.cutting_tool_model_id.suitable_machining_method_ids.ids)]
|
||||
self.blade_tip_characteristics_id = [(6, 0,
|
||||
[])] if not self.cutting_tool_model_id.blade_tip_characteristics_id else [
|
||||
(6, 0, self.cutting_tool_model_id.blade_tip_characteristics_id.ids)]
|
||||
self.suitable_machining_method_ids = [(6, 0, [])] if not \
|
||||
self.cutting_tool_model_id.suitable_machining_method_ids \
|
||||
else [(6, 0, self.cutting_tool_model_id.suitable_machining_method_ids.ids)]
|
||||
self.blade_tip_characteristics_id = [(6, 0,[])] if not \
|
||||
self.cutting_tool_model_id.blade_tip_characteristics_id \
|
||||
else [(6, 0, self.cutting_tool_model_id.blade_tip_characteristics_id.ids)]
|
||||
|
||||
self.handle_type_ids = [(6, 0,
|
||||
[])] if not self.cutting_tool_model_id.handle_type_ids else [
|
||||
|
||||
@@ -187,7 +187,6 @@ class StockRule(models.Model):
|
||||
values={'self': production, 'origin': origin_production},
|
||||
subtype_id=self.env.ref('mail.mt_note').id)
|
||||
|
||||
|
||||
'''
|
||||
创建生产计划
|
||||
'''
|
||||
@@ -404,7 +403,8 @@ class ReStockMove(models.Model):
|
||||
'fixture_clamp_workpiece_diameter_max': item.product_id.fixture_clamp_workpiece_diameter_max,
|
||||
'fixture_maximum_carrying_weight': item.product_id.fixture_maximum_carrying_weight,
|
||||
'fixture_maximum_clamping_force': item.product_id.fixture_maximum_clamping_force,
|
||||
'fixture_driving_way': '' if not item.product_id.fixture_driving_way else item.product_id.fixture_driving_way,
|
||||
'fixture_driving_way': '' if not item.product_id.fixture_driving_way else
|
||||
item.product_id.fixture_driving_way,
|
||||
'fixture_apply_machine_tool_type_codes': self.env[
|
||||
'product.template']._json_apply_machine_tool_type_item_code(item),
|
||||
'fixture_through_hole_size': item.product_id.fixture_through_hole_size,
|
||||
@@ -463,12 +463,14 @@ class ReStockMove(models.Model):
|
||||
'blade_tip_taper': item.product_id.cutting_tool_blade_tip_taper,
|
||||
'blade_helix_angle': item.product_id.cutting_tool_blade_helix_angle,
|
||||
'blade_type': item.product_id.cutting_tool_blade_type,
|
||||
'coarse_medium_fine': '' if item.product_id.cutting_tool_coarse_medium_fine is False else item.product_id.cutting_tool_coarse_medium_fine,
|
||||
'coarse_medium_fine': '' if item.product_id.cutting_tool_coarse_medium_fine is False else
|
||||
item.product_id.cutting_tool_coarse_medium_fine,
|
||||
'run_out_accuracy_max': item.product_id.cutting_tool_run_out_accuracy_max,
|
||||
'run_out_accuracy_min': item.product_id.cutting_tool_run_out_accuracy_min,
|
||||
'head_diameter': item.product_id.cutting_tool_head_diameter,
|
||||
'diameter': item.product_id.cutting_tool_diameter,
|
||||
'blade_number': '' if item.product_id.cutting_tool_blade_number is False else item.product_id.cutting_tool_blade_number,
|
||||
'blade_number': '' if item.product_id.cutting_tool_blade_number is False else
|
||||
item.product_id.cutting_tool_blade_number,
|
||||
'front_angle': item.product_id.cutting_tool_front_angle,
|
||||
'rear_angle': item.product_id.cutting_tool_rear_angle,
|
||||
'main_included_angle': item.product_id.cutting_tool_main_included_angle,
|
||||
@@ -512,7 +514,8 @@ class ReStockMove(models.Model):
|
||||
'inner_diameter': item.product_id.cutting_tool_inner_diameter,
|
||||
'cooling_suit_type_ids': item.product_id.cooling_suit_type_ids,
|
||||
'er_size_model': item.product_id.cutting_tool_er_size_model,
|
||||
'image': '' if not item.product_id.image_1920 else base64.b64encode(item.product_id.image_1920).decode('utf-8'),
|
||||
'image': '' if not item.product_id.image_1920 else
|
||||
base64.b64encode(item.product_id.image_1920).decode('utf-8'),
|
||||
}
|
||||
try:
|
||||
if item.product_id.industry_code:
|
||||
|
||||
@@ -3,3 +3,4 @@ from . import res_config_setting
|
||||
from . import sync_common
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class FtpController():
|
||||
self.ftp.connect(host, port)
|
||||
self.ftp.login(username, password)
|
||||
logging.info("ftp连接成功")
|
||||
except:
|
||||
except Exception:
|
||||
logging.info("ftp连接失败")
|
||||
|
||||
# 下载目录下的文件
|
||||
@@ -35,7 +35,7 @@ class FtpController():
|
||||
server = os.path.join(serverdir, file)
|
||||
if file.find(".") != -1:
|
||||
self.download_file(server, file)
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
# 下载指定目录下的指定文件
|
||||
|
||||
@@ -1,19 +1,25 @@
|
||||
import datetime
|
||||
import base64
|
||||
import logging
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class ReSaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
deadline_of_delivery = fields.Date('订单交期')
|
||||
deadline_of_delivery = fields.Date('订单交期', tracking=True)
|
||||
person_of_delivery = fields.Char('交货人')
|
||||
telephone_of_delivery = fields.Char('交货人电话号码')
|
||||
address_of_delivery = fields.Char('交货人地址')
|
||||
payments_way = fields.Selection([('现结', '现结'), ('月结', '月结')], '结算方式', default='现结')
|
||||
payments_way = fields.Selection([('现结', '现结'), ('月结', '月结')], '结算方式', default='现结', tracking=True)
|
||||
pay_way = fields.Selection([('转账', '转账'), ('微信', '微信'), ('支付宝', '支付宝')], '支付方式')
|
||||
|
||||
payment_term_id = fields.Many2one(
|
||||
comodel_name='account.payment.term',
|
||||
string="交付条件",
|
||||
compute='_compute_payment_term_id',
|
||||
store=True, readonly=False, precompute=True, check_company=True, tracking=True,
|
||||
domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")
|
||||
|
||||
# 业务平台分配工厂后在智能工厂先创建销售订单
|
||||
def sale_order_create(self, company_id, delivery_name, delivery_telephone, delivery_address,
|
||||
deadline_of_delivery, payments_way, pay_way):
|
||||
@@ -62,4 +68,3 @@ class ResaleOrderLine(models.Model):
|
||||
_inherit = 'sale.order.line'
|
||||
|
||||
model_glb_file = fields.Binary('模型的glb文件')
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import requests
|
||||
import logging
|
||||
import requests
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
|
||||
@@ -36,7 +36,8 @@ class WechatAuthController(http.Controller):
|
||||
|
||||
if not user:
|
||||
# 获取企业微信用户详细信息
|
||||
user_detail_url = f'https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token={access_token}&userid={user_id}'
|
||||
user_detail_url = \
|
||||
f'https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token={access_token}&userid={user_id}'
|
||||
user_detail_response = requests.get(user_detail_url).json()
|
||||
|
||||
# 创建 Odoo 用户
|
||||
|
||||
@@ -6,6 +6,5 @@ from . import wxwork_settings
|
||||
from . import wxwork_approval_template_summary
|
||||
from . import we_approval_record
|
||||
from . import wx_work_api
|
||||
|
||||
from . import wxwork_approval
|
||||
# from . import res_config_setting
|
||||
|
||||
|
||||
@@ -39,5 +39,3 @@ class WxWorkApprovalTemplate(models.Model):
|
||||
def _compute_related_records_count(self):
|
||||
for record in self:
|
||||
record.related_records_count = len(record.summary_info_ids)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user