diff options
| author | Paramjit Singh Sahota <psa@tinyerp.com> | 2013-09-18 14:40:41 +0530 |
|---|---|---|
| committer | Paramjit Singh Sahota <psa@tinyerp.com> | 2013-09-18 14:40:41 +0530 |
| commit | bfff65d4ac022e94cac4e793f2ee28257e71ddb0 (patch) | |
| tree | 0f74881dfda88580ebc66e1b292af7ffabe88cf6 | |
| parent | 5f06129179d1f2d45706cd7828c4d2dc8e4e6268 (diff) | |
[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
| -rw-r--r-- | addons/account/account_bank_statement.py | 11 | ||||
| -rw-r--r-- | addons/account/account_cash_statement.py | 4 | ||||
| -rw-r--r-- | addons/account/account_view.xml | 9 |
3 files changed, 11 insertions, 13 deletions
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index a573077891e..d927dcfd0cf 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -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) diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 8fe860099bd..731c5212493 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -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'), diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 4a57559aa5d..96eb2d2d68a 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -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> |
