[IMP] stock: add stat button for product lot
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user