Odoo adding a Treeview web controller - treeview

I've been hammering away at this specific problem for at least 3 days and coulnd't figure out where I'm supposed to modify to add new action to a specific tree view.
Has far as I know, it's supposed to be a webcontroller but I don't know where to modify ( Do I do it in my .py or .xml file? )
Is there any way I can add a new action to this?
If you know any anwser please be as specific as you can, because there's is none about this that I could find helpfull.
Thank you for you time.

I managed to solve it myself:
1) Go to the xml file you want to modify the treeview
2) Add the following code
<act_window
name="New Sub menu"
res_model="<target.model>"
src_model="<source.model>"
key2="client_action_multi" <!-- This will make it show on the "More" -->
<!-- "client_print_multi" => Will make it show on the "Print" -->
view_mode="form"
target="new"
view_type="form"
id="act_new_sub_menu"
/>

Related

Vaadin & Spring Boot, Reset/Refresh a Component

I have many layouts that extends VerticalLayout. I am removing all of them from a main layout add adding one of them to the main layout, to change the "page". First, is there a better option to this ?
My main question is, since I am adding the same component created in another scope, the content of the layouts doesn't change until I refresh. I want it to change after I click the icon in the menu bar.
So what I am looking for is a method like component.refresh() or something like this.
How can I achieve this ?
What your missing is this:
1. You can not add one component to two or more parents. The moment you add a component to parent2, its removed from parent1 (You get to see this when you hit refresh)
2. You are not using #PreserveOnRefresh on your UI class

Why does the Orbeon custom control tutorial stop showing when I change the name?

I am wanting to create a number of custom controls in Orbeon. Having had (seemingly) random success, I decided to go back to basics and start with the Tutorial.
After reading through the tutorial, I copied the basic component XBL into a file, linked it up in properties-local.xml, restarted Tomcat, went into Form Builder and clicked on the new control and it inserted the input with the label and hint into a new grid box on the form as to be expected (yay).
(here is the part of the properties-local.xml file that includes my tool)
<property as="xs:string" name="oxf.fb.toolbox.group.other.uri.*.*">
oxf:/xbl/play/slider/slider.xbl
oxf:/xbl/play/betterInput/betterInput.xbl
oxf:/xbl/play/sample/sample.xbl
</property>
I then tried to change the element name from fr|tutorial-input to fr|tutoria-input as below (a nice easy change I thought).
<xbl:xbl
xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl">
<xbl:binding
element="fr|tutoria-input"
id="fr-tutoria-input"
xxbl:mode="lhha binding value">
<xbl:template>
<!-- Input points to the external single-node binding -->
<xf:input ref="xxf:binding('fr-tutoria-input')"/>
</xbl:template>
</xbl:binding>
</xbl:xbl>
After, restarting Tomcat, going in to Form Builder and clicking on the new control again, it inserted an empty new grid box (no input, label or hint). Looking at the source of the form, it has inserted the input (see below) and the label and hint resources, just nothing shows.
empty grid box
<xh:tr>
<xh:td>
<tutoria-input xmlns="http://orbeon.org/oxf/xml/form-runner" id="control-19-control"
bind="control-19-bind">
<xf:label ref="$form-resources/control-19/label"/>
<xf:hint ref="$form-resources/control-19/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</tutoria-input>
</xh:td>
</xh:tr>
I can changed the tutoria-input back to tutorial-input in the source code (without changing my code back), apply and it will show up in the form, so obviously it is running off the code included with Orbeon and using the magical something I am missing. I have even gone as far as to grep through the source to find all occurrences of tutorial-input to see if there was a file I was missing.
Please, what am I missing to get my tutoria-input custom control showing up as it should in Form Builder/Orbeon?
In order to be automatically found at runtime, components must be placed in folders named with the name of the XBL component. So in your case if you decide to name your component tutoria-input, you must place it under:
/xbl/orbeon/tutoria-input/tutoria-input.xbl

Loading default XSLTForms subform on body onload event

