Openerp purchase order workflow 'confim order' action shall exit the edit mode - openerp-7

I am creating the new purchase order (quotation). While creating I click 'confirm order' before clicking. Ideally application shall save the order and move to confirm status and exit the edit mode (to read mode). (Expected way)
However, what is happening is, when I click 'confirm order' button, order will be saved and moved to confirmed status and keep the form in edit mode. (Wrong one)
It looks very simple. But I am missing some key concept.
Can some one guide me on this.

Thats the default workflow of openerp. Your order changes the state and has been saved as well but it doesn't change from edit mode.

Related

Saving a Work Order from an Automation Script in Maximo

I am trying to save a Work Order in Maximo through an automation script. My script triggers from an action launch point using the Assignment Table as the object. In my case a button labeled start under the assignments tab in work order is calling the script which is starting the assignment record and moving the status to INPRG, but then it does not save the Work Order itself. The user would have to click the start button, then click the save icon on the Work Order currently. I am trying to get the button to save the Work Order from the script, so they will not need to manually click save after hitting the start button.
I was able to get the result I needed by using getOwner() till I was at the Work Order level, then using getThisMboSet().save() from the owner. My button is now doing the things I need it to do to the Assignment record and saving the Work Order it belongs to when clicked.

Odoo: how to delete the saved model on cancelling/leaving form?

I have a form on odoo for scheduling appointments where the user clicks on a button to search available appointment slots.
When the button is clicked, the model is saved, that's how odoo works and I could not work around that.
But if the user gives up on scheduling the appointment, the model is already saved... So I need to delete it from the database if the user leaves the form, or clicks "cancel".
How do I do it?
A nice work around is to use The active field if this field is False Odoo by default will not show this record. and you can register a ir.cron to delete this records or leave them.
Hope you get the idea

Setting active a page(tab) in a notebook of form view

I'm developing a module for openerp v7.
I've defined a workflow and in my view defined a form with a notebook which contain as tabs as status defined in workflow.
In every tab i've a button which triggers the change of status of the workflow. All of this works like a charm!
The problem I am facing is that when the button triggers the workflow status change, the status changes but the tab marked as active is not changed, as far i know this is the expected behaviour, but i would like to change the active tab when the status of workflow changes and i didn't find any way to do it.
INFO: According to the DOCS there is a way of doing this with the fields:
default_focus: set to 1 to put the focus (cursor position) on this field when the form is first opened. There can only be one field within a view having this attribute set to 1 (new as of 5.2)
But no way with pages...
Any help would be very appreciated.
I think that making a tab to be active is not the expected behavior with a workflow. Normally, buttons are putted in the header next to the statusbar, and each button have the "states" attribute to define those status they must appear in (according with the "state" field of the model).
If you want to show/hide some information (say field, group, page, etc) according to the workflow status, you can use the "attrs" parameter with the "invisible" option restricted to a domain over a "state" field value.
If you want to use JavaScript, you can use this to focus a tab page:
$('.oe_notebook #ui-id-3').click()
Where ui-id-3 is the 1 based index of the tab page. Here it would be the third page. Works in v8, can't tell for other versions. Hope it helps anyway :)

Findrecord always go to first record before the good one

I got a problem with a form showing the follow ups of a proposal.
I made a form where you can navigate to the next follow up and the previous one.
The problem is that when I use the navigation buttons, it adds a follow up to the current proposal.
I realized that the follow up created is always the same one (the id is 83) and actually it's one made for another proposal. So every time I navigate, it updates this particular follow up and change the proposalId for the current.
here's the code for one of the navigation button:
Private Sub btnShowPrevious_Click()
Save
FindRecord "ID", txtParentID
End Sub
Because the wrong id is always the same (83), in the current form event I added an alert and found out that before to show me the good follow up, it always go to the 83 for a millisecond.
here are the steps to get this weird behavior
create new follow up and save
create his child and save
close the form
open parent or child follow up
use the navigation button
then it goes to the 83 before to show the good one.
If i press again any navigation buttons, it won't happen.
And if I don't close the form after saving and use the buttons, it works.
it's like if there's a default follow up id while he's looking for the follow up I request.
I don't know if it's clear.
I set the fetch defaults, the filter on load and allow filters properties to "No".
Also, when I open the form in view mode from the design mode, the default record is the 83.
so why when I do a findrecord it goes to the default record before to go to the good one?
EDIT
Finally, it's always the first record
Why it shows the first record when I do the findrecord before to find the good one.
Does anyone have an idea why this is happening
Thank you.
I got it...
I tested it in another project and while I was writing Findrecord I noticed some parameters were missing.
I checked and it was a method I made ( I don't remember why I made my own method for this)
There was a Me.Filter = "".. that was reloading the form to the first record.
Thank you

Wix - getting info from a Browse dialog for display in an Edit (not PathEdit) box?

I'm building an installer where a given page is asking for a directory. Unfortunately I'm not allowed (by the customer) to force an initial value into the entry (it must be blank), so using PathEdit is out--I have to use a raw Edit control. I've added a Browse button that invokes the BrowseDlg, but the question is: how to show the value entered in the browse dialog?
I've seen recommendations of duplicating the original page, since I can't update the original textbox on the initial page. While that seems workable, how can I get to the 2nd copy of the page? The button to open the Browse dialog invokes SpawnDialog. Doing it as a NewDialog looks really cheesy, and doesn't match the use of Browse dialog for the installation location, where it just pops up. But when the SpawnDialog returns, it just stays on the same page. There's no condition I could come up with that would allow me to add a NewDialog to go to the 2nd page, or to any other page for that matter.
Any ideas on how to proceed, so I can show the entered Browse value?
I suggest using a custom action and an edit box similar to this post. You can use a FolderBrowserDialog instead of the OpenFileDialog. It works for me, but upon a second install the field will be populated with the previous value.
http://community.saasgrid.com/developers/b/team/archive/2011/02/17/wix-managed-custom-actions-openfiledialog-example.aspx