Window action without having so select any record - odoo

First and for reference, what I call a window action is an action on the top of a tree view.
Example below:
Problem: if I select no record, Odoo tells me that I have to select record.
Question: I would like the action to be called even if there is no record selected: Is that possible?
Example: the action for instance will start a popup wizard, if a selection of record is done this selection will be preloaded, if no record is selected I will process myself the data preloaded.

The following context in the window action will allow it to be triggered even if no record is selected:
context="{'sidebar_without_id':True}"

Instead of Action menu you can put your own button inside control panel (e.g. beside create,import button)

Related

Close pop-up window after row selecting

I created a TableView with some data from database table. This view opens in a pop-up window.
When I select any row from the pop-up, my selected value is saved into some global variable.
How can I close the pop-up window after the row is selected? How to redirect to the view from where the pop-up was triggered?
Make this:
Create on_close event and put its name into lc_close var
Assign it to your table view click and to popup like this
<htmlb:tableView>
....
onRowSelection = "ON_CLOSE" >
</htmlb:tableView>
gr_pop_up->set_on_close_event( iv_event_name = lc_close iv_view = me ).
gr_pop_up->open( ).
Make in popup outbound plug named EXIT
Fire this plug inside itself recursively
method OP_EXIT.
me->fire_outbound_plug( iv_outbound_plug = 'EXIT' ).
endmethod.
This will close your popup.
You can save your value in a data base table or in a Singelton-Object.
What type of pop-up are you using? POPUP_TO_CONFIRM? Or a DynPro?
If it's the Function Module POPUP_TO_CONFIRM then just implement your logic based on a if statement checking the attribute "answer" of the FM.
If it's a DynPro then you need to add logic on the closing event. In a PAI Module.

Use command button to open selected record on a form without filtering?

I have a continuous form which displays a small amount of data from each record in my table ProjectT (i.e. project name, status) and a command button in the footer which I would like to open the selected record in its expanded single form (where all of the relevant info is displayed).
At first I set this button up using Access's wizard, but realized that Access opens a selected record by filtering the data on the form. The problem with this is that once the expanded form is opened, I want a user to be able to move to other records without having to select to unfilter the results. If I change the button on my continuous form to simply open the expanded single form, is there code I can run to make the form open to the selected record without putting a filter on?
Initially I thought to set the expanded form's (named ProjectF) default value to Forms!ProjectListF!ProjectID (where ProjectListF is the continuous form and ProjectID is the autonumber primary key for ProjectT), but this was not successful, I think because there is more than one ProjectID displayed on ProjectListF.
Another thing to consider is that I have another button on my Main Menu form which opens the ProjectF form in data entry mode to prevent the user inadvertently changing/deleting an existing record when they are trying to add a new one; I have no idea if this might be important when trying to find a solution to my issue.
I'm open to any suggestion--I have an okay handle on SQL, and have delved into a little VBA but am completely self taught. Any ideas? Thanks!
You can open the detailed form with this command:
DoCmd.OpenForm "ProjectF", , , "[ProjectID] = " & Me!ProjectID.Value & ""

Odoo Shortcuts, Is there any Shortcut for Search more for many2many_tags widget?

We all know that in form view if we click on Alt+Shift+E form view Edit mode shall be opened, Alt+Shift+S is going to Save the Form.
Like this is there an shortcut for Search more... option of Many2one or Many2many Tags?
In ODOO i have seen only these key till now:
For Simple CURD Operation :
Create a Record:accesskey="Alt+Shift+C"
Edit a Record :accesskey="Alt+Shift+E"
Save a Record :accesskey="Alt+Shift+S"
Discard a Record :accesskey="Alt+Shift+D"
For Iterating the records :
Move To Prev Records:accesskey="Alt+Shift+O"
Move To Next Records:accesskey="Alt+Shift+P"
For Switching the view :
Switch to KanbanView="Alt+Shift+K"
Switch to FormView="Alt+Shift+F"
Switch to ListView="Alt+Shift+L"
There is no other sort key till date in base.xml.
Hope this help you.

Save a user popup selection in a custom Automator Action

