How to open a FORM VIEW by using Server Actions? - view

Can I open a FORM VIEW via a button defined by using Server Actions?

Yes.
Both action types "Execute Python Code" and "Execute Several Actions" should work this way. The second one only when the last "child" action will be of type "Execute Python Code".
You have to set action in the python code of an action, to open a form view.
In Odoo 12 there is already an example with app "account" installed. The ID of that action is account.action_invoice_tree2 and the code looks like:
action_values = env.ref('account.action_vendor_bill_template').read()[0]
new_help = model.complete_empty_list_help()
action_values.update({'help': action_values.get('help', '') + new_help})
action = action_values
So Odoo is expecting a dictionary like you probably already have used in your module's code. But instead of returning a dictionary, you have to set variable action in server actions.
You can not only open form views, but also tree, kanban and so on.

Related

Is there a possibility to call a method from the internal visualisation?

I want to call the method directly from the internal visualisation instad of change a variable and call the method every cycle
I have tried different inputconfiguration also run st code
Errormessage onlineview
Method content
Button config
Yes it is possible, you need to execute the methods in a button event,like the picture.
Property of the button
You mentioned, you already tried to execute ST-Code in the visu. Could you please share some code, what you want to execute and how you linked?

Don't load table on first load Oracle ADF

Everytime my page comes up it executes the table query. I tried doing this,
https://blogs.oracle.com/shay/entry/preventing_queries_when_page_f
but it still happens. How can I fix this? I've tried setting the refresh condition to never, but then I can't get any data back. I'm using JDev 11g.
Thanks.
I can share how I did this in JDeveloper 12.1. I am not sure whether it works in 11g. Nor am I sure it's the best way to do it. But it worked for me.
The idea is to not prevent the initial query execution, but, rather, to make sure it happens quickly and returns no data. The approach is to set the initial query criteria in the View Instance of your Application Module.
This approach assumes you have at least one bind variable in your view object. If you do not, you will need to add one just for this.
Double click on the Application Module
Click on the "Overview" tab at the bottom
Click on the "Data Model" tab on the left, so that you are viewing the Data Model Components of your Application Module
In the "Data Model" tree on the right, click once on the View Object Usage ("MyObjectVO1", e.g.).
Click the "Edit..." in the upper-right corner of the Data Model tree.
Here, you can specify view criteria to be used initially for the page. So,
* Set an initial parameter that will (A) execute quickly and (B) return no data
Then, later, programatically reset the bind variables to correct values that will return data, when you are ready to let your query run.
The most simple way i know is to set up correctly "Refresh" attribute on iterator in the page definition.
To do that set refresh=ifNeeded, then set RefreshCondition with expression language, something like this: #{viewScope.yourBean.refresh}
public class YourBeanClass {
private boolean refresh = false;
public void someAction(ActionEvent actionEvent) {
//some custom logic to set refresh flag
refresh = true;
}
public boolean isRefresh() {
return refresh();
}
}
With this code you can simply manage the moment when you need to refresh your model.
While these solutions will work to prevent the query from executing, I would ask what is the use case that a user sees a table appear on a web page without doing a search first?
ADF is built to query automatically because normally a web page will have an af:query or af:quickquery component on the page to allow the user to enter a query. Once the query is executed, the results are returned and populate the table or form (depending on the page design). Including either of these search components on the page will prevent the page from executing the query until the search is executed. You can also execute a query on entry to the page using a taskflow and adding an Execute operation from the data control to the navigation into/prior to getting to the page.
Note that Shay's blog post is from 2009 and covers the use case of not using a search component and instead uses Execute with Params. Is this what you are using? Saying more about your use case would be helpful.

Drupal Commerce Order object extra data

