Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
8875 Lượt xem

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

Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

This issue has been resolved.

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

Ảnh đại diện
Huỷ bỏ

it was post a year ago. but still no resolve

Tác giả Câu trả lời hay nhất

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!

Ảnh đại diện
Huỷ bỏ

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

Tác giả

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

Câu trả lời hay nhất

Cheers and luck

Ảnh đại diện
Huỷ bỏ
Tác giả

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?

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 21
3986
2
thg 2 23
2391
2
thg 10 20
5162
2
thg 10 20
3572
1
thg 6 20
2030