What it use and functionality of "Synchronize Translation" in OpenERP? - odoo

I found Synchronize Translation in Application Terms under settings. It'll will be visible when we enable Technical Features. I have synchronized the language by selecting both English and French. But it doesn't made any change in Translated Terms. I don't know how it works and what it'll perform.

Purpose of that action is to update translation fields with new fields that you potentially added in your module (or changed/overrided).
Potential cases: if you create new module and add new fields on some object, or create new .rml file etc.
For example: add field with string (name) on eng base 'technical_description' and after sync with french you will get that field in view so you can translate it :)

Related

Use Piranha CMS Manager editor in application for other users

I am trying to create some dynamic forms using Piranha CMS. As far as I managed to learn it is not supported right now, so I'm looking for work arounds or alternatives.
What I want to do now is use the editor from the manager for other users. To be more precise: this is how the editor looks like inside my manager when I want to edit a page
I have a text input and a select, both are Fields and there are many more fields to be used.
I want the sys admin to create a page with a list of inputs like this, which right now are usable only by the admin. BUT make this list of inputs available for edit to other users as well. Is it possible?
I'm not sure how to extract this editor or behavior or even if it is possible. The problem is we really need the admin to be able to configure different form inputs for users as it is the main core of our functionality.
Any help/advice is highly appreciated, thank you!
The components in the management UI is not designed to be reused in the front-end application in any way. The edit models in the manager contains a lot of extra meta data since the UI is completely generic. If you want to build an edit UI in your front end application, and you're using MVC or Razor Pages, the simplest way is to.
Get the generic model instead of your strongly typed model, for example api.Pages.GetById(...) instead of api.Pages.GetById<T>(...).
Loop the available fields in your selected region (a region is an ExpandObject which can be casted to an IDictionary<string, object>).
Use the built in support in Razor by calling #Html.EditorFor(...) for the fields.
Using this approach you can easily create your own EditorTemplates for the different types of fields you use that will match the rendering in your client application.
Best regards
Håkan

UML use case diagram for note saving application

i'm new to system modeling and i have some problems expressing my ideas into diagrams especially into use case diagram because of the lack of dynamic interactions let say.
precondition : user must be connected
specifications
user will be able to view all his notes(in the home page kinda).
user can check a specific note and modify it by changing its title or its body or both.
user can access create note from the home page.
he must add title and body and at least one tag.
user can access create tag from create note page and from the home page.
when saving and returning to the main page system should save the note into backend.
when creating a tag user must enter the label and specify the color.
Questions:
1- is this a valid use case diagram for it?
2- should i add an association between the backend and create note and create tag?
No, that's not really a valid UC diagram. UCs are about added value. You started functional decomposition (like most people try when starting with UCs). A UC represents a single added value the system under consideration delivers to one of its actors. Here you have a note which for which you have CRUD. Unfortunately that already gives one a pain. Is the added value a general Manage X or is there a fundamental difference between Show and the editing? That depends on the context and there is no general answer to that. However, you do not describe steps you take (actions; like enter xy) or various scenarios (activities) as single use cases. You need to try to synthesize as much as possible in a single UC to show added values. This is difficult for techies.
As a rule of thumb: if your UC diagram resembles a spider web then your design is likely broken.
As always I recommend to read Bittner/Spence about use cases.

how do I force a field to be translated in my Odoo code?

I am developing a module for electronic invoicing, and should express the payment term in spanish, so I am setting a dictionary with all the needed fields, and when I do this:
{
...
'FmaPago': inv.payment_term.name,
...
}
The output file contains the value "name" in english. I've tried something like
_(inv.payment_term.name)
but with the same result.
How should I force the value to be expressed in a defined translation?
The field name of Payment Terms are already translatable. You can change the translation in Odoo by clicking the little button within a field in edit mode.
If you've done that correct, you have to avoid some typical mistakes at code side if you use the old API.
always pass the context
e.g. if you browse the invoice, pass the context, to get all translations correct
use partner language if you want to translate for them
Odoo is using user language in his context, to translate the web client correctly. If you print documents for customers, you want them in customer language of course...
So you maybe need to manipulate the context (key 'lang'). For new API you have to call with_context() to do that.
You must use _() for strings that you want to be able to translate.
You must make translating files *.po (as i remmember) and thats all I think.
Dont forget to check documentation link

Avoid creation of objects through SAP GUI

