콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
5482 화면

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.

관련 게시물 답글 화면 활동
1
3월 15
7720
1
6월 25
2522
0
11월 23
1413
1
4월 20
3626
1
5월 17
5641