te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>xml UBL2.1 invoice error python , using django block template - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

xml UBL2.1 invoice error python , using django block template - Stack Overflow

programmeradmin2浏览0评论

I got this error when i tried to check validity of xml invoice

Error in an electronic invoice in UBL (Universal Business Language) format that relates to compliance with billing requirements, so here I'm using django block template that function call to create xml files from invoices depending on ubl 2.1 , i got error when I'm trying to check validity of xml invoice ... could any one help

here is the code of the template

{% comment %} {% for discount in  %} {% endcomment %}
{% if invoice.allowance_discount %}
    <cac:AllowanceCharge>
        <cbc:ID>1</cbc:ID>
        <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="{{ invoice.currency.code }}">{{ invoice.allowance_discount|default:"0.0"|floatformat:2 }}</cbc:Amount>
        <cac:TaxCategory>
            <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">{{ invoicepany.finance_company.account_sale_tax.vat_category_code }}</cbc:ID>
            <cbc:Percent>{{ invoicepany.finance_company.account_sale_tax.amount|default:"0.0"|floatformat:2 }}</cbc:Percent>
            <cac:TaxScheme>
                <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
            </cac:TaxScheme>
        </cac:TaxCategory>
    </cac:AllowanceCharge>
{% endif %}
{% comment %} {% endfor %} {% endcomment %}`
```

here is the error and warning i got

`Errors
category : BR_ERROR
code :BR-CL-18
message : Invoice tax categories MUST be coded using UNCL5305 code list
Warnings
category : BR_KSA_WARNING
code :BR-KSA-80
message : The Pre-Paid amount (BT-113) must be equal to the sum total of the Prepayment VAT category Taxable Amount (KSA-31) and the Prepayment VAT Category Tax Amount (KSA-32).
category : BR_KSA_WARNING
code :BR-KSA-08
message : The seller identification (BT-29) must exist only once with one of the scheme ID (BT-29-1) (CRN, MOM, MLS, SAG, OTH, 700) and must contain only alphanumeric characters. Commercial Registration number with 'CRN' as schemeID. Momrah license with 'MOM' as schemeID. MHRSD license with 'MLS' as schemeID. 700 Number with '700' as schemeID. MISA license with 'SAG' as schemeID . Other OD with 'OTH' as schemeID.In case of multiple commercial registrations, the seller should fill the commercial registration of the branch in respect of which the Tax Invoice is being issued. In case multiple IDs exist then one of the above must be entered following the sequence specified above.
category : BR_WARNING
code :BR-S-01
message : [BR-S-01] An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is "Standard rated" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with "Standard rated".
category : BR_WARNING
code :BR-CO-17
message : VAT category tax amount (BT-117) = VAT category taxable amount (BT-116) x (VAT category rate (BT-119) / 100), rounded to two decimals.
category : BR_KSA_WARNING
code :BR-KSA-73
message : If Pre-Paid amount (BT-113) is provided, then the following data is mandatory to provide as additional invoice line(s) Prepayment ID (KSA-26) ; Sequential invoice number (BT-1) of the prepayment invoice(s) Prepayment Issue Date (KSA-28) ; Issue date (BT-2) of the prepayment invoice(s) Prepayment Issue Time (KSA-29) ; Issue time (KSA-25) of the prepayment invoice(s) Prepayment Document Type Code (KSA-30); Invoice type code (BT-3) must be 386 `

I got this error when i tried to check validity of xml invoice

Error in an electronic invoice in UBL (Universal Business Language) format that relates to compliance with billing requirements, so here I'm using django block template that function call to create xml files from invoices depending on ubl 2.1 , i got error when I'm trying to check validity of xml invoice ... could any one help

here is the code of the template

{% comment %} {% for discount in  %} {% endcomment %}
{% if invoice.allowance_discount %}
    <cac:AllowanceCharge>
        <cbc:ID>1</cbc:ID>
        <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="{{ invoice.currency.code }}">{{ invoice.allowance_discount|default:"0.0"|floatformat:2 }}</cbc:Amount>
        <cac:TaxCategory>
            <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">{{ invoicepany.finance_company.account_sale_tax.vat_category_code }}</cbc:ID>
            <cbc:Percent>{{ invoicepany.finance_company.account_sale_tax.amount|default:"0.0"|floatformat:2 }}</cbc:Percent>
            <cac:TaxScheme>
                <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
            </cac:TaxScheme>
        </cac:TaxCategory>
    </cac:AllowanceCharge>
{% endif %}
{% comment %} {% endfor %} {% endcomment %}`
```

