Merge branch 'ShashaQin-patch-25' into develop

This commit is contained in:
Anand Doshi 2016-02-16 15:30:31 +05:30
commit 1b8ca1712c
4 changed files with 148 additions and 15 deletions

View File

@ -1,9 +1,29 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cint
def print_settings_for_item_table(doc):
doc.print_templates = {
"description": "templates/print_formats/includes/item_table_description.html",
"qty": "templates/print_formats/includes/item_table_qty.html"
}
doc.hide_in_print_layout = ["item_code", "item_name", "image", "uom", "stock_uom"]
doc.flags.compact_item_print = cint(frappe.db.get_value("Features Setup", None, "compact_item_print"))
doc.flags.compact_item_fields = doc.hide_in_print_layout + ["description", "qty", "rate", "amount"]
doc.flags.show_in_description = []
if doc.flags.compact_item_print:
for df in doc.meta.fields:
if df.fieldtype not in ("Section Break", "Column Break", "Button"):
if not doc.is_print_hide(df.fieldname):
if df.fieldname not in doc.hide_in_print_layout and df.fieldname not in doc.flags.compact_item_fields:
doc.hide_in_print_layout.append(df.fieldname)
doc.flags.show_in_description.append(df.fieldname)

View File

@ -0,0 +1,5 @@
frappe.ui.form.on('Features Setup', {
refresh: function(frm) {
}
});

View File

@ -18,9 +18,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Materials",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -40,9 +42,11 @@
"in_filter": 0,
"in_list_view": 1,
"label": "Item Serial Nos",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -62,9 +66,11 @@
"in_filter": 0,
"in_list_view": 1,
"label": "Item Batch Nos",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -84,9 +90,11 @@
"in_filter": 0,
"in_list_view": 1,
"label": "Brands",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -106,9 +114,11 @@
"in_filter": 0,
"in_list_view": 1,
"label": "Item Barcode",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -126,9 +136,11 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -140,7 +152,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "1. To maintain the customer wise item code and to make them searchable based on their code use this option",
"description": "To maintain the customer wise item code and to make them searchable based on their code use this option",
"fieldname": "fs_item_advanced",
"fieldtype": "Check",
"hidden": 0,
@ -148,9 +160,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Item Advanced",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -170,9 +184,36 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Item Groups in Details",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "If checked, only Description, Quantity, Rate and Amount are shown in print of Item table. Any extra field is shown under 'Description' column.",
"fieldname": "compact_item_print",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Compact Item Print",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -191,9 +232,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Sales and Purchase",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -213,9 +256,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Exports",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -235,9 +280,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Imports",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -255,9 +302,11 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -277,9 +326,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Discounts",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -299,9 +350,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Purchase Discounts",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -321,9 +374,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "After Sale Installations",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -343,9 +398,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Projects",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -365,9 +422,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Extras",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -386,9 +445,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Accounts",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -408,9 +469,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Recurring Invoice",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -428,9 +491,11 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -450,9 +515,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Point of Sale",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -472,9 +539,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "POS View",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -493,9 +562,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Manufacturing",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -515,9 +586,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Manufacturing",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -535,9 +608,11 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -557,9 +632,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Quality",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -578,9 +655,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Miscelleneous",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -600,9 +679,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "Page Break",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -620,9 +701,11 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -641,9 +724,11 @@
"in_filter": 0,
"in_list_view": 0,
"label": "More Information",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -661,7 +746,8 @@
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"modified": "2015-08-27 03:27:35.694800",
"max_attachments": 0,
"modified": "2016-02-16 04:43:32.144944",
"modified_by": "Administrator",
"module": "Setup",
"name": "Features Setup",
@ -710,5 +796,6 @@
}
],
"read_only": 0,
"read_only_onload": 0
"read_only_onload": 0,
"sort_order": "ASC"
}

View File

@ -1,25 +1,46 @@
{%- set compact = doc.flags.compact_item_print -%}
{%- set compact_fields = doc.flags.compact_item_fields -%}
{% if doc.in_format_data("image") and doc.get("image") and not doc.is_print_hide("image")-%}
<div class="pull-left" style="max-width: 38.2%; margin-right: 10px;">
<img src="{{ doc.image }}" class="img-responsive">
<img src="{{ doc.image }}" class="img-responsive">
</div>
{%- endif %}
<div>
{% if doc.in_format_data("item_code") and not doc.is_print_hide("item_code") -%}
<div class="primary">{{ doc.item_code }}</div>
{%- endif %}
{% if (doc.in_format_data("item_name") and not doc.is_print_hide("item_name") and
(not doc.in_format_data("item_code") or doc.is_print_hide("item_code")
{% if doc.in_format_data("item_code") and not doc.is_print_hide("item_code") -%}
<div class="primary">
{% if compact %}<strong>{% endif %}
{{ doc.item_code }}
{% if compact %}</strong>{% endif %}
</div>
{%- endif %}
{% if (doc.in_format_data("item_name") and not doc.is_print_hide("item_name") and
(not doc.in_format_data("item_code") or doc.is_print_hide("item_code")
or doc.item_code != doc.item_name)) -%}
<div class="primary">{{ doc.get_formatted("item_name") }}</div>
{%- endif %}
{% if (doc.in_format_data("description") and doc.description and
(
<div class="primary">{{ doc.get_formatted("item_name") }}</div>
{%- endif %}
{% if (doc.in_format_data("description") and doc.description and
(
(
(not doc.in_format_data("item_code") or doc.is_print_hide("item_code")) and
(not doc.in_format_data("item_name") or doc.is_print_hide("item_name"))
) or not (doc.item_code == doc.item_name == doc.description)
))
-%}
<p>{{ doc.get_formatted("description") }}</p>
{%- endif %}
<p>{{ doc.get_formatted("description") }}</p>
{%- endif %}
{% if compact -%}
{%- for fieldname in doc.flags.show_in_description -%}
{% if doc.get(fieldname) -%}
<p>
<strong>{{ doc.meta.get_label(fieldname) }}:</strong>
{{ doc.get_formatted(fieldname) }}
</p>
{% endif %}
{%- endfor -%}
{%- endif %}
</div>