Merge pull request #23263 from Semiranis/uom_after_qty
feat: Option to print UOM after quantity
This commit is contained in:
commit
c9a5afaa1c
@ -20,6 +20,7 @@ def after_install():
|
||||
frappe.get_doc({'doctype': "Role", "role_name": "Analytics"}).insert()
|
||||
set_single_defaults()
|
||||
create_compact_item_print_custom_field()
|
||||
create_print_uom_after_qty_custom_field()
|
||||
create_print_zero_amount_taxes_custom_field()
|
||||
add_all_roles_to("Administrator")
|
||||
create_default_cash_flow_mapper_templates()
|
||||
@ -66,6 +67,16 @@ def create_compact_item_print_custom_field():
|
||||
})
|
||||
|
||||
|
||||
def create_print_uom_after_qty_custom_field():
|
||||
create_custom_field('Print Settings', {
|
||||
'label': _('Print UOM after Quantity'),
|
||||
'fieldname': 'print_uom_after_quantity',
|
||||
'fieldtype': 'Check',
|
||||
'default': 0,
|
||||
'insert_after': 'compact_item_print'
|
||||
})
|
||||
|
||||
|
||||
def create_print_zero_amount_taxes_custom_field():
|
||||
create_custom_field('Print Settings', {
|
||||
'label': _('Print taxes with zero amount'),
|
||||
|
@ -1,6 +1,15 @@
|
||||
{% if (doc.uom and not doc.is_print_hide("uom")) %}
|
||||
<small class="pull-left">{{ _(doc.uom) }}</small>
|
||||
{% elif (doc.stock_uom and not doc.is_print_hide("stock_uom")) %}
|
||||
<small class="pull-left">{{ _(doc.stock_uom) }}</small>
|
||||
{% set qty_first=frappe.db.get_single_value("Print Settings", "print_uom_after_quantity") %}
|
||||
{% if qty_first %}
|
||||
{{ doc.get_formatted("qty", doc) }}
|
||||
{% if (doc.uom and not doc.is_print_hide("uom")) %} {{ _(doc.uom) }}
|
||||
{% elif (doc.stock_uom and not doc.is_print_hide("stock_uom")) %} {{ _(doc.stock_uom) }}
|
||||
{%- endif %}
|
||||
{% else %}
|
||||
{% if (doc.uom and not doc.is_print_hide("uom")) %}
|
||||
<small class="pull-left">{{ _(doc.uom) }}</small>
|
||||
{% elif (doc.stock_uom and not doc.is_print_hide("stock_uom")) %}
|
||||
<small class="pull-left">{{ _(doc.stock_uom) }}</small>
|
||||
{%- endif %}
|
||||
{{ doc.get_formatted("qty", doc) }}
|
||||
{%- endif %}
|
||||
{{ doc.get_formatted("qty", doc) }}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user