[IMP] point_of_sale: show the opening and closing details

[FIX] point_of_sale: Use tools.translate library

bzr revid: stw@openerp.com-20120510074804-8jf12enzw3jghrrf
This commit is contained in:
Stephane Wirtel 2012-05-10 09:48:04 +02:00
parent 23ca8aaa38
commit 471bb6a67e
8 changed files with 99 additions and 19 deletions

View File

@ -205,6 +205,8 @@ class account_cash_statement(osv.osv):
'closing_date': fields.datetime("Closed On"),
'balance_end_cash': fields.function(_balance_end_cash, store=False, string='Closing Balance', help="Closing balance based on cashBox"),
'details_ids' : fields.one2many('account.cashbox.line', 'bank_statement_id', string='CashBox Lines'),
'opening_details_ids' : fields.one2many('account.cashbox.line', 'bank_statement_id', string='Opening Cashbox Lines'),
'closing_details_ids' : fields.one2many('account.cashbox.line', 'bank_statement_id', string='Closing Cashbox Lines'),
'user_id': fields.many2one('res.users', 'Responsible', required=False),
'difference' : fields.function(_compute_difference, method=True, string="Difference", type="float"),
}
@ -327,10 +329,6 @@ class account_cash_statement(osv.osv):
def _equal_balance(self, cr, uid, cash_id, context=None):
statement = self.browse(cr, uid, cash_id, context=context)
self.write(cr, uid, [cash_id], {'balance_end_real': statement.balance_end})
print "balance_end_real: %r" % (statement.balance_end,)
print "balance_end: %r" % (statement.balance_end,)
print "balance_end_cash: %r" % (statement.balance_end_cash,)
if statement.balance_end != statement.balance_end_cash:
return False
return True

View File

@ -505,10 +505,12 @@
<field colspan="4" name="account_control_ids" nolabel="1"/>
</page>
<page string="Cash Box">
<separator string="Profit &amp; Loss Accounts" colspan="4" />
<field name="profit_account_id" />
<field name="loss_account_id" />
<separator string="Internal Account" colspan="4" />
<field name="internal_account_id" />
<separator string="Cash Box Lines" colspan="4" />
<field name="cashbox_line_ids" nolabel="1" string="Unit Of Currency Definition" colspan="4">
<tree string="CashBox Lines" editable="bottom">
@ -2665,9 +2667,25 @@ action = pool.get('res.config').next(cr, uid, [], context)
</page>
<page string="CashBox">
<group col="2" expand="1">
<field name="details_ids" nolabel="1" >
<!--attrs="{'readonly' : [('state', '=', 'open')]}">-->
<tree string="" editable="bottom">
<field name="opening_details_ids" nolabel="1" colspan="4" attrs="{'invisible' : [('state', '!=', 'draft')]}">
<tree string="Opening Cashbox Lines" editable="bottom">
<field name="pieces" readonly="1" />
<field name="number_opening" string="Opening Unit Numbers" on_change="on_change_sub_opening(pieces, number_opening, parent.balance_end)" attrs="{'readonly' : [('parent.state', '!=', 'open')]}" />
<field name="subtotal_opening" string="Opening Subtotal"/>
</tree>
</field>
<field name="closing_details_ids" nolabel="1" colspan="4" attrs="{'invisible' : [('state', '!=', 'open')]}">
<tree string="Closing Cashbox Lines" editable="bottom">
<field name="pieces" readonly="1" />
<field name="number_opening" string="Opening Unit Numbers" readonly="1" />
<field name="subtotal_opening" string="Opening Subtotal" readonly="1" />
<field name="number_closing" string="Closing Unit Numbers" on_change="on_change_sub_closing(pieces, number_closing, parent.balance_end)" attrs="{'readonly' : [('parent.state', '!=', 'confirm')]}"/>
<field name="subtotal_closing" string="Closing Subtotal"/>
</tree>
</field>
<field name="details_ids" nolabel="1" readonly="True" attrs="{'invisible' : [('state', '!=', 'confirm')]}">
<tree string="Cashbox Lines">
<field name="pieces" readonly="1" />
<field name="number_opening" string="Opening Unit Numbers" on_change="on_change_sub_opening(pieces, number_opening, parent.balance_end)" attrs="{'readonly' : [('parent.state', '!=', 'open')]}" />
<field name="subtotal_opening" string="Opening Subtotal"/>

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python
from osv import osv, fields
import decimal_precision as dp
from tools.translate import _
class CashBox(osv.osv_memory):
_register = False
@ -29,7 +30,7 @@ class CashBox(osv.osv_memory):
for record in records:
if not record.journal_id.internal_account_id:
raise osv.except_osv(_('Error !'),
_('Please check that internal account is set to %s') % (record.journal_id.name,))
_('Please check that Internal Transfers Account is set to %s') % (record.journal_id.name,))
self._create_bank_statement_line(cr, uid, box, record, context=context)

