Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
3 Відповіді
5471 Переглядів

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


Аватар
Відмінити

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

Автор

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

Найкраща відповідь

Did you get to solve the issue?

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
бер. 15
7719
1
черв. 25
2519
0
лист. 23
1412
1
квіт. 20
3625
1
трав. 17
5637