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

I want odoo to auto click "Transfer" after Posting invoice.

Testing on Odoo 13 community.


https://imgur.com/a/EcQ7ftg .( 2 image.) before post.jpeg & after post.jpeg

الصورة الرمزية
إهمال

Hope these tips will help you: http://learnopenerp.blogspot.com/

أفضل إجابة

Hi,

You can override/super the function of the Post button and call this function. So once you click the post button this button action will also get executed.


For overriding a function, see:

def function_name(self):
res = super(Classname, self).function_name()
# call your button here
return res

Thanks

الصورة الرمزية
إهمال
الكاتب

Hi, thanks for helping.

But i don't know where to put

def function_name(self):

res = super(Classname, self).function_name()

# call your button here

return res

*I am not an odoo developer :(

الكاتب

I know how to enter developer mode, and click bug icon , and edit view form

أفضل إجابة

Hello HMMW,

Create one py file in your custom module and write the following code.

from odoo import models, fields, api, _

class AccountMove(models.Model):
_inherit =
'account.move'

 

def action_post(self):
res =
super(AccountMove, self).action_post()
#call your mothod here.    
self.your_mehhod_name(function_argument)
return res

def your_method_name(self, function_argument):
#your code

Don't forget to add your py file in __init__.py, then restart odoo service.


الصورة الرمزية
إهمال