Skip to content

Commit

Permalink
fix:format of msg
Browse files Browse the repository at this point in the history
  • Loading branch information
sonali8848 committed May 10, 2023
1 parent 84f6515 commit 19e8fb5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
4 changes: 2 additions & 2 deletions ecommerce_integrations/public/js/unicommerce/pick_list.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
frappe.ui.form.on('Pick List', {
refresh(frm){
if (frm.doc.order_details){
cur_frm.add_custom_button(__('Generate Invoice'), () => frm.trigger('generate_invoice'))
frm.add_custom_button(__('Generate Invoice'), () => frm.trigger('generate_invoice'))
}
},
generate_invoice(frm){
let selected_so = []
var tbl = cur_frm.doc.order_details || [];
var tbl = frm.doc.order_details || [];
for(var i = 0; i < tbl.length; i++) {
selected_so.push(tbl[i].sales_order)
}
Expand Down
9 changes: 3 additions & 6 deletions ecommerce_integrations/unicommerce/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,12 +606,8 @@ def on_submit(self, method=None):
)
else:
frappe.db.set_value("Pick List Sales Order Details", pl.name, {"sales_invoice": self.name})
is_invoice_generated = frappe.db.sql(
f"select name from `tabPick List Sales Order Details` where parent = '{pl.parent}' and"
" sales_invoice is null"
)
if not is_invoice_generated:
frappe.db.set_value("Pick List", pl.parent, "workflow_state", "Invoice Generated")




def on_cancel(self, method=None):
Expand All @@ -620,3 +616,4 @@ def on_cancel(self, method=None):
)
if results:
self.flags.ignore_links = True

20 changes: 8 additions & 12 deletions ecommerce_integrations/unicommerce/pick_list.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
import json

import frappe

from frappe import _

def validate(self, method=None):
if self.get("locations"):
for pl in self.get("locations"):
if pl.picked_qty and float(pl.picked_qty) > 0:
if pl.picked_qty > pl.qty:
pl.picked_qty = pl.qty
frappe.throw("Row " + str(pl.idx) + ": Picked Qty cannot be more than Sales Order Qty")
if pl.picked_qty == 0 and self.docstatus == 1:
frappe.throw(
"You have not picked "
+ pl.item_code
+ " in row "
+ str(pl.idx)
+ ". Pick the item to proceed!"
)

frappe.throw(_("Row {0} Picked Qty cannot be more than Sales Order Qty").format(pl.idx))
if pl.picked_qty == 0 and pl.docstatus == 1:
frappe.throw(_("You have not picked {0} in row {1} . Pick the item to proceed!").format(pl.item_code,pl.idx))
item_so_list = [d.sales_order for d in self.get("locations")]
unique_so_list = []
for i in item_so_list:
if i not in unique_so_list:
unique_so_list.append(i)
if len(unique_so_list) > 30:
frappe.throw("Cannot add more than 30 Sales Orders!")
so_list = [d.sales_order for d in self.get("order_details")]
for so in unique_so_list:
if so not in so_list:
Expand Down Expand Up @@ -52,3 +45,6 @@ def validate(self, method=None):
for x in self.get("order_details"):
if x.sales_order == so:
x.pick_status = "Partially Picked"



0 comments on commit 19e8fb5

Please sign in to comment.