odoo 12 show different forms based on state values - odoo-12

How to show different forms on odoo 12 based on state value. I want a switch between the states to alter the form as well while keeping the same tree view of course

you can't have two different form view based on the state from a single tree view. But you can control fields/groups/pages or other elements visibility based on state using the invisible attribute.

One could create a single form create different groups in the form or even further add different notebooks and pages whose visibility can be controlled using attributes and passing in a state change in a domain.

Related

SAPUI5: Create multiple forms for display based on number of elements in an array

I have an array which has too many fields to display inside a table. So, I was wondering, is it possible to have a pre-defined Form that can be generated dynamically for display? For example, if my array has 10 elements, 10 forms will be displayed to the user one under the next.
If this is possible what is the best way to achieve it? Eg. do we need to use a Component Container or Fragment? Thanks for your guidance.
D.
you could use something like XML Templates or build the depending UI part inside the controller.

Default Value for MultiInput in Smart Filter Bar

I am fairly new to the whole UI5 and Fiori world and maybe this is a simple problem.
So far I have created a fiori-elements list report using the SAP Web IDE.
Example Elements Application
In my smart filter bar are shown a few MultiInput fields to filter the data (see: Category field in Example).
For the Category Field I can choose contains and set a value and after I click on OK a Token is placed inside the field and I can Filter the data.
Now I want to prefill this field, so the user does not have to enter it every time.
I tried to add a token programatically by extending the controller and add a new token in onBeforeRendering
onBeforeRendering: function() {`
var multiInput = sap.ui.getCore().byId("...");
multiInput.addToken(new sap.m.Token({text: "myDefaultFilterValue"}));
// tried text: "*myDefaultFilterValue*" (contains)
}
As I would expect the token is visible, but if I click on "Go" the application behaves as if no filter is set.
Do I have to call some update mechanism or somehow use local annotations?
Variant Management might be the solution for your problem:
From the Fiori Design Guidelines https://experience.sap.com/fiori-design-web/variant-management/ :
===========
Intro
Variants store filter settings which have been defined within the filter bar. The filter settings consist of filter parameters, selection fields and a layout. This control enables the user to load, save, and change variants. In some cases, the table settings are also saved within a variant.
In the context of tables, this control is used to save, manage, and load table settings which include layout, column visibility, sorting, and grouping.
Smart variant management saves both filter settings and table layouts. It creates a page variant that includes all the controls. The button is located within the page header bar, and no secondary management is possible on table level.
Usage
Use the variant management control if:
The user needs to save and load different filter settings to find the relevant data.
The user needs to save and load different layouts (for example, a table) to display data in different views.
Use smart variant management if the user needs to save the page, including the filter settings and table layout.
===========
Please see also this blog https://blogs.sap.com/2017/03/23/annotating-and-extending-fiori-element-applications-list-report-part-3/ :
===========
Please note that we have other setting options at our disposal including the control of variant management for our List Report. Variant management allows for storing snapshots of a user’s setting when using your application such as filters within the Smart Filter Bar or visible columns within the Smart Table.
By default, the Smart Filter Bar and Smart Table each have their own variant (See above where both are set to “Standard”). If we use the setting “smartVariantManagement“: true we will now have a unified variant management area for our List Report where variants for both the Smart Filter Bar and Smart Table are saved together.
===========
You can try the below solution, here the key value will be sent to backend and text value will be displayed to user.
var multiInput = sap.ui.getCore().byId("...");
var otoken = new sap.m.Token({
key: 'myDefaultFilterValue',
text: 'myDefaultFilterValue'
});
multiInput.setTokens([otoken]);
Hope this helps you.

Is it possible to change the way a form loads with different data fields and values (Acces 2010)

I have Access 2010. I was wondering if there is a way to get the form to load different for every selection.
Example
Item A has 10 Rows and 6 columns of filled in data
Item B has 3 Rows and 2 Columns of filled in data
Both are from the same table.
Is there a way when a certain item is selected from a drop down menu to load, without having multiple forms, only the filled in data? Output would resemble Excel format.
Thank you in advance for any help.
Quick Answer (TL;DR)
Creating dynamically-generated form structure in MSFT Access can be done with sub-forms.
Detailed Answer
Context
MSFT Access
Creating forms
Problem
Scenario: Developer wishes to create context-specific form structure that depends on the query output.
Solution
Create one or more sub-form with attached VBA that changes dependent on the query ouput.
Connect the subform(s) to the primary form and load as needed depending on the context.
See also
https://stackoverflow.com/questions/tagged/ms-access+forms+vba
https://duckduckgo.com/?q=msft+access+dynamic+subform
How to dynamically load, access and unload subforms in microsoft access

AEM - adding a container and varying number of children

I have created a component, the new request is to add 3 or 4 of those components within a container. I understand I can just add a column control component and add the children as needed but the request is to go beyond that and add the children as the column control is updated. For example if you change the number of children to 3 the container will automatically add 3 of the original components that were created and so forth.
I have started working extending the Column Control - Sightly component and how I would like to add the children without having to manually add those.
The standard approach for inserting a varying number of components, is to include the Paragraph System Component (parsys), and then let the author insert the components he or she needs (can be limited to allow only specific components).
http://wem.help.adobe.com/enterprise/en_US/10-0/wem/wcm/default_components.html#Paragraph%20System%20%28parsys%29
Or is there a specific requirement that you need to be able to specify the number of components beforehand?

Making one input control affect the choices of a second input control

Using ireport I know how to make input controls but I have one issue that I wonder is do-able. I would like to have two input controls but I need one of them to be filled only by whatever the user picks for the first input control.
For instance, my first input control has 3 categories, from those 3 categories certain choices will need to show up in the 2nd input control's drop-down box according to whatever was chosen from the first input control.
Is it possible to have the choices be filled to the second input control in relation to what was chosen in the first?
Yes, it is. You can read about cascading input controls at JasperForge.