Custom report translation in OpenERP - report

Basically all the reports are changed language as per the customer language in OpenERP 7.0. But I have customized a new accounting report as same as default accounting(invoice) report.
While printing my custom report that is not translating based on customer language. Please help to solve this. I am trying this more than two days and not yet any solution.
Note: I have also used setLang function in my report.

Most probably the best solution is to add the i18n folder to your custom addon. In there you add the appropriate .po file and the trick is done.
Remember to add:
folder called i18n
In there
file module_name.pot
file language.po (example it.po)

Salam !
just make [[ setLang('code_lang*') ]] up report
example for french country fr_FR
I hop that help you

Related

How do I add translation to custom templates in odoo 15

In odoo 15 I have created a custom layout template for an invoice report (PDF). This template contains some texts in German language. Where do I have to specify any translation of these texts so they are considered if the invoice is printed in e.g. English?
Activate debug mode.
You can find it in settings > translations > Transleted terms, and you search for your germans terms for translate them one by one.
You can set your template manually, settings > Technical > Email templates
and now you can edit the template. But this is a non-dynamic solution.
More dynamic way :
Use .po,.pot files in your custom modules. if you have computed strings in your template use the function "_" before.
Ex :
my_str = _("Hello, how are you")
afterwards, edit the '.po' file
Look at the documentation here:
https://www.odoo.com/documentation/16.0/developer/howtos/translations.html
Regards,

Customize IBM DiffMerge to export a custom Report

I am using IBM DiffMerge to generate a Report that shows all differences between two .cls files or .sbs files. I was playing with it and I saw that there is a filed in option menu that allows you to change the format of the report, but it implies some keywords, like $elemname to print the element's name or $elemtype to print its type $leftonly or $rightonly which show how many differences are in the left diagram or in the right one.
Now, I was wondering if there are more variables like those above, especially one that can print a component's GUID (unique ID in Rhapsody).
Thanks,
Daniel
I would expect that $GUID will give you what you're looking for.
Under the ReporterPlus installation folder there is a folder named Templates. In it you'll find a file named DiffReport.dpl which you can load it into ReporterPlus for editing like any other template. You must run Rep+ with a command line option so that it loads with the Diffmerge specific schema:
Reporter.exe /mode=dfm
After that you can load the Diffmerge template, and edit it to customize the output of DiffMerge reports. When you do, try adding $GUID into the output.
Regards, Simon

Webform submission: how to send the translation of a variable by mail

In a Drupal project, i have a basic weborm. As soon as the user submits one, an email is send with all the things he just wrote.
Example:
Imp_First_Name:%value[firstname]
Imp_Last_Name:%value[lastname]
Imp_City:%value[lastname]
Imp_Country:%value[country]
Imp_Email:%value[email]
Imp_Subject:%value[subject]
I have a problem on this line:
Imp_Subject:%value[subject]
Subject contains what the user have selected within a select list. My problem is when the website is set to chinese, all is written in chinese obviously but i don't want the chinese version to be sent. I need the english one.
For example :
In my webform, the user has the choice between 3 countries:
Afghanistan|阿富汗
Afrique du Sud|南非
Albanie|阿尔巴尼亚
I need the country name in latin alphabet ! How can i manage to do this?
thanks in advance for your help
It's a tricky one...
There is substitution and also two possible template layers. One comes from webform and second comes from mailsystem / mail handler module.
I'm assuming that the substitution is done before the template layer so the t() function should be applied either within a hook on that level or within the proper template file.
Debugging with XDebug would really help to solve the issue.

How do I add taxonomy terms using Drupal Migrate

I'm using the migrate module to copy data from several sources to a new drupal installation. So far, I'm able to replicate a lot of what I need from the examples provided with the module. I'm currently stuck on adding terms or taxonomy to newly created nodes. The example shows:
// These are related terms, which by default will be looked up by name
$this->addFieldMapping('migrate_example_beer_styles', 'terms')
->separator(',');
I've tracked down the migrate_example_beer_styles destination mapping and it seems to be the machine name for that taxonomy.
I've tried imitating this behavior with every variation of what my machine_name should be, but the terms never seem to get associated:
By id:
// where source breed_id is '1,100' - it finds mapped values accordingly
$this->addFieldMapping('breeds', 'breed_id')
->sourceMigration('BreedMigration')
->separator(',')
And, by name:
// where source breeds is 'Dogs,German Shepherd'
$this->addFieldMapping('breeds', 'breeds')
->separator(',');
Am I wrong assuming the destination mapping is the machine name for a taxonomy?
This version of the migrate module was released recently, I haven't found any other helpful examples on the web.
This question still seems to be getting some views, so I thought I'd add what else I've discovered. While the accepted answer works, you are able to map Vocabs on ID:
$this->addFieldMapping('Exact Case Sensitive Vocab Name', 'source_field_name')
->sourceMigration('ExactSourceClassName')
->arguments(array('source_type' => 'tid'))
->separator(',');
->separator(',') used for passing a delimited string of source ids. Obviously, leave that off if you're mapping an array of values.
I'm currently working with migrate module myself, and I agree that the documentation is somewhat wanting at this point. :)
The 'machine name' of a vocabulary is listed in the Vocabulary table, in the field 'module'. Try using that value. Do note that you need to feed the text into the mapping, not the ids.
This is my first post on stackoverflow, so I apologize in advance if this isn't the accepted way to submit more information concerning this issue...
I've been stumbling around with the Migrate module for the past few days and was looking for a way to do this in Drupal 7. I had a comma-delimited list of taxonomy ids within an XML field that I wanted to use, but every example I found was retrieving from an external class, or from a database source.
Anyway, through trial and error, I found that you can use a field within the migrate class, rather than reference an external term migration class.
$this->addFieldMapping('field_article_type', 'category_id')
->arguments(array('source_type' => 'tid'))
->xpath('/article/category_id')
->separator(',');
Check out the taxonomy csv import module at http://drupal.org/project/taxonomy_csv.
It was easy to use and did what it was supposed to and more.
I ended up only using the migrate module for importin gNodes and used this module for the taxonomy. It was a pleasure to use.

Changing the QTY label in Uber Cart?

How do you change the QTY (quantity) label in UberCart (in Drupal) without actually hacking the core components? I want the label to be be months, instead of qty.
You could use the String Overrides module. Here is an excerpt from its project page:
Provides a quick and easy way to replace any text on the site.
Features:
Easily replace anything that's passed through t()
Locale support, allowing you to override strings in any language
Ability to import/export *.po files, for easy migration from the Locale module
Note that this is not a replacement to Locale as having thousands of overrides can cause more pain then benefit. Use this only if you need a few easy text changes.
I once ran into a similar issue with Ubercart in another language (German), and we "solved" it by re-translating the string. The mentioned module should do the trick in your case.
I haven't used ubercarts, but I would guess there would be an admin section to do that. Else hook_form_alter() or hook_form_FORM_ID_alter() should be able to do the trick for you.
Unfortunately, there is no setting for this in ubercart.
Doing a search for 'Qty' (case sensitive, as there are numerous 'qty' in code) in the current ubercart-6.x-2.0-rc7 release gives seven matches:
3 in theme functions, which you'd need to override in your theme
1 in a form definition, which you'd need to change via hook_form_alter as googletorp suggested
3 in table definitions, which you'd need to change via hook_tapir_table_alter and/or hook_tapir_table_header_alter (see the hooks.php file in ubercarts doc directory for these)
So you should be able to implement your changes without changing the module itself, but given the amount of work involved, I'd try schnecks suggestion first ;)

Resources