Odoo18-Base/addons/l10n_gcc_invoice/views/report_invoice.xml
2025-03-10 11:12:23 +07:00

557 lines
31 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_invoice" inherit_id="account.report_invoice">
<xpath expr='//t[@t-call="account.report_invoice_document"]' position="after">
<t t-if="o._get_name_invoice_report() == 'l10n_gcc_invoice.arabic_english_invoice'"
t-call="l10n_gcc_invoice.arabic_english_invoice" t-lang="lang"/>
</xpath>
</template>
<template id="report_invoice_with_payments" inherit_id="account.report_invoice_with_payments">
<xpath expr='//t[@t-call="account.report_invoice_document"]' position="after">
<t t-if="o._get_name_invoice_report() == 'l10n_gcc_invoice.arabic_english_invoice'"
t-call="l10n_gcc_invoice.arabic_english_invoice" t-lang="lang"/>
</xpath>
</template>
<template id="arabic_english_invoice">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context(lang=lang)" />
<t t-set="forced_vat" t-value="o.fiscal_position_id.foreign_vat"/> <!-- So that it appears in the footer of the report instead of the company VAT if it's set -->
<t t-set="address">
<address t-field="o.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' style="text-align: right"/>
<div t-if="o.partner_id.vat" class="mt16" style="text-align: right">
<t t-if="o.company_id.account_fiscal_country_id.vat_label" t-esc="o.company_id.account_fiscal_country_id.vat_label" id="inv_tax_id_label"/>
<t t-else="">Tax ID</t>: <span t-field="o.partner_id.vat"/></div>
</t>
<t t-set="o_sec" t-value="o.with_context(lang='ar_001')"/>
<t t-set="o" t-value="o.with_context(lang='en_US')"/>
<div class="page">
<h3>
<div class="row">
<div class="col-4" style="text-align:left">
<span t-if="o.move_type == 'out_invoice' and o.state == 'posted'">
Tax Invoice
</span>
<span t-if="o.move_type == 'out_invoice' and o.state == 'draft'">
Draft Invoice
</span>
<span t-if="o.move_type == 'out_invoice' and o.state == 'cancel'">
Cancelled Invoice
</span>
<span t-if="o.move_type == 'out_refund'">
Credit Note
</span>
<span t-if="o.move_type == 'in_refund'">
Vendor Credit Note
</span>
<span t-if="o.move_type == 'in_invoice'">
Vendor Bill
</span>
</div>
<div class="col-4 text-center">
<span t-if="o.name != '/'" t-field="o.name"/>
</div>
<div class="col-4" style="text-align:right">
<span t-if="o.move_type == 'out_invoice' and o.state == 'posted'">
فاتورة ضريبية
</span>
<span t-if="o.move_type == 'out_invoice' and o.state == 'draft'">
مسودة فاتورة
</span>
<span t-if="o.move_type == 'out_invoice' and o.state == 'cancel'">
فاتورة ملغاة
</span>
<span t-if="o.move_type == 'out_refund'">
إشعار دائن
</span>
<span t-if="o.move_type == 'in_refund'">
إشعار مدين
</span>
<span t-if="o.move_type == 'in_invoice'">
فاتورة المورد
</span>
</div>
</div>
</h3>
<div id="informations" class="pb-3">
<div class="row" t-if="o.invoice_date" name="invoice_date">
<div class="col-2 offset-6">
<strong style="white-space:nowrap">Invoice Date:
</strong>
</div>
<div class="col-2">
<span t-field="o.invoice_date"/>
</div>
<div class="col-2 text-end">
<strong style="white-space:nowrap">:
تاريخ الفاتورة
</strong>
</div>
</div>
<div class="row"
t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted'"
name="due_date">
<div class="col-2 offset-6">
<strong style="white-space:nowrap">Due Date:
</strong>
</div>
<div class="col-2">
<span t-field="o.invoice_date_due"/>
</div>
<div class="col-2 text-end">
<strong style="white-space:nowrap">:
تاريخ الاستحقاق
</strong>
</div>
</div>
<div class="row" t-if="o.invoice_origin" name="origin">
<div class="col-2 offset-6">
<strong style="white-space:nowrap">Source:
</strong>
</div>
<div class="col-2">
<span t-field="o.invoice_origin"/>
</div>
<div class="col-2 text-end">
<strong style="white-space:nowrap">:
المصدر
</strong>
</div>
</div>
<div class="row" t-if="o.partner_id.ref" name="customer_code">
<div class="col-2 offset-6">
<strong style="white-space:nowrap">:
Customer Code
</strong>
</div>
<div class="col-2">
<span t-field="o.partner_id.ref"/>
</div>
<div class="col-2 text-end">
<strong style="white-space:nowrap">:
كود العميل
</strong>
</div>
</div>
<div class="row" t-if="o.ref" name="reference">
<div class="col-2">
<strong style="white-space:nowrap">Reference:
</strong>
</div>
<div class="col-8">
<span t-field="o.ref"/>
</div>
<div class="col-2 text-end">
<strong style="white-space:nowrap">:
رقم الإشارة
</strong>
</div>
</div>
</div>
<t t-set="display_discount" t-value="any(l.discount for l in o.invoice_line_ids)"/>
<table class="table table-sm o_main_table" name="invoice_line_table">
<thead>
<tr>
<t t-set="colspan" t-value="6"/>
<th name="th_total" class="text-end">
<span>
السعر الاجمالي
</span>
<br/>
<span>
Total Price
</span>
</th>
<th name="th_tax_amount"
class="text-end">
<span>
قيمة الضريبة
</span>
<br/>
<span>
VAT Amount
</span>
</th>
<th name="th_subtotal" class="text-end">
<span>
مبلغ
</span>
<br/>
<span>
Amount
</span>
</th>
<th name="th_taxes"
class="text-end">
<span>
الضرائب
</span>
<br/>
<span>
Taxes
</span>
</th>
<th name="th_price_unit" t-if="display_discount"
class="text-end">
<span>
خصم %
</span>
<br/>
<span>
Disc.%
</span>
<t t-set="colspan" t-value="colspan+1"/>
</th>
<th name="th_priceunit"
class="text-end">
<span>
سعر الوحدة
</span>
<br/>
<span>
Unit price
</span>
</th>
<th name="th_quantity" class="text-end">
<span>
الكمية
</span>
<br/>
<span>
Quantity
</span>
</th>
<th name="th_source" class="d-none text-start" t-if="0">
<span>
المستند المصدر
</span>
<br/>
<span>
Source Document
</span>
</th>
<th name="th_description" class="text-end">
<span>
الوصف
</span>
<br/>
<span>
Description
</span>
</th>
</tr>
</thead>
<tbody class="invoice_tbody">
<t t-set="current_subtotal" t-value="0"/>
<t t-set="lines"
t-value="o.invoice_line_ids.sorted(key=lambda l: (-l.sequence, l.date, l.move_name, -l.id), reverse=True)"/>
<t t-foreach="lines" t-as="line">
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal"
groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_total"
groups="account.group_show_line_subtotals_tax_included"/>
<tr t-att-class="'bg-200 fw-bold o_line_section' if line.display_type == 'line_section' else 'fst-italic o_line_note' if line.display_type == 'line_note' else ''">
<t t-if="line.display_type not in ('line_note', 'line_section')" name="account_invoice_line_accountable">
<td class="text-end o_price_total">
<span class="text-nowrap" t-field="line.price_total"/>
</td>
<td class="text-end">
<span class="text-nowrap" t-field="line.l10n_gcc_invoice_tax_amount"/>
</td>
<td class="text-end o_price_total">
<span class="text-nowrap" t-field="line.price_subtotal"/>
</td>
<td class="text-end">
<span t-out="', '.join(map(lambda x: (x.description or x.name), line.tax_ids))"
id="line_tax_ids"/>
</td>
<td t-if="display_discount"
class="text-end">
<span class="text-nowrap" t-field="line.discount"/>
</td>
<td class="text-end">
<span class="text-nowrap" t-field="line.price_unit"/>
</td>
<td class="text-end">
<span t-field="line.quantity"/>
<span t-field="line.product_uom_id" groups="uom.group_uom"/>
</td>
<td name="account_invoice_line_name" class="text-end">
<t t-if="line.product_id">
<t t-set="english_name" t-value="line.with_context(lang='en_US').product_id.display_name"/>
<t t-set="arabic_name" t-value="line.with_context(lang='ar_001').product_id.display_name"/>
<span t-out="arabic_name + '\n'" t-if="arabic_name not in line.name" t-options="{'widget': 'text'}"/>
<span t-out="english_name + '\n'" t-if="(english_name != arabic_name) and (english_name not in line.name)" t-options="{'widget': 'text'}"/>
</t>
<span t-out="line.name" t-options="{'widget': 'text'}"/>
</td>
</t>
<t t-if="line.display_type == 'line_section'">
<td colspan="99">
<span t-field="line.name" t-options="{'widget': 'text'}"/>
</td>
<t t-set="current_section" t-value="line"/>
<t t-set="current_subtotal" t-value="0"/>
</t>
<t t-if="line.display_type == 'line_note'">
<td colspan="99">
<span t-field="line.name" t-options="{'widget': 'text'}"/>
</td>
</t>
</tr>
<t t-if="current_section and (line_last or lines[line_index+1].display_type == 'line_section')">
<tr class="is-subtotal text-end">
<td colspan="99">
<strong class="mr16" style="display: inline-block">Subtotal/الإجمالي الفرعي</strong>
<span
t-out="current_subtotal"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
/>
</td>
</tr>
</t>
</t>
</tbody>
</table>
<div class="clearfix pt-4 pb-3">
<div id="total" class="row">
<div class="col-6">
<table class="table table-sm" style="page-break-inside: avoid;">
<tr class="border-black o_subtotal">
<td class="text-end">
<span t-field="o.amount_untaxed"/>
</td>
<td class="text-end">
<strong>
Subtotal
/
الإجمالي الفرعي
</strong>
</td>
</tr>
<t t-set="tax_totals" t-value="o.tax_totals"/>
<t t-foreach="tax_totals['subtotals']" t-as="subtotal">
<t t-set="subtotal_to_show" t-value="subtotal['name']"/>
<!-- copy-pasted template "account.tax_groups_totals" with reversed columns order -->
<t t-foreach="tax_totals['groups_by_subtotal'][subtotal_to_show]" t-as="amount_by_group">
<tr>
<td class="text-end o_price_total">
<span class="text-nowrap" t-esc="amount_by_group['formatted_tax_group_amount']"/>
</td>
<td class="text-end">
<strong>
<span t-esc="amount_by_group['tax_group_name']"/>
<t t-if="tax_totals['display_tax_base']">
<span class="text-nowrap"> on
<t t-esc="amount_by_group['formatted_tax_group_base_amount']"/>
</span>
</t>
<!-- Arabic translation of tax group -->
<t t-set="arabic_tax_group_name" t-value="o_sec.tax_totals['groups_by_subtotal'][o_sec.tax_totals['subtotals'][subtotal_index]['name']][amount_by_group_index]['tax_group_name']"/>
<span t-if="arabic_tax_group_name != amount_by_group['tax_group_name']" class="text-nowrap">/
<t t-esc="arabic_tax_group_name"/>
</span>
</strong>
</td>
</tr>
</t>
</t>
<tr class="border-black o_total">
<td class="text-end">
<span class="text-nowrap" t-field="o.amount_total"/>
</td>
<td class="text-end">
<strong>
Total
/
المجموع
</strong>
</td>
</tr>
<t t-if="print_with_payments">
<t t-if="o.payment_state != 'invoicing_legacy'">
<t t-set="payments_vals" t-value="o.sudo().invoice_payments_widget and o.sudo().invoice_payments_widget['content'] or []"/>
<t t-foreach="payments_vals" t-as="payment_vals">
<tr class="border-black o_total">
<td>
<i class="row">
<div class="col-7 oe_form_field oe_payment_label">
Paid on/دفعت في:
</div>
<div class="col-5 ps-0 oe_form_field oe_payment_label">
<t t-out="payment_vals['date']"/>
</div>
</i>
</td>
<td class="text-end">
<span t-out="payment_vals['amount']"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
</t>
<t t-if="len(payments_vals) > 0">
<tr class="border-black">
<td>
<strong>
Amount Due
/
المبلغ المستحق
</strong>
</td>
<td class="text-end">
<span t-field="o.amount_residual"/>
</td>
</tr>
</t>
</t>
</t>
</table>
</div>
</div>
</div>
<p t-if="o.move_type in ('out_invoice', 'in_refund') and o.payment_reference" name="payment_communication">
<div class="row">
<div class="col-4">
Payment Reference :
</div>
<div class="col-4 text-center">
<b>
<span t-field="o.payment_reference"/>
</b>
</div>
<div class="col-4 text-end">
: رقم إشارة الدفعة
</div>
</div>
</p>
<p t-if="o.invoice_payment_term_id" name="payment_term">
<div class="row">
<div class="col-6 text-start">
<span t-if="o.invoice_payment_term_id.note != o_sec.invoice_payment_term_id.note" t-out="o.invoice_payment_term_id.note"/>
</div>
<div class="col-6 text-end">
<span dir="rtl" t-out="o_sec.invoice_payment_term_id.note"/>
</div>
</div>
<t t-if="o.invoice_payment_term_id.display_on_invoice and o.payment_term_details">
<div t-if="o.show_payment_term_details" id="total_payment_term_details_table" class="row">
<t t-set="pt_size" t-value="'col-9 offset-3' if o.show_discount_details else 'col-6 offset-6'"/>
<t t-set="pt_size_html" t-value="'col-sm-9 col-md-8 offset-sm-3 offset-md-4' if o.show_discount_details else 'col-sm-6 col-md-6 offset-sm-6 offset-md-6'"/>
<div t-attf-class="#{pt_size if report_type != 'html' else pt_size_html} mt-2 mb-2">
<table class="table table-sm" style="page-break-inside: avoid;">
<th class="border-black text-start">
<span>
تاريخ الاستحقاق
</span>
<br/>
<span>
Due Date
</span>
</th>
<th class="border-black text-end">
<span>
المبلغ المستحق
</span>
<br/>
<span>
Amount Due
</span>
</th>
<th t-if="o.show_discount_details" class="border-black text-end">
<span>
الخصم
</span>
<br/>
<span>
Discount
</span>
</th>
<t t-foreach="o.payment_term_details" t-as="term">
<tr>
<td t-esc="term.get('date')" class="text-start"/>
<td t-options="{'widget': 'monetary', 'display_currency': o.currency_id}" t-esc="term.get('amount')" class="text-end"/>
<td t-if="term.get('discount_date')" class="text-end">
<span dir="rtl" style="white-space: normal;">
<span t-options="{'widget': 'monetary', 'display_currency': o.currency_id}"
t-esc="term.get('discount_amount_currency')"/> إذا تم الدفع قبل
<span t-esc="term.get('discount_date')"/>
</span>
<br/>
<span t-options="{'widget': 'monetary', 'display_currency': o.currency_id}"
t-esc="term.get('discount_amount_currency')"/> if paid before
<span t-esc="term.get('discount_date')"/>
</td>
</tr>
</t>
</table>
</div>
</div>
</t>
</p>
<p t-if="o.narration" name="comment">
<div class="row">
<div class="col-6 text-start">
<span t-if="o.narration != o_sec.narration" t-out="o.narration"/>
</div>
<div class="col-6 text-end">
<span dir="rtl" t-out="o_sec.narration"/>
</div>
</div>
</p>
<p t-if="o.fiscal_position_id.note" name="note">
<div class="row">
<div class="col-6 text-start">
<span t-if="o.fiscal_position_id.note != o_sec.fiscal_position_id.note" t-out="o.fiscal_position_id.note"/>
</div>
<div class="col-6 text-end">
<span dir="rtl" t-out="o_sec.fiscal_position_id.note"/>
</div>
</div>
</p>
<p t-if="o.invoice_incoterm_id" name="incoterm">
<div class="row">
<div class="col-6 text-start">
<strong>Incoterm:
</strong>
<span
t-out="o.invoice_incoterm_id.code"/>
-
<span
t-out="o.invoice_incoterm_id.name"/>
</div>
<div class="col-6 text-end">
<strong>شرط تجاري:
</strong>
<span
t-out="o_sec.invoice_incoterm_id.code"/>
-
<span
t-out="o_sec.invoice_incoterm_id.name"/>
</div>
</div>
</p>
</div>
</t>
</template>
</odoo>