Change field label/string - invoice

I'm trying to change field label/string on amount_by_group field that is showing total tax amount on Invoice form.
Tried to do it like this - using field attributes
<xpath expr="//field[#name='amount_by_group']" position="attributes">
<attribute name="string">Porez</attribute>
</xpath>
No luck, also tried to replace field with the same field but with string defined
<xpath expr="//field[#name='amount_by_group']" position="replace">
<field name="amount_by_group" widget="tax-group-custom-field" nolabel="1" colspan="2" attrs="{'invisible': [('amount_tax', '=', 0)]}" string="Tax"/>
</xpath>
I used methods described here (first two points in answer by Cybrosys) https://www.odoo.com/forum/help-1/change-field-label-through-python-149963
Does anybody have clue how to change that fields name? At the moment field label is "Neoporezivo" and I'd like to show it as "Porez".

What you tried is correct. It seems in your case, you have to update field translation.
When we load a new language, Odoo translates terms based on .po file given the folder i18n in the related module.
You can try first from the front end and if it works, you can override .po file.
Try this:
Active developer mode.
Go to Settings > Translations > Translated Terms
Find your displayed term and edit it with your desired term.
Refresh your page and check your form. It should update with the desired term.
EDIT:

Related

Localized multilingual wix installer Does not display the values of string in .wxl files in the correct language

I created .msi installer using wix toolset 3.10 . I had localized the installer to be multi-language (just one .msi file that display the language depending on the region settings of windows).
I had created da-DK.mst file and I used wisubstg.vbs to embed the language into the english .msi file so I have one multilingual installer works for both Danish and English but I got two issues
any strings that gets its values from the language files which is
WixUI_da-DK.wxl , does not display the correct language it always displays the default language value which is english
the other problem is that the built in strings cut off in the Danish language in some forms .
what is the problem here and how to fix it ?
This is My UI from the .wxs file
<UI>
<UIRef Id="WixUI_InstallDir"/>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<Icon Id="icon.ico" SourceFile=".....\Images\Img_app.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="!(loc.LaunchApp)" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<!-- end snippet -->
If your text is getting cut off you need to change your UI's dimensions.
Whatever control you are using to display that text make its width a bigger number.
I can't comment on the "Launch App Name" text always being English since there is not enough information about that UI Control or what text it is displaying. You would need to add some more information about the UI you are using.
Here's a link to the default dialogs for wix
https://github.com/wixtoolset/wix3/tree/develop/src/ext/UIExtension/wixlib
In the browsedlg.wxs you have this control defined.
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.BrowseDlgDescription)" />
unfortunately, Danish is rather long for the description here and so the installer cuts off the text and uses an ellipses.
I think the easiest way to fix this is to add a new wxs file to your project called AppNameBrowseDlg.wxs and just copy in the whole xml from here https://github.com/wixtoolset/wix3/blob/develop/src/ext/UIExtension/wixlib/BrowseDlg.wxs . You will need to change the <Dialog> Id to be "AppNameBrowseDlg" as well. Now you can make the width of the Description control bigger so hopefully the Danish text fits properly.
To use this new dialog you also need to add another wxs file and you can call it AppName_InstallDir.wxs which will be a copy of this https://github.com/wixtoolset/wix3/blob/develop/src/ext/UIExtension/wixlib/WixUI_InstallDir.wxs . Here you need to change the <UI> Id to AppName_InstallDir
Just change the <DialogRef Id="BrowseDlg"> to <DialogRef Id="AppNameBrowseDlg">
You'll also need to modify these lines
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
to reference your AppNameBrowseDlg
This essentially replicates the dialog and UI definition that you were using in your installer. In your Product, you just need to change the UIRef to be "AppName_InstallDir" and it will use your defined UI that replaced the default browsedlg with one that can hopefully fit the Danish text. I would also consider submitting a wix improvement here https://github.com/wixtoolset/issues/issues asking that the WixUI's browsedlg's description control is wider.
For your Launch text you're getting stuck with english because you are using the English msi as a base for the other languages. The way this checkbox has been implemented means you are hardcoding the english text from the property that the checkbox control's text value is set to. The way you are localizing the msi is probably creating multiple strings tables and selecting strings from the appropriate table at runtime. But, the checkbox doesn't get its text value from the strings table. Instead, it is from the value of a property which was set at to be the value of "LaunchApp". (Incidentally, if you used the Danish version of the msi as a base, this text would always be Danish).
We can fix this in much the same way we modified the Wix BrowseDlg. In this case we want to copy over the ExitDialog to AppNameExitDialog.wxs from here https://github.com/wixtoolset/wix3/blob/develop/src/ext/UIExtension/wixlib/ExitDialog.wxs
You will need to rename the Dialog Id to AppNameExitDialog and then we want to look at this control
<Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="190" Width="220" Height="40" Hidden="yes" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]">
<Condition Action="show">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT AND NOT Installed</Condition>
</Control>
you want to change it to the following
<Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="190" Width="220" Height="40" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="!(loc.LaunchApp)" />
Additionally, windows installer is unable to display the background of a checkbox automatically as any other color than the grey-ish one you see in the screenshot you linked. If you want to get rid of this grey behind the text, you can actually modify the checkbox control's width and height to be about the size of the checkbox itself and set the text to "". Then you need to add another Text control to the UI that goes where the Check box's text used to go. This way you would have not have any grey background behind the text. The downside of this is that you must click the actual checkbox to toggle whether it is checked or not whereas before you could click anywhere in the grey area.
Again, to properly reference this new dialog you need to go to your AppName_InstallDir.wxs file and change the ExitDialog references to instead be AppNameExitDlg and also change the one <Publish> referencing the ExitDialog.
Hope this helps. The git repository is very useful for understanding how wix really works under the hood.

