From 05f2cb553d48a264634dc7119efa38ba045ce665 Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Thu, 27 Jun 2024 17:21:37 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=AE=8C=E6=88=90=20=E9=87=87?= =?UTF-8?q?=E8=B4=AD/=E9=87=87=E8=B4=AD=E6=80=BB=E7=9B=91=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E6=9D=83=E9=99=90=E5=A2=9E=E5=8A=A0=20=E9=9C=80?= =?UTF-8?q?=E6=B1=82=EF=BC=9B2=E3=80=81=E5=AE=8C=E6=88=90=20=E5=88=80?= =?UTF-8?q?=E5=85=B7=E5=87=BA=E5=85=A5=E5=BA=93=E5=88=97=E8=A1=A8=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E5=8D=95=E6=8D=AE=E8=B7=B3=E8=BD=AC=20=E9=9C=80?= =?UTF-8?q?=E6=B1=82=EF=BC=9B3=E3=80=81=E5=AE=8C=E6=88=90=20=20=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E8=AF=A6=E6=83=85=E7=9A=84=E6=9C=BA=E5=86=85=E8=A3=85?= =?UTF-8?q?=E5=88=80=E6=97=B6=E9=97=B4=E6=AF=94=E5=BD=93=E5=89=8D=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=BF=98=E6=99=9A=20=20bug=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_sale/models/sale_order.py | 5 +++++ sf_sale/security/group_security.xml | 4 ++-- sf_sale/views/purchase_order_view.xml | 7 +++++++ sf_tool_management/models/base.py | 6 ++---- sf_tool_management/models/maintenance_equipment.py | 3 ++- sf_tool_management/models/tool_material_search.py | 5 ++--- sf_tool_management/views/tool_material_search.xml | 1 + 7 files changed, 21 insertions(+), 10 deletions(-) diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py index 6508132d..f47f8c8d 100644 --- a/sf_sale/models/sale_order.py +++ b/sf_sale/models/sale_order.py @@ -171,6 +171,11 @@ class ProductTemplate(models.Model): class RePurchaseOrder(models.Model): _inherit = 'purchase.order' + mrp_production_count = fields.Integer( + "Count of MO Source", + compute='_compute_mrp_production_count', + groups='mrp.group_mrp_user,sf_base.group_purchase,sf_base.group_purchase_director') + remark = fields.Text('备注') user_id = fields.Many2one( 'res.users', string='买家', index=True, tracking=True, diff --git a/sf_sale/security/group_security.xml b/sf_sale/security/group_security.xml index 5f23b5bb..97b6d05d 100644 --- a/sf_sale/security/group_security.xml +++ b/sf_sale/security/group_security.xml @@ -54,7 +54,7 @@ 销售经理查看自己的订单 - ['|',('user_id','=',user.id),('create_uid', '=',user.id)] + ['|','|',('user_id','=',user.id),('user_id', '=', False),('create_uid', '=',user.id)] @@ -74,7 +74,7 @@ 采购岗查看自己的订单 - ['|',('user_id','=',user.id),('create_uid', '=',user.id)] + ['|','|',('user_id','=',user.id),('user_id', '=', False),('create_uid', '=',user.id)] diff --git a/sf_sale/views/purchase_order_view.xml b/sf_sale/views/purchase_order_view.xml index 85f5b1c8..eda8e59d 100644 --- a/sf_sale/views/purchase_order_view.xml +++ b/sf_sale/views/purchase_order_view.xml @@ -79,6 +79,13 @@ sf_base.group_purchase,sf_base.group_purchase_director + + + mrp.group_mrp_user,sf_base.group_purchase,sf_base.group_purchase_director + + + {'readonly': [('state', 'in', ['purchase'])]} diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py index 61156536..182141cf 100644 --- a/sf_tool_management/models/base.py +++ b/sf_tool_management/models/base.py @@ -944,13 +944,11 @@ class FunctionalToolDismantle(models.Model): functional_tool_assembly = self.functional_tool_id.functional_tool_name_id if self.scrap_boolean: # 刀柄报废 入库到Scrap - lot.create_stock_quant(location, location_dest_scrap_ids[-1], functional_tool_assembly.id, code, - functional_tool_assembly, functional_tool_assembly.tool_groups_id) + lot.create_stock_quant(location, location_dest_scrap_ids[-1], False, code, False, False) lot.tool_material_status = '报废' else: # 刀柄不报废 入库到刀具房 - lot.create_stock_quant(location, location_dest, functional_tool_assembly.id, code, - functional_tool_assembly, functional_tool_assembly.tool_groups_id) + lot.create_stock_quant(location, location_dest, False, code, False, False) lot.tool_material_status = '可用' # ==============功能刀具[报废]拆解================ diff --git a/sf_tool_management/models/maintenance_equipment.py b/sf_tool_management/models/maintenance_equipment.py index d308f1f1..48bc531f 100644 --- a/sf_tool_management/models/maintenance_equipment.py +++ b/sf_tool_management/models/maintenance_equipment.py @@ -3,6 +3,7 @@ import requests import logging from odoo import models, api, fields from odoo.exceptions import ValidationError +from datetime import datetime, timedelta from odoo.addons.sf_base.commons.common import Common @@ -101,7 +102,7 @@ class SfMaintenanceEquipment(models.Model): tool_install_time = {'Nomal': '正常', 'Warning': '报警'} equipment_tool_id.write({ 'functional_tool_name_id': functional_tool_id.id, - 'tool_install_time': time + 'tool_install_time': time - timedelta(hours=8) }) if functional_tool_id.current_location != '机内刀库': # 对功能刀具进行移动到生产线 diff --git a/sf_tool_management/models/tool_material_search.py b/sf_tool_management/models/tool_material_search.py index af8833fb..ededd64f 100644 --- a/sf_tool_management/models/tool_material_search.py +++ b/sf_tool_management/models/tool_material_search.py @@ -25,7 +25,8 @@ class ToolMaterial(models.Model): have_been_used_num = fields.Integer('在用数量', compute='_compute_number', store=True) scrap_num = fields.Integer('报废数量', compute='_compute_number', store=True) - barcode_ids = fields.One2many('stock.lot', 'tool_material_search_id', string='序列号', readonly=True) + barcode_ids = fields.One2many('stock.lot', 'tool_material_search_id', string='序列号', readonly=True, + domain=[('tool_material_status', '!=', '未入库')]) @api.depends('product_id.stock_quant_ids.quantity') def _compute_number(self): @@ -46,8 +47,6 @@ class ToolMaterial(models.Model): record.scrap_num = scrap_num record.number = usable_num + have_been_used_num + scrap_num - - @api.model def _read_group_cutting_tool_material_id(self, categories, domain, order): cutting_tool_material_id = categories._search([], order=order, access_rights_uid=SUPERUSER_ID) diff --git a/sf_tool_management/views/tool_material_search.xml b/sf_tool_management/views/tool_material_search.xml index 8a740676..ef6209f3 100644 --- a/sf_tool_management/views/tool_material_search.xml +++ b/sf_tool_management/views/tool_material_search.xml @@ -63,6 +63,7 @@ +