here is the error and warning i got

`Errors
category : BR_ERROR
code :BR-CL-18
message : Invoice tax categories MUST be coded using UNCL5305 code list
Warnings
category : BR_KSA_WARNING
code :BR-KSA-80
message : The Pre-Paid amount (BT-113) must be equal to the sum total of the Prepayment VAT category Taxable Amount (KSA-31) and the Prepayment VAT Category Tax Amount (KSA-32).
category : BR_KSA_WARNING
code :BR-KSA-08
message : The seller identification (BT-29) must exist only once with one of the scheme ID (BT-29-1) (CRN, MOM, MLS, SAG, OTH, 700) and must contain only alphanumeric characters. Commercial Registration number with 'CRN' as schemeID. Momrah license with 'MOM' as schemeID. MHRSD license with 'MLS' as schemeID. 700 Number with '700' as schemeID. MISA license with 'SAG' as schemeID . Other OD with 'OTH' as schemeID.In case of multiple commercial registrations, the seller should fill the commercial registration of the branch in respect of which the Tax Invoice is being issued. In case multiple IDs exist then one of the above must be entered following the sequence specified above.
category : BR_WARNING
code :BR-S-01
message : [BR-S-01] An Invoice that contains an Invoice line (BG-25), a Document level allowance (BG-20) or a Document level charge (BG-21) where the VAT category code (BT-151, BT-95 or BT-102) is "Standard rated" shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with "Standard rated".
category : BR_WARNING
code :BR-CO-17
message : VAT category tax amount (BT-117) = VAT category taxable amount (BT-116) x (VAT category rate (BT-119) / 100), rounded to two decimals.
category : BR_KSA_WARNING
code :BR-KSA-73
message : If Pre-Paid amount (BT-113) is provided, then the following data is mandatory to provide as additional invoice line(s) Prepayment ID (KSA-26) ; Sequential invoice number (BT-1) of the prepayment invoice(s) Prepayment Issue Date (KSA-28) ; Issue date (BT-2) of the prepayment invoice(s) Prepayment Issue Time (KSA-29) ; Issue time (KSA-25) of the prepayment invoice(s) Prepayment Document Type Code (KSA-30); Invoice type code (BT-3) must be 386 `
Share Improve this question asked Feb 17 at 13:05 user29678989user29678989 131 bronze badge New contributor user29678989 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 5
  • 1 Great errors, what is your question? – willeM_ Van Onsem Commented Feb 17 at 13:09
  • the problem is not in the tags or the UBL itself, the problem is in your code..... but I did not understand what is the final result you want to achieve. – Mohammed Almalki Commented Feb 17 at 13:57
  • give us an example of the input and the output you want – Mohammed Almalki Commented Feb 17 at 13:58
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Bot Commented Feb 17 at 17:12
  • Please follow the recommendation for better question: Help others reproduce the problem or in short – Hermann12 Commented Feb 17 at 21:12
Add a comment  | 

1 Answer 1

Reset to default 0

I don’t know, if I have the answer for your question. You should follow the comments and give us more info.

But I searched for other templates, or this this looks like:

<cac:ClassifiedTaxCategory>
<!-- 51 -->
  <cbc:ID schemeID="UNCL5305">E</cbc:ID>
    <cbc:Percent>0</cbc:Percent>
    <cac:TaxScheme>
      <cbc:ID>VAT</cbc:ID>
    </cac:TaxScheme>
</cac:ClassifiedTaxCategory>

So here is used schemeID="UNCL5305" instead of schemeID="UN/ECE 5305" with slash.

You should also ensure your template prevents an empty value

Common valid codes include, e.g.:

  • S (Standard rate)
  • Z (Zero-rated)
  • E (Exempt)
  • AE (VAT Reverse Charge)

Missing or Null Value for Tax Category Code could also lead to an error. If vat_category_code is None or empty, the template might be rendering an invalid XML structure.

Solution: Ensure it has a default value:

<cbc:ID schemeAgencyID="6" schemeID= schemeID="UNCL5305" >
    {{ invoicepany.finance_company.account_sale_tax.vat_category_code|default:"S" }}
</cbc:ID>

Replace "S" with the appropriate default value based on your business requirements.

Hope this helps a bit, but all the warnings should be also consider.

发布评论

评论列表(0)

  1. 暂无评论