Merge lp:~therp-nl/banking-addons/6.1-dev-useful_defaults into lp:banking-addons/6.1

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merge reported by: Stefan Rijnhart (Opener)
Merged at revision: not available
Proposed branch: lp:~therp-nl/banking-addons/6.1-dev-useful_defaults
Merge into: lp:banking-addons/6.1
Prerequisite: lp:~therp-nl/banking-addons/6.1-dev-fixes_from_testing_iteration_2
Diff against target: 107 lines (+47/-5)
4 files modified
account_banking/account_banking.py (+39/-3)
account_banking/i18n/nl.po (+1/-1)
account_banking/wizard/bank_import.py (+5/-0)
account_banking/wizard/bank_import_view.xml (+2/-1)
To merge this branch: bzr merge lp:~therp-nl/banking-addons/6.1-dev-useful_defaults
Reviewer Review Type Date Requested Status
Banking Addons Core Editors Pending
Review via email: mp+104542@code.launchpad.net

This proposal supersedes a proposal from 2012-05-02.

Description of the change

This branch adds a number of useful defaults, such as the ones discussed in lp:931395

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account_banking/account_banking.py'
--- account_banking/account_banking.py 2012-05-02 13:23:51 +0000
+++ account_banking/account_banking.py 2012-05-03 12:17:23 +0000
@@ -131,9 +131,41 @@
131 user = self.pool.get('res.users').browse(cursor, uid, uid, context=context)131 user = self.pool.get('res.users').browse(cursor, uid, uid, context=context)
132 if user.company_id:132 if user.company_id:
133 return user.company_id.id133 return user.company_id.id
134 return self.pool.get('res.company').search(cursor, uid,134 company_ids = self.pool.get('res.company').search(
135 [('parent_id', '=', False)]135 cursor, uid, [('parent_id', '=', False)])
136 )[0]136 return len(company_ids) == 1 and company_ids[0] or False
137
138 def _default_journal(self, cr, uid, context=None):
139 domain = [('type', '=', 'bank')]
140 user = self.pool.get('res.users').read(
141 cr, uid, uid, ['company_id'], context=context)
142 if user['company_id']:
143 domain.append(('company_id', '=', user['company_id'][0]))
144 journal_ids = self.pool.get('account.journal').search(
145 cr, uid, domain)
146 return len(journal_ids) == 1 and journal_ids[0] or False
147
148 def _default_partner_bank_id(self, cr, uid, context=None):
149 user = self.pool.get('res.users').read(
150 cr, uid, uid, ['company_id'], context=context)
151 if user['company_id']:
152 bank_ids = self.pool.get('res.partner.bank').search(
153 cr, uid, [('company_id', '=', user['company_id'][0])])
154 if len(bank_ids) == 1:
155 return bank_ids[0]
156 return False
157
158 def _default_debit_account_id(self, cr, uid, context=None):
159 account_def = self.pool.get('ir.property').get(
160 cr, uid, 'property_account_receivable',
161 'res.partner', context=context)
162 return account_def and account_def.id or False
163
164 def _default_credit_account_id(self, cr, uid, context=None):
165 account_def = self.pool.get('ir.property').get(
166 cr, uid, 'property_account_payable',
167 'res.partner', context=context)
168 return account_def and account_def.id or False
137169
138 def find(self, cr, uid, journal_id, partner_bank_id=False, context=None):170 def find(self, cr, uid, journal_id, partner_bank_id=False, context=None):
139 domain = [('journal_id','=',journal_id)]171 domain = [('journal_id','=',journal_id)]
@@ -143,6 +175,10 @@
143175
144 _defaults = {176 _defaults = {
145 'company_id': _default_company,177 'company_id': _default_company,
178 'journal_id': _default_journal,
179 'default_debit_account_id': _default_debit_account_id,
180 'default_credit_account_id': _default_credit_account_id,
181 'partner_bank_id': _default_partner_bank_id,
146 #'multi_currency': lambda *a: False,182 #'multi_currency': lambda *a: False,
147 }183 }
148account_banking_account_settings()184account_banking_account_settings()
149185
=== modified file 'account_banking/i18n/nl.po'
--- account_banking/i18n/nl.po 2012-04-16 07:35:36 +0000
+++ account_banking/i18n/nl.po 2012-05-03 12:17:23 +0000
@@ -1057,7 +1057,7 @@
1057#. module: account_banking1057#. module: account_banking
1058#: help:account.banking.account.settings,default_debit_account_id:01058#: help:account.banking.account.settings,default_debit_account_id:0
1059msgid "The account to use when an unexpected payment is received. This can be needed when a customer pays in advance or when no matching invoice can be found. Mind that you can correct movements before confirming them."1059msgid "The account to use when an unexpected payment is received. This can be needed when a customer pays in advance or when no matching invoice can be found. Mind that you can correct movements before confirming them."
1060msgstr "De grootboekrekening waarop een onverwachte betaling kan worden geboekt, bijvoorbeeld in het geval van eeen klant die vooruitbetaalt of als er geen overeenkomende factuur kan worden gevonden in het systeem. Merk op dat er voor het bevestigen van de boekingen nog wijzigingen kunnen worden aangebracht."1060msgstr "De grootboekrekening waarop een onverwachte betaling kan worden geboekt, bijvoorbeeld in het geval van een klant die vooruitbetaalt of als er geen overeenkomende factuur kan worden gevonden in het systeem. Merk op dat er voor het bevestigen van de boekingen nog wijzigingen kunnen worden aangebracht."
10611061
1062#. module: account_banking1062#. module: account_banking
1063#: field:payment.mode.type,payment_order_type:01063#: field:payment.mode.type,payment_order_type:0
10641064
=== modified file 'account_banking/wizard/bank_import.py'
--- account_banking/wizard/bank_import.py 2012-02-21 23:50:13 +0000
+++ account_banking/wizard/bank_import.py 2012-05-03 12:17:23 +0000
@@ -423,11 +423,16 @@
423 ),423 ),
424 }424 }
425425
426 def _default_parser_type(self, cr, uid, context=None):
427 types = models.parser_type.get_parser_types()
428 return types and types[0][0] or False
429
426 _defaults = {430 _defaults = {
427 'state': 'init',431 'state': 'init',
428 'company': lambda s,cr,uid,c:432 'company': lambda s,cr,uid,c:
429 s.pool.get('res.company')._company_default_get(433 s.pool.get('res.company')._company_default_get(
430 cr, uid, 'bank.import.transaction', context=c),434 cr, uid, 'bank.import.transaction', context=c),
435 'parser': _default_parser_type,
431 }436 }
432437
433banking_import()438banking_import()
434439
=== modified file 'account_banking/wizard/bank_import_view.xml'
--- account_banking/wizard/bank_import_view.xml 2012-02-17 23:36:43 +0000
+++ account_banking/wizard/bank_import_view.xml 2012-05-03 12:17:23 +0000
@@ -34,7 +34,8 @@
34 <field name="log" colspan="4" nolabel="1" width="500"/>34 <field name="log" colspan="4" nolabel="1" width="500"/>
35 </page>35 </page>
36 <page attrs="{'invisible': [('state', '!=', 'ready')]}" string="Statements">36 <page attrs="{'invisible': [('state', '!=', 'ready')]}" string="Statements">
37 <field name="statement_ids" colspan="4" nolabel="1"/>37 <field name="statement_ids" colspan="4" nolabel="1"
38 attrs="{'invisible': [('state', '!=', 'ready')]}" />
38 </page>39 </page>
39 </notebook>40 </notebook>
40 <group colspan="2" >41 <group colspan="2" >

Subscribers

People subscribed via source and target branches