Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3 Antwoorden
5470 Weergaven

Hello everyone
I made an overwrite on the create method function of the invoice lines in odoo 11. It sets the taxes in the field invoice_line_tax_ids based on another criteria. The thing is, after the creation of the invoice lines is done, in the database these results are all stored successfully, but at the erp end they won't show up, it says the fields is empty - no records. There is no computation on this field(at least not one I can found), so I really can not figure why the results from the database are not showing up.

Here is the create function for reference:​

@api.model
def create(self, vals):
invoice = self.env['account.invoice'].search([('id', '=', vals['invoice_id'])])
country = invoice.partner_id.country_id.id
cg = self.env['res.country.group'].search([('country_ids', 'in', country), ('invoice_line_account_vat', '!=', '')], limit=1)

# sale order tax will decide which account will be added to the invoice line
so_tax = self.env['sale.order'].search([('name', '=', invoice.origin)]).amount_tax

if so_tax:
account = self.env['account.account'].search([('id', '=', cg.invoice_line_account_vat.id)])
if cg.invoice_line_account_vat.id:
vals['account_id'] = account.id
else:
account = self.env['account.account'].search([('id', '=', cg.invoice_line_account_no_vat.id)])
if cg.invoice_line_account_vat.id:
vals['account_id'] = account.id

line = super(InvoiceLineExpansion, self).create(vals)

print(line.invoice_line_tax_ids)
print(line.account_id.tax_ids)
line.invoice_line_tax_ids = line.account_id.tax_ids

return line


Avatar
Annuleer

Can you please share your code? This way we can find out whether the error lies within it or not.

Auteur

Thanks for your reply, I have edited the question with it.

Gerelateerde posts Antwoorden Weergaven Activiteit
1
mrt. 15
7719
1
jun. 25
2519
0
nov. 23
1412
1
apr. 20
3625
1
mei 17
5637