[IMP] stock: add stat button for product lot

This commit is contained in:
Pratima Gupta
2017-09-11 18:18:41 -07:00
committed by Joren Van Onder
parent 06c4a707ee
commit 350f5d5878
2 changed files with 23 additions and 0 deletions
+15
View File
@@ -360,6 +360,14 @@ class Product(models.Model):
action['domain'] = [('product_id', '=', self.id)]
return action
@api.multi
def action_open_product_lot(self):
self.ensure_one()
action = self.env.ref('stock.action_production_lot_form').read()[0]
action['domain'] = [('product_id', '=', self.id)]
action['context'] = {}
return action
@api.multi
def write(self, values):
res = super(Product, self).write(values)
@@ -537,6 +545,13 @@ class ProductTemplate(models.Model):
action['domain'] = [('product_id.product_tmpl_id', 'in', self.ids)]
return action
@api.multi
def action_open_product_lot(self):
self.ensure_one()
action = self.env.ref('stock.action_production_lot_form').read()[0]
action['domain'] = [('product_id.product_tmpl_id', '=', self.id)]
action['context'] = {}
return action
class ProductCategory(models.Model):
_inherit = 'product.category'
+8
View File
@@ -262,6 +262,10 @@
name="action_view_routes"
attrs="{'invisible':[('type', '!=', 'product')]}"
class="oe_stat_button" icon="fa-cogs" groups="stock.group_adv_location"/>
<button string="Lot/Serial Number" type="object"
name="action_open_product_lot"
attrs="{'invisible': [('tracking', '=', 'none')]}"
class="oe_stat_button" icon="fa-bars" groups="stock.group_production_lot"/>
</button>
</data>
</field>
@@ -328,6 +332,10 @@
attrs="{'invisible':[('type', '!=', 'product')]}"
class="oe_stat_button" icon="fa-cogs"
groups="stock.group_adv_location"/>
<button string="Lot/Serial Number" type="object"
name="action_open_product_lot"
attrs="{'invisible': [('tracking', '=', 'none')]}"
class="oe_stat_button" icon="fa-bars" groups="stock.group_production_lot"/>
</button>
<!-- change attrs of fields added in view_template_property_form