← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~therp-nl/banking-addons/ba70-partner_model_fixes into lp:banking-addons

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/banking-addons/ba70-partner_model_fixes into lp:banking-addons.

Requested reviews:
  Banking Addons Core Editors (banking-addons-team)

For more details, see:
https://code.launchpad.net/~therp-nl/banking-addons/ba70-partner_model_fixes/+merge/185630
-- 
https://code.launchpad.net/~therp-nl/banking-addons/ba70-partner_model_fixes/+merge/185630
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~therp-nl/banking-addons/ba70-partner_model_fixes into lp:banking-addons.
=== modified file 'account_banking/banking_import_transaction.py'
--- account_banking/banking_import_transaction.py	2013-08-24 10:57:32 +0000
+++ account_banking/banking_import_transaction.py	2013-09-14 11:55:41 +0000
@@ -72,7 +72,7 @@
         invoice_ids = invoice_obj.search(cr, uid, [
             '&',
             ('type', '=', 'in_invoice'),
-            ('partner_id', '=', account_info.bank_partner_id.id),
+            ('partner_id', 'child_of', account_info.bank_partner_id.id),
             ('company_id', '=', account_info.company_id.id),
             ('date_invoice', '=', trans.effective_date),
             ('reference', '=', reference),

=== modified file 'account_banking/wizard/banking_transaction_wizard.py'
--- account_banking/wizard/banking_transaction_wizard.py	2013-08-12 09:20:35 +0000
+++ account_banking/wizard/banking_transaction_wizard.py	2013-09-14 11:55:41 +0000
@@ -131,7 +131,7 @@
                                 { 'move_line_id': move_line.id, }, context=context)
                             statement_line_obj.write(
                                 cr, uid, wiz.import_transaction_id.statement_line_id.id,
-                                { 'partner_id': move_line.invoice.partner_id.id,
+                                { 'partner_id': move_line.partner_id.id or False,
                                   'account_id': move_line.account_id.id,
                                   }, context=context)
                             found = True
@@ -226,9 +226,9 @@
                         }
 
                     if todo_entry[0]:
-                        st_line_vals['partner_id'] = invoice_obj.read(
-                            cr, uid, todo_entry[0], 
-                            ['partner_id'], context=context)['partner_id'][0]
+                        st_line_vals['partner_id'] = invoice_obj.browse(
+                            cr, uid, todo_entry[0], context=context
+                            ).partner_id.commercial_partner_id.id
 
                     statement_line_obj.write(
                         cr, uid, statement_line_id, 

=== modified file 'account_banking/wizard/banktools.py'
--- account_banking/wizard/banktools.py	2013-06-04 10:18:31 +0000
+++ account_banking/wizard/banktools.py	2013-09-14 11:55:41 +0000
@@ -97,8 +97,11 @@
     TODO: revive the search by lines from the address argument
     '''
     partner_obj = pool.get('res.partner')
-    partner_ids = partner_obj.search(cr, uid, [('name', 'ilike', name)],
-                                     context=context)
+    partner_ids = partner_obj.search(
+        cr, uid, [
+            '|', ('is_company', '=', True), ('parent_id', '=', False),
+            ('name', 'ilike', name),
+            ], context=context)
     if not partner_ids:
         # Try brute search on address and then match reverse
         criteria = []
@@ -118,11 +121,11 @@
         key = name.lower()
         partners = []
         for partner in partner_obj.read(
-            cr, uid, partner_search_ids, ['name'], context=context):
+            cr, uid, partner_search_ids, ['name', 'commercial_partner_id'], context=context):
             if (len(partner['name']) > 3 and partner['name'].lower() in key):
                 partners.append(partner)
         partners.sort(key=lambda x: len(x['name']), reverse=True)
-        partner_ids = [x['id'] for x in partners]
+        partner_ids = [x['commercial_partner_id'][0] for x in partners]
     if len(partner_ids) > 1:
         log.append(
             _('More than one possible match found for partner with '

=== modified file 'account_banking/wizard/link_partner.py'
--- account_banking/wizard/link_partner.py	2013-06-05 12:34:24 +0000
+++ account_banking/wizard/link_partner.py	2013-09-14 11:55:41 +0000
@@ -34,7 +34,10 @@
         'supplier': fields.boolean('Supplier'),
         'customer': fields.boolean('Customer'),
         'partner_id': fields.many2one(
-            'res.partner', 'or link existing partner'),
+            'res.partner', 'or link existing partner',
+            domain=['|', ('is_company', '=', True),
+                    ('partner_id', '=', False)],
+            ),
         'statement_line_id': fields.many2one(
             'account.bank.statement.line',
             'Statement line', required=True),


Follow ups