Merge pull request #16806 from rohitwaghchaure/set_scanned_barcode_in_the_table
fix: scan barcode not adding the barcode value in the items table
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 2e7748d..d0ae9c4 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -5,7 +5,7 @@
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
-__version__ = '11.1.11'
+__version__ = '11.1.13'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json
index e47f8d2..460c025 100644
--- a/erpnext/accounts/doctype/account/account.json
+++ b/erpnext/accounts/doctype/account/account.json
@@ -632,6 +632,39 @@
"set_only_once": 0,
"translatable": 0,
"unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:(doc.report_type == 'Profit and Loss' && !doc.is_group)",
+ "fieldname": "include_in_gross",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Include in gross",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
}
],
"has_web_view": 0,
@@ -645,7 +678,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2019-01-07 16:52:02.557837",
+ "modified": "2019-03-04 14:42:07.208893",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Account",
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 259172e..7c48b5c 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -52,6 +52,12 @@
self.update_loan()
self.update_inter_company_jv()
+ def before_print(self):
+ self.gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Journal Entry",
+ "voucher_no": self.name} ,
+ fields=["account", "party_type", "party", "debit", "credit", "remarks"]
+ )
+
def get_title(self):
return self.pay_to_recd_from or self.accounts[0].account
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 8161cc6..f356ef8 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -70,6 +70,12 @@
self.update_advance_paid()
self.update_expense_claim()
+ def before_print(self):
+ self.gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Payment Entry",
+ "voucher_no": self.name} ,
+ fields=["account", "party_type", "party", "debit", "credit", "remarks"]
+ )
+
def on_cancel(self):
self.setup_party_account_field()
self.make_gl_entries(cancel=1)
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js
index 13d53d1..a6386dd 100755
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.js
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js
@@ -33,6 +33,14 @@
};
});
+ frm.set_query("account_for_change_amount", function() {
+ return {
+ filters: {
+ account_type: ['in', ["Cash", "Bank"]]
+ }
+ };
+ });
+
frm.set_query("print_format", function() {
return { filters: { doc_type: "Sales Invoice", print_format_type: "Js"} };
});
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index a9e8fbc..c0d0d83 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -54,6 +54,12 @@
if not self.on_hold:
self.release_date = ''
+ def before_print(self):
+ self.gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Purchase Invoice",
+ "voucher_no": self.name} ,
+ fields=["account", "party_type", "party", "debit", "credit"]
+ )
+
def invoice_is_blocked(self):
return self.on_hold and (not self.release_date or self.release_date > getdate(nowdate()))
diff --git a/erpnext/accounts/doctype/sales_invoice/regional/italy.js b/erpnext/accounts/doctype/sales_invoice/regional/italy.js
new file mode 100644
index 0000000..1c47d3a
--- /dev/null
+++ b/erpnext/accounts/doctype/sales_invoice/regional/italy.js
@@ -0,0 +1,3 @@
+{% include "erpnext/regional/italy/sales_invoice.js" %}
+
+erpnext.setup_e_invoice_button('Sales Invoice')
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index b1a851a..3816632 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -556,6 +556,14 @@
frm.add_fetch('payment_term', 'invoice_portion', 'invoice_portion');
frm.add_fetch('payment_term', 'description', 'description');
+ frm.set_query("account_for_change_amount", function() {
+ return {
+ filters: {
+ account_type: ['in', ["Cash", "Bank"]]
+ }
+ };
+ });
+
frm.custom_make_buttons = {
'Delivery Note': 'Delivery',
'Sales Invoice': 'Sales Return',
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 4cf3a1a..62d8ffd 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -205,6 +205,12 @@
def before_cancel(self):
self.update_time_sheet(None)
+ def before_print(self):
+ self.gl_entries = frappe.get_list("GL Entry",filters={"voucher_type": "Sales Invoice",
+ "voucher_no": self.name} ,
+ fields=["account", "party_type", "party", "debit", "credit"]
+ )
+
def on_cancel(self):
self.check_close_sales_order("sales_order")
@@ -523,8 +529,8 @@
def validate_pos(self):
if self.is_return:
- if flt(self.paid_amount) + flt(self.write_off_amount) - flt(self.grand_total) < \
- 1/(10**(self.precision("grand_total") + 1)):
+ if flt(self.paid_amount) + flt(self.write_off_amount) - flt(self.grand_total) > \
+ 1.0/(10.0**(self.precision("grand_total") + 1.0)):
frappe.throw(_("Paid amount + Write Off Amount can not be greater than Grand Total"))
def validate_item_code(self):
diff --git a/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json
index ccdabfe..1c5962a 100644
--- a/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json
+++ b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.json
@@ -20,6 +20,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:parent.doctype == 'POS Profile'",
+ "fetch_if_empty": 0,
"fieldname": "default",
"fieldtype": "Check",
"hidden": 0,
@@ -52,6 +53,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "mode_of_payment",
"fieldtype": "Link",
"hidden": 0,
@@ -85,8 +87,9 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "default": "",
+ "default": "0",
"depends_on": "eval:parent.doctype == 'Sales Invoice'",
+ "fetch_if_empty": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -120,6 +123,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -151,6 +155,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "account",
"fieldtype": "Link",
"hidden": 0,
@@ -185,6 +190,7 @@
"collapsible": 0,
"columns": 0,
"fetch_from": "mode_of_payment.type",
+ "fetch_if_empty": 0,
"fieldname": "type",
"fieldtype": "Read Only",
"hidden": 0,
@@ -218,6 +224,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -251,6 +258,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "clearance_date",
"fieldtype": "Date",
"hidden": 0,
@@ -287,7 +295,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2019-02-18 15:03:59.720469",
+ "modified": "2019-03-06 15:58:37.839241",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Payment",
diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/__init__.py b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/__init__.py
diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html
new file mode 100644
index 0000000..2eadb2a
--- /dev/null
+++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.html
@@ -0,0 +1,82 @@
+{%- from "templates/print_formats/standard_macros.html" import add_header -%}
+<style>
+ .table-bordered td.top-bottom {border-top: none !important;border-bottom: none !important;}
+ .table-bordered td.right{border-right: none !important;}
+ .table-bordered td.left{border-left: none !important;}
+
+
+</style>
+<div class="page-break">
+ {%- if not doc.get("print_heading") and not doc.get("select_print_heading")
+ and doc.set("select_print_heading", _("Payment Entry")) -%}{%- endif -%}
+ {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
+ <div class="row margin-bottom">
+ <div class="col-sm-6">
+ <table>
+ <tr><td><strong>Voucher No: </strong></td><td>{{ doc.name }}</td></tr>
+ </table>
+ </div>
+ <div>
+ <table>
+ <tr><td><strong>Date: </strong></td><td>{{ frappe.utils.formatdate(doc.creation) }}</td></tr>
+ </table>
+ </div>
+ </div>
+ <div class="margin-top">
+ <table class="table table-bordered table-condensed">
+ <tr>
+ <th>Account</th>
+ <th>Party Type</th>
+ <th>Party</th>
+ <th>Amount</th>
+ </tr>
+ <tr>
+ <td class="top-bottom" colspan="5"><strong>Credit</strong></td>
+ </tr>
+ {% set total_credit = 0 -%}
+ {% for entries in doc.gl_entries %}
+ {% if entries.debit == 0.0 %}
+ <tr>
+ <td class="right top-bottom">{{ entries.account }}</td>
+ <td class="right left top-bottom">{{ entries.party_type }}</td>
+ <td class="right left top-bottom">{{ entries.party }}</td>
+ <td class="left top-bottom">{{ entries.credit }}</td>
+ {% set total_credit = total_credit + entries.credit -%}
+ </tr>
+ <tr>
+ <td class="top-bottom" colspan="4"><strong> Narration </strong><br>{{ entries.remarks }}</td>
+ </tr>
+ <tr>
+ <td class="right" colspan="3"><strong>Total (credit) </strong></td>
+ <td class="left" >{{total_credit}}</td>
+ </tr>
+ {% endif %}
+ {% endfor %}
+ <tr>
+ <td class="top-bottom" colspan="4"> </td>
+ </tr>
+ <tr>
+ <td class="top-bottom" colspan="5"><strong>Debit</strong></td>
+ </tr>
+ {% set total_debit = 0 -%}
+ {% for entries in doc.gl_entries %}
+ {% if entries.credit == 0.0 %}
+ <tr>
+ <td class="right top-bottom">{{ entries.account }}</td>
+ <td class="right left top-bottom">{{ entries.party_type }}</td>
+ <td class="right left top-bottom">{{ entries.party }}</td>
+ {% set total_debit = total_debit + entries.debit -%}
+ <td class="left top-bottom">{{ entries.debit }}</td>
+ </tr>
+ <tr>
+ <td class="top-bottom"colspan="4"><strong> Narration </strong><br>{{ entries.remarks }}</td>
+ </tr>
+ <tr>
+ <td class="right" colspan="3" ><strong>Total (debit) </strong></td>
+ <td class="left" >{{total_debit}}</td>
+ </tr>
+ {% endif %}
+ {% endfor %}
+ </table>
+ <div>
+</div>
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json
new file mode 100644
index 0000000..e3afaec
--- /dev/null
+++ b/erpnext/accounts/print_format/bank_and_cash_payment_voucher/bank_and_cash_payment_voucher.json
@@ -0,0 +1,22 @@
+{
+ "align_labels_right": 0,
+ "creation": "2019-02-15 11:49:08.608619",
+ "custom_format": 0,
+ "default_print_language": "en",
+ "disabled": 0,
+ "doc_type": "Payment Entry",
+ "docstatus": 0,
+ "doctype": "Print Format",
+ "font": "Default",
+ "idx": 0,
+ "line_breaks": 0,
+ "modified": "2019-02-15 11:49:08.608619",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Bank and Cash Payment Voucher",
+ "owner": "Administrator",
+ "print_format_builder": 0,
+ "print_format_type": "Server",
+ "show_section_headings": 0,
+ "standard": "Yes"
+}
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json b/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
index 2b7f9ce..6d7c3d3 100644
--- a/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
+++ b/erpnext/accounts/print_format/gst_purchase_invoice/gst_purchase_invoice.json
@@ -7,10 +7,10 @@
"docstatus": 0,
"doctype": "Print Format",
"font": "Default",
- "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"<div class=\\\"print-heading\\\">\\t\\t\\t\\t<h2>Purchase Invoice<br><small>{{ doc.name }}</small>\\t\\t\\t\\t</h2></div>\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"supplier_name\", \"label\": \"Supplier Name\"}, {\"print_hide\": 0, \"fieldname\": \"due_date\", \"label\": \"Due Date\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Address\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"address_display\", \"label\": \"Address\"}, {\"print_hide\": 0, \"fieldname\": \"contact_display\", \"label\": \"Contact\"}, {\"print_hide\": 0, \"fieldname\": \"contact_mobile\", \"label\": \"Mobile No\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"item_name\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"image\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"received_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rejected_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"discount_percentage\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"pricing_rule\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"weight_per_unit\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"total_weight\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"weight_uom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"warehouse\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rejected_warehouse\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"batch_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"serial_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"bom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"asset\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"items\", \"label\": \"Items\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"total\", \"label\": \"Total\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"category\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"add_deduct_tax\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"charge_type\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"row_id\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"included_in_print_rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"account_head\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"cost_center\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"tax_amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"total\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"taxes\", \"label\": \"Purchase Taxes and Charges\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"grand_total\", \"label\": \"Grand Total\"}, {\"print_hide\": 0, \"fieldname\": \"in_words\", \"label\": \"In Words\"}, {\"print_hide\": 0, \"fieldname\": \"disable_rounded_total\", \"label\": \"Disable Rounded Total\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Payments\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"cash_bank_account\", \"label\": \"Cash/Bank Account\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"other_charges_calculation\", \"align\": \"left\", \"label\": \"Tax Breakup\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Raw\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"main_item_code\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rm_item_code\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"batch_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"serial_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"required_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"consumed_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"stock_uom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"conversion_factor\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"current_stock\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"reference_name\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"bom_detail_no\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"supplied_items\", \"label\": \"Supplied Items\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Terms\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"terms\", \"label\": \"Terms and Conditions1\"}]",
+ "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"<div class=\\\"print-heading\\\">\\t\\t\\t\\t<h2>Purchase Invoice<br><small>{{ doc.name }}</small>\\t\\t\\t\\t</h2></div>\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"supplier_name\", \"label\": \"Supplier Name\"}, {\"print_hide\": 0, \"fieldname\": \"due_date\", \"label\": \"Due Date\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Address\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"address_display\", \"label\": \"Address\"}, {\"print_hide\": 0, \"fieldname\": \"contact_display\", \"label\": \"Contact\"}, {\"print_hide\": 0, \"fieldname\": \"contact_mobile\", \"label\": \"Mobile No\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"item_name\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"image\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"received_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rejected_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"discount_percentage\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"pricing_rule\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"weight_per_unit\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"total_weight\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"weight_uom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"warehouse\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rejected_warehouse\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"batch_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"serial_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"bom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"asset\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"gst_hsn_code\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"items\", \"label\": \"Items\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"total\", \"label\": \"Total\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"category\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"add_deduct_tax\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"charge_type\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"row_id\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"included_in_print_rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"account_head\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"cost_center\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"tax_amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"total\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"taxes\", \"label\": \"Purchase Taxes and Charges\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"grand_total\", \"label\": \"Grand Total\"}, {\"print_hide\": 0, \"fieldname\": \"in_words\", \"label\": \"In Words\"}, {\"print_hide\": 0, \"fieldname\": \"disable_rounded_total\", \"label\": \"Disable Rounded Total\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Payments\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"cash_bank_account\", \"label\": \"Cash/Bank Account\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"other_charges_calculation\", \"align\": \"left\", \"label\": \"Tax Breakup\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Raw\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_hide\": 0, \"fieldname\": \"main_item_code\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rm_item_code\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"description\", \"print_width\": \"300px\"}, {\"print_hide\": 0, \"fieldname\": \"batch_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"serial_no\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"required_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"consumed_qty\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"stock_uom\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"rate\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"amount\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"conversion_factor\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"current_stock\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"reference_name\", \"print_width\": \"\"}, {\"print_hide\": 0, \"fieldname\": \"bom_detail_no\", \"print_width\": \"\"}], \"print_hide\": 0, \"fieldname\": \"supplied_items\", \"label\": \"Supplied Items\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Terms\"}, {\"fieldtype\": \"Column Break\"}, {\"print_hide\": 0, \"fieldname\": \"terms\", \"label\": \"Terms and Conditions1\"}]",
"idx": 0,
"line_breaks": 0,
- "modified": "2018-04-07 13:06:08.060353",
+ "modified": "2019-03-04 13:38:47.362002",
"modified_by": "Administrator",
"module": "Accounts",
"name": "GST Purchase Invoice",
diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/__init__.py b/erpnext/accounts/print_format/journal_auditing_voucher/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/print_format/journal_auditing_voucher/__init__.py
diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html
new file mode 100644
index 0000000..4565559
--- /dev/null
+++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.html
@@ -0,0 +1,76 @@
+{%- from "templates/print_formats/standard_macros.html" import add_header -%}
+<style>
+ .table-bordered td.top-bottom {border-top: none !important;border-bottom: none !important;}
+ .table-bordered td.right{border-right: none !important;}
+ .table-bordered td.left{border-left: none !important;}
+
+
+</style>
+<div class="page-break">
+ {%- if not doc.get("print_heading") and not doc.get("select_print_heading")
+ and doc.set("select_print_heading", _("Journal Entry")) -%}{%- endif -%}
+ {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
+ <div class="row margin-bottom">
+ <div class="col-sm-6">
+ <table>
+ <tr><td><strong>Voucher No: </strong></td><td>{{ doc.name }}</td></tr>
+ </table>
+ </div>
+ <div>
+ <table>
+ <tr><td><strong>Date: </strong></td><td>{{ frappe.utils.formatdate(doc.creation) }}</td></tr>
+ </table>
+ </div>
+ </div>
+ <div class="margin-top">
+ <table class="table table-bordered table-condensed">
+ <tr>
+ <th>Account</th>
+ <th>Party Type</th>
+ <th>Party</th>
+ <th>Amount</th>
+ </tr>
+ <tr>
+ <td class="top-bottom" colspan="5"><strong>Credit</strong></td>
+ </tr>
+ {% set total_credit = 0 -%}
+ {% for entries in doc.gl_entries %}
+ {% if entries.debit == 0.0 %}
+ <tr>
+ <td class="right top-bottom">{{ entries.account }}</td>
+ <td class="right left top-bottom">{{ entries.party_type }}</td>
+ <td class="right left top-bottom">{{ entries.party }}</td>
+ <td class="left top-bottom">{{ entries.credit }}</td>
+ {% set total_credit = total_credit + entries.credit -%}
+ </tr>
+ <tr>
+ <td class="right" colspan="3"><strong>Total (credit) </strong></td>
+ <td class="left" >{{total_credit}}</td>
+ </tr>
+ {% endif %}
+ {% endfor %}
+ <tr>
+ <td class="top-bottom" colspan="4"> </td>
+ </tr>
+ <tr>
+ <td class="top-bottom" colspan="5"><strong>Debit</strong></td>
+ </tr>
+ {% set total_debit = 0 -%}
+ {% for entries in doc.gl_entries %}
+ {% if entries.credit == 0.0 %}
+ <tr>
+ <td class="right top-bottom">{{ entries.account }}</td>
+ <td class="right left top-bottom">{{ entries.party_type }}</td>
+ <td class="right left top-bottom">{{ entries.party }}</td>
+ {% set total_debit = total_debit + entries.debit -%}
+ <td class="left top-bottom">{{ entries.debit }}</td>
+ </tr>
+ <tr>
+ <td class="right" colspan="3" ><strong>Total (debit) </strong></td>
+ <td class="left" >{{total_debit}}</td>
+ </tr>
+ {% endif %}
+ {% endfor %}
+ </table>
+ <div>
+</div>
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json
new file mode 100644
index 0000000..927e818
--- /dev/null
+++ b/erpnext/accounts/print_format/journal_auditing_voucher/journal_auditing_voucher.json
@@ -0,0 +1,22 @@
+{
+ "align_labels_right": 0,
+ "creation": "2019-02-15 14:13:05.721784",
+ "custom_format": 0,
+ "default_print_language": "en",
+ "disabled": 0,
+ "doc_type": "Journal Entry",
+ "docstatus": 0,
+ "doctype": "Print Format",
+ "font": "Default",
+ "idx": 0,
+ "line_breaks": 0,
+ "modified": "2019-02-15 14:13:05.721784",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Journal Auditing Voucher",
+ "owner": "Administrator",
+ "print_format_builder": 0,
+ "print_format_type": "Server",
+ "show_section_headings": 0,
+ "standard": "Yes"
+}
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/__init__.py b/erpnext/accounts/print_format/purchase_auditing_voucher/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/print_format/purchase_auditing_voucher/__init__.py
diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html
new file mode 100644
index 0000000..35852e1
--- /dev/null
+++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.html
@@ -0,0 +1,99 @@
+{%- from "templates/print_formats/standard_macros.html" import add_header -%}
+<div class="page-break">
+ {%- if not doc.get("print_heading") and not doc.get("select_print_heading")
+ and doc.set("select_print_heading", _("Purchase Invoice")) -%}{%- endif -%}
+ {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
+ <div class="row margin-bottom">
+ <div class="col-sm-6">
+ <table>
+ <tr><td><strong>Supplier Name: </strong></td><td>{{ doc.supplier }}</td></tr>
+ <tr><td><strong>Due Date: </strong></td><td>{{ frappe.utils.formatdate(doc.due_date) }}</td></tr>
+ <tr><td><strong>Address: </strong></td><td>{{doc.address_display}}</td></tr>
+ <tr><td><strong>Contact: </strong></td><td>{{doc.contact_display}}</td></tr>
+ <tr><td><strong>Mobile no: </strong> </td><td>{{doc.contact_mobile}}</td></tr>
+ </table>
+ </div>
+ <div>
+ <table>
+ <tr><td><strong>Voucher No: </strong></td><td>{{ doc.name }}</td></tr>
+ <tr><td><strong>Date: </strong></td><td>{{ frappe.utils.formatdate(doc.creation) }}</td></tr>
+ </table>
+ </div>
+ </div>
+ <div class="margin-top margin-bottom">
+ <table class="table table-bordered table-condensed">
+ <tr>
+ <th>SL</th>
+ <th>Item Code</th>
+ <th>Item Name</th>
+ <th>UOM</th>
+ <th>Received Qty.</th>
+ <th>Rejected Qty</th>
+ <th>Qty</th>
+ <th>Basic Rate</th>
+ <th>Amount</th>
+ </tr>
+ {% for item in doc.items %}
+ <tr>
+ <td>{{ loop.index }}</td>
+ <td>{{ item.item_code }}</td>
+ <td>{{ item.item_name }}</td>
+ <td>{{ item.uom }}</td>
+ <td>{{ item.received_qty }}</td>
+ <td>{{ item.rejected_qty }}</td>
+ <td>{{ item.qty}}</td>
+ <td>{{ item.rate }}</td>
+ <td>{{ item.amount }}</td>
+ </tr>
+ {% endfor %}
+ </table>
+ </div>
+ <div class="row margin-bottom">
+ <div class="col-sm-6">
+ <table>
+ <tr><td><strong>Total Quantity: </strong></td><td>{{ doc.total_qty }}</td></tr>
+ <tr><td><strong>Total: </strong></td><td>{{doc.total}}</td></tr>
+ <tr><td><strong>Net Weight: </strong></td><td>{{ doc.total_net_weight }}</td></tr>
+ </table>
+ </div>
+ <div>
+ <table>
+ <tr><td><strong>Tax and Charges: </strong></td><td>{{doc.taxes_and_charges}}</td></tr>
+ {% for tax in doc.taxes %}
+ <tr><td><strong>{{ tax.account_head }}: </strong></td><td>{{ tax.tax_amount_after_discount_amount }}</td></tr>
+ {% endfor %}
+ <tr><td><strong> Taxes and Charges Added: </strong></td><td>{{ doc.taxes_and_charges_added }}</td></tr>
+ <tr><td><strong> Taxes and Charges Deducted: </strong></td><td>{{ doc.taxes_and_charges_deducted }}</td></tr>
+ <tr><td><strong> Total Taxes and Charges: </strong></td><td>{{ doc.total_taxes_and_charges }}</td></tr>
+ <tr><td><strong> Net Payable: </strong></td><td>{{ doc.grand_total }}</td></tr>
+ </table>
+ </div>
+ </div>
+ <div class="margin-top">
+ <table class='table table-bordered table-condensed'>
+ <tr>
+ <th>SL</th>
+ <th>Account</th>
+ <th>Party Type</th>
+ <th>Party</th>
+ <th>Credit Amount</th>
+ <th>Debit Amount</th>
+ </tr>
+ {% for entries in doc.gl_entries %}
+ <tr>
+ <td>{{ loop.index }}</td>
+ <td>{{ entries.account }}</td>
+ <td>{{ entries.party_type }}</td>
+ <td>{{ entries.party }}</td>
+ <td>{{ entries.credit }}</td>
+ <td>{{ entries.debit }}</td>
+ </tr>
+ {% endfor %}
+ <tr>
+ <td colspan="4"><strong>Total</strong></td>
+ <td>{{ doc.grand_total|flt }}</td>
+ <td>{{ doc.grand_total|flt }}</td>
+ </tr>
+ </table>
+ </div>
+</div>
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json
new file mode 100644
index 0000000..73779d4
--- /dev/null
+++ b/erpnext/accounts/print_format/purchase_auditing_voucher/purchase_auditing_voucher.json
@@ -0,0 +1,22 @@
+{
+ "align_labels_right": 0,
+ "creation": "2019-02-14 14:42:35.151611",
+ "custom_format": 0,
+ "default_print_language": "en",
+ "disabled": 0,
+ "doc_type": "Purchase Invoice",
+ "docstatus": 0,
+ "doctype": "Print Format",
+ "font": "Default",
+ "idx": 0,
+ "line_breaks": 0,
+ "modified": "2019-02-14 14:42:35.151611",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Purchase Auditing Voucher",
+ "owner": "Administrator",
+ "print_format_builder": 0,
+ "print_format_type": "Server",
+ "show_section_headings": 0,
+ "standard": "Yes"
+}
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/__init__.py b/erpnext/accounts/print_format/sales_auditing_voucher/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/print_format/sales_auditing_voucher/__init__.py
diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html
new file mode 100644
index 0000000..04de83d
--- /dev/null
+++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.html
@@ -0,0 +1,93 @@
+{%- from "templates/print_formats/standard_macros.html" import add_header -%}
+<div class="page-break">
+ {%- if not doc.get("print_heading") and not doc.get("select_print_heading")
+ and doc.set("select_print_heading", _("Sales Invoice")) -%}{%- endif -%}
+ {{ add_header(0, 1, doc, letter_head, no_letterhead, print_settings) }}
+ <div class="row margin-bottom">
+ <div class="col-sm-6">
+ <table>
+ <tr><td><strong>Customer Name: </strong></td><td>{{ doc.customer }}</td></tr>
+ <tr><td><strong>Due Date: </strong></td><td>{{ frappe.utils.formatdate(doc.due_date) }}</td></tr>
+ <tr><td><strong>Address: </strong></td><td>{{doc.address_display}}</td></tr>
+ <tr><td><strong>Contact: </strong></td><td>{{doc.contact_display}}</td></tr>
+ <tr><td><strong>Mobile no: </strong> </td><td>{{doc.contact_mobile}}</td></tr>
+ </table>
+ </div>
+ <div>
+ <table>
+ <tr><td><strong>Voucher No: </strong></td><td>{{ doc.name }}</td></tr>
+ <tr><td><strong>Date: </strong></td><td>{{ frappe.utils.formatdate(doc.creation) }}</td></tr>
+ </table>
+ </div>
+ </div>
+ <div class="margin-top margin-bottom">
+ <table class="table table-bordered table-condensed">
+ <tr>
+ <th>SL</th>
+ <th>Item Code</th>
+ <th>Item Name</th>
+ <th>UOM</th>
+ <th>Quantity</th>
+ <th>Basic Rate</th>
+ <th>Amount</th>
+ </tr>
+ {% for item in doc.items %}
+ <tr>
+ <td>{{ loop.index }}</td>
+ <td>{{ item.item_code }}</td>
+ <td>{{ item.item_name }}</td>
+ <td>{{ item.uom }}</td>
+ <td>{{ item.qty}}</td>
+ <td>{{ item.rate }}</td>
+ <td>{{ item.amount }}</td>
+ </tr>
+ {% endfor %}
+ </table>
+ </div>
+ <div class="row margin-bottom">
+ <div class="col-sm-6">
+ <table>
+ <tr><td><strong>Total Quantity: </strong></td><td>{{ doc.total_qty }}</td></tr>
+ <tr><td><strong>Total: </strong></td><td>{{doc.total}}</td></tr>
+ <tr><td><strong>Net Weight: </strong></td><td>{{ doc.total_net_weight }}</td></tr>
+ </table>
+ </div>
+ <div>
+ <table>
+ <tr><td><strong>Tax and Charges: </strong></td><td>{{doc.taxes_and_charges}}</td></tr>
+ {% for tax in doc.taxes %}
+ <tr><td><strong>{{ tax.account_head }}: </strong></td><td>{{ tax.tax_amount_after_discount_amount }}</td></tr>
+ {% endfor %}
+ <tr><td><strong> Total Taxes and Charges: </strong></td><td>{{ doc.total_taxes_and_charges }}</td></tr>
+ <tr><td><strong> Net Payable: </strong></td><td>{{ doc.grand_total }}</td></tr>
+ </table>
+ </div>
+ </div>
+ <div class="margin-top">
+ <table class='table table-bordered table-condensed'>
+ <tr>
+ <th>SL</th>
+ <th>Account</th>
+ <th>Party Type</th>
+ <th>Party</th>
+ <th>Credit Amount</th>
+ <th>Debit Amount</th>
+ </tr>
+ {% for entries in doc.gl_entries %}
+ <tr>
+ <td>{{ loop.index }}</td>
+ <td>{{ entries.account }}</td>
+ <td>{{ entries.party_type }}</td>
+ <td>{{ entries.party }}</td>
+ <td>{{ entries.credit }}</td>
+ <td>{{ entries.debit }}</td>
+ </tr>
+ {% endfor %}
+ <tr>
+ <td colspan="4"><strong>Total</strong></td>
+ <td>{{ doc.grand_total|flt }}</td>
+ <td>{{ doc.grand_total|flt }}</td>
+ </tr>
+ </table>
+ </div>
+</div>
\ No newline at end of file
diff --git a/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json
new file mode 100644
index 0000000..0544e0b
--- /dev/null
+++ b/erpnext/accounts/print_format/sales_auditing_voucher/sales_auditing_voucher.json
@@ -0,0 +1,22 @@
+{
+ "align_labels_right": 0,
+ "creation": "2019-02-15 15:02:51.454754",
+ "custom_format": 0,
+ "default_print_language": "en",
+ "disabled": 0,
+ "doc_type": "Sales Invoice",
+ "docstatus": 0,
+ "doctype": "Print Format",
+ "font": "Default",
+ "idx": 0,
+ "line_breaks": 0,
+ "modified": "2019-02-15 15:02:51.454754",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Sales Auditing Voucher",
+ "owner": "Administrator",
+ "print_format_builder": 0,
+ "print_format_type": "Server",
+ "show_section_headings": 0,
+ "standard": "Yes"
+}
\ No newline at end of file
diff --git a/erpnext/accounts/report/financial_statements.html b/erpnext/accounts/report/financial_statements.html
index 4b3b5f2..449fb84 100644
--- a/erpnext/accounts/report/financial_statements.html
+++ b/erpnext/accounts/report/financial_statements.html
@@ -15,7 +15,7 @@
height: 37px;
}
</style>
-{% var letterhead= filters.letter_head || (frappe.get_doc(":Company", filters.company) && frappe.get_doc(":Company", filters.company).default_letter_head) || frappe.defaults.get_default("letter_head"); %}
+{% var letterhead= filters.letter_head || (frappe.get_doc(":Company", filters.company) && frappe.get_doc(":Company", filters.company).default_letter_head) %}
{% if(letterhead) { %}
<div style="margin-bottom: 7px;" class="text-center">
{%= frappe.boot.letter_heads[letterhead].header %}
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 2c7bd72..e9aecfb 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -126,7 +126,7 @@
def get_data(
company, root_type, balance_must_be, period_list, filters=None,
accumulated_values=1, only_current_fiscal_year=True, ignore_closing_entries=False,
- ignore_accumulated_values_for_fy=False):
+ ignore_accumulated_values_for_fy=False , total = True):
accounts = get_accounts(company, root_type)
if not accounts:
@@ -154,7 +154,7 @@
out = prepare_data(accounts, balance_must_be, period_list, company_currency)
out = filter_out_zero_value_rows(out, parent_children_map)
- if out:
+ if out and total:
add_total_row(out, root_type, balance_must_be, period_list, company_currency)
return out
@@ -218,6 +218,9 @@
"year_start_date": year_start_date,
"year_end_date": year_end_date,
"currency": company_currency,
+ "include_in_gross": d.include_in_gross,
+ "account_type": d.account_type,
+ "is_group": d.is_group,
"opening_balance": d.get("opening_balance", 0.0) * (1 if balance_must_be=="Debit" else -1),
"account_name": ('%s - %s' %(_(d.account_number), _(d.account_name))
if d.account_number else _(d.account_name))
@@ -285,7 +288,7 @@
def get_accounts(company, root_type):
return frappe.db.sql("""
- select name, account_number, parent_account, lft, rgt, root_type, report_type, account_name
+ select name, account_number, parent_account, lft, rgt, root_type, report_type, account_name, include_in_gross, account_type, is_group, lft, rgt
from `tabAccount`
where company=%s and root_type=%s order by lft""", (company, root_type), as_dict=True)
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index be66332..ecb18f7 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -53,7 +53,7 @@
frappe.throw(_("Can not filter based on Account, if grouped by Account"))
if (filters.get("voucher_no")
- and filters.get("group_by") in [_('Group by Voucher'), _('Group by Voucher (Consolidated)')]):
+ and filters.get("group_by") in [_('Group by Voucher')]):
frappe.throw(_("Can not filter based on Voucher No, if grouped by Voucher"))
if filters.from_date > filters.to_date:
diff --git a/erpnext/accounts/report/gross_and_net_profit_report/__init__.py b/erpnext/accounts/report/gross_and_net_profit_report/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/report/gross_and_net_profit_report/__init__.py
diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.html b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.html
new file mode 100644
index 0000000..40ba20c
--- /dev/null
+++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.html
@@ -0,0 +1 @@
+{% include "accounts/report/financial_statements.html" %}
\ No newline at end of file
diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.js b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.js
new file mode 100644
index 0000000..63ac281
--- /dev/null
+++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.js
@@ -0,0 +1,51 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+/* eslint-disable */
+
+frappe.query_reports["Gross and Net Profit Report"] = {
+ "filters": [
+
+ ]
+}
+frappe.require("assets/erpnext/js/financial_statements.js", function() {
+ frappe.query_reports["Gross and Net Profit Report"] = $.extend({},
+ erpnext.financial_statements);
+
+ frappe.query_reports["Gross and Net Profit Report"]["filters"].push(
+ {
+ "fieldname":"project",
+ "label": __("Project"),
+ "fieldtype": "MultiSelect",
+ get_data: function() {
+ var projects = frappe.query_report.get_filter_value("project") || "";
+
+ const values = projects.split(/\s*,\s*/).filter(d => d);
+ const txt = projects.match(/[^,\s*]*$/)[0] || '';
+ let data = [];
+
+ frappe.call({
+ type: "GET",
+ method:'frappe.desk.search.search_link',
+ async: false,
+ no_spinner: true,
+ args: {
+ doctype: "Project",
+ txt: txt,
+ filters: {
+ "name": ["not in", values]
+ }
+ },
+ callback: function(r) {
+ data = r.results;
+ }
+ });
+ return data;
+ }
+ },
+ {
+ "fieldname": "accumulated_values",
+ "label": __("Accumulated Values"),
+ "fieldtype": "Check"
+ }
+ );
+});
diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.json b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.json
new file mode 100644
index 0000000..994b47f
--- /dev/null
+++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.json
@@ -0,0 +1,30 @@
+{
+ "add_total_row": 0,
+ "creation": "2019-02-08 10:58:55.763090",
+ "disable_prepared_report": 0,
+ "disabled": 0,
+ "docstatus": 0,
+ "doctype": "Report",
+ "idx": 0,
+ "is_standard": "Yes",
+ "modified": "2019-02-08 10:58:55.763090",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Gross and Net Profit Report",
+ "owner": "Administrator",
+ "prepared_report": 0,
+ "ref_doctype": "GL Entry",
+ "report_name": "Gross and Net Profit Report",
+ "report_type": "Script Report",
+ "roles": [
+ {
+ "role": "Accounts User"
+ },
+ {
+ "role": "Accounts Manager"
+ },
+ {
+ "role": "Auditor"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py
new file mode 100644
index 0000000..6550981
--- /dev/null
+++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py
@@ -0,0 +1,154 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from frappe.utils import flt
+from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
+import copy
+
+
+def execute(filters=None):
+ period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
+ filters.periodicity, filters.accumulated_values, filters.company)
+
+ columns, data = [], []
+
+ income = get_data(filters.company, "Income", "Credit", period_list, filters = filters,
+ accumulated_values=filters.accumulated_values,
+ ignore_closing_entries=True, ignore_accumulated_values_for_fy= True, total= False)
+
+ expense = get_data(filters.company, "Expense", "Debit", period_list, filters=filters,
+ accumulated_values=filters.accumulated_values,
+ ignore_closing_entries=True, ignore_accumulated_values_for_fy= True, total= False)
+
+ columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company)
+
+
+ gross_income = get_revenue(income, period_list)
+
+ gross_expense = get_revenue(expense, period_list)
+
+ if(len(gross_income)==0 and len(gross_expense)== 0):
+ data.append({"account_name": "'" + _("Nothing is included in gross") + "'",
+ "account": "'" + _("Nothing is included in gross") + "'"})
+
+ return columns, data
+
+ data.append({"account_name": "'" + _("Included in Gross Profit") + "'",
+ "account": "'" + _("Included in Gross Profit") + "'"})
+
+ data.append({})
+ data.extend(gross_income or [])
+
+ data.append({})
+ data.extend(gross_expense or [])
+
+ data.append({})
+ gross_profit = get_profit(gross_income, gross_expense, period_list, filters.company, 'Gross Profit',filters.presentation_currency)
+ data.append(gross_profit)
+
+ non_gross_income = get_revenue(income, period_list, 0)
+ data.append({})
+ data.extend(non_gross_income or [])
+
+ non_gross_expense = get_revenue(expense, period_list, 0)
+ data.append({})
+ data.extend(non_gross_expense or [])
+
+ net_profit = get_net_profit(non_gross_income, gross_income, gross_expense, non_gross_expense, period_list, filters.company,filters.presentation_currency)
+ data.append({})
+ data.append(net_profit)
+
+ return columns, data
+
+def get_revenue(data, period_list, include_in_gross=1):
+ revenue = [item for item in data if item['include_in_gross']==include_in_gross or item['is_group']==1]
+
+ data_to_be_removed =True
+ while data_to_be_removed:
+ revenue, data_to_be_removed = remove_parent_with_no_child(revenue, period_list)
+ revenue = adjust_account(revenue, period_list)
+ return copy.deepcopy(revenue)
+
+def remove_parent_with_no_child(data, period_list):
+ data_to_be_removed = False
+ for parent in data:
+ if 'is_group' in parent and parent.get("is_group") == 1:
+ have_child = False
+ for child in data:
+ if 'parent_account' in child and child.get("parent_account") == parent.get("account"):
+ have_child = True
+ break
+
+ if not have_child:
+ data_to_be_removed = True
+ data.remove(parent)
+
+ return data, data_to_be_removed
+
+def adjust_account(data, period_list, consolidated= False):
+ leaf_nodes = [item for item in data if item['is_group'] == 0]
+ totals = {}
+ for node in leaf_nodes:
+ set_total(node, node["total"], data, totals)
+ for d in data:
+ for period in period_list:
+ key = period if consolidated else period.key
+ d[key] = totals[d["account"]]
+ d['total'] = totals[d["account"]]
+ return data
+
+def set_total(node, value, complete_list, totals):
+ if not totals.get(node['account']):
+ totals[node["account"]] = 0
+ totals[node["account"]] += value
+
+ parent = node['parent_account']
+ if not parent == '':
+ return set_total(next(item for item in complete_list if item['account'] == parent), value, complete_list, totals)
+
+
+def get_profit(gross_income, gross_expense, period_list, company, profit_type, currency=None, consolidated=False):
+
+ profit_loss = {
+ "account_name": "'" + _(profit_type) + "'",
+ "account": "'" + _(profit_type) + "'",
+ "warn_if_negative": True,
+ "currency": currency or frappe.get_cached_value('Company', company, "default_currency")
+ }
+
+ has_value = False
+
+ for period in period_list:
+ key = period if consolidated else period.key
+ profit_loss[key] = flt(gross_income[0].get(key, 0)) - flt(gross_expense[0].get(key, 0))
+
+ if profit_loss[key]:
+ has_value=True
+
+ if has_value:
+ return profit_loss
+
+def get_net_profit(non_gross_income, gross_income, gross_expense, non_gross_expense, period_list, company, currency=None, consolidated=False):
+ profit_loss = {
+ "account_name": "'" + _("Net Profit") + "'",
+ "account": "'" + _("Net Profit") + "'",
+ "warn_if_negative": True,
+ "currency": currency or frappe.get_cached_value('Company', company, "default_currency")
+ }
+
+ has_value = False
+
+ for period in period_list:
+ key = period if consolidated else period.key
+ total_income = flt(gross_income[0].get(key, 0)) + flt(non_gross_income[0].get(key, 0))
+ total_expense = flt(gross_expense[0].get(key, 0)) + flt(non_gross_expense[0].get(key, 0))
+ profit_loss[key] = flt(total_income) - flt(total_expense)
+
+ if profit_loss[key]:
+ has_value=True
+
+ if has_value:
+ return profit_loss
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index 67105e5..073516f 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -6,7 +6,7 @@
from frappe import _, scrub
from erpnext.stock.utils import get_incoming_rate
from erpnext.controllers.queries import get_match_cond
-from frappe.utils import flt
+from frappe.utils import flt, cint
def execute(filters=None):
@@ -106,11 +106,14 @@
self.grouped = {}
self.grouped_data = []
+ self.currency_precision = cint(frappe.db.get_default("currency_precision")) or 3
+ self.float_precision = cint(frappe.db.get_default("float_precision")) or 2
+
for row in self.si_list:
if self.skip_row(row, self.product_bundles):
continue
- row.base_amount = flt(row.base_net_amount)
+ row.base_amount = flt(row.base_net_amount, self.currency_precision)
product_bundles = []
if row.update_stock:
@@ -129,15 +132,15 @@
# get buying rate
if row.qty:
- row.buying_rate = row.buying_amount / row.qty
- row.base_rate = row.base_amount / row.qty
+ row.buying_rate = flt(row.buying_amount / row.qty, self.float_precision)
+ row.base_rate = flt(row.base_amount / row.qty, self.float_precision)
else:
row.buying_rate, row.base_rate = 0.0, 0.0
# calculate gross profit
- row.gross_profit = flt(row.base_amount - row.buying_amount, 3)
+ row.gross_profit = flt(row.base_amount - row.buying_amount, self.currency_precision)
if row.base_amount:
- row.gross_profit_percent = flt((row.gross_profit / row.base_amount) * 100.0, 3)
+ row.gross_profit_percent = flt((row.gross_profit / row.base_amount) * 100.0, self.currency_precision)
else:
row.gross_profit_percent = 0.0
@@ -156,8 +159,8 @@
new_row = row
else:
new_row.qty += row.qty
- new_row.buying_amount += row.buying_amount
- new_row.base_amount += row.base_amount
+ new_row.buying_amount += flt(row.buying_amount, self.currency_precision)
+ new_row.base_amount += flt(row.base_amount, self.currency_precision)
new_row = self.set_average_rate(new_row)
self.grouped_data.append(new_row)
else:
@@ -167,18 +170,19 @@
returned_item_rows = self.returned_invoices[row.parent][row.item_code]
for returned_item_row in returned_item_rows:
row.qty += returned_item_row.qty
- row.base_amount += returned_item_row.base_amount
- row.buying_amount = row.qty * row.buying_rate
+ row.base_amount += flt(returned_item_row.base_amount, self.currency_precision)
+ row.buying_amount = flt(row.qty * row.buying_rate, self.currency_precision)
if row.qty or row.base_amount:
row = self.set_average_rate(row)
self.grouped_data.append(row)
def set_average_rate(self, new_row):
- new_row.gross_profit = flt(new_row.base_amount - new_row.buying_amount,3)
- new_row.gross_profit_percent = flt(((new_row.gross_profit / new_row.base_amount) * 100.0),3) \
+ new_row.gross_profit = flt(new_row.base_amount - new_row.buying_amount, self.currency_precision)
+ new_row.gross_profit_percent = flt(((new_row.gross_profit / new_row.base_amount) * 100.0), self.currency_precision) \
if new_row.base_amount else 0
- new_row.buying_rate = (new_row.buying_amount / new_row.qty) if new_row.qty else 0
- new_row.base_rate = (new_row.base_amount / new_row.qty) if new_row.qty else 0
+ new_row.buying_rate = flt(new_row.buying_amount / new_row.qty, self.float_precision) if new_row.qty else 0
+ new_row.base_rate = flt(new_row.base_amount / new_row.qty, self.float_precision) if new_row.qty else 0
+
return new_row
def get_returned_invoice_items(self):
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 4c16323..f8f1e54 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -172,8 +172,8 @@
or tabItem.item_code LIKE %(txt)s
or tabItem.item_group LIKE %(txt)s
or tabItem.item_name LIKE %(txt)s
- or tabItem.item_code IN (select parent from `tabItem Barcode` where barcode LIKE %(txt)s
- {description_cond}))
+ or tabItem.item_code IN (select parent from `tabItem Barcode` where barcode LIKE %(txt)s)
+ {description_cond})
{fcond} {mcond}
order by
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
diff --git a/erpnext/hr/doctype/additional_salary/additional_salary.py b/erpnext/hr/doctype/additional_salary/additional_salary.py
index 6f87954..e25e69e 100644
--- a/erpnext/hr/doctype/additional_salary/additional_salary.py
+++ b/erpnext/hr/doctype/additional_salary/additional_salary.py
@@ -11,8 +11,8 @@
class AdditionalSalary(Document):
def validate(self):
self.validate_dates()
- if self.amount <= 0:
- frappe.throw(_("Amount should be greater than zero."))
+ if self.amount < 0:
+ frappe.throw(_("Amount should not be less than zero."))
def validate_dates(self):
date_of_joining, relieving_date = frappe.db.get_value("Employee", self.employee,
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 9873efa..947d693 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -282,6 +282,10 @@
total_bundle_qty = frappe.db.sql(""" select sum(qty) from
`tabProduct Bundle Item` where parent = %s""", (frappe.db.escape(self.product_bundle_item)))[0][0]
+ if not total_bundle_qty:
+ # product bundle is 0 (product bundle allows 0 qty for items)
+ total_bundle_qty = 1
+
cond = "product_bundle_item = %s" if self.product_bundle_item else "production_item = %s"
qty = frappe.db.sql(""" select sum(qty) from
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index b1a393b..433141c 100755
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -587,4 +587,4 @@
execute:frappe.delete_doc('DocType', 'Notification Control')
erpnext.patches.v11_0.remove_barcodes_field_from_copy_fields_to_variants
erpnext.patches.v10_0.item_barcode_childtable_migrate # 16-02-2019
-erpnext.patches.v11_0.make_italian_localization_fields
+erpnext.patches.v11_0.make_italian_localization_fields # 01-03-2019
diff --git a/erpnext/patches/v11_0/make_italian_localization_fields.py b/erpnext/patches/v11_0/make_italian_localization_fields.py
index fa77149..44a281f 100644
--- a/erpnext/patches/v11_0/make_italian_localization_fields.py
+++ b/erpnext/patches/v11_0/make_italian_localization_fields.py
@@ -22,7 +22,9 @@
condition += " when '{0}' then '{1}'".format(frappe.db.escape(state), frappe.db.escape(code))
if condition:
- frappe.db.sql("""
- UPDATE tabAddress set state_code = (case state {condition} end)
- WHERE country in ('Italy', 'Italia', 'Italian Republic', 'Repubblica Italiana')
- """.format(condition=condition))
+ condition = "state_code = (case state {0} end),".format(condition)
+
+ frappe.db.sql("""
+ UPDATE tabAddress set {condition} country_code = UPPER(ifnull((select code
+ from `tabCountry` where name = `tabAddress`.country), ''))
+ """.format(condition=condition))
diff --git a/erpnext/public/js/controllers/stock_controller.js b/erpnext/public/js/controllers/stock_controller.js
index 1b8e079..1c12c35 100644
--- a/erpnext/public/js/controllers/stock_controller.js
+++ b/erpnext/public/js/controllers/stock_controller.js
@@ -73,7 +73,7 @@
from_date: me.frm.doc.posting_date,
to_date: me.frm.doc.posting_date,
company: me.frm.doc.company,
- group_by: ""
+ group_by: "Group by Voucher (Consolidated)"
};
frappe.set_route("query-report", "General Ledger");
}, __("View"));
diff --git a/erpnext/regional/italy/e-invoice.xml b/erpnext/regional/italy/e-invoice.xml
index 30ac1e0..c886ee9 100644
--- a/erpnext/regional/italy/e-invoice.xml
+++ b/erpnext/regional/italy/e-invoice.xml
@@ -9,7 +9,7 @@
{%- if address.state_code %}
<Provincia>{{ address.state_code }}</Provincia>
{%- endif %}
-<Nazione>{{ address.country_code|upper }}</Nazione>
+<Nazione>{{ address.country_code }}</Nazione>
{%- endmacro %}
{%- macro render_discount_or_margin(item) -%}
@@ -40,7 +40,7 @@
<FatturaElettronicaHeader>
<DatiTrasmissione>
<IdTrasmittente>
- <IdPaese>{{ doc.company_address_data.country_code|upper or "IT" }}</IdPaese>
+ <IdPaese>{{ doc.company_address_data.country_code }}</IdPaese>
<IdCodice>{{ doc.company_fiscal_code or doc.company_tax_id | replace("IT","") }}</IdCodice>
</IdTrasmittente>
<ProgressivoInvio>{{ doc.progressive_number }}</ProgressivoInvio>
@@ -56,7 +56,7 @@
<CedentePrestatore>
<DatiAnagrafici>
<IdFiscaleIVA>
- <IdPaese>{{ doc.company_address_data.country_code|upper or "IT"}}</IdPaese>
+ <IdPaese>{{ doc.company_address_data.country_code }}</IdPaese>
<IdCodice>{{ doc.company_tax_id | replace("IT","") }}</IdCodice>
</IdFiscaleIVA>
{%- if doc.company_fiscal_code %}
@@ -99,7 +99,7 @@
<CodiceFiscale>{{ doc.customer_data.fiscal_code }}</CodiceFiscale>
{%- else %}
<IdFiscaleIVA>
- <IdPaese>{{ doc.customer_address_data.country_code|upper or "IT" }}</IdPaese>
+ <IdPaese>{{ doc.customer_address_data.country_code }}</IdPaese>
<IdCodice>{{ doc.tax_id | replace("IT","") }}</IdCodice>
</IdFiscaleIVA>
{%- endif %}
@@ -160,7 +160,7 @@
<CodiceTipo>CODICE</CodiceTipo>
<CodiceValore>{{ item.item_code }}</CodiceValore>
</CodiceArticolo>
- <Descrizione>{{ html2text(item.description) or item.item_name }}</Descrizione>
+ <Descrizione>{{ html2text(item.description or '') or item.item_name }}</Descrizione>
<Quantita>{{ format_float(item.qty) }}</Quantita>
<UnitaMisura>{{ item.stock_uom }}</UnitaMisura>
<PrezzoUnitario>{{ format_float(item.price_list_rate or item.rate) }}</PrezzoUnitario>
@@ -199,7 +199,15 @@
<ModalitaPagamento>{{ payment_term.mode_of_payment_code.split("-")[0] }}</ModalitaPagamento>
<DataScadenzaPagamento>{{ payment_term.due_date }}</DataScadenzaPagamento>
<ImportoPagamento>{{ format_float(payment_term.payment_amount) }}</ImportoPagamento>
- {%- if payment_term.bank_account_iban %}<IBAN>{{ payment_term.bank_account_iban }}</IBAN>{%- endif %}
+ <IstitutoFinanziario>{{ payment_term.bank_account_name }}</IstitutoFinanziario>
+ {%- if payment_term.bank_account_iban %}
+ <IBAN>{{ payment_term.bank_account_iban }}</IBAN>
+ <ABI>{{ payment_term.bank_account_iban[5:10] }}</ABI>
+ <CAB>{{ payment_term.bank_account_iban[10:15] }}</CAB>
+ {%- endif %}
+ {%- if payment_term.bank_account_swift_number %}
+ <BIC>{{ payment_term.bank_account_swift_number }}</BIC>
+ {%- endif %}
</DettaglioPagamento>
{%- endfor %}
</DatiPagamento>
diff --git a/erpnext/regional/italy/sales_invoice.js b/erpnext/regional/italy/sales_invoice.js
new file mode 100644
index 0000000..3457f71
--- /dev/null
+++ b/erpnext/regional/italy/sales_invoice.js
@@ -0,0 +1,19 @@
+erpnext.setup_e_invoice_button = (doctype) => {
+ frappe.ui.form.on(doctype, {
+ refresh: (frm) => {
+ if(frm.doc.docstatus == 1) {
+ frm.add_custom_button('Generate E-Invoice', () => {
+ var w = window.open(
+ frappe.urllib.get_full_url(
+ "/api/method/erpnext.regional.italy.utils.generate_single_invoice?"
+ + "docname=" + frm.doc.name
+ )
+ )
+ if (!w) {
+ frappe.msgprint(__("Please enable pop-ups")); return;
+ }
+ });
+ }
+ }
+ });
+};
diff --git a/erpnext/regional/italy/setup.py b/erpnext/regional/italy/setup.py
index a9de2d1..2b6e3af 100644
--- a/erpnext/regional/italy/setup.py
+++ b/erpnext/regional/italy/setup.py
@@ -32,12 +32,12 @@
fieldtype='Section Break', insert_after='date_of_establishment', print_hide=1),
dict(fieldname='fiscal_regime', label='Fiscal Regime',
fieldtype='Select', insert_after='sb_e_invoicing', print_hide=1,
- options="\n".join(map(lambda x: x.decode('utf-8'), fiscal_regimes))),
+ options="\n".join(map(lambda x: frappe.safe_decode(x, encoding='utf-8'), fiscal_regimes))),
dict(fieldname='fiscal_code', label='Fiscal Code', fieldtype='Data', insert_after='fiscal_regime', print_hide=1,
description=_("Applicable if the company is an Individual or a Proprietorship")),
dict(fieldname='vat_collectability', label='VAT Collectability',
fieldtype='Select', insert_after='fiscal_code', print_hide=1,
- options="\n".join(map(lambda x: x.decode('utf-8'), vat_collectability_options))),
+ options="\n".join(map(lambda x: frappe.safe_decode(x, encoding='utf-8'), vat_collectability_options))),
dict(fieldname='cb_e_invoicing1', fieldtype='Column Break', insert_after='vat_collectability', print_hide=1),
dict(fieldname='registrar_office_province', label='Province of the Registrar Office',
fieldtype='Data', insert_after='cb_e_invoicing1', print_hide=1, length=2),
@@ -57,7 +57,7 @@
dict(fieldname='tax_exemption_reason', label='Tax Exemption Reason',
fieldtype='Select', insert_after='included_in_print_rate', print_hide=1,
depends_on='eval:doc.charge_type!="Actual" && doc.rate==0.0',
- options="\n" + "\n".join(map(lambda x: x.decode('utf-8'), tax_exemption_reasons))),
+ options="\n" + "\n".join(map(lambda x: frappe.safe_decode(x, encoding='utf-8'), tax_exemption_reasons))),
dict(fieldname='tax_exemption_law', label='Tax Exempt Under',
fieldtype='Text', insert_after='tax_exemption_reason', print_hide=1,
depends_on='eval:doc.charge_type!="Actual" && doc.rate==0.0')
@@ -80,30 +80,33 @@
'Mode of Payment': [
dict(fieldname='mode_of_payment_code', label='Code',
fieldtype='Select', insert_after='included_in_print_rate', print_hide=1,
- options="\n".join(map(lambda x: x.decode('utf-8'), mode_of_payment_codes)))
+ options="\n".join(map(lambda x: frappe.safe_decode(x, encoding='utf-8'), mode_of_payment_codes)))
],
'Payment Schedule': [
dict(fieldname='mode_of_payment_code', label='Code',
fieldtype='Select', insert_after='mode_of_payment', print_hide=1,
- options="\n".join(map(lambda x: x.decode('utf-8'), mode_of_payment_codes)),
+ options="\n".join(map(lambda x: frappe.safe_decode(x, encoding='utf-8'), mode_of_payment_codes)),
fetch_from="mode_of_payment.mode_of_payment_code", read_only=1),
dict(fieldname='bank_account', label='Bank Account',
fieldtype='Link', insert_after='mode_of_payment_code', print_hide=1,
options="Bank Account"),
- dict(fieldname='bank_account_name', label='Bank Account Name',
+ dict(fieldname='bank_account_name', label='Bank Name',
fieldtype='Data', insert_after='bank_account', print_hide=1,
- fetch_from="bank_account.account_name", read_only=1),
+ fetch_from="bank_account.bank", read_only=1),
dict(fieldname='bank_account_no', label='Bank Account No',
fieldtype='Data', insert_after='bank_account_name', print_hide=1,
fetch_from="bank_account.bank_account_no", read_only=1),
dict(fieldname='bank_account_iban', label='IBAN',
fieldtype='Data', insert_after='bank_account_name', print_hide=1,
fetch_from="bank_account.iban", read_only=1),
+ dict(fieldname='bank_account_swift_number', label='Swift Code (BIC)',
+ fieldtype='Data', insert_after='bank_account_iban', print_hide=1,
+ fetch_from="bank_account.swift_number", read_only=1),
],
"Sales Invoice": [
dict(fieldname='vat_collectability', label='VAT Collectability',
fieldtype='Select', insert_after='taxes_and_charges', print_hide=1,
- options="\n".join(map(lambda x: x.decode('utf-8'), vat_collectability_options)),
+ options="\n".join(map(lambda x: frappe.safe_decode(x, encoding='utf-8'), vat_collectability_options)),
fetch_from="company.vat_collectability"),
dict(fieldname='sb_e_invoicing_reference', label='E-Invoicing',
fieldtype='Section Break', insert_after='pos_total_qty', print_hide=1),
@@ -132,7 +135,7 @@
'Supplier Quotation Item': invoice_item_fields,
'Address': [
dict(fieldname='country_code', label='Country Code',
- fieldtype='Data', insert_after='country', print_hide=1, read_only=1,
+ fieldtype='Data', insert_after='country', print_hide=1, read_only=0,
fetch_from="country.code"),
dict(fieldname='state_code', label='State Code',
fieldtype='Data', insert_after='state', print_hide=1)
diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py
index 540cea3..f39b144 100644
--- a/erpnext/regional/italy/utils.py
+++ b/erpnext/regional/italy/utils.py
@@ -189,7 +189,7 @@
if not doc.company_address:
frappe.throw(_("Please set an Address on the Company '%s'" % doc.company), title=_("E-Invoicing Information Missing"))
else:
- validate_address(doc.company_address, "Company")
+ validate_address(doc.company_address)
company_fiscal_regime = frappe.get_cached_value("Company", doc.company, 'fiscal_regime')
if not company_fiscal_regime:
@@ -217,7 +217,7 @@
if not doc.customer_address:
frappe.throw(_("Please set the Customer Address"), title=_("E-Invoicing Information Missing"))
else:
- validate_address(doc.customer_address, "Customer")
+ validate_address(doc.customer_address)
if not len(doc.taxes):
frappe.throw(_("Please set at least one row in the Taxes and Charges Table"), title=_("E-Invoicing Information Missing"))
@@ -252,15 +252,29 @@
prepare_and_attach_invoice(doc)
-def prepare_and_attach_invoice(doc):
- progressive_name, progressive_number = get_progressive_name_and_number(doc)
+def prepare_and_attach_invoice(doc, replace=False):
+ progressive_name, progressive_number = get_progressive_name_and_number(doc, replace)
invoice = prepare_invoice(doc, progressive_number)
invoice_xml = frappe.render_template('erpnext/regional/italy/e-invoice.xml', context={"doc": invoice}, is_path=True)
invoice_xml = invoice_xml.replace("&", "&")
xml_filename = progressive_name + ".xml"
- save_file(xml_filename, invoice_xml, dt=doc.doctype, dn=doc.name, is_private=True)
+ return save_file(xml_filename, invoice_xml, dt=doc.doctype, dn=doc.name, is_private=True)
+
+@frappe.whitelist()
+def generate_single_invoice(docname):
+ doc = frappe.get_doc("Sales Invoice", docname)
+
+ e_invoice = prepare_and_attach_invoice(doc, True)
+
+ content = None
+ with open(frappe.get_site_path('private', 'files', e_invoice.file_name), "r") as f:
+ content = f.read()
+
+ frappe.local.response.filename = e_invoice.file_name
+ frappe.local.response.filecontent = content
+ frappe.local.response.type = "download"
#Delete e-invoice attachment on cancel.
def sales_invoice_on_cancel(doc, method):
@@ -285,13 +299,14 @@
return out
-def validate_address(address_name, address_context):
- pincode, city = frappe.db.get_value("Address", address_name, ["pincode", "city"])
- if not pincode:
- frappe.throw(_("Please set pin code on %s Address" % address_context), title=_("E-Invoicing Information Missing"))
- if not city:
- frappe.throw(_("Please set city on %s Address" % address_context), title=_("E-Invoicing Information Missing"))
+def validate_address(address_name):
+ fields = ["pincode", "city", "country_code"]
+ data = frappe.get_cached_value("Address", address_name, fields, as_dict=1) or {}
+ for field in fields:
+ if not data.get(field):
+ frappe.throw(_("Please set {0} for address {1}".format(field.replace('-',''), address_name)),
+ title=_("E-Invoicing Information Missing"))
def get_unamended_name(doc):
attributes = ["naming_series", "amended_from"]
@@ -304,7 +319,13 @@
else:
return doc.name
-def get_progressive_name_and_number(doc):
+def get_progressive_name_and_number(doc, replace=False):
+ if replace:
+ for attachment in get_e_invoice_attachments(doc):
+ remove_file(attachment.name, attached_to_doctype=doc.doctype, attached_to_name=doc.name)
+ filename = attachment.file_name.split(".xml")[0]
+ return filename, filename.split("_")[1]
+
company_tax_id = doc.company_tax_id if doc.company_tax_id.startswith("IT") else "IT" + doc.company_tax_id
progressive_name = frappe.model.naming.make_autoname(company_tax_id + "_.#####")
progressive_number = progressive_name.split("_")[1]
@@ -312,6 +333,9 @@
return progressive_name, progressive_number
def set_state_code(doc, method):
+ if doc.get('country_code'):
+ doc.country_code = doc.country_code.upper()
+
if not doc.get('state'):
return
@@ -319,4 +343,7 @@
return
state_codes_lower = {key.lower():value for key,value in state_codes.items()}
- doc.state_code = state_codes_lower.get(doc.get('state','').lower())
+
+ state = doc.get('state','').lower()
+ if state_codes_lower.get(state):
+ doc.state_code = state_codes_lower.get(state)
diff --git a/erpnext/selling/report/address_and_contacts/address_and_contacts.py b/erpnext/selling/report/address_and_contacts/address_and_contacts.py
index eb242d0..a9e4303 100644
--- a/erpnext/selling/report/address_and_contacts/address_and_contacts.py
+++ b/erpnext/selling/report/address_and_contacts/address_and_contacts.py
@@ -102,8 +102,7 @@
records = frappe.get_list(doctype, filters=filters, fields=fields, as_list=True)
for d in records:
details = party_details.get(d[0])
- if details:
- details.setdefault(frappe.scrub(doctype), []).append(d[1:])
+ details.setdefault(frappe.scrub(doctype), []).append(d[1:])
return party_details
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index 62c9e7b..8a164f9 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -33,7 +33,7 @@
tabCompany limit 1""") and 'Yes' or 'No'
bootinfo.docs += frappe.db.sql("""select name, default_currency, cost_center, default_terms,
- default_letter_head, default_bank_account, enable_perpetual_inventory from `tabCompany`""",
+ default_letter_head, default_bank_account, enable_perpetual_inventory, country from `tabCompany`""",
as_dict=1, update={"doctype":":Company"})
party_account_types = frappe.db.sql(""" select name, ifnull(account_type, '') from `tabParty Type`""")