Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
9583 Vues

 the part id={{invoice_id}} doesn't get the id of my invoice. Even though I declared it in the py.

is there a way to call id and put it in href/t-att-href?


I want to automatically open the form of the invoice  I created.


code:

<a href="/web?debug#id={{invoice_id}}&amp;view_type=form&amp;model=account.invoice&amp;action=249" >

                               <button  class="btn btn-danger" string="Create Invoice" name="create_invoice"  type="object"/>

                           </a>

Avatar
Ignorer
Meilleure réponse

try this it should work for you

XML side

<button name="create_invoice" type="object" string="Create Invoice" />

Python side

def create_invoice(self):

	# your other code before open view
        
        return { 'name': 'invoice', # Lable 'type': 'ir.actions.act_window', 'view_type': 'form', 'view_mode': 'form', 'res_model': 'account.invoice', # your model 'target': 'new', # if you want popup 'context': ctx, # if you need     }

Avatar
Ignorer
Auteur

if I put the 'view_mode':'form'

it opens a new create form.. what should I do?

if you want a particular record to display then you have to put 'res_id': '' also

try to add this line it should work otherwise debug and find res_id of your current record

'res_id': self.id,

Auteur

thank you :)

Auteur

Hello.. what should I do, it displays as vendor bill instead customer invoice.

Publications associées Réponses Vues Activité
1
juin 18
3452
0
août 23
1816
1
déc. 22
5104
1
déc. 22
2697
4
nov. 18
15060