[IMP] if 'cash control' if false in the journal, no need to have the opening and closing cash control tab in cash registers

bzr revid: psa@tinyerp.com-20130918091041-c5zponkbu5uwgb94
This commit is contained in:
Paramjit Singh Sahota 2013-09-18 14:40:41 +05:30
parent 5f06129179
commit bfff65d4ac
3 changed files with 11 additions and 13 deletions

View File

@ -128,6 +128,7 @@ class account_bank_statement(osv.osv):
'currency': fields.function(_currency, string='Currency',
type='many2one', relation='res.currency'),
'account_id': fields.related('journal_id', 'default_debit_account_id', type='many2one', relation='account.account', string='Account used in this journal', readonly=True, help='used in statement reconciliation domain, but shouldn\'t be used elswhere.'),
'cash_control': fields.related('journal_id', 'cash_control' , type='boolean', relation='account.journal',string='Cash control'),
}
_defaults = {
@ -460,12 +461,12 @@ class account_bank_statement(osv.osv):
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None):
if not journal_id:
return {}
if context is None:
context = {}
balance_start = self._compute_balance_end_real(cr, uid, journal_id, context=context)
journal_data = self.pool.get('account.journal').read(cr, uid, journal_id, ['company_id', 'currency'], context=context)
company_id = journal_data['company_id']
currency_id = journal_data['currency'] or self.pool.get('res.company').browse(cr, uid, company_id[0], context=context).currency_id.id
return {'value': {'balance_start': balance_start, 'company_id': company_id, 'currency': currency_id}}
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context)
currency = journal.currency or journal.company_id.currency_id
return {'value': {'balance_start': balance_start, 'company_id': journal.company_id.id, 'currency': currency.id, 'cash_control': journal.cash_control}}
def unlink(self, cr, uid, ids, context=None):
stat = self.read(cr, uid, ids, ['state'], context=context)

View File

@ -225,10 +225,6 @@ class account_cash_statement(osv.osv):
string="Starting Balance",
help="Total of opening cash control lines.",
readonly=True),
'cash_register_total_entry_encoding' : fields.related('cash_register_id', 'total_entry_encoding',
string='Total Cash Transaction',
readonly=True,
help="Total of all paid sale orders"),
'cash_register_balance_end' : fields.related('cash_register_id', 'balance_end',
type='float',
digits_compute=dp.get_precision('Account'),

View File

@ -2271,10 +2271,11 @@
<field name="closing_date" readonly="1"/>
<field name="period_id" class="oe_inline"/>
<field name="currency" invisible="1"/>
<field name="cash_control" invisible="1"/>
</group>
</group>
<notebook>
<page string="Cash Control">
<page string="Cash Control" attrs="{'invisible' : [('cash_control', '=', False)]}">
<group col="2" expand="1">
<group string="Opening Cash Control" attrs="{'invisible' : [('state', '!=', 'draft')]}">
<field name="opening_details_ids" colspan="2" nolabel="1">
@ -2342,7 +2343,7 @@
</page>
</notebook>
<group>
<group class="oe_subtotal_footer oe_right">
<group class="oe_subtotal_footer oe_right" attrs="{'invisible' : [('cash_control', '=', False)]}">
<field name="balance_start" readonly="1" string="Opening Balance" class="oe_subtotal_footer_separator oe_open_balance" widget="monetary" options="{'currency_field': 'currency'}" help="Total of opening cash control lines"/>
<label for="total_entry_encoding" string="+ Transactions" class="oe_force_bold oe_mini_subtotal_footer_separator"/>
<field name="total_entry_encoding" nolabel="1" class="oe_bold oe_account_total" widget="monetary" options="{'currency_field': 'currency'}"/>
@ -2350,12 +2351,12 @@
<field name="balance_end" nolabel="1" class="oe_bold oe_account_total" widget="monetary" options="{'currency_field': 'currency'}"/>
</group>
<div>
<group class="oe_subtotal_footer oe_right" attrs="{'invisible' : [('state', '=', 'draft')]}">
<group class="oe_subtotal_footer oe_right" attrs="{'invisible': ['|', ('cash_control', '=', False), ('state', '=', 'draft')]}">
<field name="balance_end_real" readonly="1" string="Real Closing Balance" class="oe_subtotal_footer_separator oe_real_closing_balance" widget="monetary" options="{'currency_field': 'currency'}" help="Total of closing cash control lines."/>
</group>
<group/>
<group/>
<group class="oe_subtotal_footer oe_right" attrs="{'invisible' : [('state', '=', 'draft')]}">
<group class="oe_subtotal_footer oe_right" attrs="{'invisible': ['|', ('cash_control', '=', False), ('state', '=', 'draft')]}">
<field name="difference" class="oe_subtotal_footer_separator oe_difference" widget="monetary" options="{'currency_field': 'currency'}"/>
</group>
</div>