How might it be possible to get Commerce-Product-Display information in a Commerce-Order object?
The issue is I need to publish a Commerce-Product-Display node when a user has made a payment to publish the node. I am using Rules to detect the payment and attempt to publish the node.
My problem is, because the Completing the checkout process Rules event only has data for a Commerce-Order, and the Commerce-Order does not have information for the Product nor the Product display, I am unable to publish the node.
OK, so here's my new answer based on the new info you provided in your question
=================================
So this is probably a little more complicated than you expected, but not impossible! Two things are important:
the line-items that are attached to your order will contain your products and
you will need to use a rule component, in order to be able to have an additional 'condition-action' combo inside your rule action
Here is how to do it:
In your rule that is triggered upon 'Completing the checkout process', add a loop in your 'Actions' section. You should see 'Add loop' right next to 'Add action'. We'll use this loop to iterate through all the commerce-line-items in your order: that's where the products are hiding
When configuring the loop, tell it to iterate through 'commerce-order:commerce-line-items' and either rename, or remember what it's going to call each line item as it goes through it.
Now - as it's going through each of your order's line items, we'll want to call an entire new rule with its own set of 'condition' and 'action'. The condition we need is to check that the line item contains the product you expect, and the action can be whatever you want - publish a node based on a certain field or whatever. In my case, the action will just be sending an email to prove I found a product. When we need condition-action sets within a rule, we need to create a rule component!!
Go to /admin/config/workflow/rules/components to create a new rule component to run for each of the above items. Click the 'Add new component' link at the top of the page
Select 'Rule' from the drop-down options, since this will be a component that contains both a condition and an action
Name the rule, and in the 'Variables' section, we have to let it know we're going to pass it a parameter to work with. In our case, it will be the commerce line item that is currently being iterated through.
Add two conditions to your component (or whatever checks you think are necessary). I added 'Entity is of type' => Commerce Line item and 'Entity has field' => commerce_product. So this runs for all my products at the moment.
The condition I set on my component is to send an email, and I filled in the following for the body of the email: [line-item:commerce_product], and it prints out the product's name beautifully in the email each time I've tested checking out!
But first - how do I call this component for each of my line item types after I save it?? Read on:
After the component is saved, Add an action to your loop:
From now on, at the very bottom of your actions, you'll see a brand new 'Components' section, and in your case, you should only have one now. Select it to call it for each item:
Last step will be to fill in the parameter to pass to this component, which is obviously the list_item you're currently on, or whatever the computer name of the current item was if you changed it.
Save and test!
Whew! It's a little complicated, but I hope it puts you in the right direction!
The way rules work in Drupal is that not all fields are shown for your entity by default in the actions. What you need to do is prompt Rules to recognize your object as a certain type of node in order for the Rule to add all of its appropriate fields.
You can do this either by
using the 'Content is of type' under the Node section check (and select your Commerce Display node type or
directly using the 'Entity has field' check under the Entities section to check for a specific field you want to use.
Either of those should prompt Rules to recognize the type of entity you're working with and populate the Actions with the necessary fields.
Let us know if this works!

Oracle Forms Builder - change to window in another form

We have two forms so far, and need to switch from window1 in from1 (which is login screen) to windowX in formX using button (trigger code below):
begin
show_window('windowX');
go_block('some_block_in_formX');
end;
This gives error FRM-41052: Cannot find Window: invalid ID
So question is, should I add formX into show_window parameter in certain way or is there another approach? Thank you.
Please note, that forms are in different files.
that forms are in different files.
If the forms are different files, you need to call the other form using open form/call form/newform - whatever suits your needs.
show_window/go_block sequence can be used only when you're moving to different windows/blocks of the same form - and the error message
error FRM-41052: Cannot find Window: invalid ID
is complaining that it can't go to that Window because it's in a different form.
Each form effectively has a private namespace for all its windows, blocks, items, etc - and your code always runs within the context of a single form.
To solve this, you'll need a form parameter, plus some code in the other form, e.g.:
in formX, add a parameter ACTION
in form1, pass the value 'XYZ' to ACTION
in formX, in the WHEN-NEW-FORM-INSTANCE trigger, check if :PARAMETER.ACTION = 'XYZ', and if so, do your show_window and go_block. Copy the same code to your WHEN-WINDOW-ACTIVATED trigger.
Of course, you'll need to think about the name of the parameter (e.g. ACTION) and value ('XYZ') that will make sense to people maintaining your forms in the future.

Changing Views in a Module pops me into the Admin Skin

This question has probably been the most covered question in all of DotNetNuke's lifetime but I'm going to ask it here in StackOverflow because I need an answer, a really good one that doesn't make me look the other way. Thanks in advance to all DNN experts.
I've researched many ways of making this work for me and i've seen Michael Washington's solutions (Panels, MultiViews, ...) and Will's (Strohl) blog post on DotNetNuke's personalization engine through setting SkinSrc which is useful, as well as reading through Default.aspx's code which has given me more insight, however, i'm still faced with the problem that calling EditUrl()/NavigateUrl() brings me to a page with a single module in admin skin or a page with nothing respectively.
The specific version is DotNetNuke 6.0.1 (DNN). This Module has 4 other views in addition to the main view which I desire to navigate through sequentially. e.g.
Begin Checkout -> Collection of Delivery Details -> Confim Order
Have you found a solution?
I want to achieve
1) Module loads with other modules around. No module isolation
2) Views in a module that don't Preload e.g. Page_Load in each view gets called when the Module loads up
Help!
Assuming you are asking this as the module developer, the solution is to not use DNN's mechanism for specifying a control. So, you can't use EditUrl or specify the ControlKey in the NavigateURL call (which both generate "ctl=mycontrol" in the URL). Instead you need to have your module display your various controls based on the Query String parameters. So, you'll generally have a control in your module who's primary purpose is to dynamically load other controls based on the query string. So, for instance:
You will start with your control that lists items. You'll have a "Buy Now" button for each item. The hyperlink for each item can be generated by calling
NavigateURL(TabID, "", "View=BeginCheckout", "itemid=" & id, "mid=" & mid)
2.) On the page load of the handler control, it looks to see if anything is specified for the "View" Querystring parameter. If not it displays the listing control, if so, it displays the corresponding control.
Dim controlPath As String
Dim path as String = "~/DesktopModules/MyModule/Controls"
Select Case Request("View")
Case "BeginCheckout"
ControlPath = path + "BeginCheckout.ascx"
Case "DeliveryDetails"
ControlPath = path + "DeliveryDetails.ascx"
Case "ConfirmOrder"
ControlPath = path + "ConfirmOrder.ascx"
Case Else
ControlPath = path + "ItemList.aspx"
End Select
If System.IO.File.Exists(Request.MapPath(controlPath)) Then
placeholder.LoadControl(controlPath)
Else
Throw New Exception("Unable to load selected template. Please go into module settings and select a list and details template.")
End If
Most of the advanced modules for DNN do something along these lines so there's plenty of sample code out there. I would guess some of the core modules do something similar. I adapted the code above from Efficon's Articles module for DotNetNuke.

Resources