Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
3 Respostas
8882 Visualizações

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

Avatar
Cancelar

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

Melhor resposta

This issue has been resolved.

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

Avatar
Cancelar

it was post a year ago. but still no resolve

Autor Melhor resposta

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!

Avatar
Cancelar

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

Autor

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

Melhor resposta

Cheers and luck

Avatar
Cancelar
Autor

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?

Publicações relacionadas Respostas Visualizações Atividade
1
mar. 21
3989
2
fev. 23
2395
2
out. 20
5166
2
out. 20
3573
1
jun. 20
2032