Example #1
0
    def update_related_clirec_obj(self, obj, uploaded_comment=''):
        """Update the clirec object from which the charge was created."""

        clirec_id = self.request.POST.get('clirec_id')

        if clirec_id:
            clirec_obj = UnmatchedClarec.objects.get(pk=clirec_id)
            clirec_obj.clirec_obj = obj
            if hasattr(obj, 'lc_number'):
                clirec_obj.lc_number = obj.lc_number
            comment = clirec_obj.comment or ''
            if uploaded_comment:
                comment += '\n\n%s' % uploaded_comment
            clirec_obj.comment = comment + '\n%s' % get_model_name(obj)
            clirec_obj.date_upload_processed = date.today()
            clirec_obj.save()