mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
[print] Hide Rate, Amount if Print Without Amount in Delivery Note
This commit is contained in:
@@ -40,6 +40,20 @@ class DeliveryNote(SellingController):
|
|||||||
total_qty = sum((item.qty for item in self.get("delivery_note_details")))
|
total_qty = sum((item.qty for item in self.get("delivery_note_details")))
|
||||||
self.get("__onload").billing_complete = (billed_qty[0][0] == total_qty)
|
self.get("__onload").billing_complete = (billed_qty[0][0] == total_qty)
|
||||||
|
|
||||||
|
def before_print(self):
|
||||||
|
def toggle_print_hide(meta, fieldname):
|
||||||
|
df = meta.get_field(fieldname)
|
||||||
|
if self.get("print_without_amount"):
|
||||||
|
df.set("__print_hide", 1)
|
||||||
|
else:
|
||||||
|
df.delete_key("__print_hide")
|
||||||
|
|
||||||
|
toggle_print_hide(self.meta, "currency")
|
||||||
|
|
||||||
|
item_meta = frappe.get_meta("Delivery Note Item")
|
||||||
|
for fieldname in ("rate", "amount", "price_list_rate", "discount_percentage"):
|
||||||
|
toggle_print_hide(item_meta, fieldname)
|
||||||
|
|
||||||
def get_portal_page(self):
|
def get_portal_page(self):
|
||||||
return "shipment" if self.docstatus==1 else None
|
return "shipment" if self.docstatus==1 else None
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
{%- from "templates/print_formats/standard_macros.html" import print_value -%}
|
{%- from "templates/print_formats/standard_macros.html" import print_value -%}
|
||||||
{%- set std_fields = ("item_code", "item_name", "description", "qty", "rate", "amount", "stock_uom", "uom") -%}
|
{%- set std_fields = ("item_code", "item_name", "description", "qty", "rate", "amount", "stock_uom", "uom") -%}
|
||||||
{%- set visible_columns = get_visible_columns(doc.get(df.fieldname), table_meta) -%}
|
{%- set visible_columns = get_visible_columns(doc.get(df.fieldname), table_meta) -%}
|
||||||
|
{%- set hide_rate = data[0].meta.is_print_hide("rate") -%}
|
||||||
|
{%- set hide_amount = data[0].meta.is_print_hide("amount") -%}
|
||||||
|
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -8,8 +10,8 @@
|
|||||||
<th style="width: 3%">{{ _("Sr") }}</th>
|
<th style="width: 3%">{{ _("Sr") }}</th>
|
||||||
<th style="width: 57%">{{ _("Item") }}</th>
|
<th style="width: 57%">{{ _("Item") }}</th>
|
||||||
<th style="width: 10%;" class="text-right">{{ _("Qty") }}</th>
|
<th style="width: 10%;" class="text-right">{{ _("Qty") }}</th>
|
||||||
<th style="width: 15%;" class="text-right">{{ _("Rate") }}</th>
|
{% if not hide_rate -%}<th style="width: 15%;" class="text-right">{{ _("Rate") }}</th>{%- endif %}
|
||||||
<th style="width: 15%;" class="text-right">{{ _("Amount") }}</th>
|
{% if not hide_amount -%}<th style="width: 15%;" class="text-right">{{ _("Amount") }}</th>{%- endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{%- for row in data -%}
|
{%- for row in data -%}
|
||||||
<tr>
|
<tr>
|
||||||
@@ -30,17 +32,15 @@
|
|||||||
{%- for field in visible_columns -%}
|
{%- for field in visible_columns -%}
|
||||||
{%- if (field.fieldname not in std_fields) and
|
{%- if (field.fieldname not in std_fields) and
|
||||||
(row[field.fieldname] not in (None, "", 0)) -%}
|
(row[field.fieldname] not in (None, "", 0)) -%}
|
||||||
<div><strong>{{ _(field.label) }}:</strong></div>
|
<div><strong>{{ _(field.label) }}:</strong>
|
||||||
{{ row.get_formatted(field.fieldname, doc) }}
|
{{ row.get_formatted(field.fieldname, doc) }}</div>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align: right;">{{ row.get_formatted("qty", doc) }}<br>
|
<td style="text-align: right;">{{ row.get_formatted("qty", doc) }}<br>
|
||||||
<small>{{ row.uom or row.stock_uom }}</small></td>
|
<small>{{ row.uom or row.stock_uom }}</small></td>
|
||||||
<td style="text-align: right;">{{
|
{% if not hide_rate -%}<td style="text-align: right;">{{ row.get_formatted("rate", doc) }}</td>{%- endif %}
|
||||||
row.get_formatted("rate", doc) }}</td>
|
{% if not hide_amount -%}<td style="text-align: right;">{{ row.get_formatted("amount", doc) }}</td>{%- endif %}
|
||||||
<td style="text-align: right;">{{
|
|
||||||
row.get_formatted("amount", doc) }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user