I'm trying to use subforms and I had a problem: I saw the example provided in the oficcial XSLTForms but in that case the elements that load/unload the forms are always in the "main form" and, in my case, I need them to desappear, because I'm trying to build something like a wizard, So the first subform must desappear when the user press "Next" and then subform2 is loaded, and so on. This presents two problems:
1) If I include the first subform elements in the "main page", when I press the trigger the elements of subform1 are never unloaded. The other subforms do it, but that initial one is treated as part of the structure that never changes... And I really need to desappear. SO I think I have to put all the content of subform1 outside, in a separate xml and load it in the same way as the other subforms, but there is another problem:
2) I need it be loaded by default, and I tryed to put a load element directly in the main form body, but it didn't work.
I "patched it" temporally with a trigger in the main form, which loads the firms subform, but it is so... ugly, and I still have the same problem: I can navigate through subforms but that initial trigger never dissapears... So, any idea will be welcome! Thanks in advance!
<xf:model xmlns="" >
<xf:action ev:event="xforms-ready">
<xf:load show="embed" targetid="subform" resource="FirstSubform.xml"/>
</xf:action>
</xf:model>

What ComponentQuery should I use for this example in this.control()?

I have:
1.) What should I type in this.control() for getting the reference to the grid panel?
My plan is, when user double clicks one row, new tab is created. I already have code for creating new tabs but I just need to get reference to the grid panel.
Something like this:
'viewport > westpanel > accordion > gridpanel': {
doubleclick: function...
}
2.) Let's say that I gave an ID to the grid panel. How can I get reference in this.control using .get method?
3.) How can I be sure that I've got the right reference? Can I console.log() - it or something like that?
I would know how to do this without MVC but here I need help. :)
Thank you! :)
It is quite easy once you understand how to use it. First you should read the API about the ComponentQuery cause that is what is used within the control.
this depends on your components. You so can go by the xtype 'panel > grid': {itemdblclick:this.yourCallback}
the recommend way if you can't define a really unique path by xtypes '#myID': {itemdblclick:this.yourCallback} using defined refs within the control is not possible in the currently release, as far as I know.
Use Id's instead of just xtypes '#myID > grid': {itemdblclick:this.yourCallback} or define additional params '#myID > grid[customProp=identString]': {itemdblclick:this.yourCallback}

Magento Custom Options - make every first radio button checked

We have a Magento Shop with some products that have custom options as radio buttons. Every non required option has the first button checked by default but not the required ones. How can I make them checked?
I've allready installed the extension Dependent Custom Options (gallery). That gives me the option to set which custom option should be checked by default but that doesn't update the price to the right value.
Thanks for evey help
This solution may not be the best for you, but I had this same problem, and just fixed it.
First I had to use a convoluted method for installing jQuery correctly in Magento. Part of the problem, I believe comes from the Spriptaculous Effects file being outdated with the latest Magento build. So I went to the site www.script.aculo.us and downloaded the latest version. I then pulled out the effects.js file and used it to overwrite the effects.js in:
[Magento]/js/scriptaculous
Then I downloaded jQuery from the jQuery site and made a folder called jquery in:
[Magento]/js/
And dumped the jquery file in there.
Then I opened the file:
[Magento]/app/design/frontend/default/default/layout/page.xml
And found a list of lines that look like this:
<action method="addJs"><script>scriptaculous/effects.js</script></action>
I copied one of these and replaced the path to that of the jquery file like this.
<action method="addJs"><script>jquery/jquery-1.6.1.min.js</script></action>
Now jQuery will be included in all your pages.
Important! You have to run jQuery in noConflict() mode. So this is what the JS looks like that (for me) worked to select the first radio button on any page with custom options.
var $j = jQuery.noConflict();
$j(document).ready(function(){
// auto selects the first input with radio class
$j('.options-list input.radio:first').attr('checked','checked');
});
I saved that file into my jquery folder and linked to it the same way I linked to the jQ library.
Flushed my cache, and voila!
I hope this helps!
You can use jQuery, as Gordon says, but to update the price you need to run opConfig.reloadPrice() function when check. So the code will be something like this:
var $j = jQuery.noConflict();
$j(document).ready(function(){
// auto selects the first input with radio class
$j('.options-list input.radio:first').attr('checked','checked');
opConfig.reloadPrice();
});
There is a javascript function named something like optionsConfig.reloadPrice() which, when called, updates the price according to options. You probably need to have this triggered during the dom:loaded event.
Go to app\code\core\Mage\Catalog\Block\Product\View\Options\Type\select.php
You can find here your custom option title and set if condition with your title.
For example, my custom option title is price:
if($this->htmlEscape($_option->getTitle()=='Price'))

Resources