View File

@ -30,6 +30,8 @@ class account_journal(osv.osv):
'opening_control': fields.boolean('Opening Control', help="If you want the journal should be control at opening, check this option"),
'closing_control': fields.boolean('Closing Control', help="If you want the journal should be control at closing, check this option"),
'amount_authorized_diff' : fields.float('Amount Authorized Difference'),
}
_defaults = {
'opening_control' : True,
@ -87,6 +89,11 @@ class account_cash_statement(osv.osv):
]
return super(account_cash_statement, self).search(cr, uid, domain, offset=offset, limit=limit, order=order, context=context, count=count)
_columns = {
'pos_session_id' : fields.many2one('pos.session'),
}
account_cash_statement()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -14,6 +14,7 @@
<field name="journal_user"/>
<field name="opening_control" />
<field name="closing_control" />
<field name="amount_authorized_diff" />
</group>
</page>
</xpath>

View File

@ -183,7 +183,7 @@ class pos_session(osv.osv):
('opening_control', 'Opening Control'), # Signal open
('opened', 'Opened'), # Signal closing
('closing_control', 'Closing Control'), # Signal close
('closed', 'Closed'),
('closed', 'Closed & Posted'),
]
def _compute_cash_register_id(self, cr, uid, ids, fieldnames, args, context=None):
@ -231,9 +231,26 @@ class pos_session(osv.osv):
type='many2one', relation='account.bank.statement',
string='Cash Register', store=True),
'opening_details_ids' : fields.related('cash_register_id', 'opening_details_ids',
type='one2many', relation='account.cashbox.line',
string='CashBox Lines'),
'closing_details_ids' : fields.related('cash_register_id', 'closing_details_ids',
type='one2many', relation='account.cashbox.line',
string='CashBox Lines'),
'details_ids' : fields.related('cash_register_id', 'details_ids',
type='one2many', relation='account.cashbox.line',
string='CashBox Lines'),
'cash_register_date' : fields.related('cash_register_id', 'date', type='datetime', string='Started On'),
'cash_register_closing_date' : fields.related('cash_register_id', 'closing_date', type='datetime', string='Closed On'),
'cash_register_balance_end_real' : fields.related('cash_register_id', 'balance_end_real', type='float', digits_compute=dp.get_precision('Account'), string="Ending Balance"),
'cash_register_balance_start' : fields.related('cash_register_id', 'balance_start', type='float', digits_compute=dp.get_precision('Account'), string="Starting Balance"),
'cash_register_total_entry_encoding' : fields.related('cash_register_id', 'total_entry_encoding', string='Total Cash Transaction'),
'cash_register_balance_end' : fields.related('cash_register_id', 'balance_end', type='float', digits_compute=dp.get_precision('Account'), string="Computed Balance"),
'cash_register_balance_end_cash' : fields.related('cash_register_id', 'balance_end_cash', string='Closing Balance', help="Closing balance based on cashBox"),
'cash_register_difference' : fields.related('cash_register_id', 'difference', type='float', string='Difference'),
'journal_ids' : fields.related('config_id', 'journal_ids',
type='many2many',
readonly=True,
@ -241,12 +258,7 @@ class pos_session(osv.osv):
string='Journals'),
'order_ids' : fields.one2many('pos.order', 'session_id', 'Orders'),
'statement_ids' : fields.many2many('account.bank.statement',
'pos_session_statement_rel',
'session_id',
'statement_id',
'Bank Statement',
readonly=True),
'statement_ids' : fields.one2many('account.bank.statement', 'pos_session_id', 'Bank Statement', readonly=True),
}
_defaults = {
@ -911,7 +923,7 @@ class pos_order(osv.osv):
continue
account_move_line_obj.create(cr, uid, {
'name': "Tax" + line.name + " (%s)" % (tax.name),
'name': _("Tax") + line.name + " (%s)" % (tax.name),
'date': order.date_order[:10],
'ref': order.name,
'product_id':line.product_id.id,
@ -950,7 +962,7 @@ class pos_order(osv.osv):
# counterpart
to_reconcile.append(account_move_line_obj.create(cr, uid, {
'name': "Trade Receivables", #order.name,
'name': _("Trade Receivables"), #order.name,
'date': order.date_order[:10],
'ref': order.name,
'move_id': move_id,

View File

@ -885,21 +885,62 @@
<notebook colspan="4">
<page string="Cash">
<field name="cash_register_id" invisible="0" />
<field name="details_ids" colspan="4" nolabel="1">
<tree string="" editable="bottom">
<field name="opening_details_ids" colspan="4" nolabel="1" attrs="{'invisible' : [('state', 'not in', ('opening_control', 'opened'))], 'readonly' : [('state', '=', 'opened')]}">
<tree string="Opening Cashbox Lines" editable="bottom">
<field name="pieces" readonly="1" />
<field name="number_opening" string="Opening Unit Numbers" on_change="on_change_sub_opening(pieces, number_opening, parent.balance_end)" />
<field name="subtotal_opening" string="Opening Subtotal"/>
</tree>
</field>
<field name="closing_details_ids" colspan="4" nolabel="1" attrs="{'invisible' : [('state', '!=', 'closing_control')]}">
<tree string="Closing Cashbox Lines" editable="bottom">
<field name="pieces" readonly="1" />
<field name="number_opening" string="Opening Unit Numbers" readonly="1"/>
<field name="subtotal_opening" string="Opening Subtotal" readonly="1" />
<field name="number_closing" string="Closing Unit Numbers" on_change="on_change_sub_closing(pieces, number_closing, parent.balance_end)" />
<field name="subtotal_closing" string="Closing Subtotal"/>
</tree>
</field>
<field name="details_ids" colspan="4" nolabel="1" readonly="1" attrs="{'invisible': [('state', '!=', 'closed')]}">
<tree string="Cashbox Lines">
<field name="pieces" readonly="1" />
<field name="number_opening" string="Opening Unit Numbers"/>
<field name="subtotal_opening" string="Opening Subtotal"/>
<field name="number_closing" string="Closing Unit Numbers" />
<field name="subtotal_closing" string="Closing Subtotal"/>
</tree>
</field>
<group col="6" colspan="4">
<group col="2" colspan="2">
<separator string="Dates" colspan="4"/>
<field name="cash_register_date" select="1" readonly="1" />
<field name="cash_register_closing_date" select="1" readonly="1"/>
</group>
<group col="2" colspan="2">
<separator string="Opening Balance" colspan="4"/>
<field name="cash_register_balance_end_real" readonly="1" string="Last Closing Balance"/>
<field name="cash_register_balance_start" readonly="1" string="Computed Amount"/>
<field name="cash_register_total_entry_encoding" />
</group>
<group col="2" colspan="2">
<separator string="Closing Balance" colspan="4"/>
<field name="cash_register_balance_end"/>
<field name="cash_register_balance_end_cash"/>
<field name="cash_register_difference" />
</group>
</group>
</page>
<page string="Accouting">
<field name="statement_ids" colspan="4" nolabel="1">
<tree string="Statements">
<field name="name" />
<field name="journal_id" />
<field name="balance_start" />
<field name="balance_end_real" />
<field name="difference" />
<field name="currency" />
<field name="state" />

View File

@ -25,6 +25,7 @@
</field>
</record>
<!--
<act_window name="Close Statements"
res_model="pos.close.statement"
src_model="account.bank.statement"
@ -32,6 +33,7 @@
target="new"
key2="client_action_multi"
id="act_pos_open_statement"/>
-->
<record id="action_pos_close_statement" model="ir.actions.act_window">
<field name="name">Close Cash Register</field>