Skip to content

Commit

Permalink
Merge branch 'develop' into dev-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush committed Jun 5, 2023
2 parents 13928e9 + fa461c8 commit b3bf98d
Show file tree
Hide file tree
Showing 14 changed files with 369 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"actions": [],
"creation": "2023-04-19 11:57:15.149202",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"sales_order",
"sales_invoice",
"posting_date",
"pick_status",
"invoice_url",
"invoice_pdf"
],
"fields": [
{
"fieldname": "sales_order",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Sales Order",
"options": "Sales Order"
},
{
"fieldname": "sales_invoice",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Sales Invoice",
"options": "Sales Invoice"
},
{
"fetch_from": "sales_invoice.posting_date",
"fieldname": "posting_date",
"fieldtype": "Date",
"label": "Posting Date"
},
{
"fieldname": "pick_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Pick Status",
"options": "\nPartially Picked\nFully Picked"
},
{
"fieldname": "invoice_url",
"fieldtype": "Data",
"hidden": 1,
"label": "Invoice URL"
},
{
"fieldname": "invoice_pdf",
"fieldtype": "Attach",
"in_list_view": 1,
"label": "Invoice Pdf"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-04-20 10:58:07.144994",
"modified_by": "Administrator",
"module": "Ecommerce Integrations",
"name": "Pick List Sales Order Details",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class PickListSalesOrderDetails(Document):
pass
6 changes: 6 additions & 0 deletions ecommerce_integrations/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"Sales Invoice": "public/js/unicommerce/sales_invoice.js",
"Item": "public/js/unicommerce/item.js",
"Stock Entry": "public/js/unicommerce/stock_entry.js",
"Pick List": "public/js/unicommerce/pick_list.js",
}
# doctype_list_js = {"doctype" : "public/js/doctype_list.js"}
# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
Expand Down Expand Up @@ -114,6 +115,11 @@
"on_cancel": "ecommerce_integrations.unicommerce.grn.prevent_grn_cancel",
},
"Item Price": {"on_change": "ecommerce_integrations.utils.price_list.discard_item_prices"},
"Pick List": {"validate": "ecommerce_integrations.unicommerce.pick_list.validate"},
"Sales Invoice": {
"on_submit": "ecommerce_integrations.unicommerce.invoice.on_submit",
"on_cancel": "ecommerce_integrations.unicommerce.invoice.on_cancel",
},
}

# Scheduled Tasks
Expand Down
47 changes: 47 additions & 0 deletions ecommerce_integrations/public/js/unicommerce/pick_list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
frappe.ui.form.on('Pick List', {
refresh(frm){
if (frm.doc.order_details){
frm.add_custom_button(__('Generate Invoice'), () => frm.trigger('generate_invoice'))
}
},
generate_invoice(frm){
let selected_so = []
var tbl = frm.doc.order_details || [];
for(var i = 0; i < tbl.length; i++) {
selected_so.push(tbl[i].sales_order)
}
let sales_orders = [];
let so_item_list = [];
const warehouse_allocation = {};
selected_so.forEach(function(so) {
const item_details = frm.doc.locations.map((item) => {
if (item.sales_order == so && item.picked_qty > 0){
so_item_list.push({so_item:item.sales_order_item,
qty:item.qty
});
return {
sales_order_row: item.sales_order_item,
item_code: item.item_code,
warehouse: item.warehouse,
shelf:item.shelf
}
}
else{
return {}
}
});
sales_orders.push(so);
warehouse_allocation[so] = item_details.filter(value => Object.keys(value).length !== 0);
});
frappe.call({
method: 'ecommerce_integrations.unicommerce.invoice.generate_unicommerce_invoices',
args: {
'sales_orders': sales_orders,
'warehouse_allocation': warehouse_allocation
},
freeze: true,
freeze_message: "Requesting Invoice generation. Once synced, invoice will appear in linked documents.",
});

},
})
4 changes: 3 additions & 1 deletion ecommerce_integrations/unicommerce/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
SHIPPING_PACKAGE_STATUS_FIELD = "unicommerce_shipping_package_status"
IS_COD_CHECKBOX = "unicommerce_is_cod"
SHIPPING_METHOD_FIELD = "unicommerce_shipping_method"
SHIPPIND_ID = "unicommerce_shipment_id"
UNICOMMERCE_SHIPPING_ID = "unicommerce_shipment_id"
PICKLIST_ORDER_DETAILS_FIELD = "order_details"

GRN_STOCK_ENTRY_TYPE = "GRN on Unicommerce"


Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"actions": [],
"creation": "2023-04-19 11:57:15.149202",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"sales_order",
"sales_invoice",
"posting_date",
"pick_status",
"invoice_url",
"invoice_pdf"
],
"fields": [
{
"fieldname": "sales_order",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Sales Order",
"options": "Sales Order"
},
{
"fieldname": "sales_invoice",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Sales Invoice",
"options": "Sales Invoice"
},
{
"fetch_from": "sales_invoice.posting_date",
"fieldname": "posting_date",
"fieldtype": "Date",
"label": "Posting Date"
},
{
"fieldname": "pick_status",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Pick Status",
"options": "\nPartially Picked\nFully Picked"
},
{
"fieldname": "invoice_url",
"fieldtype": "Data",
"hidden": 1,
"label": "Invoice URL"
},
{
"fieldname": "invoice_pdf",
"fieldtype": "Attach",
"in_list_view": 1,
"label": "Invoice Pdf"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-05-02 19:52:50.157639",
"modified_by": "Administrator",
"module": "unicommerce",
"name": "Pick List Sales Order Details",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023, Frappe and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class PickListSalesOrderDetails(Document):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@
ORDER_ITEM_CODE_FIELD,
ORDER_STATUS_FIELD,
PACKAGE_TYPE_FIELD,
PICKLIST_ORDER_DETAILS_FIELD,
PRODUCT_CATEGORY_FIELD,
RETURN_CODE_FIELD,
SHIPPIND_ID,
SHIPPING_METHOD_FIELD,
SHIPPING_PACKAGE_CODE_FIELD,
SHIPPING_PACKAGE_STATUS_FIELD,
SHIPPING_PROVIDER_CODE,
TRACKING_CODE_FIELD,
UNICOMMERCE_SHIPPING_ID,
)
from ecommerce_integrations.unicommerce.utils import create_unicommerce_log

Expand Down Expand Up @@ -80,6 +81,7 @@ def renew_tokens(self, save=True):
raise e
if save:
self.flags.ignore_custom_fields = True
self.flags.ignore_permissions = True
self.save()
frappe.db.commit()
self.load_from_db()
Expand Down Expand Up @@ -446,13 +448,21 @@ def setup_custom_fields(update=True):
read_only=1,
),
dict(
fieldname=SHIPPIND_ID,
fieldname=UNICOMMERCE_SHIPPING_ID,
label="Unicommerce Shipment Id",
fieldtype="Data",
insert_after=ORDER_CODE_FIELD,
read_only=1,
),
],
"Pick List": [
dict(
fieldname=PICKLIST_ORDER_DETAILS_FIELD,
label="Order Details",
fieldtype="Table",
options="Pick List Sales Order Details",
),
],
}

# create sections first for proper ordering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-11-19 16:39:01.415522",
"modified": "2023-05-12 14:06:13.182121",
"modified_by": "Administrator",
"module": "unicommerce",
"name": "Unicommerce Warehouses",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
Loading

0 comments on commit b3bf98d

Please sign in to comment.