-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(unicommerce): Sales Invoice creation through picklist (#240)
* feat:added shelf wise inventory sync and funtionality to generate invoice through pick list * feat:added shelf wise inventory sync and funtionality to generate invoicethrough picklist * fix:whitespace * fix:error log in inventory sync * fix:error log in inventory sync * fix:error log in inventory sync * feat:remove whitelist and clean the code * feat:add custom fields in unicommerce settings * fix:inventory sync * fix:fieldtype * fix:set workflow state on submit the sales invoice * fix:error in query * fix:whitespace * fix:format of msg * fix:pre-commit * fix:validations on pick_list and sales_invoice --------- Co-authored-by: sonali8848 <[email protected]>
- Loading branch information
1 parent
3cf612b
commit 8410c59
Showing
13 changed files
with
359 additions
and
34 deletions.
There are no files selected for viewing
Empty file.
70 changes: 70 additions & 0 deletions
70
...rce_integrations/doctype/pick_list_sales_order_details/pick_list_sales_order_details.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
9 changes: 9 additions & 0 deletions
9
...merce_integrations/doctype/pick_list_sales_order_details/pick_list_sales_order_details.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.", | ||
}); | ||
|
||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
70 changes: 70 additions & 0 deletions
70
...ions/unicommerce/doctype/pick_list_sales_order_details/pick_list_sales_order_details.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
9 changes: 9 additions & 0 deletions
9
...ations/unicommerce/doctype/pick_list_sales_order_details/pick_list_sales_order_details.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.