Odoo Help

Welcome!

This community 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.

0

How set STATE=DONE? (Action & Button)

By
Damian Phang
on 1/27/14, 7:10 PM 2,200 views

How do I go about creating a button that sets the state of purchase order to done?

I have in my purchase.py file

def action_done(self, cr, uid, ids, context=None):
        self.write(cr, uid, ids, {'state': 'done'}, context=context)
        return True

I then added the line action_done in xml. When I click the button, it says no attribute for purchase order. I've already updated the modules, and also rebooted the server. The action is defined in the purchase.py file

you most have in the xml view, for example, in the form view a button <button name="action_done" type="workflow" string="Done" />

Jose Angel Inda Herrera
on 1/28/14, 12:19 PM
0

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
3918
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 2/17/14, 3:47 AM

This issue has been resolved.

It was notified as a bug : https://bugs.launchpad.net/openobject-addons/+bug/1097633

it was post a year ago. but still no resolve

Hariyanto
on 2/18/14, 3:23 AM
0
Damian Phang
On 1/29/14, 3:37 AM

Let me try this out. In XML view I defined it as "function" and when I call it, it says purchase.order has no such attribute. I'll try it as "workflow" to see if it works

EDIT: Somehow after moving it to a different line in purchase.py the button now works. This is the code I used:

in purchase.py

def action_done(self, cr, uid, ids, context=None):
        self.write(cr, uid, ids, {'state': 'done'}, context=context)
        return True

in form view xml

<button name="action_done" type="object" string="Done" />

Thanks a bunch!

can you please share this solution file i need it also. as in my problem that the purchase order always remain in purchase order state not getting done automatically even invoice paid, and the good in warehouse received

Hariyanto
on 2/16/14, 9:45 AM

Hi, you need to modify your own .py file and in debug mode, add the extra line into the xml. If you can't get it done, drop another message here or leave your email I can send you screenshot on how to get it done. Many bugs are fixed in v8 but now I noticed that if you purchase and pay for an item that is $0, it will not complete the purchase order as well.

Damian Phang
on 2/18/14, 8:44 AM

my problem is when the purchase order scheduler then it will be in not done state. because i make the sales order it will generate purchase order. when payment done and warehouse goods received still the purchase order in purchase order state. that's let me confuse which order are not done, which is done.

Hariyanto
on 2/18/14, 9:35 AM

my problem come if the purhcase order from warehouse scheduler, even payment done, goods received in warehouse purhcase order remain "purchase order state". i find solution over google non of them give satisfied answer. even in launchpad no solution or update. i'm no knowledge in programing. but i added your command above in purhcase.py via gedit and add the button line in xml file still no done button appear. maybe because i put in wrong line. since i don't know any in programing. my mail: blackneck6666 at gmail dot com

Hariyanto
on 2/18/14, 9:36 AM
0

Cheers and luck

The button is clickable and an action is set, but the purchase order status is still showing as "purchase order" instead of done. I'd post a picture but I don't have enough karma. Any help on this?

Damian Phang
on 1/29/14, 3:02 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/27/14, 7:10 PM
Seen: 2200 times
Last updated: 3/16/15, 8:10 AM