[PYTHON]fix allowing for partners without invoice to be considered as valid, eg impor...
authorAntoine Gonzalez <antoine.gonzalez@gmail.com>
Thu, 14 Jan 2016 13:26:33 +0000 (14:26 +0100)
committerAntoine Gonzalez <antoine.gonzalez@gmail.com>
Thu, 14 Jan 2016 13:26:33 +0000 (14:26 +0100)
pos_membership.py

index 3513176..cce51b5 100644 (file)
@@ -444,6 +444,25 @@ class Partner(osv.osv):
                             s = 5
                         else:
                             s = 6
+
+                if s == 6:
+                    # special case when the partner is imported from a file,
+                    # in this case is has a valid membership lines but
+                    # no payment information associated, consider it valid
+
+                    no_payment_info_at_all = True
+                    valid_line = False
+
+                    for mline in partner_data.member_lines:
+                        if mline.date_to >= today:
+                            valid_line = True
+
+                        if mline.account_invoice_line or mline.pos_order_line:
+                            no_payment_info_at_all = False
+
+                    if no_payment_info_at_all and valid_line:
+                        s = 0
+
                 if s == 0:
                     res[id] = 'paid'
                 elif s == 1: