Skip to content

Commit

Permalink
Merge pull request #74 from pseudocode-skyai/unizone-migration
Browse files Browse the repository at this point in the history
sdm changes
  • Loading branch information
Aditya-skyai committed Jul 20, 2024
2 parents 58bb217 + 47fe7d1 commit d5e2f27
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 80 deletions.
29 changes: 21 additions & 8 deletions erpnext/buying/doctype/purchase_order/purchase_order.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
frappe.set_route("query-report", "Purchase Order Report");
}, __("View"));
}
if(!in_list(["Closed", "Ready", "Shipped", "Proposed Ready Date", "Open"], doc.status)) {
if(!in_list(["Closed", "Ready", "Shipped", "Proposed Ready Date", "Open", "Ready and Short Close", "Shipped and Short Close"], doc.status)) {
/* if(this.frm.doc.status !== 'Closed' && flt(this.frm.doc.per_received) < 100 && flt(this.frm.doc.per_billed) < 100) {
this.frm.add_custom_button(__('Update Items'), () => {
erpnext.utils.update_child_items({
Expand All @@ -213,8 +213,16 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
} else{
this.frm.add_custom_button(__('Resume'), () => this.unhold_purchase_order(), __("Status"));
} */
if (doc.status != "Ready") {
this.frm.add_custom_button(__('Ready'), () => this.direct_ready_purchase_order(), __("Status"));
var ready_not_shipped = 0;
$.each(doc.items || [], function (i, row) {
if (row.received_qty != row.shipped_qty) {
ready_not_shipped = 1
}
})
if (doc.status != "Ready and Short Close" && ready_not_shipped == 1) {
this.frm.add_custom_button(__('Ready and Short Close'), () => this.short_close_po_for_ready(), __("Status"));
} else if (doc.status != "Ready and Short Close" && ready_not_shipped == 0) {
this.frm.add_custom_button(__('Shipped and Short Close'), () => this.short_close_po_for_shipped(), __("Status"));
}
}
}
Expand All @@ -225,7 +233,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
this.frm.page.set_inner_btn_group_as_primary(__("Status"));
} */
} else if(flt(doc.per_received, 6) < 100 && in_list(["Closed", "Delivered", "Ready"], doc.status)) {
} else if(flt(doc.per_received, 6) < 100 && in_list(["Closed", "Delivered", "Ready and Short Close", "Shipped and Short Close"], doc.status)) {
if (this.frm.has_perm("submit")) {
this.frm.add_custom_button(__('Re-open'), () => this.unclose_purchase_order(), __("Status"));
}
Expand All @@ -239,10 +247,10 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
if(doc.status != "Closed") {
if (doc.status != "On Hold") {
// ***** START Proposed Ready Date & Ready PO Custom Button Instead of Purchase Receipt ***** //
if(flt(doc.per_received) < 100 && allow_receipt && !in_list(["Ready", "Shipped", "Open"], doc.status)) {
if(flt(doc.per_received) < 100 && allow_receipt && !in_list(["Ready", "Shipped", "Open", "Ready and Short Close", "Shipped and Short Close"], doc.status)) {
cur_frm.add_custom_button(__('Ready PO'), this.make_purchase_receipt,);
}
if (!in_list(["Ready", "Shipped", "Proposed Ready Date", "Partially Ready"], doc.status)) {
if (!in_list(["Ready", "Shipped", "Proposed Ready Date", "Partially Ready","Ready and Short Close", "Shipped and Short Close"], doc.status)) {
cur_frm.add_custom_button(__("Proposed Ready Date"), function() {
cur_frm.doc.po_status="Proposed Ready Date";
cur_frm.doc.status="Proposed Ready Date";
Expand Down Expand Up @@ -674,8 +682,13 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
cur_frm.cscript.update_status('Close', 'Closed')
},

direct_ready_purchase_order: function(){
cur_frm.cscript.update_status('Ready', 'Ready')
short_close_po_for_ready: function(){
cur_frm.cscript.update_status('Ready and Short Close', 'Ready and Short Close')
refresh_field('status')
},
short_close_po_for_shipped: function(){
cur_frm.cscript.update_status('Shipped and Short Close', 'Shipped and Short Close')
refresh_field('status')
},

delivered_by_supplier: function(){
Expand Down
8 changes: 4 additions & 4 deletions erpnext/buying/doctype/purchase_order/purchase_order.json
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Select",
"options": "\nOpen\nProposed Ready Date\nPartially Ready\nReady\nShipped\nCancelled",
"options": "\nOpen\nProposed Ready Date\nPartially Ready\nReady and Short Close\nReady\nShipped\nShipped and Short Close\nCancelled",
"print_hide": 1,
"read_only": 1,
"reqd": 1,
Expand Down Expand Up @@ -1245,7 +1245,7 @@
"fieldname": "po_status",
"fieldtype": "Select",
"label": "PO Status",
"options": "Open\nProposed Ready Date\nPartially Ready\nReady\nShipped\nCancelled"
"options": "Open\nProposed Ready Date\nPartially Ready\nReady and Short\nReady\nShipped\nCancelled"
},
{
"allow_on_submit": 1,
Expand All @@ -1271,7 +1271,7 @@
{
"fieldname": "section_break_142",
"fieldtype": "Section Break",
"hidden": 1
"hidden": 0
},
{
"allow_on_submit": 1,
Expand All @@ -1287,7 +1287,7 @@
"idx": 105,
"is_submittable": 1,
"links": [],
"modified": "2023-02-14 05:35:29.939784",
"modified": "2023-12-06 05:39:06.601927",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
Expand Down
12 changes: 6 additions & 6 deletions erpnext/buying/doctype/purchase_order/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,12 +701,12 @@ def update_status(status, name):
po = frappe.get_doc("Purchase Order", name)
po.update_status(status)
po.update_delivered_qty_in_sales_order()
if po.status == "Ready":
total_received_amt = 0
for d in po.get("items"):
total_received_amt += d.rate
# Update Ammount in Account Payble DocType
frappe.db.set_value("Account Payable", po.name, 'total_payable_after_revision', 0)
# if po.status == "Ready":
# total_received_amt = 0
# for d in po.get("items"):
# total_received_amt += d.rate
# # Update Ammount in Account Payble DocType
# frappe.db.set_value("Account Payable", po.name, 'total_payable_after_revision', 0)


@frappe.whitelist()
Expand Down
50 changes: 25 additions & 25 deletions erpnext/buying/print_format/unizone_po/unizone_po.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"absolute_value": 0,
"align_labels_right": 0,
"creation": "2022-08-22 19:30:39.041461",
"css": "/* @page {*/\n/* margin: 0;*/\n/*}*/\n\n.print-format, .print-format-preview {font-size: 10; padding: 0.25in;}\n\n.print-display-flex {\n display: flex;\n justify-content: space-between;\n }\n\n.print-display-flex h2 div {font-size: 16px; font-weight: bold;}\n\n.print-company-info {text-align: left;}\n.print-company-info h3 {margin-top: 0; color: #0b6cb4;}\n.print-company-info p {\n color: #0b6cb4; \n font-size: 11px;\n margin-bottom: 5px;\n }",
"custom_format": 0,
"default_print_language": "",
"disabled": 0,
"doc_type": "Purchase Order",
"docstatus": 0,
"doctype": "Print Format",
"font": "Helvetica Neue",
"format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"<div class=\\\"print-heading print-display-flex\\\">\\n <div class=\\\"print-company-info\\\">\\n <h3>UNIZONE PTE. LTD.</h3>\\n <p>\\n UNIT 15-01 Valley Point <br>\\n 491B River Valley Road, Singapore 248373\\n </p>\\n </div>\\t\\n <h2><div>Purchase Order</div><small class=\\\"sub-heading\\\">{{ doc.name }}</small>\\t\\t\\t\\t</h2></div>\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"supplier_name\", \"print_hide\": 0, \"label\": \"Supplier Name\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"address_display\", \"print_hide\": 0, \"label\": \"Supplier Address\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"transaction_date\", \"print_hide\": 0, \"label\": \"Date\"}, {\"fieldname\": \"proposed_ready_date\", \"print_hide\": 0, \"label\": \"Proposed Ready Date\"}, {\"fieldname\": \"ready_date\", \"print_hide\": 0, \"label\": \"Ready Date\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Subcontracting\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"supplier_warehouse\", \"print_hide\": 0, \"label\": \"Supplier Warehouse\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"items\", \"print_hide\": 0, \"label\": \"Items\", \"visible_columns\": [{\"fieldname\": \"item_code\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"description\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"pack_size\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"product_label\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"qty\", \"print_width\": \"60px\", \"print_hide\": 0}, {\"fieldname\": \"rate\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"amount\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"batch_number\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"manufacturing_date\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"expiry_date\", \"print_width\": \"\", \"print_hide\": 0}]}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"<b>\\tTotal (USD)\\t:</b> {{ doc.get_formatted('total') }} \"}, {\"fieldtype\": \"Section Break\", \"label\": \"Payment Terms\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"payment_terms_template\", \"print_hide\": 0, \"align\": \"left\", \"label\": \"Payment Terms Template\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Terms and Conditions\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"terms\", \"print_hide\": 0, \"label\": \"Terms and Conditions\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Subscription Section\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"update_auto_repeat_reference\", \"print_hide\": 0, \"label\": \"Update Auto Repeat Reference\"}, {\"fieldtype\": \"Section Break\", \"label\": \"More Information\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"is_internal_supplier\", \"print_hide\": 0, \"label\": \"Is Internal Supplier\"}, {\"fieldname\": \"represents_company\", \"print_hide\": 0, \"label\": \"Represents Company\"}, {\"fieldname\": \"inter_company_order_reference\", \"print_hide\": 0, \"label\": \"Inter Company Order Reference\"}]",
"idx": 0,
"line_breaks": 1,
"modified": "2022-12-01 08:13:04.843477",
"modified_by": "Administrator",
"module": "Buying",
"name": "Unizone PO",
"owner": "Administrator",
"parent": "Purchase Order",
"print_format_builder": 1,
"print_format_type": "Jinja",
"raw_printing": 0,
"show_section_headings": 0,
"standard": "Yes"
"absolute_value": 0,
"align_labels_right": 0,
"creation": "2022-08-22 19:30:39.041461",
"css": "/* @page {*/\n/* margin: 0;*/\n/*}*/\n\n.print-format, .print-format-preview {font-size: 10; padding: 0.25in;}\n\n.print-display-flex {\n display: flex;\n justify-content: space-between;\n }\n\n.print-display-flex h2 div {font-size: 16px; font-weight: bold;}\n\n.print-company-info {text-align: left;}\n.print-company-info h3 {margin-top: 0; color: #0b6cb4;}\n.print-company-info p {\n color: #0b6cb4; \n font-size: 11px;\n margin-bottom: 5px;\n }",
"custom_format": 0,
"default_print_language": "",
"disabled": 0,
"doc_type": "Purchase Order",
"docstatus": 0,
"doctype": "Print Format",
"font": "Helvetica Neue",
"format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"<div class=\\\"print-heading print-display-flex\\\">\\n <div class=\\\"print-company-info\\\">\\n <img src=\\\"/files/h2k-2000-logo.png\\\" width=\\\"150\\\">\\n <p>\\n 30-70 East Beaver Creek Road, <br>\\n Richmond Hill, ON L4B 3B2\\n </p>\\n </div>\\t\\n <h2><div>Purchase Order</div><small class=\\\"sub-heading\\\">{{ doc.name }}</small>\\t\\t\\t\\t</h2></div>\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"supplier_name\", \"print_hide\": 0, \"label\": \"Supplier Name\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"address_display\", \"print_hide\": 0, \"label\": \"Supplier Address\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"transaction_date\", \"print_hide\": 0, \"label\": \"Date\"}, {\"fieldname\": \"proposed_ready_date\", \"print_hide\": 0, \"label\": \"Proposed Ready Date\"}, {\"fieldname\": \"ready_date\", \"print_hide\": 0, \"label\": \"Ready Date\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Subcontracting\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"supplier_warehouse\", \"print_hide\": 0, \"label\": \"Supplier Warehouse\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"items\", \"print_hide\": 0, \"label\": \"Items\", \"visible_columns\": [{\"fieldname\": \"item_code\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"description\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"pack_size\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"product_label\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"qty\", \"print_width\": \"60px\", \"print_hide\": 0}, {\"fieldname\": \"rate\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"amount\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"batch_number\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"manufacturing_date\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"expiry_date\", \"print_width\": \"\", \"print_hide\": 0}]}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"<b>\\tTotal (USD)\\t:</b> {{ doc.get_formatted('total') }} \"}, {\"fieldtype\": \"Section Break\", \"label\": \"Payment Terms\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"payment_terms_template\", \"print_hide\": 0, \"align\": \"left\", \"label\": \"Payment Terms Template\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Terms and Conditions\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"terms\", \"print_hide\": 0, \"label\": \"Terms and Conditions\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Subscription Section\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"update_auto_repeat_reference\", \"print_hide\": 0, \"label\": \"Update Auto Repeat Reference\"}, {\"fieldtype\": \"Section Break\", \"label\": \"More Information\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"is_internal_supplier\", \"print_hide\": 0, \"label\": \"Is Internal Supplier\"}, {\"fieldname\": \"represents_company\", \"print_hide\": 0, \"label\": \"Represents Company\"}, {\"fieldname\": \"inter_company_order_reference\", \"print_hide\": 0, \"label\": \"Inter Company Order Reference\"}]",
"idx": 0,
"line_breaks": 1,
"modified": "2023-08-24 02:46:36.770259",
"modified_by": "Administrator",
"module": "Buying",
"name": "Unizone PO",
"owner": "Administrator",
"parent": "Purchase Order",
"print_format_builder": 1,
"print_format_type": "Jinja",
"raw_printing": 0,
"show_section_headings": 0,
"standard": "Yes"
}
3 changes: 2 additions & 1 deletion erpnext/controllers/status_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def validate_status(status, options):
],
["Proposed Ready Date", "eval:self.status=='Proposed Ready Date' and self.per_received == 0"],
["Cancelled", "eval:self.docstatus==2"],
["Ready", "eval:self.status=='Ready'"],
["Ready and Short Close", "eval:self.status=='Ready and Short Close'"],
["Shipped and Short Close", "eval:self.status=='Shipped and Short Close'"],
["Shipped", "eval:self.po_status=='Shipped'"]
],
"Delivery Note": [
Expand Down
19 changes: 12 additions & 7 deletions erpnext/controllers/trends.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def get_data(filters, conditions):
"Purchase Invoice",
"Purchase Receipt",
"Delivery Note",
"Shipping Notice Instruction"
]:
posting_date = "t1.posting_date"
if filters.period_based_on:
Expand All @@ -84,6 +85,10 @@ def get_data(filters, conditions):
"Fiscal Year", filters.get("fiscal_year"), ["year_start_date", "year_end_date"]
)

if (conditions["trans"] == "Shipping Notice Instruction"):
item_table = "Shipping Note"
else:
item_table = conditions["trans"]
if filters.get("group_by"):
sel_col = ""
ind = conditions["columns"].index(conditions["grbc"][0])
Expand All @@ -108,7 +113,7 @@ def get_data(filters, conditions):
% (
query_details,
conditions["trans"],
conditions["trans"],
item_table,
conditions["addl_tables"],
"%s",
posting_date,
Expand Down Expand Up @@ -137,7 +142,7 @@ def get_data(filters, conditions):
% (
sel_col,
conditions["trans"],
conditions["trans"],
item_table,
conditions["addl_tables"],
"%s",
posting_date,
Expand Down Expand Up @@ -165,7 +170,7 @@ def get_data(filters, conditions):
sel_col,
conditions["period_wise_select"],
conditions["trans"],
conditions["trans"],
item_table,
conditions["addl_tables"],
"%s",
posting_date,
Expand Down Expand Up @@ -198,7 +203,7 @@ def get_data(filters, conditions):
% (
query_details,
conditions["trans"],
conditions["trans"],
item_table,
conditions["addl_tables"],
"%s",
posting_date,
Expand All @@ -224,7 +229,7 @@ def period_wise_columns_query(filters, trans):
pwc = []
bet_dates = get_period_date_ranges(filters.get("period"), filters.get("fiscal_year"))

if trans in ["Purchase Receipt", "Delivery Note", "Purchase Invoice", "Sales Invoice"]:
if trans in ["Purchase Receipt", "Delivery Note", "Shipping Notice Instruction","Purchase Invoice", "Sales Invoice"]:
trans_date = "posting_date"
if filters.period_based_on:
trans_date = filters.period_based_on
Expand Down Expand Up @@ -330,7 +335,7 @@ def based_wise_columns_query(based_on, trans):
"Customer:Link/Customer:120",
"Territory:Link/Territory:120",
]
based_on_details["based_on_select"] = "t1.customer_name, t1.territory, "
based_on_details["based_on_select"] = "t1.customer, t1.territory, "
based_on_details["based_on_group_by"] = (
"t1.party_name" if trans == "Quotation" else "t1.customer"
)
Expand Down Expand Up @@ -366,7 +371,7 @@ def based_wise_columns_query(based_on, trans):
based_on_details["addl_tables"] = ""

elif based_on == "Project":
if trans in ["Sales Invoice", "Delivery Note", "Sales Order"]:
if trans in ["Sales Invoice", "Delivery Note", "Shipping Notice Instruction", "Sales Order"]:
based_on_details["based_on_cols"] = ["Project:Link/Project:120"]
based_on_details["based_on_select"] = "t1.project,"
based_on_details["based_on_group_by"] = "t1.project"
Expand Down
9 changes: 8 additions & 1 deletion erpnext/selling/doctype/customer/customer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"account_manager",
"category",
"contact",
"disable_sdm",
"customer_group",
"territory",
"tax_id",
Expand Down Expand Up @@ -590,6 +591,12 @@
"options": "\nPrivate Sales\nGovt Sales"
},
{
"default": "0",
"fieldname": "disable_sdm",
"fieldtype": "Check",
"label": "Disable Sales Data Module?"
},
{
"fieldname": "category",
"fieldtype": "Link",
"in_list_view": 1,
Expand All @@ -610,7 +617,7 @@
"link_fieldname": "party"
}
],
"modified": "2024-07-08 07:49:09.527242",
"modified": "2023-10-06 08:29:35.547007",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def execute(filters=None):
if not filters:
filters = {}
data = []
conditions = get_columns(filters, "Sales Order")
conditions = get_columns(filters, "Customer Order")
data = get_data(filters, conditions)
chart_data = get_chart_data(data, conditions, filters)

Expand Down
Loading

0 comments on commit d5e2f27

Please sign in to comment.