コード例 #1
0
    def _get_xml_file(self):
        if self.invoice_id.type == "out_invoice":
            xml_without_signature = global_functions.get_template_xml(
                self._get_invoice_values(),
                'Invoice')
        elif self.invoice_id.type == "out_refund" and self.invoice_id.refund_type == "credit":
            xml_without_signature = global_functions.get_template_xml(
                self._get_credit_note_values(),
                'CreditNote')
        elif self.invoice_id.type == "out_refund" and self.invoice_id.refund_type == "debit":
            xml_without_signature = global_functions.get_template_xml(
                self._get_debit_note_values(),
                'DebitNote')

        try:
            response = urlopen(self.company_id.signature_policy_url, timeout=2)

            if response.getcode() != 200:
                return False
        except:
            return False

        xml_with_signature = global_functions.get_xml_with_signature(
            xml_without_signature,
            self.company_id.signature_policy_url,
            self.company_id.signature_policy_description,
            self.company_id.certificate_file,
            self.company_id.certificate_password)

        return xml_with_signature
コード例 #2
0
    def _get_xml_file(self):
        xml_without_signature = global_functions.get_template_xml(
            self._get_xml_values(), 'generic_invoice')
        xml_with_signature = global_functions.get_xml_with_signature(
            xml_without_signature,
            self.invoice_id.company_id.signature_policy_url,
            self.invoice_id.company_id.signature_policy_description,
            self.invoice_id.company_id.certificate_file,
            self.invoice_id.company_id.certificate_password)

        return xml_with_signature
コード例 #3
0
    def _get_xml_file(self):
        if self.invoice_id.type == "out_invoice":
            xml_without_signature = global_functions.get_template_xml(
                self._get_invoice_values(), 'Invoice')
        elif self.invoice_id.type == "out_refund" and self.invoice_id.refund_type == "credit":
            xml_without_signature = global_functions.get_template_xml(
                self._get_credit_note_values(), 'CreditNote')
        elif self.invoice_id.type == "out_refund" and self.invoice_id.refund_type == "debit":
            xml_without_signature = global_functions.get_template_xml(
                self._get_debit_note_values(), 'DebitNote')

        xml_with_signature = global_functions.get_xml_with_signature(
            xml_without_signature, self.company_id.signature_policy_url,
            self.company_id.signature_policy_description,
            self.company_id.certificate_file,
            self.company_id.certificate_password)

        return xml_with_signature