diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index 1fb1daa6..da6919a4 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -10,7 +10,7 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['account', 'base', 'mrp_workorder', 'sale', 'purchase'], + 'depends': ['account', 'base', 'mrp_workorder', 'sale', 'purchase', 'sales_team'], 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', diff --git a/sf_base/models/__init__.py b/sf_base/models/__init__.py index 93961162..31dfcf95 100644 --- a/sf_base/models/__init__.py +++ b/sf_base/models/__init__.py @@ -4,9 +4,3 @@ from . import tool_base_new from . import fixture from . import functional_fixture from . import tool_other_features - - - - - - diff --git a/sf_base/models/common.py b/sf_base/models/common.py index 7ec20654..f6e6771a 100644 --- a/sf_base/models/common.py +++ b/sf_base/models/common.py @@ -17,29 +17,7 @@ class MrsProductionMaterials(models.Model): remark = fields.Text("备注") active = fields.Boolean('有效', default=True) - # def open_url_action(self): - # base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') - # # url = 'http://192.168.50.202:8080/api' - # url = 'https://bfw.jikimo.com/' - # # data = { - # # 'key' : 'value' - # # } - # - # response = requests.get(url) - # response.raise_for_status() - # return { - # 'type': 'ir.actions.act_url', - # 'url': response.url, - # 'target': 'new' - # } - - - def open_url_action(self): - # sf_sync_config = self.env['res.config.settings'].get_values() - # token = sf_sync_config['token'] - # sf_secret_key = sf_sync_config['sf_secret_key'] - # headers = Common.get_headers(self, token, sf_secret_key) url = 'http://192.168.50.127:8081' params = { 'user_id': self._uid @@ -82,7 +60,6 @@ class MrsMaterialModel(models.Model): active = fields.Boolean('有效', default=True) - class MrsProductionProcessCategory(models.Model): _name = 'sf.production.process.category' _description = '表面工艺类别' @@ -131,6 +108,7 @@ class MrsProcessingOrder(models.Model): index=True, string='加工工艺') production_process_id = fields.Many2one('sf.production.process', string="表面工艺") + class SupplierSort(models.Model): _name = 'sf.supplier.sort' _description = '供应商排序' diff --git a/sf_base/models/functional_fixture.py b/sf_base/models/functional_fixture.py index b0659da9..a3677947 100644 --- a/sf_base/models/functional_fixture.py +++ b/sf_base/models/functional_fixture.py @@ -1,5 +1,5 @@ -import requests import json +import requests from odoo import models, fields, api from odoo.addons.sf_base.commons.common import Common from odoo.exceptions import ValidationError diff --git a/sf_base/security/group_security.xml b/sf_base/security/group_security.xml index b0d8bb6c..4d57bc43 100644 --- a/sf_base/security/group_security.xml +++ b/sf_base/security/group_security.xml @@ -43,17 +43,16 @@ 20 - + 销售经理 - - - - - - + + 销售总监 + + + 计划调度岗 diff --git a/sf_bf_connect/controllers/__init__.py b/sf_bf_connect/controllers/__init__.py index b2809a39..e046e49f 100644 --- a/sf_bf_connect/controllers/__init__.py +++ b/sf_bf_connect/controllers/__init__.py @@ -1,3 +1 @@ -from .import controllers - - +from . import controllers diff --git a/sf_dlm/__init__.py b/sf_dlm/__init__.py index 899bcc97..0650744f 100644 --- a/sf_dlm/__init__.py +++ b/sf_dlm/__init__.py @@ -1,2 +1 @@ from . import models - diff --git a/sf_dlm/data/product_data.xml b/sf_dlm/data/product_data.xml index 3cc92912..9b562fbb 100644 --- a/sf_dlm/data/product_data.xml +++ b/sf_dlm/data/product_data.xml @@ -35,6 +35,11 @@ 功能刀具 + + 业务平台 + + + 功能刀具 diff --git a/sf_dlm_management/__manifest__.py b/sf_dlm_management/__manifest__.py index b10fa76d..a32ecf81 100644 --- a/sf_dlm_management/__manifest__.py +++ b/sf_dlm_management/__manifest__.py @@ -9,7 +9,7 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['sf_sale', 'sf_dlm','sf_manufacturing'], + 'depends': ['sf_sale', 'sf_dlm', 'sf_manufacturing'], 'data': [ 'views/product_template_management_view.xml', ], diff --git a/sf_dlm_management/models/__init__.py b/sf_dlm_management/models/__init__.py index a4da1521..8c38257e 100644 --- a/sf_dlm_management/models/__init__.py +++ b/sf_dlm_management/models/__init__.py @@ -1,7 +1,2 @@ -#from . import product_template -#from . import product_supplierinfo - - - - -# \ No newline at end of file +# from . import product_template +# from . import product_supplierinfo diff --git a/sf_maintenance/__manifest__.py b/sf_maintenance/__manifest__.py index 7bfe057d..9c3c978a 100644 --- a/sf_maintenance/__manifest__.py +++ b/sf_maintenance/__manifest__.py @@ -6,7 +6,7 @@ 'category': '工厂设备', 'description': """ """, - 'depends': ['maintenance', 'sf_base'], + 'depends': ['hr_maintenance', 'sf_base'], 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 06c2b293..7a7f10ce 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1,13 +1,12 @@ +import logging +from datetime import datetime +from dateutil.relativedelta import relativedelta import os import base64 import math import requests -import logging # import subprocess -from datetime import datetime -from dateutil.relativedelta import relativedelta from odoo import api, fields, models, SUPERUSER_ID, _ -from odoo.exceptions import ValidationError from odoo.addons.sf_base.commons.common import Common from odoo.exceptions import UserError from odoo.addons.sf_mrs_connect.models.ftp_operate import FtpController @@ -388,7 +387,8 @@ class ResMrpWorkOrder(models.Model): productions._create_workorder() productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \ ( - p.move_dest_ids.procure_method != 'make_to_order' and not p.move_raw_ids and not p.workorder_ids)).action_confirm() + p.move_dest_ids.procure_method != 'make_to_order' and + not p.move_raw_ids and not p.workorder_ids)).action_confirm() for production in productions: origin_production = production.move_dest_ids and production.move_dest_ids[ diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py index 9fa13895..5a079abe 100644 --- a/sf_manufacturing/models/product_template.py +++ b/sf_manufacturing/models/product_template.py @@ -818,9 +818,9 @@ class ResProductMo(models.Model): # 将attach的datas内容转为glb文件 def transition_glb_file(self, report_path, code): - # shapes = read_step_file(report_path) + shapes = read_step_file(report_path) output_file = os.path.join('/tmp', str(code) + '.stl') - # write_stl_file(shapes, output_file, 'binary', 0.03, 0.5) + write_stl_file(shapes, output_file, 'binary', 0.03, 0.5) # 转化为glb output_glb_file = os.path.join('/tmp', str(code) + '.glb') util_path = get_resource_path('sf_base', 'static/util') diff --git a/sf_mrs_connect/__init__.py b/sf_mrs_connect/__init__.py index 10245345..91c5580f 100644 --- a/sf_mrs_connect/__init__.py +++ b/sf_mrs_connect/__init__.py @@ -1,3 +1,2 @@ from . import controllers from . import models - diff --git a/sf_sale/__manifest__.py b/sf_sale/__manifest__.py index abd8d5a6..64d9c41a 100644 --- a/sf_sale/__manifest__.py +++ b/sf_sale/__manifest__.py @@ -10,10 +10,11 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['sale', 'sale_management', 'web_widget_model_viewer'], + 'depends': ['sale', 'sale_management', 'web_widget_model_viewer', 'sf_base'], 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', + 'views/sale_team.xml', 'views/sale_order_view.xml', 'views/quick_easy_order_view.xml' ], diff --git a/sf_sale/models/auto_quatotion_common.py b/sf_sale/models/auto_quatotion_common.py index 09ea3f0f..d1bdb65a 100644 --- a/sf_sale/models/auto_quatotion_common.py +++ b/sf_sale/models/auto_quatotion_common.py @@ -2,7 +2,7 @@ import logging from odoo.modules import get_resource_path from odoo import fields, models, api -from quatotion import readSql, feature_recognize, auto_quatotion +# from quatotion import readSql, feature_recognize, auto_quatotion __author__ = 'jinling.yang' _logger = logging.getLogger(__name__) @@ -24,14 +24,14 @@ class AutoQuatotion(models.Model): def get_process_time_db_path(self): return get_resource_path('sf_sale', 'models', 'process_time.db') - def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code): - ''' - 通过打包好的.so库, - 以调用autoQuatotion库中Quatotion类, - 初始化后调用类的analyseShape方法对模型文件进行价格预测 - ''' - # 初始化自动报价类(输入特征数据库和加工时间数据库) - reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path) - # 获取价格、加工时间、尺寸、XYZ、翻面次数 - feature_info = reader.analyseShape(stp_url, InfoJson={}) - return feature_info + # def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code): + # ''' + # 通过打包好的.so库, + # 以调用autoQuatotion库中Quatotion类, + # 初始化后调用类的analyseShape方法对模型文件进行价格预测 + # ''' + # # 初始化自动报价类(输入特征数据库和加工时间数据库) + # reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path) + # # 获取价格、加工时间、尺寸、XYZ、翻面次数 + # feature_info = reader.analyseShape(stp_url, InfoJson={}) + # return feature_info diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py index 93d67e37..c699a9d0 100644 --- a/sf_sale/models/sale_order.py +++ b/sf_sale/models/sale_order.py @@ -12,6 +12,8 @@ class ReSaleOrder(models.Model): address_of_delivery = fields.Char('交货人地址') payments_way = fields.Selection([('现结', '现结'), ('月结', '月结')], '结算方式', default='现结', tracking=True) pay_way = fields.Selection([('转账', '转账'), ('微信', '微信'), ('支付宝', '支付宝')], '支付方式') + check_status = fields.Selection([('unchecked', '未审核'), ('checked', '已审核')], '审核状态', default='unchecked') + payment_term_id = fields.Many2one( comodel_name='account.payment.term', @@ -40,6 +42,10 @@ class ReSaleOrder(models.Model): }) return order_id + # 审核 + def action_check(self): + self.check_status = 'checked' + def get_customer(self): customer = self.env['res.partner'].search([('name', '=', '业务平台')]) if customer: @@ -68,3 +74,9 @@ class ResaleOrderLine(models.Model): _inherit = 'sale.order.line' model_glb_file = fields.Binary('模型的glb文件') + + +class ResCrmTeam(models.Model): + _inherit = 'crm.team' + + diff --git a/sf_sale/security/group_security.xml b/sf_sale/security/group_security.xml index b8668782..33890d49 100644 --- a/sf_sale/security/group_security.xml +++ b/sf_sale/security/group_security.xml @@ -1,4 +1,42 @@ - + + + 销售经理只可以查看本人所在的团队 + + [('crm_team_member_ids.user_id','=',user.id)] + + + + + + + + 销售总监 + + [(1,'=',1)] + + + + + + + + 销售总监查看所有的订单 + + [(1,'=',1)] + + + + + + + 销售经理查看自己的订单 + + ['|',('partner_id','=',user.partner_id.id),('create_uid', '=',user.id)] + + + + + \ No newline at end of file diff --git a/sf_sale/security/ir.model.access.csv b/sf_sale/security/ir.model.access.csv index 5a3a2ee8..171a6d4d 100644 --- a/sf_sale/security/ir.model.access.csv +++ b/sf_sale/security/ir.model.access.csv @@ -1,6 +1,15 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_quick_easy_order,quick_easy_order,model_quick_easy_order,base.group_user,1,1,1,1 -access_sf_auto_quatotion_common,sf_auto_quatotion_common,model_sf_auto_quatotion_common,base.group_user,1,1,1,1 +access_quick_easy_order,quick_easy_order,model_quick_easy_order,base.group_system,1,1,1,1 +access_sf_auto_quatotion_common,sf_auto_quatotion_common,model_sf_auto_quatotion_common,base.group_system,1,1,1,1 +access_sale_order_manager,sale_order_manager,model_sale_order,sf_base.group_sale_salemanager,1,1,1,0 +access_sale_order_director,sale_order_director,model_sale_order,sf_base.group_sale_director,1,1,1,0 +access_sale_order_line_manager,sale_order_line_manager,model_sale_order_line,sf_base.group_sale_salemanager,1,1,1,0 +access_sale_order_line_director,sale_order_line_director,model_sale_order_line,sf_base.group_sale_director,1,1,1,0 +access_crm_team_member_manager,crm_team_manager,sales_team.model_crm_team,sf_base.group_sale_director,1,1,1,0 +access_crm_team_member_director,crm_team_member_director,sales_team.model_crm_team_member,sf_base.group_sale_director,1,1,1,0 +access_res_users,res_users,base.model_res_users,sf_base.group_sale_director,1,1,1,0 + + diff --git a/sf_sale/views/sale_order_view.xml b/sf_sale/views/sale_order_view.xml index ba32f029..a02a8adc 100644 --- a/sf_sale/views/sale_order_view.xml +++ b/sf_sale/views/sale_order_view.xml @@ -7,6 +7,25 @@ sale.order + + +