Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修改机床参数bug

This commit is contained in:
qihao.gong@jikimo.com
2024-02-04 15:57:16 +08:00
60 changed files with 2233 additions and 1325 deletions

View File

@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
import datetime
import logging
from odoo import api, fields, models
from odoo import api, fields, models, _
from odoo.osv import expression
from odoo.exceptions import UserError
class SfLocation(models.Model):
@@ -279,7 +280,7 @@ class ShelfLocation(models.Model):
('空闲', '空闲'),
('占用', '占用'),
('禁用', '禁用')
], string='货位状态', default='空闲')
], string='货位状态', default='空闲', readonly=True)
# product_id = fields.Many2one('product.template', string='产品')
product_id = fields.Many2one('product.product', string='产品', compute='_compute_product_id', readonly=True)
product_sn_id = fields.Many2one('stock.lot', string='产品序列号')
@@ -287,6 +288,14 @@ class ShelfLocation(models.Model):
hide_shelf = fields.Boolean(compute='_compute_hide_what', string='隐藏货架')
hide_location = fields.Boolean(compute='_compute_hide_what', string='隐藏货位')
# 修改货位状态为禁用
def action_location_status_disable(self):
self.location_status = '禁用'
# 修改货位状态为空闲
def action_location_status_enable(self):
self.location_status = '空闲'
@api.onchange('shelf_location_id')
def _onchange_shelf_location_id(self):
"""
@@ -305,8 +314,8 @@ class ShelfLocation(models.Model):
"""
for record in self:
if record.product_sn_id:
record.product_id = record.product_sn_id.product_id
record.location_status = '占用'
record.sudo().product_id = record.product_sn_id.product_id
record.sudo().location_status = '占用'
else:
record.product_id = False
# record.location_status = '空闲'
@@ -318,12 +327,12 @@ class ShelfLocation(models.Model):
:return:
"""
for record in self:
record.hide_shelf = False
record.hide_location = False
record.sudo().hide_shelf = False
record.sudo().hide_location = False
if record.location_type and record.location_type == '货架':
record.hide_shelf = True
record.sudo().hide_shelf = True
elif record.location_type and record.location_type == '货位':
record.hide_location = True
record.sudo().hide_location = True
else:
pass

View File

@@ -97,7 +97,7 @@ access_stock_lot_label_layout_user,lot.label.layout.user,stock.model_lot_label_l
access_stock_replenish_option,stock.replenishment.option,stock.model_stock_replenishment_option,sf_warehouse.group_sf_stock_user,1,1,1,0
access_mrp_production,mrp.production,mrp.model_mrp_production,sf_warehouse.group_sf_stock_user,1,1,1,0
access_sf_shelf_location_group_plan_dispatch,sf.shelf.location,model_sf_shelf_location,sf_base.group_plan_dispatch,1,1,0,0
access_sf_shelf_location_group_plan_dispatch,sf.shelf.location,model_sf_shelf_location,sf_base.group_plan_dispatch,1,0,0,0
access_stock_move,stock.move,stock.model_stock_move,sf_base.group_plan_dispatch,1,1,1,0
access_stock_picking,stock.picking,stock.model_stock_picking,sf_base.group_plan_dispatch,1,0,0,0
access_stock_lot_group_plan_dispatch,stock.lot,stock.model_stock_lot,sf_base.group_plan_dispatch,1,0,0,0
@@ -127,6 +127,15 @@ access_stock_lot_group_purchase_director,stock_lot_group_purchase_director,stock
access_mrp_workcenter_productivity_group_purchase,mrp_workcenter_productivity_group_purchase,mrp.model_mrp_workcenter_productivity,sf_base.group_purchase,1,0,0,0
access_mrp_workcenter_productivity_group_purchase_director,mrp_workcenter_productivity_group_purchase_director,mrp.model_mrp_workcenter_productivity,sf_base.group_purchase_director,1,0,0,0
access_sf_cutting_speed_group_sf_stock_manager,sf_cutting_speed_group_sf_stock_manager,sf_base.model_sf_cutting_speed,sf_warehouse.group_sf_stock_manager,1,0,1,0
access_sf_feed_per_tooth_group_sf_stock_manager,sf_feed_per_tooth_group_sf_stock_manager,sf_base.model_sf_feed_per_tooth,sf_warehouse.group_sf_stock_manager,1,0,1,0
access_sf_cutting_tool_material_group_sf_stock_manager,sf_cutting_tool_material_group_sf_stock_manager,sf_base.model_sf_cutting_tool_material,sf_warehouse.group_sf_stock_manager,1,0,1,0
access_sf_cutting_tool_standard_library_group_sf_stock_manager,sf_cutting_tool_standard_library_group_sf_stock_manager,sf_base.model_sf_cutting_tool_standard_library,sf_warehouse.group_sf_stock_manager,1,0,1,0
access_sf_tool_materials_basic_parameters_group_sf_stock_manager,sf_tool_materials_basic_parameters_group_sf_stock_manager,sf_base.model_sf_tool_materials_basic_parameters,sf_warehouse.group_sf_stock_manager,1,0,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
97 access_sf_shelf_location_group_plan_dispatch sf.shelf.location model_sf_shelf_location sf_base.group_plan_dispatch 1 1 0 0 0
98 access_stock_move stock.move stock.model_stock_move sf_base.group_plan_dispatch 1 1 1 0
99 access_stock_picking stock.picking stock.model_stock_picking sf_base.group_plan_dispatch 1 0 0 0
100 access_stock_lot_group_plan_dispatch stock.lot stock.model_stock_lot sf_base.group_plan_dispatch 1 0 0 0
101 access_stock_lot_group_plan_director stock.lot stock.model_stock_lot sf_base.group_plan_director 1 1 1 0
102 access_stock_warehouse_orderpoint stock.warehouse.orderpoint stock.model_stock_warehouse_orderpoint sf_base.group_plan_dispatch 1 1 0 0
103 access_product_product product.product product.model_product_product sf_base.group_plan_dispatch 1 0 0 0
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

View File

@@ -15,10 +15,10 @@
('location_id', '=', location_dest_id_value),
('location_status', '=', '空闲')
]"/>
<!-- <field name="location_dest_id_product_type"/> -->
<!-- <field name="location_dest_id"/> -->
<!-- <field name="location_dest_id_product_type"/> -->
<!-- <field name="location_dest_id"/> -->
<field name="location_dest_id_value" invisible="1"/>
<!-- <button name="button_test" string="测试" type="object" class="oe_highlight"/> -->
<!-- <button name="button_test" string="测试" type="object" class="oe_highlight"/> -->
</xpath>
</field>
</record>
@@ -55,26 +55,37 @@
</field>
</record>
<!-- 原生的按钮对base.user可见这里修改为对库存用户可见 -->
<!-- 原生的按钮对base.user可见这里修改为对库存用户可见 -->
<record id="sf_view_picking_form" model="ir.ui.view">
<field name="name">sf.view.picking.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//form//header//button[@name='action_cancel']" position="replace">
<button name="action_cancel" attrs="{'invisible': [('state', 'not in', ('assigned', 'confirmed', 'draft', 'waiting'))]}" string="取消" groups="sf_warehouse.group_sf_stock_user" type="object" data-hotkey="z"/>
<button name="action_cancel"
attrs="{'invisible': [('state', 'not in', ('assigned', 'confirmed', 'draft', 'waiting'))]}"
string="取消" groups="sf_warehouse.group_sf_stock_user" type="object" data-hotkey="z"/>
</xpath>
<xpath expr="//form//header//button[@name='do_unreserve']" position="replace">
<button name="do_unreserve" string="取消保留" groups="sf_warehouse.group_sf_stock_user" type="object" attrs="{'invisible': ['|', '|', '|', ('picking_type_code', '=', 'incoming'), ('immediate_transfer', '=', True), '&amp;', ('state', '!=', 'assigned'), ('move_type', '!=', 'one'), '&amp;', ('state', 'not in', ('assigned', 'confirmed')), ('move_type', '=', 'one')]}" data-hotkey="w"/>
<button name="do_unreserve" string="取消保留" groups="sf_warehouse.group_sf_stock_user"
type="object"
attrs="{'invisible': ['|', '|', '|', ('picking_type_code', '=', 'incoming'), ('immediate_transfer', '=', True), '&amp;', ('state', '!=', 'assigned'), ('move_type', '!=', 'one'), '&amp;', ('state', 'not in', ('assigned', 'confirmed')), ('move_type', '=', 'one')]}"
data-hotkey="w"/>
</xpath>
<xpath expr="//form//header//button[@name='button_scrap']" position="replace">
<button name="button_scrap" groups="sf_warehouse.group_sf_stock_user" type="object" string="报废" attrs="{'invisible': ['|', '&amp;', ('picking_type_code', '=', 'incoming'), ('state', '!=', 'done'), '&amp;', ('picking_type_code', '=', 'outgoing'), ('state', '=', 'done')]}" data-hotkey="y"/>
<button name="button_scrap" groups="sf_warehouse.group_sf_stock_user" type="object" string="报废"
attrs="{'invisible': ['|', '&amp;', ('picking_type_code', '=', 'incoming'), ('state', '!=', 'done'), '&amp;', ('picking_type_code', '=', 'outgoing'), ('state', '=', 'done')]}"
data-hotkey="y"/>
</xpath>
<xpath expr="//form//header//button[@name='action_assign']" position="replace">
<button name="action_assign" attrs="{'invisible': [('show_check_availability', '=', False)]}" string="检查可用量" type="object" class="oe_highlight" groups="sf_warehouse.group_sf_stock_user" data-hotkey="q"/>
<button name="action_assign" attrs="{'invisible': [('show_check_availability', '=', False)]}"
string="检查可用量" type="object" class="oe_highlight"
groups="sf_warehouse.group_sf_stock_user" data-hotkey="q"/>
</xpath>
<xpath expr="//form//header//button[@name='%(stock.act_stock_return_picking)d']" position="replace">
<button name="%(stock.act_stock_return_picking)d" string="退回" attrs="{'invisible': [('state', '!=', 'done')]}" type="action" groups="sf_warehouse.group_sf_stock_user" data-hotkey="k"/>
<button name="%(stock.act_stock_return_picking)d" string="退回"
attrs="{'invisible': [('state', '!=', 'done')]}" type="action"
groups="sf_warehouse.group_sf_stock_user" data-hotkey="k"/>
</xpath>
</field>
@@ -86,7 +97,25 @@
<field name="inherit_id" ref="stock.stock_scrap_form_view"/>
<field name="arch" type="xml">
<xpath expr="//header//button[@name='action_validate']" position="replace">
<button name="action_validate" states="draft" string="Validate" type="object" class="oe_highlight" context="{'not_unlink_on_discard': True}" data-hotkey="v" groups="sf_warehouse.group_sf_stock_user"/>
<button name="action_validate" states="draft" string="Validate" type="object" class="oe_highlight"
context="{'not_unlink_on_discard': True}" data-hotkey="v"
groups="sf_warehouse.group_sf_stock_user"/>
</xpath>
</field>
</record>
<record id="sf_vpicktree" model="ir.ui.view">
<field name="name">sf.vpicktree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.vpicktree"/>
<field name="arch" type="xml">
<xpath expr="//header//button[@name='do_unreserve']" position="replace">
<button name="do_unreserve" type="object" string="取消保留"
groups="sf_warehouse.group_sf_stock_user"/>
</xpath>
<xpath expr="//header//button[@name='action_assign']" position="replace">
<button name="action_assign" type="object" string="检查可用量"
groups="sf_warehouse.group_sf_stock_user"/>
</xpath>
</field>
</record>

View File

@@ -55,8 +55,13 @@
<form string="Shelf Location">
<header>
<field name="location_status" invisible="1"/>
<button string="生成货位" name="create_location" type="object" class="oe_highlight"
attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
<button string="禁用货位" name="action_location_status_disable" type="object" class="oe_highlight"
attrs="{'invisible': ['|', ('hide_shelf', '=', True), ('location_status', '!=', '空闲')]}"/>
<button string="启用货位" name="action_location_status_enable" type="object" class="oe_highlight"
attrs="{'invisible': ['|', ('hide_shelf', '=', True), ('location_status', '!=', '禁用')]}"/>
<!-- <button name="%(shelf_location_kanban_action_id)d"-->
<!-- type="action"-->