Skip to content

Commit

Permalink
Merge pull request #1380 from Bloomstack/production
Browse files Browse the repository at this point in the history
Bring hotfix inline with production
  • Loading branch information
DeveloperMetal authored Jun 11, 2021
2 parents a0f076f + 0c6c87b commit a347687
Show file tree
Hide file tree
Showing 71 changed files with 2,855 additions and 208 deletions.
2 changes: 1 addition & 1 deletion erpnext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from frappe.utils import getdate

__erpnext_version__ = '12.10.1'
__version__ = '2.2.2'
__version__ = '2.3.0'

def get_default_company(user=None):
'''Get default company for user'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"doctype": "Print Format",
"font": "Default",
"format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}]",
"html": "{% if doc.license %}\n{% set type = frappe.db.get_value('Compliance Info' ,doc.license, 'license_for' )%}\n{% endif %}\n<div class=\"row\">\n <div class=\"col-md-6\">\n <h2>{{doc.company}}</h2>\n <div class=\"company-address\">\n {% set links = frappe.get_all(\"Dynamic Link\", filters={\"link_doctype\": \"Company\", \"link_name\": doc.company, \"parenttype\": \"Address\"}, fields=[\"parent\"]) %}\n {% if links %}\n <p>{{ frappe.db.get_value(\"Address\", links[0].parent, \"address_line1\")}}, \n {{ frappe.db.get_value(\"Address\", links[0].parent, \"address_line2\") or \" \" }}</p>\n <p>{{ frappe.db.get_value(\"Address\", links[0].parent, \"city\") or \" \" }},\n {{ frappe.db.get_value(\"Address\", links[0].parent, \"state\") or \" \" }},\n {{ frappe.db.get_value(\"Address\", links[0].parent, \"country\") or \" \" }},\n {{ frappe.db.get_value(\"Address\", links[0].parent, \"pincode\") or \" \" }}.\n {% endif %}\n </div>\n <p class=\"license\">License: {{ frappe.db.get_value(\"Company\",doc.company , \"license\") or \" \" }}</p>\n <p class=\"phone\">Phone: {{ frappe.db.get_value(\"Address\", links[0].parent, \"phone\") or \" \" }}.</p>\n </div>\n <div class=\"col-md-6\">\n <h2 class=\"text-right\">Invoice</h2>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <h3>Invoice Number</h3>\n </div>\n <div class=\"col-md-6\">\n <p>{{doc.name}}</p>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <h3>Date</h3>\n </div>\n <div class=\"col-md-6\">\n <p>{{doc.posting_date}}</p>\n </div>\n </div>\n {% if type != \"Retailer\" %}\n <div class=\"row\">\n <div class=\"col-md-6\">\n <h3>Payment Terms</h3>\n </div>\n <div class=\"col-md-6\">\n <p>{{doc.payment_terms_template}}</p>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <h3>Due Date</h3>\n </div>\n <div class=\"col-md-6\">\n <p>{{doc.due_date}}</p>\n </div>\n </div>\n {% endif %}\n </div>\n</div>\n {% if type != \"Retailer\" %}\n<div class=\"row billing_shipping_info\">\n <div class=\"col-md-6\">\n <h3 class=\"bill_to\">Bill To:</h3>\n <p class=\"customer\">{{doc.customer}}</p>\n <p class=\"company_address\">{{doc.address_display or ''}}</p>\n <p class=\"license\">License: {{doc.license or \"\"}}</p>\n <p class=\"license\">A/R Contact: {{doc.contact_person or \"\"}}</p>\n </div>\n <div class=\"col-md-6\">\n <h3>Ship To:</h3>\n <p class=\"customer\">{{doc.customer}}</p>\n <p class=\"comapany_address\">{{doc.shipping_address or \"\"}}</p>\n </div>\n</div>\n{% endif %}\n<div class=\"row\">\n <table>\n <thead>\n <tr>\n <th width=\"50%\">Item Name</th>\n <th>Quantity</th>\n <th>Unit Price</th>\n <th>Amount</th>\n </tr>\n </thead>\n <tbody>\n {% for item in doc.items %}\n <tr>\n <td>{{item.item_name or \"\"}}</td>\n <td>{{item.qty or \"0\"}}</td>\n <td>{{item.rate or \"0\"}}</td>\n <td>{{item.amount or \"0\"}}</td>\n </tr>\n {% endfor %}\n </tbody>\n </table>\n</div>\n<div class=\"row\">\n <table>\n <thead>\n <tr>\n <th width=\"50%\">Account Head</th>\n <th>Tax</th>\n <th>Rate</th>\n <th>Tax Amount</th>\n </tr>\n </thead>\n <tbody>\n {% for tax in doc.taxes %}\n <tr>\n <td>{{tax.account_head or ''}}</td>\n <td>{{tax.description or ''}}</td>\n <td>{{tax.rate or ''}}</td>\n <td>{{tax.tax_amount or ''}}</td>\n </tr>\n {% endfor %}\n </tbody>\n </table>\n</div>\n<div class=\"row\">\n <table>\n <tbody>\n <tr>\n <td colspan=\"3\" class=\"text-right\">Subtotal</td>\n <td class=\"text-right\">{{doc.total}}</td>\n </tr>\n <tr>\n <td colspan=\"3\" class=\"text-right\">Discount</td>\n <td class=\"text-right\">-{{doc.discount_amount}}</td>\n </tr>\n {% if type != \"Retailer\" %}\n <tr>\n <td colspan=\"3\" class=\"text-right\">Net Total</td>\n <td class=\"text-right\">{{doc.net_total}}</td>\n </tr>\n {% endif %}\n <tr>\n <td colspan=\"3\" class=\"text-right\">Taxes Charged</td>\n <td class=\"text-right\">{{doc.total_taxes_and_charges}}</td>\n </tr>\n <tr>\n <td colspan=\"3\" class=\"text-right\">Grand Total</td>\n <td class=\"text-right\">{{doc.grand_total}}</td>\n </tr>\n <tr>\n <td colspan=\"3\" class=\"text-right\">Mode of Payment</td>\n {% set mode_of_payment = frappe.get_all(\"Payment Entry\",{\"reference_name\": doc.name},\"mode_of_payment\") %}\n <td class=\"text-right\">\n {% for m in mode_of_payment %}\n {{m.mode_of_payment}}\n {% endfor%}\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n",
"html": "{% if doc.license %}\n{% set type = frappe.db.get_value('Compliance Info' ,doc.license, 'license_for' )%}\n{% endif %}\n<div class=\"row\">\n <div class=\"col-md-6\">\n <h2>{{doc.company}}</h2>\n <div class=\"company-address\">\n {% set links = frappe.get_all(\"Dynamic Link\", filters={\"link_doctype\": \"Company\", \"link_name\": doc.company, \"parenttype\": \"Address\"}, fields=[\"parent\"]) %}\n {% if links %}\n <p>{{ frappe.db.get_value(\"Address\", links[0].parent, \"address_line1\")}}, \n {{ frappe.db.get_value(\"Address\", links[0].parent, \"address_line2\") or \" \" }}</p>\n <p>{{ frappe.db.get_value(\"Address\", links[0].parent, \"city\") or \" \" }},\n {{ frappe.db.get_value(\"Address\", links[0].parent, \"state\") or \" \" }},\n {{ frappe.db.get_value(\"Address\", links[0].parent, \"country\") or \" \" }},\n {{ frappe.db.get_value(\"Address\", links[0].parent, \"pincode\") or \" \" }}.\n {% endif %}\n </div>\n <p class=\"license\">License: {{ doc.license or \" \" }}</p>\n <p class=\"phone\">Phone: {{ frappe.db.get_value(\"Address\", links[0].parent, \"phone\") or \" \" }}.</p>\n </div>\n <div class=\"col-md-6\">\n <h2 class=\"text-right\">Invoice</h2>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <h3>Invoice Number</h3>\n </div>\n <div class=\"col-md-6\">\n <p>{{doc.name}}</p>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <h3>Date</h3>\n </div>\n <div class=\"col-md-6\">\n <p>{{doc.posting_date}}</p>\n </div>\n </div>\n {% if type != \"Retailer\" %}\n <div class=\"row\">\n <div class=\"col-md-6\">\n <h3>Payment Terms</h3>\n </div>\n <div class=\"col-md-6\">\n <p>{{doc.payment_terms_template}}</p>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <h3>Due Date</h3>\n </div>\n <div class=\"col-md-6\">\n <p>{{doc.due_date}}</p>\n </div>\n </div>\n {% endif %}\n </div>\n</div>\n {% if type != \"Retailer\" %}\n<div class=\"row billing_shipping_info\">\n <div class=\"col-md-6\">\n <h3 class=\"bill_to\">Bill To:</h3>\n <p class=\"customer\">{{doc.customer}}</p>\n <p class=\"company_address\">{{doc.address_display or ''}}</p>\n <p class=\"license\">License: {{doc.license or \"\"}}</p>\n <p class=\"license\">A/R Contact: {{doc.contact_person or \"\"}}</p>\n </div>\n <div class=\"col-md-6\">\n <h3>Ship To:</h3>\n <p class=\"customer\">{{doc.customer}}</p>\n <p class=\"company_address\">{{doc.shipping_address or \"\"}}</p>\n </div>\n</div>\n{% endif %}\n<div class=\"row\">\n <table>\n <thead>\n <tr>\n <th width=\"50%\">Item Name</th>\n <th>Quantity</th>\n <th>Unit Price</th>\n <th>Amount</th>\n </tr>\n </thead>\n <tbody>\n {% for item in doc.items %}\n <tr>\n <td>{{item.item_name or \"\"}}</td>\n <td>{{item.qty or \"0\"}}</td>\n <td>{{item.rate or \"0\"}}</td>\n <td>{{item.amount or \"0\"}}</td>\n </tr>\n {% endfor %}\n </tbody>\n </table>\n</div>\n<div class=\"row\">\n <table>\n <thead>\n <tr>\n <th width=\"50%\">Account Head</th>\n <th>Tax</th>\n <th>Rate</th>\n <th>Tax Amount</th>\n </tr>\n </thead>\n <tbody>\n {% for tax in doc.taxes %}\n <tr>\n <td>{{tax.account_head or ''}}</td>\n <td>{{tax.description or ''}}</td>\n <td>{{tax.rate or ''}}</td>\n <td>{{tax.tax_amount or ''}}</td>\n </tr>\n {% endfor %}\n </tbody>\n </table>\n</div>\n<div class=\"row\">\n <table>\n <tbody>\n <tr>\n <td colspan=\"3\" class=\"text-right\">Subtotal</td>\n <td class=\"text-right\">{{doc.total}}</td>\n </tr>\n <tr>\n <td colspan=\"3\" class=\"text-right\">Discount</td>\n <td class=\"text-right\">-{{doc.discount_amount}}</td>\n </tr>\n {% if type != \"Retailer\" %}\n <tr>\n <td colspan=\"3\" class=\"text-right\">Net Total</td>\n <td class=\"text-right\">{{doc.net_total}}</td>\n </tr>\n {% endif %}\n <tr>\n <td colspan=\"3\" class=\"text-right\">Taxes Charged</td>\n <td class=\"text-right\">{{doc.total_taxes_and_charges}}</td>\n </tr>\n <tr>\n <td colspan=\"3\" class=\"text-right\">Grand Total</td>\n <td class=\"text-right\">{{doc.grand_total}}</td>\n </tr>\n <tr>\n <td colspan=\"3\" class=\"text-right\">Mode of Payment</td>\n {% set mode_of_payment = frappe.get_all(\"Payment Entry\",{\"reference_name\": doc.name},\"mode_of_payment\") %}\n <td class=\"text-right\">\n {% for m in mode_of_payment %}\n {{m.mode_of_payment}}\n {% endfor%}\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n",
"idx": 0,
"line_breaks": 0,
"modified": "2021-05-20 05:25:16.166402",
"modified": "2021-05-31 23:25:03.224988",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
Expand Down
35 changes: 31 additions & 4 deletions erpnext/buying/report/procurement_tracker/procurement_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,20 @@ def get_columns(filters):
"fieldtype": "Date",
"width": 140
},
{
"label": _("Batch No"),
"fieldname": "batch_no",
"fieldtype": "Link",
"options": "Batch",
"width": 140
},
{
"label": _("Package Tag"),
"fieldname": "package_tag",
"fieldtype": "Link",
"options": "Package Tag",
"width": 140
}
]
return columns

Expand Down Expand Up @@ -168,6 +182,13 @@ def get_data(filters):
if procurement_record_against_mr:
procurement_record += procurement_record_against_mr
for po in purchase_order_entry:
# get batch and package tag related information form purchase receipt.
posting_date, batch_no, package_tag = None, None, None
if pr_records.get(po.name):
posting_date = pr_records.get(po.name).get('posting_date')
batch_no = pr_records.get(po.name).get('batch_no')
package_tag = pr_records.get(po.name).get('package_tag')

# fetch material records linked to the purchase order item
mr_record = mr_records.get(po.material_request_item, [{}])[0]
procurement_detail = {
Expand All @@ -189,7 +210,9 @@ def get_data(filters):
"purchase_order_amt": flt(po.amount),
"purchase_order_amt_in_company_currency": flt(po.base_amount),
"expected_delivery_date": po.schedule_date,
"actual_delivery_date": pr_records.get(po.name)
"actual_delivery_date": posting_date,
"batch_no": batch_no,
"package_tag": package_tag
}
procurement_record.append(procurement_detail)
return procurement_record
Expand Down Expand Up @@ -252,17 +275,21 @@ def get_mapped_pi_records():
"""))

def get_mapped_pr_records():
return frappe._dict(frappe.db.sql("""
pr_records = frappe.db.sql("""
SELECT
pr_item.purchase_order_item,
pr.posting_date
pr.posting_date,
pr_item.batch_no,
pr_item.package_tag
FROM `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
WHERE
pr.docstatus=1
AND pr.name=pr_item.parent
AND pr_item.purchase_order_item IS NOT NULL
AND pr.status not in ("Closed","Completed","Cancelled")
"""))
""", as_dict=1)
pr_records_dict = {item['purchase_order_item']:item for item in pr_records}
return pr_records_dict

def get_po_entries(conditions):
return frappe.db.sql("""
Expand Down
9 changes: 9 additions & 0 deletions erpnext/config/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,13 @@ def get_data():
'standard': 1,
"description": "Publish items to other ERPNext users."
},
{
"module_name": "Reports",
"category": "Modules",
"label": _("Reports"),
"color": "#3498db",
"icon": "octicon octicon-repo",
"type": "module",
"description": "Accounts, billing, payments, cost center and budgeting."
}
]
Loading

0 comments on commit a347687

Please sign in to comment.