Using Xcode 5.* for a cocoa-applescript automator action.
Interface is a a simple popup menu that gets populated using an outlet with:
tell thePopupMenu to removeAllItems()
tell thePopupMenu to addItemsWithTitles_(theList)
When the action is used in a workflow (a Service actually), I want the next time it is run and the action dialog shows up (I will have "Options:Show when run" selected), I want the popup menu to change the selection to the last one that was selected. Right now, the default first item shows, even though last time it was run, the user selected a different item in the popup menu.
My thought was that I need to capture a change in the popup menu with a Sent Action handler, and then set some type of default. I have a working handler:
on thePopupMenuSentAction_(sender)
set popupValue to (popupSelectedValue of my parameters()) as string
-- save this selection somewhere???
end
What's the right way to save this? Do I use User Defaults? My Bindings are currenly all tied through Parameter object/controller. If I should use User Defaults, can someone give example code for setting up User Defaults, and then how to get and set a new value using Cocoa-Applescript?
If I can get the name string of the menu item saved somewhere, I can get the string and then change the selection of the popup menu in the
on opened {}
-- set up the action interface
end
handler which gets called just before the action is displayed each time.
Thanks for any help,
Joe
I did mine a bit differently. I will assume you are referring to what XCode calls a "pop up button" (somewhat misleading). I did not use the parameters at all, although that is probably better for larger projects. Have a look at the code:
script Insert_Picture_into_Powerpoint_Slide_Show
property parent : class "AMBundleAction"
property menuChoices : {"Insert a Beginning", "Insert at End"}
property menuSelection : missing value
if (menuSelection as string) is "missing value"
set menuSelection to 0 as integer -- sets default value
end if
end script
I bound Content Values to File's Owner and under Model Key Path I put menuChoices.
Then you just bind the Selected Index to File's Owner and for the Model Key Path type menuSelection.
Defaults
On the initial run, if the user does not click anything, the menuSelection will be missing value. Because I couldn't find a way around this, I created a conditional which tests for this and sets it to the first choice by default (the one that is shown when you add the action).
When the user selections one of the menu choices, the choice is remembered on sequential runs.

Gray out a form row's (detail's) button conditionally with VBA code

I have a standard form in MS-Access which lists a bunch of orders, and each row contains order no, customer, etc fields + a button to view notes and attached document files.
On request from our customer we should gray out the button btnAnm (or check or uncheck a checkbox) depending on a calculation from two queries to two other tables (a SELECT COUNT WHERE and a check if a text field is empty).
I've tried btnAnm_BeforeUpdate(...) and btnAnm_BeforeRender(...) and put breakpoints in the subs, but none of them trigger. The same if I use the control Ordernr instead of btnAnm.
I'd like a function in the Detail VBA code to be triggered for each "Me." (row) so to speak, and set the row's control's properties in that sub.
What do I do? I've looked at the help file and searched here.
*Edit: So I want to do something that "isn't made to work that way"? Ie. events are not triggered in Details.
As an alternative, could I base the value of a checkbox on each line on a query based on the 'Ordernr' field of the current row and the result of a SELECT COUNT from another table and empty field check?
Do I do this in the query the list is based on, or can I bind the extra checkbox field to a query?
A description of how to do this (combine a COUNT and a WHERE "not empty" to yes/no checkbox value) would be perfectly acceptable, I think! :)*
You cannot do much with an unbound control in a continuous form, anything you do will only apply to the current record. You can use a bound control with a click event so that it acts like a button.
Presumably the related documents have a reference to the order number that appears on your form, which means that you can create a control, let us call it CountOrders, with a ControlSource like so:
=DCount("OrderID","QueryName","OrderID=" & [OrderID])
The control can be hidden, or you can set it up to return true or False for use with a textbox, you can also use it for Conditional Formatting, but sadly, not for command buttons.
Expression Is [CountOrders]>0
You can also hide the contents and add a click event so that is acts in place of the command button. Conditional Formatting will allow you to enable or disable a textbox.
As I understand your question, you have a continuous form with as command button that appears on each row - and you'd like to enable/disable the button conditionally depending on the contents of the row.
Unfortunately you can't do that. It seems that you can't reference the individual command buttons separately.
Having wanted to do something similar in the past I came up with two alternate ways of setting up my interface.
Put a trap into the onClick code for the Button. Which is icky, because it is counter intuitive to the user. But it gets you that functionality now.
Move the command button (and editable fields) up into the form header, and make the rows read only. Your users then interact with the record only in the header, and select the record they want work with in the list below. As I recall this is known a Master-Detail interface.