Merge pull request #2002 from anandpdoshi/anand-july-29
[print] Hide Rate, Amount if Print Without Amount in Delivery Note
This commit is contained in:
commit
ddbf14adba
@ -17,7 +17,7 @@ install:
|
||||
- wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-precise-amd64.deb
|
||||
- sudo dpkg -i wkhtmltox-0.12.1_linux-precise-amd64.deb
|
||||
|
||||
- CFLAGS=-O0 pip install git+https://github.com/frappe/frappe.git@$develop &&
|
||||
- CFLAGS=-O0 pip install git+https://github.com/frappe/frappe.git@develop &&
|
||||
- pip install --editable .
|
||||
|
||||
before_script:
|
||||
|
@ -73,3 +73,4 @@ execute:frappe.delete_doc("DocType", "Payment to Invoice Matching Tool") # 29-07
|
||||
execute:frappe.delete_doc("DocType", "Payment to Invoice Matching Tool Detail") # 29-07-2014
|
||||
execute:frappe.delete_doc("Page", "trial-balance") #2014-07-22
|
||||
erpnext.patches.v4_2.delete_old_print_formats #2014-07-29
|
||||
erpnext.patches.v4_2.toggle_rounded_total
|
||||
|
9
erpnext/patches/v4_2/toggle_rounded_total.py
Normal file
9
erpnext/patches/v4_2/toggle_rounded_total.py
Normal file
@ -0,0 +1,9 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
global_defaults = frappe.get_doc("Global Defaults", "Global Defaults")
|
||||
global_defaults.toggle_rounded_total()
|
@ -16,7 +16,6 @@ frappe.require("assets/erpnext/js/transaction.js");
|
||||
erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
onload: function() {
|
||||
this._super();
|
||||
this.toggle_rounded_total();
|
||||
this.setup_queries();
|
||||
this.toggle_editable_price_list_rate();
|
||||
},
|
||||
@ -229,16 +228,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
}
|
||||
},
|
||||
|
||||
toggle_rounded_total: function() {
|
||||
var me = this;
|
||||
if(cint(frappe.defaults.get_global_default("disable_rounded_total"))) {
|
||||
$.each(["rounded_total", "rounded_total_export"], function(i, fieldname) {
|
||||
me.frm.set_df_property(fieldname, "print_hide", 1);
|
||||
me.frm.toggle_display(fieldname, false);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
toggle_editable_price_list_rate: function() {
|
||||
var df = frappe.meta.get_docfield(this.tname, "price_list_rate", this.frm.doc.name);
|
||||
var editable_price_list_rate = cint(frappe.defaults.get_default("editable_price_list_rate"));
|
||||
|
@ -5,6 +5,8 @@ from __future__ import unicode_literals
|
||||
"""Global Defaults"""
|
||||
import frappe
|
||||
import frappe.defaults
|
||||
from frappe.utils import cint
|
||||
from frappe.core.doctype.property_setter.property_setter import make_property_setter
|
||||
|
||||
keydict = {
|
||||
# "key in defaults": "key in Global Defaults"
|
||||
@ -42,8 +44,19 @@ class GlobalDefaults(Document):
|
||||
if self.default_currency:
|
||||
frappe.db.set_value("Currency", self.default_currency, "enabled", 1)
|
||||
|
||||
self.toggle_rounded_total()
|
||||
|
||||
# clear cache
|
||||
frappe.clear_cache()
|
||||
|
||||
def get_defaults(self):
|
||||
return frappe.defaults.get_defaults()
|
||||
|
||||
def toggle_rounded_total(self):
|
||||
self.disable_rounded_total = cint(self.disable_rounded_total)
|
||||
|
||||
# Make property setters to hide rounded total fields
|
||||
for doctype in ("Quotation", "Sales Order", "Sales Invoice", "Delivery Note"):
|
||||
for fieldname in ("rounded_total", "rounded_total_export"):
|
||||
make_property_setter(doctype, fieldname, "hidden", self.disable_rounded_total, "Check")
|
||||
make_property_setter(doctype, fieldname, "print_hide", self.disable_rounded_total, "Check")
|
||||
|
@ -40,6 +40,20 @@ class DeliveryNote(SellingController):
|
||||
total_qty = sum((item.qty for item in self.get("delivery_note_details")))
|
||||
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):
|
||||
return "shipment" if self.docstatus==1 else None
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,8 @@
|
||||
{%- 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 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">
|
||||
<tbody>
|
||||
@ -8,8 +10,8 @@
|
||||
<th style="width: 3%">{{ _("Sr") }}</th>
|
||||
<th style="width: 57%">{{ _("Item") }}</th>
|
||||
<th style="width: 10%;" class="text-right">{{ _("Qty") }}</th>
|
||||
<th style="width: 15%;" class="text-right">{{ _("Rate") }}</th>
|
||||
<th style="width: 15%;" class="text-right">{{ _("Amount") }}</th>
|
||||
{% if not hide_rate -%}<th style="width: 15%;" class="text-right">{{ _("Rate") }}</th>{%- endif %}
|
||||
{% if not hide_amount -%}<th style="width: 15%;" class="text-right">{{ _("Amount") }}</th>{%- endif %}
|
||||
</tr>
|
||||
{%- for row in data -%}
|
||||
<tr>
|
||||
@ -30,17 +32,15 @@
|
||||
{%- for field in visible_columns -%}
|
||||
{%- if (field.fieldname not in std_fields) and
|
||||
(row[field.fieldname] not in (None, "", 0)) -%}
|
||||
<div><strong>{{ _(field.label) }}:</strong></div>
|
||||
{{ row.get_formatted(field.fieldname, doc) }}
|
||||
<div><strong>{{ _(field.label) }}:</strong>
|
||||
{{ row.get_formatted(field.fieldname, doc) }}</div>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</td>
|
||||
<td style="text-align: right;">{{ row.get_formatted("qty", doc) }}<br>
|
||||
<small>{{ row.uom or row.stock_uom }}</small></td>
|
||||
<td style="text-align: right;">{{
|
||||
row.get_formatted("rate", doc) }}</td>
|
||||
<td style="text-align: right;">{{
|
||||
row.get_formatted("amount", doc) }}</td>
|
||||
{% if not hide_rate -%}<td style="text-align: right;">{{ row.get_formatted("rate", doc) }}</td>{%- endif %}
|
||||
{% if not hide_amount -%}<td style="text-align: right;">{{ row.get_formatted("amount", doc) }}</td>{%- endif %}
|
||||
</tr>
|
||||
{%- endfor -%}
|
||||
</tbody>
|
||||
|
Loading…
Reference in New Issue
Block a user