تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
8019 أدوات العرض

hello,

Now i d'ld like to make an invoice (invoce from invocing management module) toward a button like "Creer une facture". what's the way to do that?i build custom module in odoo 11 which allow to choose articles for sale (something like sale module)



الصورة الرمزية
إهمال
أفضل إجابة

Hi,
For creating an invoice from code, what you have to do is that call the create method of the corresponding model and pass the necessary values as dict to the create method. See,


rslt = self.env['account.invoice'].create({
'partner_id': self.test_partner.id,
'currency_id': self.currency_two.id,
'name': 'customer invoice',
'type': 'out_invoice',
'date_invoice': date,
'account_id': self.account_receivable.id,
'invoice_line_ids': [(0, 0, {
'name': 'test line',
'origin': sale_order.name,
'account_id': self.account_income.id,
'price_unit': self.product_price_unit,
'quantity': 1.0,
'discount': 0.0,
'uom_id': product.uom_id.id,
'product_id': product.id,
'sale_line_ids': [(6, 0, [line.id for line in sale_order.order_line])],
})],
})


For development tutorials and tips see: Odoo Development Tutorials

Thanks

الصورة الرمزية
إهمال

Hi,

How can I do this in odoo 13 ? I am trying to create an invoice from a button in my custom module. I can create the invoice with succes, however, I am having issues with the tax lines in account_move_line...I dont know how to create them so I can have tax amount on my invoice.

Thank you.

Hi @Niyas, how to auto posted the invoice when it generate using above code?
I want to, the invoice confirmed and posted when it created.