Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4645 Widoki

Hi guys, I want to know the correct way to create one2many records which will trigger all the onchange and calculate properly, specifically on the accounting side

1. use create() function

2. use new() function

self.invoice_line_ids += self.env['account.move.line'].new({
'partner_id': self.partner_id,
'account_id': suggestions['account_id'],
'currency_id': self.currency_id.id,
'price_unit': suggestions['price_unit'],
'tax_ids': [],
})

3. use Command object

out_invoice = self.env['account.move'].create({
'move_type': 'out_invoice',
'date': '2016-01-01',
'invoice_date': '2016-01-01',
'partner_id': self.partner_a.id,
'currency_id': self.currency_data['currency'].id,
'invoice_line_ids': [Command.create({
'product_id': product_a.id,
'price_unit': 300,
'tax_ids': [],
})],
})


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
kwi 19
4087
1
mar 21
2694
2
kwi 20
4642
1
lis 17
4869
3
lip 20
18276