Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Sales/Purchase Details Report #17739

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
df547d3
feat(Sales/Purchase Details Report): Party-Transaction-Item tree view
SaiFi0102 Mar 25, 2019
ad6ecbe
feat: Add Sales/Purchase Details Report link in explore links
SaiFi0102 Mar 25, 2019
646b4bf
feat(Sales/Purchase Details Report): Grand Total Column
SaiFi0102 Mar 25, 2019
6ba6324
fix(Item Wise Sales Register): Do not round amounts in get_tax_accounts
SaiFi0102 Mar 25, 2019
07a97b1
fix(Sales/Purchase Details Report): Always show name column
SaiFi0102 Mar 27, 2019
840660a
feat(Sales Details Report): List view and Filter to show tax columns
SaiFi0102 Apr 6, 2019
21236ae
fix(Sales/Purchase Details): Remove unnecessary columns and use forma…
SaiFi0102 Apr 7, 2019
522ab14
fix(Sales/Purchase Details): Collapse tree onload
SaiFi0102 Apr 8, 2019
d99cf17
feat(Sales/Purchase Details): Use initial_depth 1 instead of collapse…
SaiFi0102 Apr 9, 2019
99eead9
fix(Sales/Purchase Details): Handle the case that tax_rate can be "NA"
SaiFi0102 Apr 26, 2019
8cd1eb5
fix(Sales/Purchase Details): Remove letter head in report json
SaiFi0102 Apr 30, 2019
ea7eb87
feat(Sales/Purchase Details): Dynamic grouping using grouping utility
SaiFi0102 May 23, 2019
1bb4cd3
fix(Sales/Purchase Details): Do not group if not necessary
SaiFi0102 May 24, 2019
47a8c93
Merge branch 'develop' of https://github.com/frappe/erpnext.git into …
SaiFi0102 May 24, 2019
5972230
Merge branch 'develop' into Sales-Purchase-Details-Report-V12
nabinhait May 27, 2019
0c9039e
Merge branch 'develop' into Sales-Purchase-Details-Report-V12
Jul 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ def get_tax_accounts(item_list, columns, company_currency,
invoice_item_row = {}
itemised_tax = {}

tax_amount_precision = get_field_precision(frappe.get_meta(tax_doctype).get_field("tax_amount"),
currency=company_currency) or 2

for d in item_list:
invoice_item_row.setdefault(d.parent, []).append(d)
item_row_map.setdefault(d.parent, {}).setdefault(d.item_code or d.item_name, []).append(d)
Expand Down Expand Up @@ -243,9 +240,8 @@ def get_tax_accounts(item_list, columns, company_currency,
item_tax_amount = flt((tax_amount * d.base_net_amount) / item_net_amount) \
if item_net_amount else 0
if item_tax_amount:
tax_value = flt(item_tax_amount, tax_amount_precision)
tax_value = (tax_value * -1
if (doctype == 'Purchase Invoice' and name in deducted_tax) else tax_value)
tax_value = (item_tax_amount * -1
if (doctype == 'Purchase Invoice' and name in deducted_tax) else item_tax_amount)

itemised_tax.setdefault(d.name, {})[description] = frappe._dict({
"tax_rate": tax_rate,
Expand All @@ -258,8 +254,7 @@ def get_tax_accounts(item_list, columns, company_currency,
for d in invoice_item_row.get(parent, []):
itemised_tax.setdefault(d.name, {})[description] = frappe._dict({
"tax_rate": "NA",
"tax_amount": flt((tax_amount * d.base_net_amount) / d.base_net_total,
tax_amount_precision)
"tax_amount": flt((tax_amount * d.base_net_amount) / d.base_net_total)
})

tax_columns.sort()
Expand Down
Empty file.
112 changes: 112 additions & 0 deletions erpnext/buying/report/purchase_details/purchase_details.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
/* eslint-disable */

frappe.query_reports["Purchase Details"] = {
"filters": [
{
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company"),
reqd: 1
},
{
fieldname: "doctype",
label: __("Based On"),
fieldtype: "Select",
options: ["Purchase Order","Purchase Receipt","Purchase Invoice"],
default: "Purchase Invoice",
reqd: 1
},
{
fieldname: "qty_field",
label: __("Quantity Type"),
fieldtype: "Select",
options: ["Stock Qty", "Contents Qty", "Transaction Qty"],
default: "Stock Qty",
reqd: 1
},
{
fieldname: "from_date",
label: __("From Date"),
fieldtype: "Date",
default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
reqd: 1
},
{
fieldname: "to_date",
label: __("To Date"),
fieldtype: "Date",
default: frappe.datetime.get_today(),
reqd: 1
},
{
fieldname: "supplier",
label: __("Supplier"),
fieldtype: "Link",
options: "Supplier"
},
{
fieldname: "supplier_group",
label: __("Supplier Group"),
fieldtype: "Link",
options: "Supplier Group"
},
{
fieldname: "item_code",
label: __("Item"),
fieldtype: "Link",
options: "Item"
},
{
fieldname: "item_group",
label: __("Item Group"),
fieldtype: "Link",
options: "Item Group"
},
{
fieldname: "brand",
label: __("Brand"),
fieldtype: "Link",
options: "Brand"
},
{
fieldname: "group_by_1",
label: __("Group By Level 1"),
fieldtype: "Select",
options: ["Ungrouped", "Group by Supplier", "Group by Supplier Group", "Group by Transaction",
"Group by Item", "Group by Item Group", "Group by Brand"],
default: "Ungrouped"
},
{
fieldname: "group_by_2",
label: __("Group By Level 2"),
fieldtype: "Select",
options: ["Ungrouped", "Group by Supplier", "Group by Supplier Group", "Group by Transaction",
"Group by Item", "Group by Item Group", "Group by Brand"],
default: "Group by Supplier"
},
{
fieldname: "group_by_3",
label: __("Group By Level 3"),
fieldtype: "Select",
options: ["Ungrouped", "Group by Supplier", "Group by Supplier Group", "Group by Transaction",
"Group by Item", "Group by Item Group", "Group by Brand"],
default: "Group by Transaction"
},
{
fieldname: "group_same_items",
label: __("Group Same Items"),
fieldtype: "Check",
default: 1
},
{
fieldname: "include_taxes",
label: __("Include Taxes"),
fieldtype: "Check"
},
],
"initial_depth": 1
}
27 changes: 27 additions & 0 deletions erpnext/buying/report/purchase_details/purchase_details.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"add_total_row": 0,
"creation": "2019-03-25 15:25:54.566163",
"disable_prepared_report": 0,
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 0,
"is_standard": "Yes",
"modified": "2019-03-25 15:25:54.566163",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Details",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Purchase Order",
"report_name": "Purchase Details",
"report_type": "Script Report",
"roles": [
{
"role": "Purchase User"
},
{
"role": "Accounts User"
}
]
}
8 changes: 8 additions & 0 deletions erpnext/buying/report/purchase_details/purchase_details.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
from erpnext.selling.report.sales_details.sales_details import SalesPurchaseDetailsReport

def execute(filters=None):
return SalesPurchaseDetailsReport(filters).run("Supplier")
6 changes: 6 additions & 0 deletions erpnext/config/buying.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ def get_data():
"reference_doctype": "Material Request",
"onboard": 1,
},
{
"type": "report",
"is_query_report": True,
"name": "Purchase Details",
"doctype": "Purchase Order"
},
]
},
{
Expand Down
6 changes: 6 additions & 0 deletions erpnext/config/selling.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ def get_data():
"name": "Sales Order Trends",
"doctype": "Sales Order"
},
{
"type": "report",
"is_query_report": True,
"name": "Sales Details",
"doctype": "Sales Order"
},
]
},
{
Expand Down
Empty file.
126 changes: 126 additions & 0 deletions erpnext/selling/report/sales_details/sales_details.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
/* eslint-disable */

frappe.query_reports["Sales Details"] = {
"filters": [
{
fieldname: "company",
label: __("Company"),
fieldtype: "Link",
options: "Company",
default: frappe.defaults.get_user_default("Company"),
reqd: 1
},
{
fieldname: "doctype",
label: __("Based On"),
fieldtype: "Select",
options: ["Sales Order","Delivery Note","Sales Invoice"],
default: "Sales Invoice",
reqd: 1
},
{
fieldname: "qty_field",
label: __("Quantity Type"),
fieldtype: "Select",
options: ["Stock Qty", "Contents Qty", "Transaction Qty"],
default: "Stock Qty",
reqd: 1
},
{
fieldname: "from_date",
label: __("From Date"),
fieldtype: "Date",
default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),
reqd: 1
},
{
fieldname: "to_date",
label: __("To Date"),
fieldtype: "Date",
default: frappe.datetime.get_today(),
reqd: 1
},
{
fieldname: "customer",
label: __("Customer"),
fieldtype: "Link",
options: "Customer"
},
{
fieldname: "customer_group",
label: __("Customer Group"),
fieldtype: "Link",
options: "Customer Group"
},
{
fieldname: "item_code",
label: __("Item"),
fieldtype: "Link",
options: "Item"
},
{
fieldname: "item_group",
label: __("Item Group"),
fieldtype: "Link",
options: "Item Group"
},
{
fieldname: "brand",
label: __("Brand"),
fieldtype: "Link",
options: "Brand"
},
{
fieldname: "territory",
label: __("Territory"),
fieldtype: "Link",
options: "Territory"
},
{
fieldname: "sales_person",
label: __("Sales Person"),
fieldtype: "Link",
options: "Sales Person"
},
{
fieldname: "group_by_1",
label: __("Group By Level 1"),
fieldtype: "Select",
options: ["Ungrouped", "Group by Customer", "Group by Customer Group", "Group by Transaction",
"Group by Item", "Group by Item Group", "Group by Brand", "Group by Territory", "Group by Sales Person"],
default: "Ungrouped"
},
{
fieldname: "group_by_2",
label: __("Group By Level 2"),
fieldtype: "Select",
options: ["Ungrouped", "Group by Customer", "Group by Customer Group", "Group by Transaction",
"Group by Item", "Group by Item Group", "Group by Brand", "Group by Territory", "Group by Sales Person"],
default: "Group by Customer"
},
{
fieldname: "group_by_3",
label: __("Group By Level 3"),
fieldtype: "Select",
options: ["Ungrouped", "Group by Customer", "Group by Customer Group", "Group by Transaction",
"Group by Item", "Group by Item Group", "Group by Brand", "Group by Territory", "Group by Sales Person"],
default: "Group by Transaction"
},
{
fieldname: "group_same_items",
label: __("Group Same Items"),
fieldtype: "Check",
default: 1
},
{
fieldname: "include_taxes",
label: __("Include Taxes"),
fieldtype: "Check"
},
],
"initial_depth": 1
}


27 changes: 27 additions & 0 deletions erpnext/selling/report/sales_details/sales_details.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"add_total_row": 0,
"creation": "2019-03-24 16:27:15.822005",
"disable_prepared_report": 0,
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 0,
"is_standard": "Yes",
"modified": "2019-03-24 16:27:15.822005",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Details",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Sales Order",
"report_name": "Sales Details",
"report_type": "Script Report",
"roles": [
{
"role": "Accounts User"
},
{
"role": "Sales User"
}
]
}
Loading