This question has been flagged
1 Reply
4378 Views

hi,

    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),       }

printshop2_support() 

    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),
                }
printshop2_support_line()

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

thanks

Avatar
Discard

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

Author

hi, i want line details thanks

Best Answer

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

Avatar
Discard