Skip to Content
Menu
This question has been flagged
546 Views

I have an issue with def _get_deferred_tax_key(self, line, tax_key, tax_repartition_line_id): at "enterprise/account_accountant/models/account_move.py line 510. I was having this error in my log when I was trying to enter to some invoices:

TypeError: odoo.tools.misc.frozendict() got multiple values for keyword argument 'deferred_start_date'

but I found that the new commited function _get_deferred_tax_key has no validations for deferred_start_date and deferred_end_date

@api.model

def _get_deferred_tax_key(self, line, tax_key, tax_repartition_line_id):

if (

line.deferred_start_date

and line.deferred_end_date

and line._is_compatible_account()

and tax_repartition_line_id

and not tax_repartition_line_id.use_in_tax_closing

):

return frozendict(

**tax_key,

deferred_start_date=line.deferred_start_date,

deferred_end_date=line.deferred_end_date,

)

if tax_repartition_line_id: 

​return frozendict( **tax_key, deferred_start_date=False, deferred_end_date=False, )

 return tax_key

as it used to have in before commits (specifically at b567c56 commit) like this:

@api.model

def _get_deferred_tax_key(self, line, tax_key, tax_repartition_line_id):

if (

line.deferred_start_date

and line.deferred_end_date

and line._is_compatible_account()

and tax_repartition_line_id

and not tax_repartition_line_id.use_in_tax_closing

):

# Asegurarse de que las claves no existan en tax_key antes de asignarlas

updated_key = {**tax_key}

if "deferred_start_date" not in updated_key:

updated_key["deferred_start_date"] = line.deferred_start_date

if "deferred_end_date" not in updated_key:

updated_key["deferred_end_date"] = line.deferred_end_date

return frozendict(**updated_key)

if tax_repartition_line_id:

# Asegurarse de que las claves no existan en tax_key antes de asignarlas

updated_key = {**tax_key}

if "deferred_start_date" not in updated_key:

updated_key["deferred_start_date"] = False

if "deferred_end_date" not in updated_key:

updated_key["deferred_end_date"] = False

return frozendict(**updated_key)

return frozendict(**tax_key)

when I added the validations again to my latest commit, it worked and the error disapeared. I think without the validations might be overweriting those variables so thats why the error. Please check it up because we had a lot of problems trying to see some old invoices.

Greetings!

Avatar
Discard
Related Posts Replies Views Activity
1
Apr 24
982
4
Apr 24
2061
1
Apr 24
1470
5
Apr 24
2112
1
Jun 23
6885