← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 745045] Re: base_sale_multichannels: base.sale.payment.type multiple matches

 

Hello,

Good news for your POS integration, your abstract modules
base_external_referentials and base_sale_multichannels open ways for
many integrations, it's a smart solution.

If I understand well, you propose to just replace the ilike by a = ?

It has the advantage to be simple, but that means that everyone has to
split their settings and create as many settings as they have payment
types. It can be annoying to manage all of them (see the  attached
screenshot).

My proposition is smoother as it keep the actual behavior but search for
an exact match only if many payment types are found with the ilike :

         payment_setting_ids = self.pool.get('base.sale.payment.type').search(cr, uid, [['name', 'ilike', payment_code]])
+        # it can happens that a payment_code match 2 payment types like: bank and bankcr.
+        # in such case, we have to search which one is the good one by splitting the payment types and search for the exact match
+        if len(payment_setting_ids) > 1:
+            for payment_setting_id in payment_setting_ids[:]:
+                name = self.pool.get('base.sale.payment.type').read(cr, uid, payment_setting_id, ['name'])['name']
+                if payment_code.lower() in [exact_payment_name.strip().lower() for exact_payment_name in name.split(';')]:
+                    payment_setting_ids = [payment_setting_id]
+                    break

So there is no need to change the configuration and the performance is not impacted for most of the cases.
Do you agree with that ?

Thanks
Guewen

** Attachment added: "payment types"
   https://bugs.launchpad.net/magentoerpconnect/+bug/745045/+attachment/1955672/+files/Screenshot-OpenERP-1.png

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/745045

Title:
  base_sale_multichannels: base.sale.payment.type multiple matches

Status in Magento Open ERP Connector:
  New

Bug description:
  Hi,

  This bug concerns the module base_sale_multichannels in extra-addons,
  so I'm not sure if I better have to report the bug here or on
  openobject-addons. Please tell me if I have to report on extra-addons
  next time.

  The payment codes in base.sale.payment.type are a list of codes
  separated by a ; like "ccsave;free".

  There is a method payment_code_to_payment_settings in the sale.order
  class which searches and returns the right object of
  base.sale.payment.type according to the payment_code given by magento.

  The search is basically a "ilike" on the name, that's efficient and
  works perfect with most of cases.

  But it can happen that you have one payment settings "bank" and one
  "bankcr" for example (we have this issue).

  The method returns the first found, so it can return the settings of
  "bankcr" instead of "bank".

  I just added a few lines in that method which search the exact match
  when many rows are found with the "ilike".

  The attached patch is for extra-addons V5. But if you agree with my
  fix, I can give you a patch for V6 or apply them myself to both extra-
  addons v5 and v6. Just confirm me that's ok for you.

  Thanks
  Guewen



Follow ups

References