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 @@ +