[IMP] stock: editable picking list view

Makes the picking view list multi-editable, and some readonly conditions
was moved form the view to in the model (for the `backorder_id`, `name`,
`scheduled_date` fields).

Task #2078163
This commit is contained in:
svs-odoo
2019-10-01 12:34:17 +00:00
parent 2a10328c13
commit 06aeb07cff
2 changed files with 10 additions and 8 deletions
+4 -4
View File
@@ -242,8 +242,7 @@ class Picking(models.Model):
name = fields.Char(
'Reference', default='/',
copy=False, index=True,
states={'done': [('readonly', True)], 'cancel': [('readonly', True)]})
copy=False, index=True, readonly=True)
origin = fields.Char(
'Source Document', index=True,
states={'done': [('readonly', True)], 'cancel': [('readonly', True)]},
@@ -251,8 +250,7 @@ class Picking(models.Model):
note = fields.Text('Notes')
backorder_id = fields.Many2one(
'stock.picking', 'Back Order of',
copy=False, index=True,
states={'done': [('readonly', True)], 'cancel': [('readonly', True)]},
copy=False, index=True, readonly=True,
check_company=True,
help="If this shipment was split, then this field links to the shipment which contains the already processed part.")
backorder_ids = fields.One2many('stock.picking', 'backorder_id', 'Back Orders')
@@ -288,6 +286,7 @@ class Picking(models.Model):
scheduled_date = fields.Datetime(
'Scheduled Date', compute='_compute_scheduled_date', inverse='_set_scheduled_date', store=True,
index=True, default=fields.Datetime.now, tracking=True,
states={'done': [('readonly', True)], 'cancel': [('readonly', True)]},
help="Scheduled time for the first part of the shipment to be processed. Setting manually a value here would set it as expected date for all the stock moves.")
date = fields.Datetime(
'Creation Date',
@@ -330,6 +329,7 @@ class Picking(models.Model):
user_id = fields.Many2one(
'res.users', 'Responsible', tracking=True,
domain=lambda self: [('groups_id', 'in', self.env.ref('stock.group_stock_user').id)],
states={'done': [('readonly', True)], 'cancel': [('readonly', True)]},
default=lambda self: self.env.user)
move_line_ids = fields.One2many('stock.move.line', 'picking_id', 'Operations')
move_line_ids_without_package = fields.One2many('stock.move.line', 'picking_id', 'Operations without package', domain=['|',('package_level_id', '=', False), ('picking_type_entire_packs', '=', False)])
+6 -4
View File
@@ -187,7 +187,9 @@
<field name="name">stock.picking.tree</field>
<field name="model">stock.picking</field>
<field name="arch" type="xml">
<tree decoration-info="state == 'draft'" decoration-muted="state == 'cancel'" decoration-danger="state not in ('cancel', 'done') and scheduled_date &lt; current_date" string="Picking list">
<tree string="Picking list" multi_edit="1"
decoration-info="state == 'draft'" decoration-muted="state == 'cancel'"
decoration-danger="state not in ('cancel', 'done') and scheduled_date &lt; current_date">
<field name="name"/>
<field name="location_id" options="{'no_create': True}" string="From" groups="stock.group_stock_multi_locations" optional="show"/>
<field name="location_dest_id" options="{'no_create': True}" string="To" groups="stock.group_stock_multi_locations" optional="show"/>
@@ -266,7 +268,7 @@
</button>
</div>
<h1 class="d-none d-md-block">
<field name="name" attrs="{'invisible': [('name','=','/')]}" readonly="1"/>
<field name="name" attrs="{'invisible': [('name','=','/')]}"/>
</h1>
<group>
<group>
@@ -282,10 +284,10 @@
<field name="picking_type_id" attrs="{'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" readonly="1" attrs="{'invisible': [('backorder_id','=',False)]}"/>
<field name="backorder_id" attrs="{'invisible': [('backorder_id','=',False)]}"/>
</group>
<group>
<field name="scheduled_date" attrs="{'readonly': [('state', 'in', ('done', 'cancel'))], 'required': [('id', '!=', False)]}"/>
<field name="scheduled_date" attrs="{'required': [('id', '!=', False)]}"/>
<field name="date_done" string="Effective Date" attrs="{'invisible': [('state', '!=', 'done')]}"/>
<field name="origin" placeholder="e.g. PO0032"/>
<field name="owner_id" groups="stock.group_tracking_owner"