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

Translation filter on select field #101

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

raimonesteve
Copy link
Contributor

When render some fields in template, this fields is a option, not value (for example selected fields). Add new filter to translate values from ir.translations.

@raimonesteve raimonesteve deleted the translation_filter branch October 15, 2013 15:06
@raimonesteve raimonesteve restored the translation_filter branch October 15, 2013 15:10
@raimonesteve raimonesteve reopened this Oct 15, 2013
@raimonesteve
Copy link
Contributor Author

I test more about selected fields to get label and not option.

In some cases, key, value are not exactly and don't find all translated labels in translation_filter. For example:

sale.state: cancel, cancelled
invoice.type: out_credit_note, Credit Note

I think a better option is clone select options in template and get it:

{% set invoice_type = {'out_invoice': _('Invoice'), 'out_credit_note': _('Credit Note')} %}
{{ type[invoice.type] }}

@raimonesteve
Copy link
Contributor Author

I improve values from selection fields use Model.fields_get. Get values from selection fields is more easy than add conditions or dict in jinja template (need afeter to translate).

raimonesteve@8537342

I don't know if "translation_filter" is the best name of this method/filter. Feedback?

Details https://groups.google.com/d/msg/tryton-dev/JVCYVFlVtxs/GsZI-QGB810J

@raimonesteve raimonesteve reopened this Oct 17, 2013
@sharoonthomas
Copy link

@raimonesteve could you send the translation of select fields as a new patch please ? It is an important contribution which we could include before 3.2 release

@sharoonthomas sharoonthomas changed the title Translation filter Translation filter on select field Jun 13, 2014
@raimonesteve
Copy link
Contributor Author

Hie Sharoon,

I try to resend pull request but I get "Travis error field"...

You could import/export commit raimonesteve@8537342 or copy code in main nereid project. You are free ;)

@sharoonthomas
Copy link

Sure, we will try :)

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

Successfully merging this pull request may close these issues.

2 participants