Add a configuration parameter to use entry_posted journal setting. Add update_posted in journal items to display or not the button cancel.

This commit is contained in:
Laetitia Gangloff
2015-06-30 10:48:25 +02:00
committed by Stéphane Bidoul
parent 48385fbfeb
commit afe5a0e285
12 changed files with 231 additions and 37 deletions

View File

@@ -18,6 +18,7 @@
##############################################################################
from openerp import models, api
from openerp.tools.safe_eval import safe_eval
class AccountBankStatement(models.Model):
@@ -27,5 +28,14 @@ class AccountBankStatement(models.Model):
def button_confirm_bank(self):
res = super(AccountBankStatement, self).button_confirm_bank()
entries = self.mapped('line_ids.journal_entry_id')
use_journal_setting = safe_eval(self.env['ir.config_parameter'].
get_param('use_journal_setting',
default="False"))
if use_journal_setting:
new_entries = self.env['account.move']
for e in entries:
if not e.journal_id.entry_posted:
new_entries += e
entries = new_entries
entries.write({'state': 'draft'})
return res