Odoo Ajuda

5

2
12 Respostas
15
Avatar

Maniganda Índia

--Maniganda--

1165
| 6 8 9
Bangalore, Índia
--Maniganda--
Maniganda Índia
28/08/14 00:38

Hi Eric you can achieve this by addind few lines of code in your server action

<record id="sale_license_more_item_action" model="ir.actions.server">

             <field name="name">Erics More Item</field>

            <field name="model_id" ref="model_sale_licenses"/>
            <field name="state">code</field>
            <field name="code">action = self.renew_license(cr, uid, context.get('active_ids', []), context=context)</field>
        </record>
        
        <record id="test_more_item" model="ir.values">
            <field eval="'client_action_multi'" name="key2"/>
            <field eval="'sale.licenses'" name="model"/>
            <field name="name">Test Item</field>
            <field eval="'ir.actions.server,%d'%sale_license_more_item_action" name="value"/>
        </record>

 

4 Comentários
Eric Estados Unidos
28/08/14 13:24

Hello Maniganda. Thank you for your help. I did what you said, but it still isn't working for me. Let me show you what I have again and can you let me know if you see anything wrong with it. Thank you again Erics More Item ir.actions.act_window sale.licenses form form self.renew_license(cr, uid, context.get('active_ids', []), context=context) Test Item action client_action_multi

Eric Estados Unidos
28/08/14 13:26

the last comment got cut off. I'll post my code as another answer so that you can see

abdallah ghrir Tunísia
27/10/14 10:45

i want to call function :'action_button_confirm' in dropdown list menu "More" ???? this is my code and it dosent work : Transformer en BL ir.actions.act_window sale.order form form self.action_button_confirm(cr, uid, context.get('active_ids', []), context=context) Test Item action client_action_multi

dirtyHandsPHP Índia
02/07/16 13:33

Thanks @Maniganda: You saved my day!!! :)

1
Artem Federação Russa
17/09/16 15:36

working code

<record id="dditem1_action" model="ir.actions.server">
        <field name="name">Text to display as menu item</field>
        <field name="model_id" ref="model_your_model"/>
        <field name="state">code</field>
        <field name="condition">True</field>
        <field name="code">if object: self.browse(cr,uid,context.get('active_ids', [])).your_function()</field>
</record>
<record id="dditem1" model="ir.values">
        <field name="name">name</field>
        <field name="model">your.model</field>
        <field name="key" >action</field>
        <field name="key2">client_action_multi</field>
        <field name="value" eval="'ir.actions.server,%d'%dditem1_action"/>
</record>
@api.multi
def your_function(self):
     for item in self:
         # do something with selected records
1
Eric Estados Unidos
28/08/14 13:29

My new code:

<record id="sale_license_more_item_action" model="ir.actions.act_window">
            <field name="name">Erics More Item</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.licenses</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="code">self.renew_license(cr, uid, context.get('active_ids', []), context=context)</field>
        </record>

        <record model="ir.values" id="test_more_item">
            <field name="name">Test Item</field>
            <field name="model" eval="'sale.licenses'" />
            <field name="key" >action</field>
            <field name="key2">client_action_multi</field>
            <field name="value" eval="'ir.actions.act_window,%d'%sale_license_more_item_action" />
            <field name="object" eval="True" />
        </record>

 

I dont get any errors, but it still just goes to the form without running the code that was added.  Thank you again

4 Comentários
Maniganda Índia
31/08/14 23:04

Eric i have updated the answer you can check this

Eric Estados Unidos
02/09/14 11:32

Thank you Maniganda for your help. Your solution works for me. Can you help me with one more thing? The function that is called is supposed to create a new sales order, which it does, but I would also like it to open the new sales order form when its finished. The end of my function returns a dictionary like this return { 'name': 'Sales Order', 'view_type': 'form', 'view_mode': 'form', 'view_id': self.pool.get('ir.ui.view').search(cr, uid, [('name','=','sale.order.form')])[0], 'res_model': 'sale.order', 'res_id': new_order_id, 'type': 'ir.actions.act_window', } This seems to work on other function calls, but for some reason it isn't working for this one.

Maniganda Índia
03/09/14 01:59

Eric i have updated the answer

Eric Estados Unidos
04/09/14 18:06
Hello Maniganda.  I appreciate your help.  I'm still having trouble with opening the new sale order in the form view once my function is done executing.  Do you have any other ideas?


On Tue, Sep 2, 2014 at 10:59 PM, Maniganda <k-maniganda-gmail-com@mail.odoo.com> wrote:

Eric i have updated the answer

--

Maniganda
Sent by OpenERP S.A. using Odoo about Forum Post False



--
Eric Bangerter | tel.: +1 (954) 585-9016 xYourExtension
Mertech Data Systems, Inc. | 114 East Shaw Avenue | Suite 209 | Fresno, CA 93710 | USA | Fax: +1 (866) 228-1213 | www.mertechdata.com
Building Bridges to New Technologies

CONFIDENTIALITY NOTICE
This email message from Mertech Data Systems, Inc. is intended only for the individual or entity to which it is addressed. This email may contain information that is privileged, confidential and exempt from disclosure under applicable law. This email may contain information which is shared in confidence with the recipient and must not be shared on any social media or posted on forums, blogs and websites without written consent from Mertech Data Systems, Inc. If you received this e-mail by accident, please notify the sender immediately and remove it from your system. You are hereby notified that unauthorized dissemination, distribution or copying of this communication is prohibited.

CONFIDENTIALITY NOTICE

This email message from Mertech Data Systems, Inc. is intended only for the individual or entity to which it is addressed. This email may contain information that is privileged, confidential and exempt from disclosure under applicable law. This email may contain information which is shared in confidence with the recipient and must not be shared on any social media or posted on forums, blogs and websites without written consent from Mertech Data Systems, Inc. If you received this e-mail by accident, please notify the sender immediately and remove it from your system. You are hereby notified that unauthorized dissemination, distribution or copying of this communication is prohibited.

0
belazarFati Marrocos
16/08/17 12:26

can you please tell me what is  eval="'ir.actions.act_window,%d'%hr_employee_normal_action_tree2"  stand for

Faça uma Pergunta
Writer
734
Eric
Keep Informed
2 seguidor (es)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now