How can we export translatable fields content in Odoo? - odoo

In Odoo (16), I would like to export all my translatable fields content to a file so I can easily edit it and translate to new languages.
I already know how to edit one by one, in the screen, but for what is a growing set of data it will take more time that translate it using a proper program (example: PoEdit).
Here is part of my model definition
class Card(models.Model):
_name = "carddecks.card"
_description = "Card"
cardText = fields.Char("Card Text", required=True, translate=True)
And now I can also see the language icon in the Card form, so I can edit it there.
How do I manage to export a po file with all the content?
All I can get from Settings -> Translations -> Export Translation is a set of field labels. Not field content...
Any ideas on how to accomplish this?

In debug mode via Technical Settings there should be a menu item named Translated Terms

Related

Vue Storefront: Display labels for custom attribute filter instead of option id

I am trying to figure out from couple of days how to display label for filters on category page. As mentioned in document I have added attribute inside config.products.defaultFilters[] and the filter have started showing there.
I have color and brand filters. For color filters I have mapped color id to color name in config.products.colorMappings so it is displaying correctly there. But for brand I can do the same but it is a static solution so every time admin adds new brand I will need to add its mapping and build the storefront again.
I have tried to check their forum but nothing useful. I checked Vue Storefront vuex catalog and category-next stores for hint but cannot find anything related there.
The label for option under brand_filter should be readable but it is showing that brand attribute option's id
Ok, after spending couple of days finding solution to this problem, I finally got a hint from this answer.
I am using theme vsf-capybara, and according to its guide, to setup I generated a local.json from generate-local-config.js and I merged configuration manually from that local.json to config/local.json file. Prior to this there was no filter named brand or color added already to the main config file.
The config property responsible for the filter labels to be incorrect was entities.attribute.loadByAttributeMetadata and it was set to true I changed it to false because core/module/catalog/CatalogModule has one action attribute/list needs to be dispatched for application use. So if entities.attribute.loadByAttributeMetadata in config/local.json is set to true, this action will not be dispatched. Here is the excerpt from CatalogModule:
if (!config.entities.attribute.loadByAttributeMetadata) {
await store.dispatch('attribute/list', { // loading attributes for application use
filterValues: uniq([...config.products.defaultFilters, ...config.entities.productListWithChildren.includeFields])
})
}

Intellij shortcut to create code snippet for testing

Is there any shortcut/setting/plugin available in intellij where I can create test data structure with some default values ?
e.g.
Map<String,String> stringMap = new HashMap();
stringMap.put("1","A")
stringMap.put("2","B")
stringMap.put("3","C")
I dont want to type all of the above as I want to test very quick with any values.
You can use the 'Live Templates' functionality, for instance. A guide on how to create such a template can be found here.
Use live templates to insert common constructs into your code, such as
loops, conditions, various declarations, or print statements.
To expand a code snippet, type the corresponding template abbreviation
and press Tab
In the screenshot below, I created a custom template called smap in the 'other' template group, added your code to it and selected the language (Java) that this template can be applied to.
Once in the editor, I can type smap and a pop-up will appear suggesting me to use the existing template to replace the abbreviation with code. Hitting Tab or Enter will perform the replacement.

Drupal 7 - Print PDF and Panelizer

Hi guys ,
I'm currently working on a Drupal project which use the Panelizer module by overriding the default node display. The panel for this content type is made width a lot of rules and specifications in order to display some specific content (like views) according some fields.
Now I need to print in PDF the same content that is displayed by the panelizer module but in another display (in one column ), so I cloned the display I use and rearranged it to display what I want.Then I want to use this display width the print module but I didn't managed to do that.
Any idea how can I do that ?
I just can't use the default node render, because I would miss some informations dues to the specifications used in the panel, and I can't print the panelized content because it's not the same display.
I read this thread but how can I say to the print module to use the "print" display I cloned instead of the default one ?
Any suggestions or ideas will be appreciated or if you have another idea for doing that you're welcome :)
Thank you !
In your print pdf template you can load the node then create a view with the display and finally render it : drupal_render(node_view(node_load($node->nid), "name of your display")) ;
Another way is to alter node entity info, telling that 'print' view can be panelized, i.e.
/**
* Implements hook_entity_info_alter().
*/
function mymodule_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['print']['custom settings'] = TRUE;
...
}
After that, you go to panelizer settings of your content type(s), and set whatever you want for the print view mode

