Subversion Repositories SmartDukaan

Rev

Rev 8119 | Rev 13476 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8119 Rev 13363
Line 76... Line 76...
76
        html_msg = MIMEText(mail.body, 'html')
76
        html_msg = MIMEText(mail.body, 'html')
77
        msg.attach(html_msg)
77
        msg.attach(html_msg)
78
 
78
 
79
        if mail.emailType == "DeliverySuccess":
79
        if mail.emailType == "DeliverySuccess":
80
            tclient = TransactionClient().get_client()
80
            tclient = TransactionClient().get_client()
-
 
81
            if '-' in mail.source:
-
 
82
                subOrders = tclient.getGroupOrdersByLogisticsTxnId(mail.source)
-
 
83
                singleOrderId = 0
-
 
84
                for order in subOrders:
-
 
85
                    if order.insurer:
-
 
86
                        singleOrderId = order.id
-
 
87
                        break
-
 
88
                if singleOrderId > 0:
-
 
89
                    document = tclient.getDocument(1, int(mail.source))
-
 
90
                    if document != bin(0):
-
 
91
                        msg.attach(self.get_attachment_part(document, mail.source))
-
 
92
            else:
81
            document = tclient.getDocument(1, int(mail.source))
93
                document = tclient.getDocument(1, int(mail.source))
82
            if document != bin(0):
94
                if document != bin(0):
83
                msg.attach(self.get_attachment_part(document, mail.source))
95
                    msg.attach(self.get_attachment_part(document, mail.source))
84
            
96
            
85
        try:
97
        try:
86
            self.setMailServerAndPassword(mail)
98
            self.setMailServerAndPassword(mail)
87
            rs = self.mailServer.sendmail(self.password, mail.emailTo + mail.cc + mail.bcc + ['backup@saholic.com'], msg.as_string())
99
            rs = self.mailServer.sendmail(self.password, mail.emailTo + mail.cc + mail.bcc + ['backup@saholic.com'], msg.as_string())
88
        except smtplib.SMTPServerDisconnected as e:
100
        except smtplib.SMTPServerDisconnected as e: