Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Taxes template for selling/buying doctypes #28048

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 18:06:53.083133",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Purchase Invoice",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:06:53.083133",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 17:50:00.152759",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Sales Invoice",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:13:20.894207",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 18:07:19.253457",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Purchase Order",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:07:19.253457",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 18:09:08.103919",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Supplier Quotation",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:09:08.103919",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 15:48:56.416449",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Quotation",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:11:33.553722",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"creation": "2021-10-19 18:04:24.443076",
"docstatus": 0,
"doctype": "Print Format Field Template",
"document_type": "Sales Order",
"field": "taxes",
"idx": 0,
"modified": "2021-10-19 18:04:24.443076",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Taxes",
"owner": "Administrator",
"standard": 1,
"template": "",
"template_file": "templates/print_formats/includes/taxes_and_charges.html"
}
34 changes: 34 additions & 0 deletions erpnext/templates/print_formats/includes/taxes_and_charges.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{% macro render_row(label, value) %}
<div class="field row">
<div class="col-7 {%- if doc.align_labels_right %} text-right{%- endif -%}">
<div class="label">{{ label }}</div>
</div>
<div class="text-right col-5">
{{ value }}
</div>
</div>
{% endmacro %}

{%- macro render_discount_amount(doc) -%}
{%- if doc.discount_amount -%}
{{ render_row(_(doc.meta.get_label('discount_amount')), '- ' + doc.get_formatted("discount_amount", doc)) }}
{%- endif -%}
{%- endmacro -%}

<div class="row">
<div class="col"></div>
<div class="col">
{%- if doc.apply_discount_on == "Net Total" -%}
{{ render_discount_amount(doc) }}
{%- endif -%}
{%- for charge in doc.taxes -%}
{%- if (charge.tax_amount or print_settings.print_taxes_with_zero_amount) and (not charge.included_in_print_rate or doc.flags.show_inclusive_tax_in_print) -%}
{{ render_row(charge.get_formatted("description"), charge.get_formatted('tax_amount', doc)) }}
{%- endif -%}
{%- endfor -%}
{%- if doc.apply_discount_on == "Grand Total" -%}
{{ render_discount_amount(doc) }}
{%- endif -%}
</div>
</div>