Skip to Content
Menu
This question has been flagged
2 Replies
3278 Views

Hello,

When I click on a record, it displays a form view but I want to have a pivot view when I click on a record.

Is it possible ? If yes, how to do it ?

Thanks for help

Avatar
Discard

Can you please elaborate the question? then we can give more suggestions.

pivot view is for a set of records, not for a single one. if you mean you click a button then you need the view, its possible, So make more clear in your question.

Author

Please check my answer. No I don't want a button to display the pivot view but I want the pivot view (instead of the form view) when I click on the record.

Author Best Answer

Hello,

I will give more details :

I've two models (codes below), only the first is display and when I click on a record from the first model (miadi.tarifs), I want to display a pivot view for all records in the second model (miadi.lignestarifs) where there is the same "code_tarif". Check codes :

miadi.tarifs :

class miadi_tarifs(models.Model):
    _name = 'miadi.tarifs'
    _order = 'code'
    
    code = fields.Char(string='Code', default="", required=True)
    libelle = fields.Char(string='Description', default='', required=True)
    remise = fields.Float(string='Discount', digits=(5,2), default=0)

miadi.lignestarifs :

class miadi_lignesTarifs(models.Model):
    _name = 'miadi.lignestarifs'
    _order = 'code_tarif, produit_id, conditionnement_id'
    
    code_tarif = fields.Many2one('miadi.tarifs', 'Price Code', default='', required=True, ondelete='cascade')
    numero_ordre = fields.Integer('Order number')
    produit_id = fields.Many2one('product.product', 'Product', required=True, ondelete='cascade')
    conditionnement_id = fields.Many2one('miadi.packaging', 'Packaging', required=True, ondelete='cascade')
    prix_unitaire = fields.Float('Unit Price', default=0)

So, in "miadi.lignestarifs", I've some records with the same "code_tarif". In the model "miadi.tarif", when I click on a record, I've the form view of the record but, instead of this, I want a pivot view based on the model "miadi.lignestarifs" for the record selected.


I hope you will understand better.

Regards

Avatar
Discard
Related Posts Replies Views Activity
9
Jun 17
15760
2
Jun 17
11301
1
Mar 15
10869
2
Mar 22
9055
1
Jul 24
24