Fixed text when scrolling

My program displays an ABAP list, I'm trying to show a header (some lines of text, nothing fancy) fixed when scrolling down in a report.
Is there some kind of tag or declaration that I have to use?
In SE38 you can define list heading with 'GOTO -> Text Elements -> List Headings`.
You can define a list header, and titles for your list (Columns heading).
One advantage: With GOTO -> Translations you can define different texts in different languages.
Another way to get this maintenance screen:
From your list, you can choose: System -> List -> List Header.
Another way:
You can use top-of-page to define your header text inside your report code.
top-of-page.
write 'My header'.
You can use the TOP OF PAGE event to write something that will stick at the top of the page while scrolling. You can find more info here.
You can also use the list headers from Text Elements menu. More info here.
Best regards,
Sergiu
One way is directly using top-of-page in your code.
Other way is calling reuse_alv_grid_display or reuse_alv_list_display (depending on your output type) and declaring "top-of-page" in the I_CALLBACK_TOP_OF_PAGE line. Then create a sub-routine with the same name as your "top-of-page". In that you can write
wa_list-typ = 'H'.
wa_list-info = ''.
APPEND wa_list to it_list.
clear wa_list.
OR
wa_list-typ = 'A'.
wa_list-info = 'Report Header'.
APPEND wa_list to it_list.
clear wa_list.
OR
wa_list-typ = 'S'.
wa_list-info = 'Report Header'.
APPEND wa_list to it_list.
clear wa_list.
depending on what you want (header, action or selection).
Finally you can use REUSE_ALV_COMMENTARY_WRITE function and call the table(in this example it_list).
Hope it helped.

How to add an image to a SAP Adobe Form from the MIME repository?

I have loaded an image to the SAP MIME Repository:
Name: watermark100.bmp
MIME Type: Icon (Under technical information on the properties window. I didn't set this, I assume SAP defaults that in based on the file type when I upload).
Now I'm trying to display this image in a SAP adobe form:
In the Form Interface I have created a global Constant:
GV_IMG_WATERMARK TYPE STRING VALUE 'watermark100.bmp'
In the Context I have created a Graphic Node:
Name: WATERMARK
Graphic Type: GRAPHIC CONTENT
Field: GV_IMG_WATERMARK
MIME Type: 'icon' //I have also tried '.bmp'
Unfortunately, when I test the form, no image displays. Any idea what I'm doing wrong?
Additional Comments:
I can display the image by pointing to the URL & embedding it in the form, but that is not sufficient for what I'm trying to do. The image have to be loaded from MIME, and displaying the node will be conditional.
There seems to be a somewhat convoluted way where I can convert the image to an XSTRING and pass that to the form, I will probably try that next, but it seems overly complex for what I'm trying to achieve.
Ok I've solved it in the following way:
Changed the data declarations as follows: The URL just follows the tree structure in the MIME Repository
data: gv_bmp_watermark type xstring.
constants: gc_url_watermark type string
value '/BC/PUBLIC/MyImages/watermark100.bmp'.
In the interface under Code Initialization I added the following: (Note that you have to import & export the relevant variables using the interface at the top - you'll get a fairly self-explanatory compile error if you don't)
//* Read Images
data: lr_api type ref to if_mr_api.
lr_api = cl_mime_repository_api=>get_api( ).
lr_api->get( exporting i_url = gc_url_watermark
importing e_content = gv_bmp_watermark ).
The Context node only changed slightly:
Name: WATERMARK
Graphic Type: GRAPHIC CONTENT
Field: GV_BMP_WATERMARK
MIME Type: 'image/bmp'