[FIX] account: fix crash on post() action of journal entry

This commits defines a new method 'action_post()' for 'account.move' object to call instead of 'post()' from the account.move form view.
Indeed, additional parameter ‘invoice’ of post() is considered as ‘context’ by webclient when called from button action and it is crashing badly.

TASK ID - 1860817
This commit is contained in:
Kirti Choudhary
2018-07-26 11:09:35 +02:00
committed by qdp-odoo
parent d519082137
commit bbec66b6a0
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -303,6 +303,10 @@ class AccountMove(models.Model):
move.name = new_name
return self.write({'state': 'posted'})
@api.multi
def action_post(self):
return self.post()
@api.multi
def button_cancel(self):
for move in self:
+1 -1
View File
@@ -1492,7 +1492,7 @@
<field name="arch" type="xml">
<form string="Account Entry">
<header>
<button name="post" states="draft" string="Post" type="object" class="oe_highlight" groups="account.group_account_invoice"/>
<button name="action_post" states="draft" string="Post" type="object" class="oe_highlight" groups="account.group_account_invoice"/>
<button name="%(action_view_account_move_reversal)d" states="posted" string="Reverse Entry" type="action" groups="account.group_account_invoice"/>
<field name="state" widget="statusbar"/>
</header>