diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index 7f11b5f5..0b6fb8bb 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -526,4 +526,8 @@ div:has(.o_required_modifier) > label::before { // 设置表单页面label文本不换行 .o_form_view .o_group .o_wrap_label .o_form_label { white-space: nowrap; +} +// 修复表格内容覆盖表头bug +.o_list_renderer .o_list_table tbody th { + position: unset; } \ No newline at end of file diff --git a/jikimo_hide_options/models/models.py b/jikimo_hide_options/models/models.py index 72046dca..84aee828 100644 --- a/jikimo_hide_options/models/models.py +++ b/jikimo_hide_options/models/models.py @@ -301,53 +301,27 @@ def unlink(self): # This is used to restrict the access right to unlink a record current_model_id = self.env['ir.model'].sudo().search( [('model', '=', self._name)]).id - # access_right_rec = self.env['access.right'].sudo().search_read( - # [('model_id', '=', current_model_id)], ['model_id', 'is_delete', - # 'groups_id']) - # if access_right_rec and not self.env.is_admin(): - # for rec in access_right_rec: - # group_name = self.env['ir.model.data'].sudo().search([ - # ('model', '=', 'res.groups'), - # ('res_id', '=', rec['groups_id'][0]) - # ]).name - # module_name = self.env['ir.model.data'].sudo().search([ - # ('model', '=', 'res.groups'), - # ('res_id', '=', rec['groups_id'][0]) - # ]).module - # group = module_name + "." + group_name - # if self.env.user.has_group(group): - # if rec['is_delete']: - # raise UserError(_('You are restricted from performing this' - # ' operation. Please contact the' - # ' administrator.')) - # 检查 'access.right' 模型是否存在于环境中 - if 'access.right' in self.env: - # current_model_id = self.env['ir.model'].sudo().search([('model', '=', self._name)]).id - access_right_rec = self.env['access.right'].sudo().search_read( - [('model_id', '=', current_model_id)], ['model_id', 'is_delete', 'groups_id'] - ) - - if access_right_rec and not self.env.is_admin(): - for rec in access_right_rec: - group_data = self.env['ir.model.data'].sudo().search_read( - [('model', '=', 'res.groups'), ('res_id', '=', rec['groups_id'][0])], - ['name', 'module'] - ) - - if group_data: - group_name = group_data[0]['name'] - module_name = group_data[0]['module'] - group_xml_id = f"{module_name}.{group_name}" - - if self.env.user.has_group(group_xml_id) and rec['is_delete']: - raise UserError( - _('You are restricted from performing this operation. Please contact the administrator.')) - else: - # 如果 'access.right' 模型不存在,可以在这里定义备选逻辑 - pass - + access_right_rec = self.env['access.right'].sudo().search_read( + [('model_id', '=', current_model_id)], ['model_id', 'is_delete', + 'groups_id']) + if access_right_rec and not self.env.is_admin(): + for rec in access_right_rec: + group_name = self.env['ir.model.data'].sudo().search([ + ('model', '=', 'res.groups'), + ('res_id', '=', rec['groups_id'][0]) + ]).name + module_name = self.env['ir.model.data'].sudo().search([ + ('model', '=', 'res.groups'), + ('res_id', '=', rec['groups_id'][0]) + ]).module + group = module_name + "." + group_name + if self.env.user.has_group(group): + if rec['is_delete']: + raise UserError(_('You are restricted from performing this' + ' operation. Please contact the' + ' administrator.')) return True BaseModel._create = _create -BaseModel.unlink = unlink +BaseModel.unlink = unlink \ No newline at end of file diff --git a/sf_base/models/tool_base_new.py b/sf_base/models/tool_base_new.py index 7977ed80..98eea36c 100644 --- a/sf_base/models/tool_base_new.py +++ b/sf_base/models/tool_base_new.py @@ -331,7 +331,7 @@ class ToolInventory(models.Model): work_material = fields.Selection([('钢', '钢'), ('铝', '铝')], string='加工材料') life_span = fields.Float('寿命(min)') - tool_groups_id = fields.Many2one('sf.tool.groups', string='刀具组') + tool_groups_id = fields.Many2one('sf.tool.groups', string='刀具组', required=True) active = fields.Boolean('已归档', default=True) diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index 09b96baa..ecc572c7 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -11,8 +11,8 @@ access_sf_machine_control_system,sf_machine_control_system,model_sf_machine_cont access_sf_machine_control_system_admin,sf_machine_control_system_admin,model_sf_machine_control_system,base.group_system,1,1,1,0 access_sf_production_process_group_sale_director,sf_production_process_group_sale_director,model_sf_production_process,sf_base.group_sale_director,1,0,0,0 access_sf_production_process_group_sale_salemanager,sf_production_process_group_sale_salemanager,model_sf_production_process,sf_base.group_sale_salemanager,1,0,0,0 -access_res_partner_category_group_sale_salemanager,res_partner_category_group_sale_salemanager,base.model_res_partner_category,sf_base.group_sale_salemanager,1,0,1,0 -access_res_partner_category_group_sale_director,res_partner_category_group_sale_director,base.model_res_partner_category,sf_base.group_sale_director,1,0,1,0 +access_res_partner_category_group_sale_salemanager,res_partner_category_group_sale_salemanager,base.model_res_partner_category,sf_base.group_sale_salemanager,1,1,1,0 +access_res_partner_category_group_sale_director,res_partner_category_group_sale_director,base.model_res_partner_category,sf_base.group_sale_director,1,1,1,0 access_sf_production_process,sf_production_process,model_sf_production_process,base.group_user,1,1,1,0 access_sf_production_process_admin,sf_production_process_admin,model_sf_production_process,base.group_system,1,1,1,0 access_sf_production_materials,sf_production_materials,model_sf_production_materials,base.group_user,1,1,1,0 diff --git a/sf_bf_connect/models/http.py b/sf_bf_connect/models/http.py index aac8ba38..8b10aa21 100644 --- a/sf_bf_connect/models/http.py +++ b/sf_bf_connect/models/http.py @@ -21,6 +21,7 @@ class Http(models.AbstractModel): def _auth_method_sf_token(cls): # 从headers.environ中获取对方传过来的token,timestamp,加密的校验字符串 datas = request.httprequest.headers.environ + _logger.info('datas:%s' % datas) if 'HTTP_TOKEN' in datas: _logger.info('token:%s' % datas['HTTP_TOKEN']) # 查询密钥 diff --git a/sf_bf_connect/models/jd_eclp.py b/sf_bf_connect/models/jd_eclp.py index e381242a..7879938e 100644 --- a/sf_bf_connect/models/jd_eclp.py +++ b/sf_bf_connect/models/jd_eclp.py @@ -5,7 +5,7 @@ import requests import cpca # from odoo.exceptions import UserError # from odoo.exceptions import ValidationError -from odoo import api, fields, models +from odoo import api, fields, models, _ from odoo.exceptions import ValidationError _logger = logging.getLogger(__name__) @@ -14,7 +14,7 @@ _logger = logging.getLogger(__name__) class JdEclp(models.Model): _inherit = 'stock.picking' - senderNickName = fields.Char(string='寄件工厂简称', required=True, default='MW') + senderNickName = fields.Char(string='寄件工厂简称', required=True, default='XT') # receiverName = fields.Char(string='收件人姓名') # receiverMobile = fields.Char(string='收件人电话') @@ -161,15 +161,25 @@ class JdEclp(models.Model): url2 = config['bfm_url'] + '/api/get/jd/no' response = requests.post(url2, json=json2, data=None) # _logger.info('调用成功2', response.json()['result']['wbNo']) - self.carrier_tracking_ref = response.json()['result']['wbNo'] + self.carrier_tracking_ref = response.json()['result'].get('wbNo') + if not self.carrier_tracking_ref: + raise ValidationError('物流下单未成功,请联系管理员') self.is_bill = True self.logistics_status = '1' - # # 京东物流下单后,销售订单状态改为待收货 - # self.env['sale.order'].search([('name', '=', self.origin)]).write({'scheduled_status': 'to receive'}) + notification = { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': _('成功'), + 'type': 'success', + 'message': '物流下单成功', + 'sticky': False, + 'next': {'type': 'ir.actions.client', 'tag': 'reload'} + } + } - # else: - # raise UserError("选择京东物流才能下单呦") + return notification def get_bill(self): """ diff --git a/sf_bf_connect/views/view.xml b/sf_bf_connect/views/view.xml index 6db5cb1d..184d0e71 100644 --- a/sf_bf_connect/views/view.xml +++ b/sf_bf_connect/views/view.xml @@ -32,7 +32,7 @@ -