Skip to content

Commit

Permalink
Merge pull request #293 from yrestom/version-13-hotfix
Browse files Browse the repository at this point in the history
Version 4.2.4
  • Loading branch information
yrestom committed Apr 6, 2023
2 parents 73d82bd + 7400a06 commit 84360d2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
6 changes: 5 additions & 1 deletion posawesome/posawesome/api/posapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,11 @@ def set_batch_nos_for_bundels(doc, warehouse_field, throw=False):
warehouse = d.get(warehouse_field, None)
if has_batch_no and warehouse and qty > 0:
if not d.batch_no:
d.batch_no = get_batch_no(
batch_no = get_batch_no(
d.item_code, warehouse, qty, throw, d.serial_no
)
if batch_no:
d.batch_no = batch_no.get("batch_no")
else:
batch_qty = get_batch_qty(batch_no=d.batch_no, warehouse=warehouse)
if flt(batch_qty, d.precision("qty")) < flt(qty, d.precision("qty")):
Expand Down Expand Up @@ -871,6 +873,8 @@ def create_customer(
customer.territory = territory
customer.save(ignore_permissions=True)
return customer
else:
frappe.throw(_("Customer already exists"))


@frappe.whitelist()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
import json
from frappe import _
from frappe.model.document import Document
from frappe.utils import getdate, get_datetime, flt
from collections import defaultdict
from erpnext.controllers.taxes_and_totals import get_itemised_tax_breakup_data
from frappe.utils import flt


class POSClosingShift(Document):
def validate(self):
user = frappe.get_all('POS Closing Shift',
filters={'user': self.user, 'docstatus': 1},
or_filters={
'period_start_date': ('between', [self.period_start_date, self.period_end_date]),
'period_end_date': ('between', [self.period_start_date, self.period_end_date])
})

if user:
other_profiles = frappe.get_all('POS Closing Shift',
filters={
'user': self.user,
'docstatus': 1,
"pos_opening_shift" :self.pos_opening_shift,
"name": ["!=", self.name]
}
)

if other_profiles:
frappe.throw(_("POS Closing Shift {} against {} between selected period"
.format(frappe.bold("already exists"), frappe.bold(self.user))), title=_("Invalid Period"))

Expand Down
6 changes: 6 additions & 0 deletions posawesome/public/js/posapp/components/pos/NewCustomer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ export default {
vm.birthday = '';
vm.group = '';
vm.customerDialog = false;
} else {
frappe.utils.play_sound('error');
evntBus.$emit('show_mesage', {
text: __('Customer creation failed.'),
color: 'error',
});
}
},
});
Expand Down

0 comments on commit 84360d2

Please sign in to comment.