Odoo Help


fonction serach for filter many2one

tarik lallouch
on 12/18/13, 1:18 PM 1,711 views


    class printshop2_support(osv.osv):
    _name = 'printshop2.support'
    _description = 'PRINTSHOP2 Support'

    _columns = {
            'name':fields.char('Designation', size=64, required=True, readonly=False),
            'gr':fields.char('grammage', size=32, required=False, readonly=False),
            'line_ids':fields.one2many('printshop2.support.line', 'support_id', 'Variantes supports',required=True),       }


    class printshop2_support_line(osv.osv):
        _name = 'printshop2.support.line'
        _description = 'PRINTSHOP Support line'

        _columns = {
                'product_id':fields.many2one('product.product', 'Produit', required=True, domain="[('marque_support2', '=',printshop2.support.name)]"),
                'largeur_support': fields.related('product_id','longueur_calcul',type='float', relation="product.product", string="Largeur support", store=False),
                'longueur_support': fields.related('product_id','largeur_calcul',type='float', relation="product.product", string="Longueur support", store=False),
                'prix_support': fields.related('product_id','prix_interne',type='float', relation="product.product", string="prix Support à la feuille", store=False),
                'gr_support': fields.related('product_id','epaisseur_calcul',type='char', relation="product.product", string="grammage feuille", store=False),

i want to have in line_ids all products that (printshop2.support.name = printshop2.support.line.gr_support) and update it automatiquelly

please how can i do that


You want search lines details in header ? or lines values want to save in header records?

on 12/19/13, 1:14 AM

hi, i want line details thanks

tarik lallouch
on 12/20/13, 11:45 AM
On 1/2/14, 3:00 AM

In printshop2.support table add the below related fields

'product_id' : fields.related('line_ids', 'product_id', type="many2one", relation="product.product", string="Product"),

And xml file search view objects printshop2.support add:-

  <field name="product_id"/>

After updated the modules you can filter line details

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 12/18/13, 1:18 PM
Seen: 1711 times
Last updated: 3/16/15, 8:10 AM