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

I created a button that creates an invoice in the invoice module according to data from my Custom module

When I press the button, the data appears in the database, but does not appear in the view

What is the reason for that? 

my code :

    defcreate_invoice(self):
        vals={   
        'name':'samer',   
        'partner_id':self.vendor_id.id,   
        'invoice_date':date.today(),     
      'state':'draft',       
    'invoice_line_ids': [(0, 0, {   
            'price_unit': self.product_id.list_price,   
            'quantity': 1.0,           
    'discount': 0.0,               
'product_id': self.product_id.name, 
          })]        }     
  self.update({           
'state': '2', 
      })   
    return self.env['account.move'].create(vals)
Imagine profil
Abandonează
Cel mai bun răspuns

It will not shown in Invoices but it will shown in journal entry because the move_type is not set and the default value is entry. it should be out_invoice for sales invoices and in_invoice for purchase bill.


The product_id should get the id value not the name 'product_id': self.product_id.id


    vals={    

'name':'samer',

'partner_id':self.vendor_id.id,

'invoice_date':date.today(),

'move_type': 'out_invoice',

'invoice_line_ids': [(0, 0, {

'price_unit': self.product_id.list_price,

'quantity': 1.0,

'discount': 0.0,

'product_id': self.product_id.id,

'name': self.product_id.name

})]

}  
Imagine profil
Abandonează
Autor

Thank you very much Mr.Waled
It's working

Related Posts Răspunsuri Vizualizări Activitate
0
nov. 22
101
1
apr. 24
2487
3
oct. 23
8953
1
sept. 21
3862
1
iun. 21
3240