mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-07 07:02:54 +00:00
wip
This commit is contained in:
@@ -23,6 +23,14 @@ class BuyingController(StockController):
|
|||||||
if hasattr(self, "taxes"):
|
if hasattr(self, "taxes"):
|
||||||
print_settings_for_taxes(self)
|
print_settings_for_taxes(self)
|
||||||
|
|
||||||
|
def before_print(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_print_settings(self):
|
||||||
|
items_field = self.meta.get_field('items')
|
||||||
|
if items_field and items_field.fieldtype == 'Table':
|
||||||
|
return ['compact_item_print', 'print_uom_after_quantity']
|
||||||
|
|
||||||
def get_feed(self):
|
def get_feed(self):
|
||||||
if self.get("supplier_name"):
|
if self.get("supplier_name"):
|
||||||
return _("From {0} | {1} {2}").format(self.supplier_name, self.currency,
|
return _("From {0} | {1} {2}").format(self.supplier_name, self.currency,
|
||||||
|
|||||||
@@ -64,26 +64,22 @@ def has_taxes_field(doc):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def get_print_settings():
|
def get_print_settings():
|
||||||
|
|
||||||
|
# return ['comp']
|
||||||
settings = {
|
settings = {
|
||||||
'compact_item_print': {
|
'compact_item_print': {
|
||||||
'condition': 'erpnext.controllers.print_settings.has_items_field',
|
'condition': 'erpnext.controllers.print_settings.has_items_field',
|
||||||
'fieldtype': 'Check',
|
|
||||||
'child_field': 'items',
|
'child_field': 'items',
|
||||||
'label': 'Compact Item Print',
|
# 'set_template': 'erpnext.controllers.print_settings.print_settings_for_item_table'
|
||||||
'set_template': 'erpnext.controllers.print_settings.print_settings_for_item_table'
|
|
||||||
},
|
},
|
||||||
'print_uom_after_quantity': {
|
'print_uom_after_quantity': {
|
||||||
'condition': 'erpnext.controllers.print_settings.has_taxes_field',
|
'condition': 'erpnext.controllers.print_settings.has_taxes_field',
|
||||||
'fieldtype': 'Check',
|
|
||||||
'child_field': 'items',
|
'child_field': 'items',
|
||||||
'label': 'Print UOM after Quantity',
|
# 'set_template': 'erpnext.controllers.print_settings.print_settings_for_item_table'
|
||||||
'set_template': 'erpnext.controllers.print_settings.print_settings_for_item_table'
|
|
||||||
},
|
},
|
||||||
'print_taxes_with_zero_amount': {
|
'print_taxes_with_zero_amount': {
|
||||||
'condition': 'erpnext.controllers.print_settings.has_taxes_field',
|
'condition': 'erpnext.controllers.print_settings.has_taxes_field',
|
||||||
'fieldtype': 'Check',
|
# 'set_template': 'erpnext.controllers.print_settings.print_settings_for_taxes'
|
||||||
'label': 'Print taxes with zero amount',
|
|
||||||
'set_template': 'erpnext.controllers.print_settings.print_settings_for_taxes'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,17 @@ class SellingController(StockController):
|
|||||||
if hasattr(self, "taxes"):
|
if hasattr(self, "taxes"):
|
||||||
print_settings_for_taxes(self)
|
print_settings_for_taxes(self)
|
||||||
|
|
||||||
|
def before_print(self):
|
||||||
|
self.print_templates = {
|
||||||
|
"items": "templates/print_formats/includes/items.html",
|
||||||
|
}
|
||||||
|
self.flags.compact_item_fields = ['description']
|
||||||
|
|
||||||
|
def get_print_settings(self):
|
||||||
|
items_field = self.meta.get_field('items')
|
||||||
|
if items_field and items_field.fieldtype == 'Table':
|
||||||
|
return ['compact_item_print', 'print_uom_after_quantity']
|
||||||
|
|
||||||
|
|
||||||
def get_feed(self):
|
def get_feed(self):
|
||||||
return _("To {0} | {1} {2}").format(self.customer_name, self.currency,
|
return _("To {0} | {1} {2}").format(self.customer_name, self.currency,
|
||||||
|
|||||||
33
erpnext/templates/print_formats/includes/items.html
Normal file
33
erpnext/templates/print_formats/includes/items.html
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{%- if data -%}
|
||||||
|
{%- set visible_columns = get_visible_columns(doc.get(df.fieldname),
|
||||||
|
table_meta, df) -%}
|
||||||
|
|
||||||
|
<div {{ fieldmeta(df) }}>
|
||||||
|
<table class="table table-bordered table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 40px" class="table-sr">{{ _("Sr") }}</th>
|
||||||
|
{% for tdf in visible_columns %}
|
||||||
|
{% if (data and not print_settings.compact_item_print) or tdf.fieldname in doc.get(df.fieldname)[0].flags.compact_item_fields %}
|
||||||
|
<th style="width: {{ get_width(tdf) }};" class="{{ get_align_class(tdf) }}" {{ fieldmeta(df) }}>
|
||||||
|
{{ _(tdf.label) }}</th>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for d in data %}
|
||||||
|
<tr>
|
||||||
|
<td class="table-sr">{{ d.idx }}</td>
|
||||||
|
{% for tdf in visible_columns %}
|
||||||
|
{% if not doc.get(df.fieldname)[0].flags.compact_item_print or tdf.fieldname in doc.get(df.fieldname)[0].flags.compact_item_fields %}
|
||||||
|
<td class="{{ get_align_class(tdf) }}" {{ fieldmeta(df) }}>
|
||||||
|
<div class="value">{{ print_value(tdf, d, doc, visible_columns) }}</div></td>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{%- endif -%}
|
||||||
Reference in New Issue
Block a user