As a tester, I'd like to know whether it is possible to restrict the manual creation of new objects by the user. The restriction should be done programatically in ABAP, not by removal of permissions.
Background information: we have quite complex objects which are hard to set up manually. Therefore we have implemented a wizard, which does all the condition checking etc. when creating the object. Also, if the wizard shall work, the user must have appropriate permissions to create the object.
Is it possible to remove the object type for that complex object from the list which appears when creating a new object (pressing the New button)?
As I'm only a tester for this part of our software, I can't show any existing code. I just got the feedback "It's not possible" and that's hard to believe for me at the moment. Usability really suffers, because people try to create those objects manually and can't make it work.
I also don't need a working code example, just a hint (class or method or setting) for the developer where to find a solution. I'll then insist that he implements it :-)
Update
Today, the user can click the "New" icon. Then, a dialog appears with 4 choices. 3 choices are for simple objects which he shall create like this. However, the first item in that list is for the complex object, which is impossible to create manually (why we have the wizard). I'd like to know whether it is possible to remove that item from the list programatically.
ᵺṓᵯᶏᵴ, the information you have provided is still a bit vague. However, here is an idea that may work for you.
It might not be possible to completely automate this process, but you could ask your developer to enhance the code that processes the New button, so that it would reject any attempt to bypass the wizard for the first item on the list.
Your developer can tell you if it is feasible in your case, to have the enhancement raise an error (message of type E) to stop the user from proceeding.
This would have to be combined with end-user training to tell people to avoid the New button for that item, and use the wizard instead
ᵺṓᵯᶏᵴ, it looks like a custom dialog so it should be possible to remove it the option, alternatively if it is a standard dialog in a SAP app there is always a way to restrict it, it can be as simple as disallow entry from specific transaction codes. for example the developer could set a variable at the start of the wizard and then check for that variable when creating the object, if it not there he can show a dialog "Please use the Wizard we carefully crafted for your use......" Ok maybe you wont say all of that but you get it.
So the answer to your query is yes it can be done but the approach will depend on what it is your changing custom or standard object etc,.
Later..

How to add a custom field provider to MS Word?

Foreword: I want to allow users to define high quality document templates and then inject there data from our information system and print the result. I think MS Word is a great starting point, because this work is aimed to business letters etc., not data reports.
Question: Is it possible to add a custom field provider to MS Word?
I don't have English MS Word, so I must try to describe what I mean in a few sentences. Normally we can insert "fields" like author name, current date etc. These fields work seamlessly. We can switch view of fileds between data and definition. Definion of author field looks like this: { AUTHOR \\* MERGEFORMAT }.
Now I want to inject external data into documents and let user specify where to put them. A user should define a document template and mark spots where external data should be injected. Since Word users generally aren't IT experts, the easiest way for them is to use some macros or "insert field" option to do it. So I want to define my own set of fields and connect Word to my custom field and data provider. How to do it? I am unable to find any documentation on this.
I think this approach is better than using sql database connection or something like that, because I want to let the external source define list of known fields and their values, not the docx document itself. Also, data source won't actually be an sql database.
Yes you can do this by using Custom Document Properties as placeholders and then use some VBA code to set those properties to whatever you want. You can get the data via ODBC or from an Excel spreadsheet or from a text file.
First of all, experiment manually by going into File, Properties and creating some custom properties. Give them a value and then, in the document, insert some DocProperty fields. If you can't find DocProperty in your language version of Word then look through a list of the fields like Author etc. Since field names are visible to end users they might have been translated.
Then in order to complete your document template, create a VBA function that uses SetProperty. Read this article for more details. It is up to you whether the VBA is triggered by opening the file or whether you add a menu item to do that.
No need for special controls or any commercial add-ons. I'm going to add a VBA tag to your question since this is really a VBA programming question. In fact, this has been possible since Word for Windows 1.0.
Using SetProperty in VBA is a bit more complex now. I got the following snippet of code from this forum posting.
object docProps = wdDoc.CustomDocumentProperties;
Type docPropsType = docProps.GetType();
object Prop = docPropsType.InvokeMember("Item",
BindingFlags.Default |
BindingFlags.GetProperty,
null, docProps,
new object[] {propName} );
Type PropType = Prop.GetType();
PropType.InvokeMember("Item",
BindingFlags.Default |
BindingFlags.SetProperty,
null, docProps,
new object[] {propName,propValue} );
Absolutely, this is the exact kind of scenario that Content Controls and CustomXMLParts were built for (Word 2007/2010 only, not earlier .doc format).
Most of the Word Developer Center home page deals with these two: Content Controls and CustomXMLParts. If you go this route, you'll find the Word Content Control Toolkit an invaluable resource as well, especially when just starting out.
From an end-user perspective, it could be as simple as just creating buttons on the Ribbon for insertable Content Controls via a template or document add-in (VSTO or VBA).
If you want a fairly decent prebuilt solution, check out Windward reports.
Yeah, the name makes it sound like a reporting tool, but in reality, it's exactly what you're describing. They have a Word add in that allows users to easily mark up a word doc with fields to be inserted from your data source.
I built a very similar system for a law firm. Windward didn't do quite everything I needed it to do, but at the same time, it's pretty powerful.