[FIX] point_of_sale: Set the right account for the internal account.
[REF] point_of_sale: Review the code for the Take Money Out and Push Money In. [FIX] point_of_sale: Can post a session with an order in the invoiced state. bzr revid: stw@openerp.com-20120905150538-v9ex7wehyebft7tu
This commit is contained in:
@@ -383,7 +383,7 @@
|
||||
<field name="type">cash</field>
|
||||
<field name="profit_account_id" model="account.account" ref="rsa" />
|
||||
<field name="loss_account_id" model="account.account" ref="rsa" />
|
||||
<field name="internal_account_id" model="account.account" ref="chart0" />
|
||||
<field name="internal_account_id" model="account.account" ref="rsa" />
|
||||
<field name="with_last_closing_balance" eval="True" />
|
||||
<field name="cash_control" eval="True" />
|
||||
<field name="view_id" ref="account_journal_bank_view"/>
|
||||
|
||||
@@ -40,6 +40,10 @@ class CashBox(osv.osv_memory):
|
||||
|
||||
return {}
|
||||
|
||||
def _create_bank_statement_line(self, cr, uid, box, record, context=None):
|
||||
values = self._compute_values_for_statement_line(cr, uid, box, record, context=context)
|
||||
return self.pool.get('account.bank.statement.line').create(cr, uid, values, context=context)
|
||||
|
||||
|
||||
class CashBoxIn(CashBox):
|
||||
_name = 'cash.box.in'
|
||||
@@ -49,30 +53,24 @@ class CashBoxIn(CashBox):
|
||||
'ref' : fields.char('Reference', size=32),
|
||||
})
|
||||
|
||||
def _create_bank_statement_line(self, cr, uid, box, record, context=None):
|
||||
absl_proxy = self.pool.get('account.bank.statement.line')
|
||||
|
||||
values = {
|
||||
def _compute_values_for_statement_line(self, cr, uid, box, record, context=None):
|
||||
return {
|
||||
'statement_id' : record.id,
|
||||
'journal_id' : record.journal_id.id,
|
||||
'account_id' : record.journal_id.internal_account_id.id,
|
||||
'amount' : box.amount or 0.0,
|
||||
'ref' : "%s" % (box.ref or ''),
|
||||
'ref' : '%s' % (box.ref or ''),
|
||||
'name' : box.name,
|
||||
}
|
||||
|
||||
return absl_proxy.create(cr, uid, values, context=context)
|
||||
|
||||
CashBoxIn()
|
||||
|
||||
class CashBoxOut(CashBox):
|
||||
_name = 'cash.box.out'
|
||||
|
||||
def _create_bank_statement_line(self, cr, uid, box, record, context=None):
|
||||
absl_proxy = self.pool.get('account.bank.statement.line')
|
||||
|
||||
def _compute_values_for_statement_line(self, cr, uid, box, record, context=None):
|
||||
amount = box.amount or 0.0
|
||||
values = {
|
||||
return {
|
||||
'statement_id' : record.id,
|
||||
'journal_id' : record.journal_id.id,
|
||||
'account_id' : record.journal_id.internal_account_id.id,
|
||||
@@ -80,6 +78,4 @@ class CashBoxOut(CashBox):
|
||||
'name' : box.name,
|
||||
}
|
||||
|
||||
return absl_proxy.create(cr, uid, values, context=context)
|
||||
|
||||
CashBoxOut()
|
||||
|
||||
@@ -422,7 +422,7 @@ class pos_session(osv.osv):
|
||||
self.pool.get('pos.order')._create_account_move_line(cr, uid, order_ids, session, move_id, context=context)
|
||||
|
||||
for order in session.order_ids:
|
||||
if order.state != 'paid':
|
||||
if order.state not in ('paid', 'invoiced'):
|
||||
raise osv.except_osv(
|
||||
_('Error!'),
|
||||
_("You cannot confirm all orders of this session, because they have not the 'paid' status"))
|
||||
|
||||
@@ -897,7 +897,7 @@
|
||||
</group>
|
||||
<newline/>
|
||||
|
||||
<group string="Opening Cash Control" attrs="{'invisible' : ['|', ('cash_control', '=', False),('state', '=', 'closed')]}">
|
||||
<group string="Opening Cash Control" attrs="{'invisible' : ['|', ('cash_control', '=', False),('state', 'in', ('opened', 'closing_control'))]}">
|
||||
<field name="opening_details_ids" nolabel="1" colspan="2" attrs="{'readonly' : [('state', 'not in', ('opening_control',))]}">
|
||||
<tree string="Opening Cashbox Lines" editable="bottom">
|
||||
<field name="pieces" readonly="1" />
|
||||
@@ -906,7 +906,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group string="Closing Cash Control" attrs="{'invisible': ['|', ('cash_control', '=', False), ('state', '!=', 'closing_control')]}">
|
||||
<group string="Closing Cash Control" attrs="{'invisible': ['|', ('cash_control', '=', False), ('state', 'in', ('opening_control', 'opened'))]}">
|
||||
<field name="details_ids" nolabel="1" colspan="2">
|
||||
<tree string="Cashbox Lines" editable="bottom">
|
||||
<field name="pieces" readonly="1" />
|
||||
@@ -916,14 +916,14 @@
|
||||
</field>
|
||||
</group>
|
||||
|
||||
<div attrs="{'invisible': [('state', '!=', 'closed')]}">
|
||||
<div attrs="{'invisible' : ['|', ('cash_control', '=', False),('state', 'in', ('opened', 'closing_control'))]}">
|
||||
<group class="oe_subtotal_footer oe_right">
|
||||
<field name="cash_register_balance_start" readonly="1" string="Opening Balance" class="oe_subtotal_footer_separator"/>
|
||||
<field name="cash_register_total_entry_encoding" attrs="{'invisible' : [('state', '=', 'opening_control')]}" string="+ Transactions"/>
|
||||
<field name="cash_register_balance_end" attrs="{'invisible' : [('state', '=', 'opening_control')]}" string="= Theorical Balance"/>
|
||||
</group>
|
||||
<div class="oe_clear"/>
|
||||
<div attrs="{'invisible' : [('cash_journal_id', '=', False)]}" class="oe_view_nocontent" groups="point_of_sale.group_pos_manager">
|
||||
<div attrs="{'invisible' : ['|', ('cash_journal_id', '=', False), ('state', '!=', 'opening_control')]}" class="oe_view_nocontent" groups="point_of_sale.group_pos_manager">
|
||||
<p class="oe_view_nocontent_create">
|
||||
You can define another list of available currencies on the
|
||||
<i>Cash Registers</i> tab of the <b><field name="cash_journal_id" class="oe_inline"/></b>
|
||||
@@ -933,7 +933,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<group class="oe_subtotal_footer oe_right" attrs="{'invisible' : [('state', '!=', 'closed')]}">
|
||||
<group class="oe_subtotal_footer oe_right" attrs="{'invisible': ['|', ('cash_control', '=', False), ('state', 'in', ('opening_control', 'opened'))]}">
|
||||
<field name="cash_register_balance_end_real" class="oe_subtotal_footer_separator"/>
|
||||
<field name="cash_register_difference" class="oe_subtotal_footer_separator"/>
|
||||
</group>
|
||||
|
||||
@@ -15,8 +15,7 @@ class PosBox(CashBox):
|
||||
active_ids = context.get('active_ids', []) or []
|
||||
|
||||
if active_model == 'pos.session':
|
||||
records = self.pool.get(active_model).browse(cr, uid, context.get('active_ids', []) or [], context=context)
|
||||
|
||||
records = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)
|
||||
bank_statements = [record.cash_register_id for record in records if record.cash_register_id]
|
||||
|
||||
if not bank_statements:
|
||||
@@ -30,6 +29,30 @@ class PosBox(CashBox):
|
||||
class PosBoxIn(PosBox):
|
||||
_inherit = 'cash.box.in'
|
||||
|
||||
def _compute_values_for_statement_line(self, cr, uid, box, record, context=None):
|
||||
values = super(PosBoxIn, self)._compute_values_for_statement_line(cr, uid, box, record, context=context)
|
||||
|
||||
active_model = context.get('active_model', False) or False
|
||||
active_ids = context.get('active_ids', []) or []
|
||||
|
||||
if active_model == 'pos.session':
|
||||
session = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)[0]
|
||||
values['ref'] = session.name
|
||||
|
||||
return values
|
||||
|
||||
|
||||
class PosBoxOut(PosBox):
|
||||
_inherit = 'cash.box.out'
|
||||
|
||||
def _compute_values_for_statement_line(self, cr, uid, box, record, context=None):
|
||||
values = super(PosBoxOut, self)._compute_values_for_statement_line(cr, uid, box, record, context=context)
|
||||
|
||||
active_model = context.get('active_model', False) or False
|
||||
active_ids = context.get('active_ids', []) or []
|
||||
|
||||
if active_model == 'pos.session':
|
||||
session = self.pool.get(active_model).browse(cr, uid, active_ids, context=context)[0]
|
||||
values['ref'] = session.name
|
||||
|
||||
return values
|
||||
|
||||
Reference in New Issue
Block a user