Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0] Error translate marker month name #1160

Closed
Bilbonet opened this issue Dec 16, 2024 · 4 comments · Fixed by #1169
Closed

[15.0] Error translate marker month name #1160

Bilbonet opened this issue Dec 16, 2024 · 4 comments · Fixed by #1169
Labels

Comments

@Bilbonet
Copy link

Hello @victoralmau
Since this change #1153
I have this error generating recurring invoices.

File "../contract/models/contract_line.py", line 613, in _translate_marker_month_name
return months[month_name]
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "../server/odoo/http.py", line 658, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "../server/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
KeyError: 'diciembre'

Thanks

@Bilbonet Bilbonet added the bug label Dec 16, 2024
@victoralmau
Copy link
Member

@Bilbonet
Copy link
Author

Bilbonet commented Dec 17, 2024

Hello

I think the problem is here:

https://github.com/Tecnativa/contract/blob/85ae222dd3593ebb43f61b89826c196fe4495de8/contract/models/contract_line.py#L626

If your locale is in other laguage the name of the month doesn't much. You need to use locale for ensuring that the name of the month is always correct.

import locale
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')

first_date_invoiced.strftime("%B") = "december"

victoralmau added a commit to Tecnativa/contract that referenced this issue Dec 20, 2024
Related to OCA#1153
Fixes OCA#1160

Use the month number to set the text of the month and avoid problems according
to the language defined in locale.
@victoralmau
Copy link
Member

This can be closed, it is already solved #1163

victoralmau added a commit to Tecnativa/contract that referenced this issue Jan 7, 2025
Related to OCA#1153
Fixes OCA#1160

Use the month number to set the text of the month and avoid problems according
to the language defined in locale.
@rousseldenis
Copy link
Contributor

@Bilbonet Could you check ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants