[IMP] stock: add reference that is either picking name or move name

Add this in the stock.move tree while also cleaning it up a bit.
This commit is contained in:
Prakash Prajapati
2017-09-21 18:44:58 -07:00
committed by Joren Van Onder
parent 1a8f086041
commit 0b9105cc2c
2 changed files with 10 additions and 7 deletions
+6
View File
@@ -157,6 +157,7 @@ class StockMove(models.Model):
is_locked = fields.Boolean(related='picking_id.is_locked', readonly=True)
is_initial_demand_editable = fields.Boolean('Is initial demand editable', compute='_compute_is_initial_demand_editable')
is_quantity_done_editable = fields.Boolean('Is quantity done editable', compute='_compute_is_quantity_done_editable')
reference = fields.Char(compute='_compute_reference', string="Reference", store=True)
@api.depends('product_id', 'has_tracking', 'move_line_ids', 'location_id', 'location_dest_id')
def _compute_show_details_visible(self):
@@ -208,6 +209,11 @@ class StockMove(models.Model):
else:
move.is_quantity_done_editable = True
@api.depends('picking_id', 'name')
def _compute_reference(self):
for move in self:
move.reference = move.picking_id.name if move.picking_id else move.name
@api.one
@api.depends('product_id', 'product_uom', 'product_uom_qty')
def _compute_product_qty(self):
+4 -7
View File
@@ -52,18 +52,15 @@
<field eval="8" name="priority"/>
<field name="arch" type="xml">
<tree decoration-muted="state == 'cancel'" decoration-danger="(state not in ('cancel','done')) and date > current_date" string="Moves" create="0">
<field name="name"/>
<field name="picking_id" string="Reference"/>
<field name="origin"/>
<field name="date" groups="base.group_no_one"/>
<field name="reference"/>
<field name="picking_type_id" invisible="1"/>
<field name="create_date" invisible="1" groups="base.group_no_one"/>
<field name="product_id"/>
<field name="product_uom_qty"/>
<field name="product_uom" options="{'no_open': True, 'no_create': True}" string="Unit of Measure" groups="product.group_uom"/>
<field name="location_id" groups="stock.group_stock_multi_locations"/>
<field name="location_dest_id" groups="stock.group_stock_multi_locations"/>
<field name="date" groups="base.group_no_one"/>
<field name="date_expected" invisible="context.get('scrap_move')"/> <!-- TDE FIXME: woooooo -->
<field name="product_uom_qty"/>
<field name="product_uom" options="{'no_open': True, 'no_create': True}" string="Unit of Measure" groups="product.group_uom"/>
<field name="state"/>
</tree>
</field>