Skip to Content
Menu
This question has been flagged
1 Reply
1016 Views

every product in odoo should have quantity minimum 
i have created product and i set the quantity min to it in reordering rule
what i want to do is get the product name and it's quantity min in python
this is my python file

from odoo import fields,models,api
 
class Qty_Min_Alert(models.Model):
_inherit='product.template'
product_name = # here i want to set the product name from product.template
product_qty_min = # here i want to set the product quantity minimum from product.template

i added 'product' in depends on __manifest__.py
can you help me please

Avatar
Discard
Best Answer

Hi,

You can refer to this code.

from odoo import fields, models


class ProductTemplate(models.Model):
_inherit = 'product.template'

product_name = fields.Many2one('product.template', string='Prooooooo')
product_qty_min = fields.Float(related='product_name.reordering_min_qty')

Regards

Avatar
Discard