Hello, can any help me in creating invoice by code in Odoo 14?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
I have created it like this
def action_order_processing(self):
self.write({'stage_id': '2'})
self.write({'driver_custody': True})
for record in self:
delivey_invoice = self.env['account.move'].create([
{
'move_type': 'out_invoice',
'invoice_date': fields.Date.context_today(self),
'partner_id': self.partner_id.id,
'currency_id': self.currency_id.id,
'amount_total': self.delivery_total,
'invoice_line_ids': [
(0, None, {
'product_id': 1,
'name': 'Delivery Service',
'quantity': 1,
'price_unit': self.delivery_total,
'price_subtotal': self.delivery_total,
}),
],
},
])
delivey_invoice.action_post(
Hi,
See Sample Code of creating invoice here:
https://pastebin.ubuntu.com/p/dctnMk8RgD/For Creating record from code, see: https://www.youtube.com/watch?v=Jssb15ADeyg
Thanks
Sample:
move = self.env['account.move'].create({
'move_type': 'in_invoice',
'date': '2017-01-01',
'partner_id': self.partner_a.id,
'invoice_date': fields.Date.from_string('2017-01-01'),
'currency_id': self.currency_data['currency'].id,
'invoice_payment_term_id': self.pay_terms_a.id,
'invoice_line_ids': [
(0, None, {
'name': self.product_line_vals_1['name'],
'product_id': self.product_line_vals_1['product_id'],
'product_uom_id': self.product_line_vals_1['product_uom_id'],
'quantity': self.product_line_vals_1['quantity'],
'price_unit': self.product_line_vals_1['price_unit'],
'tax_ids': self.product_line_vals_1['tax_ids'],
}),
(0, None, {
'name': self.product_line_vals_2['name'],
'product_id': self.product_line_vals_2['product_id'],
'product_uom_id': self.product_line_vals_2['product_uom_id'],
'quantity': self.product_line_vals_2['quantity'],
'price_unit': self.product_line_vals_2['price_unit'],
'tax_ids': self.product_line_vals_2['tax_ids'],
}),
]
})
Thank you!
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
0
sie 23
|
1357 | ||
|
1
gru 21
|
2097 | ||
Unselect the Show in Invoices Footer option
Rozwiązane
|
|
3
lut 25
|
2591 | |
invoice number prefix
Rozwiązane
|
|
1
lis 24
|
2335 | |
|
1
cze 24
|
4439 |