list_partner += ids2
return list_partner
+
+ def _membership_state(self, cr, uid, ids, name, args, context=None):
+ res = super(Partner, self)._membership_state(cr, uid, ids, name, args, context)
+ today = time.strftime('%Y-%m-%d')
+
+ # special case when the partner is imported from a file,
+ # in this case is has a valid membership line but
+ # no payment information associated to it, consider it valid
+ for id in ids:
+ if res[id] == 'none':
+
+ partner_data = self.browse(cr, uid, id, context=context)
+
+ 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:
+ no_payment_info_at_all = False
+
+ if no_payment_info_at_all and valid_line:
+ res[id] = 'paid'
+
+ return res
+
+
_columns = {
'member_ident': fields.char('Member identifier', size=64),
'associate_members': fields.one2many('res.partner', 'associate_member', 'Associate members', help='Members who are associated to this partner.'),
and context.get('date_from')
and datetime.strptime(context('date_from'), "%Y-%m-%d")
or date.today())
- date_to = date_from + relativedelta(months = +12) # TODO: parameterize this delta?
+ date_to = date_from + relativedelta(months=+12, days=-1) # TODO: parameterize this delta?
date_from = date_from.strftime("%Y-%m-%d")
date_to = date_to .strftime("%Y-%m-%d")
print ("DEV: [remembership] [account_invoice_line] [write] date_from: %s" % str(date_from))
and context.get('date_from')
and datetime.strptime(context.get('date_from'), "%Y-%m-%d")
or date.today())
- date_to = date_from + relativedelta(days = +364) # TODO: parameterize this delta?
+ print("#DEBUG: Date de début - %s" % str(date_from))
+ date_to = date_from + relativedelta(months=+12, days=-1) # TODO: parameterize this delta?
date_from = date_from.strftime("%Y-%m-%d")
date_to = date_to .strftime("%Y-%m-%d")
print ("DEV: [remembership] [account_invoice_line] [create] date_from: %s" % str(date_from))