1、禁用超级管理员之外的角色通过库存概览跳转到调拨单界面的调拨单创建按钮,隐藏制造作业类型的单据;2、优化移动历史记录。
This commit is contained in:
@@ -931,13 +931,6 @@ class SfStockMoveLine(models.Model):
|
|||||||
if not record.destination_location_id.product_id:
|
if not record.destination_location_id.product_id:
|
||||||
record.destination_location_id.product_id = record.product_id.id
|
record.destination_location_id.product_id = record.product_id.id
|
||||||
|
|
||||||
@api.model_create_multi
|
|
||||||
def create(self, vals_list):
|
|
||||||
|
|
||||||
records = super(SfStockMoveLine, self).create(vals_list)
|
|
||||||
self.put_shelf_location(records)
|
|
||||||
return records
|
|
||||||
|
|
||||||
|
|
||||||
class SfStockPicking(models.Model):
|
class SfStockPicking(models.Model):
|
||||||
_inherit = 'stock.picking'
|
_inherit = 'stock.picking'
|
||||||
@@ -1122,6 +1115,12 @@ class SfPickingType(models.Model):
|
|||||||
'sf_warehouse.group_sf_stock_manager'
|
'sf_warehouse.group_sf_stock_manager'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _get_action(self, action_xmlid):
|
||||||
|
action = super(SfPickingType, self)._get_action(action_xmlid)
|
||||||
|
if not self.env.user.has_group('base.group_system'):
|
||||||
|
action['context']['create'] = False
|
||||||
|
return action
|
||||||
|
|
||||||
|
|
||||||
class CustomStockMove(models.Model):
|
class CustomStockMove(models.Model):
|
||||||
_name = 'stock.move'
|
_name = 'stock.move'
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
<record model="ir.actions.act_window" id="stock.stock_picking_type_action">
|
<record model="ir.actions.act_window" id="stock.stock_picking_type_action">
|
||||||
<field name="context">{'search_default_groupby_code':1}</field>
|
<field name="context">{'search_default_groupby_code':1}</field>
|
||||||
|
<field name="domain">[('name', '!=', '制造')]</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="view_location_form_sf_inherit" model="ir.ui.view">
|
<record id="view_location_form_sf_inherit" model="ir.ui.view">
|
||||||
|
|||||||
@@ -77,18 +77,20 @@ class ShelfLocationWizard(models.TransientModel):
|
|||||||
|
|
||||||
def confirm_the_change(self):
|
def confirm_the_change(self):
|
||||||
if self.destination_barcode_id:
|
if self.destination_barcode_id:
|
||||||
|
stocks = []
|
||||||
if self.lot_id:
|
if self.lot_id:
|
||||||
self.current_barcode_id.product_sn_id = False
|
self.current_barcode_id.product_sn_id = False
|
||||||
self.destination_barcode_id.product_sn_id = self.lot_id.id
|
self.destination_barcode_id.product_sn_id = self.lot_id.id
|
||||||
self.create_stock_moves(self.lot_id, 1)
|
stocks = self.create_stock_moves(self.lot_id, 1)
|
||||||
elif self.current_product_sn_ids:
|
elif self.current_product_sn_ids:
|
||||||
for current_product_sn_id in self.current_product_sn_ids:
|
for current_product_sn_id in self.current_product_sn_ids:
|
||||||
self.create_stock_moves(current_product_sn_id.lot_id, current_product_sn_id.qty_num)
|
stocks = self.create_stock_moves(current_product_sn_id.lot_id, current_product_sn_id.qty_num)
|
||||||
current_product_sn_id.write({
|
current_product_sn_id.write({
|
||||||
'qty_num': 0
|
'qty_num': 0
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
raise ValidationError('没有需要变更的批次/序列号!')
|
raise ValidationError('没有需要变更的批次/序列号!')
|
||||||
|
self.env['stock.move.line'].sudo().put_shelf_location(stocks[-1])
|
||||||
else:
|
else:
|
||||||
raise ValidationError('请选择目标货位编码!')
|
raise ValidationError('请选择目标货位编码!')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user