[IMP] stock: improve stock_quant form view
- Added stat button in stock_quant for open stock_move_line. - Added 'Reserved Quantity' field. - Moved UoM on right of 'On Hand'. - Set product name in breadcrumb instead of 'stock.quant,2'
This commit is contained in:
@@ -11,6 +11,7 @@ from odoo.osv import expression
|
||||
class StockQuant(models.Model):
|
||||
_name = 'stock.quant'
|
||||
_description = 'Quants'
|
||||
_rec_name = 'product_id'
|
||||
|
||||
product_id = fields.Many2one(
|
||||
'product.product', 'Product',
|
||||
@@ -47,6 +48,18 @@ class StockQuant(models.Model):
|
||||
readonly=True, required=True)
|
||||
in_date = fields.Datetime('Incoming Date', readonly=True)
|
||||
|
||||
@api.multi
|
||||
def action_view_stock_moves(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref('stock.stock_move_line_action').read()[0]
|
||||
action['domain'] = [
|
||||
('product_id', '=', self.product_id.id),
|
||||
'|', ('location_id', '=', self.location_id.id),
|
||||
('location_dest_id', '=', self.location_id.id),
|
||||
('lot_id', '=', self.lot_id.id),
|
||||
('package_id', '=', self.package_id.id)]
|
||||
return action
|
||||
|
||||
@api.multi
|
||||
@api.constrains('product_id')
|
||||
def check_product_id(self):
|
||||
|
||||
@@ -38,20 +38,33 @@
|
||||
<field eval="10" name="priority"/>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Inventory Valuation" create="false" edit="false" delete="false">
|
||||
<group>
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button class="oe_stat_button" icon="fa-arrows-v" type="object" name="action_view_stock_moves" string="Picking Moves"/>
|
||||
</div>
|
||||
<group>
|
||||
<field name="product_id"/>
|
||||
<field name="quantity"/>
|
||||
<field name="product_uom_id" groups="product.group_uom"/>
|
||||
<field name="lot_id" groups="stock.group_production_lot"/>
|
||||
<field name="package_id" groups="stock.group_tracking_lot"/>
|
||||
<field name="location_id"/>
|
||||
<field name="owner_id" groups="stock.group_tracking_owner"/>
|
||||
<group>
|
||||
<field name="product_id"/>
|
||||
<field name="location_id"/>
|
||||
<field name="lot_id" groups="stock.group_production_lot"/>
|
||||
<field name="package_id" groups="stock.group_tracking_lot"/>
|
||||
<field name="owner_id" groups="stock.group_tracking_owner"/>
|
||||
</group>
|
||||
<group>
|
||||
<label for="quantity" string="Quantity On Hand"/>
|
||||
<div class="o_row">
|
||||
<field name="quantity"/>
|
||||
<field name="product_uom_id" groups="product.group_uom"/>
|
||||
</div>
|
||||
<label for="reserved_quantity" string="Quantity Reserved"/>
|
||||
<div class="o_row">
|
||||
<field name="reserved_quantity"/>
|
||||
<field name="product_uom_id" groups="product.group_uom"/>
|
||||
</div>
|
||||
<field name="in_date" attrs="{'invisible': [('lot_id', '=', False)]}" groups="stock.group_production_lot"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<field name="in_date" attrs="{'invisible': [('lot_id', '=', False)]}" groups="stock.group_production_lot"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user