Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
9564 Vizualizări

 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>

Imagine profil
Abandonează
Cel mai bun răspuns

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     }

Imagine profil
Abandonează
Autor

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,

Autor

thank you :)

Autor

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

Related Posts Răspunsuri Vizualizări Activitate
1
iun. 18
3436
0
aug. 23
1789
1
dec. 22
5085
1
dec. 22
2687
4
nov. 18
15043