-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] account_cancel: better handling of bank statement cancellation
Before this addition, cancelling a bank statement line was allowed even if the bank statement was confirmed. However, when the bank statement is confirmed, it is not possible to reconcile it afterwards. The consequence is that is was not possible to reconcile this bank statement line without cancelling the whole bank statement, and therefore forcing the user to do the complete reconciliation process again. With this addition, it is not possible to cancel a bank statement line if the corresponding bank statement is confirmed. However, we offer the user the possibility to reset the bank statement to draft through a new button. This new button will only change the state of the bank statement, and will not modify the state of the associated bank statement lines. The consequence is that the user will be able to first set the bank statement to draft, then cancel the bank statement lines he wants, and finally launch the reconciliation process only on the lines which were cancelled. opw-645903
- Loading branch information
Showing
5 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
import account_bank_statement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from openerp import models, api, _ | ||
from openerp.exceptions import Warning | ||
|
||
|
||
class BankStatement(models.Model): | ||
_inherit = 'account.bank.statement' | ||
|
||
@api.multi | ||
def button_draft(self): | ||
self.state = 'draft' | ||
|
||
class BankStatementLine(models.Model): | ||
_inherit = 'account.bank.statement.line' | ||
|
||
@api.multi | ||
def cancel(self): | ||
for line in self: | ||
if line.statement_id.state == 'confirm': | ||
raise Warning(_("Please set the bank statement to New before canceling.")) | ||
return super(BankStatementLine, self).cancel() |
6f35562
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Nicolas,
Could you check the following please: #8410
Maybe not perfect in terms of naming conventions (although I kept the number "2" at the end of the view names)
Goal of this view is to add the same feature on cash registers, otherwise you can never reset it to new.
6f35562
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
6f35562
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nim-odoo Could we add the same..the Cancel button in cash register lines for easier cancelling of only one line, not the whole cash register?