mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[ADD] Useful defaults on simple setups for import settings (lp:931395)
[ADD] Default to first available parser on the import wizard [FIX] Statements field on import wizard not invisible in initial state [FIX] Typo in Dutch translation
This commit is contained in:
@@ -131,9 +131,41 @@ class account_banking_account_settings(osv.osv):
|
||||
user = self.pool.get('res.users').browse(cursor, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
return user.company_id.id
|
||||
return self.pool.get('res.company').search(cursor, uid,
|
||||
[('parent_id', '=', False)]
|
||||
)[0]
|
||||
company_ids = self.pool.get('res.company').search(
|
||||
cursor, uid, [('parent_id', '=', False)])
|
||||
return len(company_ids) == 1 and company_ids[0] or False
|
||||
|
||||
def _default_journal(self, cr, uid, context=None):
|
||||
domain = [('type', '=', 'bank')]
|
||||
user = self.pool.get('res.users').read(
|
||||
cr, uid, uid, ['company_id'], context=context)
|
||||
if user['company_id']:
|
||||
domain.append(('company_id', '=', user['company_id'][0]))
|
||||
journal_ids = self.pool.get('account.journal').search(
|
||||
cr, uid, domain)
|
||||
return len(journal_ids) == 1 and journal_ids[0] or False
|
||||
|
||||
def _default_partner_bank_id(self, cr, uid, context=None):
|
||||
user = self.pool.get('res.users').read(
|
||||
cr, uid, uid, ['company_id'], context=context)
|
||||
if user['company_id']:
|
||||
bank_ids = self.pool.get('res.partner.bank').search(
|
||||
cr, uid, [('company_id', '=', user['company_id'][0])])
|
||||
if len(bank_ids) == 1:
|
||||
return bank_ids[0]
|
||||
return False
|
||||
|
||||
def _default_debit_account_id(self, cr, uid, context=None):
|
||||
account_def = self.pool.get('ir.property').get(
|
||||
cr, uid, 'property_account_receivable',
|
||||
'res.partner', context=context)
|
||||
return account_def and account_def.id or False
|
||||
|
||||
def _default_credit_account_id(self, cr, uid, context=None):
|
||||
account_def = self.pool.get('ir.property').get(
|
||||
cr, uid, 'property_account_payable',
|
||||
'res.partner', context=context)
|
||||
return account_def and account_def.id or False
|
||||
|
||||
def find(self, cr, uid, journal_id, partner_bank_id=False, context=None):
|
||||
domain = [('journal_id','=',journal_id)]
|
||||
@@ -143,6 +175,10 @@ class account_banking_account_settings(osv.osv):
|
||||
|
||||
_defaults = {
|
||||
'company_id': _default_company,
|
||||
'journal_id': _default_journal,
|
||||
'default_debit_account_id': _default_debit_account_id,
|
||||
'default_credit_account_id': _default_credit_account_id,
|
||||
'partner_bank_id': _default_partner_bank_id,
|
||||
#'multi_currency': lambda *a: False,
|
||||
}
|
||||
account_banking_account_settings()
|
||||
|
||||
@@ -1057,7 +1057,7 @@ msgstr "Unreconcile payment order not implemented"
|
||||
#. module: account_banking
|
||||
#: help:account.banking.account.settings,default_debit_account_id:0
|
||||
msgid "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."
|
||||
msgstr "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."
|
||||
msgstr "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."
|
||||
|
||||
#. module: account_banking
|
||||
#: field:payment.mode.type,payment_order_type:0
|
||||
|
||||
@@ -423,11 +423,16 @@ class banking_import(osv.osv_memory):
|
||||
),
|
||||
}
|
||||
|
||||
def _default_parser_type(self, cr, uid, context=None):
|
||||
types = models.parser_type.get_parser_types()
|
||||
return types and types[0][0] or False
|
||||
|
||||
_defaults = {
|
||||
'state': 'init',
|
||||
'company': lambda s,cr,uid,c:
|
||||
s.pool.get('res.company')._company_default_get(
|
||||
cr, uid, 'bank.import.transaction', context=c),
|
||||
'parser': _default_parser_type,
|
||||
}
|
||||
|
||||
banking_import()
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
<field name="log" colspan="4" nolabel="1" width="500"/>
|
||||
</page>
|
||||
<page attrs="{'invisible': [('state', '!=', 'ready')]}" string="Statements">
|
||||
<field name="statement_ids" colspan="4" nolabel="1"/>
|
||||
<field name="statement_ids" colspan="4" nolabel="1"
|
||||
attrs="{'invisible': [('state', '!=', 'ready')]}" />
|
||||
</page>
|
||||
</notebook>
|
||||
<group colspan="2" >
|
||||
|
||||
Reference in New Issue
Block a user