Odoo - Hide a group or page in inherited view without name - odoo

I am trying inherit base.user_groups_view and base.view_users_form to hide some information which is not useful in my case.
base.view_users_form
I want to hide Preferences tab completely but this page have a string and doesn't have a name attribute that's why when i try to find out this page it says cannot locate in parent view and if i try to search using string attribute it says View inheritance may not use attribute 'string' as a selector.
base.view_users_form
Same a above when i try to hide Application spearator it says View inheritance may not use attribute 'string' as a selector.
How to hide these when we are in inherited view
Edit
I am using Odoo 10 Enterprise

In odoo 9 it is impossible to use 'string' in xpath expressions. In your case you should use an index. For example:
<xpath expr="//page[3]">
<!-- your code -->
</xpath>
This will search the third element that is a page in your view.
You could visit: xpath_string for more information.
I hope this help you!

Related

Expose fields of child on parent view

It seems like its impossible to expose a field via child-navigation (one2many child) onto a parent view (e.g. tree view).
Parent-View:
<field name="child.child_field"/>
Doesn't matter if type of child_field is simple or complex, the error is always:
Error while validating view. The field child.child_field doesn't
exist.
Is this possible in ODOO 13 or not?
Best regards,
Lars
You have to define related field in parent model first. For e.g. related_child_field = fields.Char(related='child.child_field'). Then, use that field in view <field name="related_child_field"/>
I tried to do the same when I started with odoo. You cannot use dotted notion to child field in odoo list view, form view, etc. It is not just in odoo13, it also does not work in odoo11 which I usually use. So, I guess it will be the same for earlier versions.
As you can see in the views documentation, the field renders (and allow edition of, possibly) a single field of the current record.

Using Big Commerce Product Custom Fields in Templates

I have come to a road block in my search to the answer to using custom fields in templates.
I have tried adding
%%SNIPPET_ProductCustomFields%%
in the ProductDescription.html but nothing shows.
Is there ANY documentation about this?
Can this snippet be used in certain places only? if so which ones?
What needs to be in place for this to display in the products description?
Any help, tips or pointers would be great.
The CustomFields Snippet, %%SNIPPET_ProductCustomFields%%, can only be used if being referenced through its own Panel.
By default, the Panel that calls this snippet is named %%Panel.ProductOtherDetails%%
You can also create your own custom Panels by uploading them to the Panels folder via WebDav.
For example, if you created a template file called CustomFieldsPanel.html, you would upload it to the /dav/template/Panels folder, and reference it in your theme by %%Panel.CustomFieldsPanel%%
To answer your question though, you can do one of the following to display Custom Fields in the Product Description:
Insert it into ProductDescription.html via its default Panel - %%Panel.ProductOtherDetails%% - modifying it by editing the template file ProductOtherDetails.html
Create your own custom panel, include the Snippet within that same custom panel, and insert it into ProductDescription.html by the custom panel's name. An example of that file might look like so:
<!--
* /dav/template/Panels/MyCustomFieldsPanel.html
* %%Panel.MyCustomFieldsPanel%%
-->
<div id="MyCustomFieldsPanel">
<h1> Custom Fields Below </h1>
%%SNIPPET_ProductCustomFields%%
</div>
Hope this helps :-)

Piranha- Custom Manager Area

I created a custom page in the manager area and would like to add the text area for editing HTML content. I can't seem to figure out how to reference the existing control. Thanks
To create an HTML-editor, follow these steps:
1: Include the partial view that sets up the html-editor
#Html.Partial("~/Areas/Manager/Views/Shared/Partial/TinyMCE.cshtml")
2: Add the class editor to your textarea
<textarea class="editor"></textarea>
That should do the trick.
Regards
/ Håkan

Make button text A/B testable - Sitecore MVC

I have an MVC/angularJS page with a button, the button needs to call code to process the current page and proceed to the next step in the application, but they want the button text to be a/b testable with different variations. I'm new to Sitecore so am struggling to know the best way of doing things.
I thought of having a simple text component/template which just has a single line text property, but if I add that to the page template then it doesn't seem a/b testable because when you click on the test option it asks you to select content. Whereas the content was text they entered as part of the page template.
The only way I know of making a/b testable content so that they can click on the page in page editor and choose to select content / add test variation. I wouldn't add the button to the placeholder as it needs to call specific angular code and always be there, but should I be adding a placeholder where the text is? It seems like overkill to have to define a placeholder there, define a rendering, create a partial view, define placeholder settings to limit it to the simple text component, and then hope they don't try adding multiple items to the placeholder.
I would make a separate template (ie with the text field for your button) to represent your form, then either create the two test variation items as children of your page, or maybe place them in a shared components folder outside of your 'home' node.
EDIT
In order to move your form component into a new A/B testable component you would need to create a new Sublayout in Sitecore, then create a new ascx control for the sublayout. In the Page_Load handler of this control, you would use the following code to retrieve the datasource of the sublayout:
//assume you have a button on your usercontrol called btnSubmit
//assume your template has a single-line text field called 'SubmitButtonText'
Guid dataSourceId;
Sitecore.Data.Items.Item dataSource;
if (Guid.TryParse(sublayout.DataSource, out dataSourceId))
{
dataSource = Sitecore.Context.Database.GetItem(new ID(dataSourceId));
btnSubmit.Text = dataSource["SubmitButtonText"];
}
So I created a new template which just had a single line of text as a field, and added a content item in a shared data node.
In my partial view:
#model Digital.Models.SimpleTextItem
<button ....>
<span class="hidden-xs">#Model.SimpleText_Value<br></span>
</button>
In my main page - I was trying to statically bind it so that they could only change content rather than add new controls to the placeholder, but that only worked if I specified the datasource in this page.
Using a rendering, and in the page layout adding the rendering to the placeholder with a specified data source:
#Html.Sitecore().Placeholder("PremiumQuoteApplyNowPlaceHolder")
Not sure if it was the best approach but it achieves what I need it to.
A/B testing could be applied only to controls(XSLT renderings, sublayouts, action controller renderings, view renderings). If you want to make A/B testing only for button then you should create additional control for it as you did.
Technical details for MVC: A/B testing is applied on mvc.customizeRendering pipeline where rendering arguments are processed. This pipeline operates on renderings level. It means that you are not able to create A/B testing for particular field(button) without your own customization.

OpenERP 7.0 xml tag <group> explained

As far as I know there was fundamental change of xml tag <group> between versions 6.x and 7.0. Could somebody explain or point to a resource where I could read how this tag behaves in OpenERP 7.0?
I haven't seen a definitive doc although I vaguely remember reading something on Launchpad but I can't find it now. The developer docs have this:
Technically, the layout of forms version 7.0 is different than former
versions. There is no longer a default “grid” layout; instead the
layout is more based on HTML and CSS. The following conventions are
now used:
The elements <form> and <page> no longer define groups; the elements inside are laid out inline. One should use explicit <div> or
to create blocks.
By default, the element <group> now defines two columns inside, unless an attribute col=”n” is used. The columns have the same width
(1/n th of the group’s width). Use a element to produce a
column of fields.
The element <separator string=”XXX”/> on top of a group can be replaced putting string=”XXX” inside the <group> element.
The element <field name=”XXX”/> does not produce a label, except when they are directly below a <group> element. Use <label for=”XXX”/>
to produce the label of the field.
I have found sometimes I need to define a top level group inside the form and then use groups inside that with the regular col and colspan attributes. Possibly the best is to find a form that matches what you are trying to achieve and see how it does it.
There is also the new, annoying sheet attribute as well, I just don't understand this one (I mean I don't understand why, I know what it does).