Currency symbol in kanban view odoo 8

I need to add company currency symbol in kanban view.
<field name="company_currency_id" invisible="0" />
<field name="total_earnings" attrs="{'invisible':[('type_dashboard','!=','Total Earnings')]}" widget="monetary" options="{'currency_field': 'company_currency_id'}"
pls help
In your case basically currency_id it always part of company related field.
which is always part of company.currency model
first added that field in your kanban view file and make it as invisible
and that added your price field name using widget attribute.
<field name="currency_id" invisible="1" />
<field name="amount_total" nolabel="1" widget="monetary" options="{'currency_field': 'currency_id'}"/>
hear you can easily got the currency field after and before of field as per you are defined in your currency direction configuration for each currency.
amount_total is our price field we will get easily that field with currency configuration.
I hope my answer may helpful for you :)

Including Empty Text in TFS HTML Field (TFS 2013)

I am trying to add default empty text to an HTML field in TFS 2013. I am doing this by updating the "EmptyText" attribute for the field in the Layout options (using Process Editor).
However, regardless of what I enter here, the intended text is never displayed. It is always empty. I have the same issue with both HTML & Plain Text fields.
Is this a fundamental limitation of TFS? Or am I specifying this incorrectly?
I am not using a DEFAULT rule because I want the user to notice that the field is empty and be required to enter a value.
I can get it work correctly. Two changes made:
Edit the "Empty Text" attribute just as you mentioned above (in my case I create one custom HTML field called Custom.DetailHTML):
Add Required rule to this field to define that this field must be specified with a value:
<FieldDefinition name="DetailHtml" refname="Custom.DetailHtml" type="HTML">
<REQUIRED />
</FieldDefinition>
If you still can't get it work, please show your WIT file.

How to change the number pattern in gsp?

I have one domain class which has one numeric field. Default scaffolding generated it. When I enter a number with more than 3 digits, ex:- 1234, then in show.gsp and list.gsp it shows as 1,234. My requirement is to show the number without comma. I can't use g:formatNumber because I have more than 50 domains and not able to use this tag for every gsp page. Is there anything I can do to change the number pattern globally?
thanks
maybe solution suggested here can be useful
Get the field directly like:
<td valign="top" class="value">${formulationTypeInstance?.id}</td>
Of course you may lose some of the tag's features with it, like highlighting field when a validation error occurs. But you're in show.gsp and it shouldn't have text fields or something to submit, so you lose nothing! Simple is the way to go here. =)

Formatting hyperlink as a picture in a custom list schema

In my custom list XML I added a few URL fields. one of them has to be displayed as a picture just like when you select "Format URL as: Picture" in the fields settings of the UI.
In the customList's schema.xml I haven't found any place where to override the html markup for a URL type.
Any help or clue is welcome :)
Thanks,
teebot
Try changing the Format property of the relevant fields xml Schema.
Get a copy of SharePoint Manager to try it.
<Field ID="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}" Name="URL"
SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="URL"
Group="Base Columns" Type="URL" DisplayName="URL" ColName="nvarchar3"
RowOrdinal="0" ColName2="nvarchar4" RowOrdinal2="0" Format="Image" Version="1" />

Resources