تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
9655 أدوات العرض

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" />

أفضل إجابة

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

الكاتب أفضل إجابة

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

الكاتب

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.

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.

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

أفضل إجابة

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?

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 21
4606
2
فبراير 23
3145
2
أكتوبر 20
5828
2
أكتوبر 20
4101
1
يونيو 20
2526