Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
9518 Tampilan

 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
Buang
Jawaban Terbai

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
Buang
Penulis

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,

Penulis

thank you :)

Penulis

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

Post Terkait Replies Tampilan Aktivitas
1
Jun 18
3384
0
Agu 23
1713
1
Des 22
4993
1
Des 22
2624
4
Nov 18
14956