This question has been flagged
3 Replies
5550 Views

i have used this  method to create customer invoice but  the view appeared is  the journal not customer  invoice 

def create_task_invoice(self):
return {
'name': 'Invoice',
'res_model': 'account.move',
'type': 'ir.actions.act_window',
'view_mode': 'form',
'target': 'new',
'view_id': self.env.ref('account.view_move_form').id,
'context': {
'default_type': 'out_invoice',
'default_state': 'draft',
'default_partner_id': self.partner_id.id,
'default_invoice_line_ids': [(0, 0, {
'product_id': self.design_product_id.id
})],
},
}

Avatar
Discard
Best Answer

Hi,

For creating invoice from code, see:  https://pastebin.ubuntu.com/p/dctnMk8RgD/

For Creating record from code:  https://www.youtube.com/watch?v=Jssb15ADeyg

Thanks

Avatar
Discard

Code:

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'],

}),

]

})

Best Answer

it's useful for me. many thanks.

Avatar
Discard
Best Answer

You can upload invoices straight from the system by clicking on the UPLOAD button. In order to create new customer invoices, select the CREATE button. A new Invoice window will appear on the screen. Here, you will have to enter the details of the new invoice.

Avatar
Discard

You can upload invoices straight from the system by clicking on the UPLOAD button. In order to create new customer invoices, https://gbplus.net/download-gbwhatsapp-apk/ select the CREATE button. A new Invoice window will appear on the screen. Here, you will have to enter the details of the new invoice.