[IMP] stock: hide picking type field
Hides the `picking_type_id` field when creating a new transfer if it is set by default. As this field is automatically set when coming from a list of a specific transfer type or when asking to create directly a specific transfer type this field is superfluous in these cases. task-2328830 X-original-commit: c26ec70c61f51e6dc30c460c1b60f0d9ff3286a8
This commit is contained in:
@@ -318,6 +318,7 @@ class Picking(models.Model):
|
||||
readonly=True)
|
||||
picking_type_entire_packs = fields.Boolean(related='picking_type_id.show_entire_packs',
|
||||
readonly=True)
|
||||
hide_picking_type = fields.Boolean(compute='_compute_hide_pickign_type')
|
||||
partner_id = fields.Many2one(
|
||||
'res.partner', 'Contact',
|
||||
check_company=True,
|
||||
@@ -388,6 +389,9 @@ class Picking(models.Model):
|
||||
for picking in self:
|
||||
picking.has_deadline_issue = picking.date_deadline and picking.date_deadline < picking.scheduled_date or False
|
||||
|
||||
def _compute_hide_pickign_type(self):
|
||||
self.hide_picking_type = self.env.context.get('default_picking_type_id', False)
|
||||
|
||||
@api.depends('move_lines.delay_alert_date')
|
||||
def _compute_delay_alert_date(self):
|
||||
delay_alert_date_data = self.env['stock.move'].read_group([('id', 'in', self.move_lines.ids), ('delay_alert_date', '!=', False)], ['delay_alert_date:max'], 'picking_id')
|
||||
|
||||
@@ -211,6 +211,7 @@
|
||||
<field name="show_lots_text" invisible="1"/>
|
||||
<field name="immediate_transfer" invisible="1"/>
|
||||
<field name="picking_type_code" invisible="1"/>
|
||||
<field name="hide_picking_type" invisible="1"/>
|
||||
<field name="show_operations" invisible="1" readonly="1"/>
|
||||
<field name="show_reserved" invisible="1" readonly="1"/>
|
||||
<field name="move_line_exist" invisible="1"/>
|
||||
@@ -281,7 +282,7 @@
|
||||
attrs="{'invisible': [('picking_type_code', 'in', ['incoming', 'outgoing'])]}"/>
|
||||
</div>
|
||||
<field name="partner_id" nolabel="1"/>
|
||||
<field name="picking_type_id" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="picking_type_id" attrs="{'invisible': [('hide_picking_type', '=', True)], 'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations" attrs="{'invisible': [('picking_type_code', '=', 'incoming')]}"/>
|
||||
<field name="location_dest_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations" attrs="{'invisible': [('picking_type_code', '=', 'outgoing')]}"/>
|
||||
<field name="backorder_id" attrs="{'invisible': [('backorder_id','=',False)]}"/>
|
||||
|
||||
Reference in New Issue
Block a user