[FIX] account: money in/out in PoS

It is not possible to take money out or put money in for a PoS since it
leads to a traceback.

The decorator `@api.one` returns a list, which is something we don't
want when the method returns a dictionary.

opw-681417
This commit is contained in:
Nicolas Martinelli
2016-06-28 14:17:39 +02:00
parent 841aa4e208
commit 6d51bce057
+3 -3
View File
@@ -35,7 +35,7 @@ class CashBox(models.TransientModel):
if record.state == 'confirm':
raise UserError(_("You cannot put/take money in/out for a bank statement which is closed."))
values = self._calculate_values_for_statement_line(record)
return record.write({'line_ids': [(0, False, values[0])]})
return record.write({'line_ids': [(0, False, values)]})
class CashBoxIn(CashBox):
@@ -43,7 +43,7 @@ class CashBoxIn(CashBox):
ref = fields.Char('Reference')
@api.one
@api.multi
def _calculate_values_for_statement_line(self, record):
if not record.journal_id.company_id.transfer_account_id:
raise UserError(_("You should have defined an 'Internal Transfer Account' in your cash register's journal!"))
@@ -61,7 +61,7 @@ class CashBoxIn(CashBox):
class CashBoxOut(CashBox):
_name = 'cash.box.out'
@api.one
@api.multi
def _calculate_values_for_statement_line(self, record):
if not record.journal_id.company_id.transfer_account_id:
raise UserError(_("You should have defined an 'Internal Transfer Account' in your cash register's journal!"))