From 7b3dd3585b5f2371254a02fe2ae713a23bdc9871 Mon Sep 17 00:00:00 2001 From: Saqib Date: Tue, 27 Apr 2021 20:00:21 +0530 Subject: [PATCH 1/3] fix: unexpected keyword argument 'merge_logs' (#25489) * fix: unexpected keyword arguement 'merge_logs' * fix: reference error * fix: test --- .../pos_invoice_merge_log.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py index 6d2cffcf68..4d5472df4b 100644 --- a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py +++ b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py @@ -235,11 +235,11 @@ def get_invoice_customer_map(pos_invoices): return pos_invoice_customer_map -def consolidate_pos_invoices(pos_invoices=[], closing_entry={}): - invoices = pos_invoices or closing_entry.get('pos_transactions') or get_all_unconsolidated_invoices() +def consolidate_pos_invoices(pos_invoices=None, closing_entry=None): + invoices = pos_invoices or (closing_entry and closing_entry.get('pos_transactions')) or get_all_unconsolidated_invoices() invoice_by_customer = get_invoice_customer_map(invoices) - if len(invoices) >= 5 and closing_entry: + if len(invoices) >= 1 and closing_entry: closing_entry.set_status(update=True, status='Queued') enqueue_job(create_merge_logs, invoice_by_customer=invoice_by_customer, closing_entry=closing_entry) else: @@ -252,18 +252,18 @@ def unconsolidate_pos_invoices(closing_entry): pluck='name' ) - if len(merge_logs) >= 5: + if len(merge_logs) >= 1: closing_entry.set_status(update=True, status='Queued') enqueue_job(cancel_merge_logs, merge_logs=merge_logs, closing_entry=closing_entry) else: cancel_merge_logs(merge_logs, closing_entry) -def create_merge_logs(invoice_by_customer, closing_entry={}): +def create_merge_logs(invoice_by_customer, closing_entry=None): for customer, invoices in iteritems(invoice_by_customer): merge_log = frappe.new_doc('POS Invoice Merge Log') - merge_log.posting_date = getdate(closing_entry.get('posting_date')) + merge_log.posting_date = getdate(closing_entry.get('posting_date')) if closing_entry else nowdate() merge_log.customer = customer - merge_log.pos_closing_entry = closing_entry.get('name', None) + merge_log.pos_closing_entry = closing_entry.get('name') if closing_entry else None merge_log.set('pos_invoices', invoices) merge_log.save(ignore_permissions=True) @@ -273,7 +273,7 @@ def create_merge_logs(invoice_by_customer, closing_entry={}): closing_entry.set_status(update=True, status='Submitted') closing_entry.update_opening_entry() -def cancel_merge_logs(merge_logs, closing_entry={}): +def cancel_merge_logs(merge_logs, closing_entry=None): for log in merge_logs: merge_log = frappe.get_doc('POS Invoice Merge Log', log) merge_log.flags.ignore_permissions = True @@ -283,20 +283,20 @@ def cancel_merge_logs(merge_logs, closing_entry={}): closing_entry.set_status(update=True, status='Cancelled') closing_entry.update_opening_entry(for_cancel=True) -def enqueue_job(job, merge_logs=None, invoice_by_customer=None, closing_entry=None): +def enqueue_job(job, **kwargs): check_scheduler_status() + closing_entry = kwargs.get('closing_entry') or {} + job_name = closing_entry.get("name") if not job_already_enqueued(job_name): enqueue( job, + **kwargs, queue="long", timeout=10000, event="processing_merge_logs", job_name=job_name, - closing_entry=closing_entry, - invoice_by_customer=invoice_by_customer, - merge_logs=merge_logs, now=frappe.conf.developer_mode or frappe.flags.in_test ) From a86a51f0207cdd9480d84cbebea3abd93a60f435 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Fri, 23 Apr 2021 20:03:50 +0530 Subject: [PATCH 2/3] fix(HR): Permission error while adding weekly holidays (#25450) --- erpnext/hr/doctype/holiday_list/holiday_list.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.py b/erpnext/hr/doctype/holiday_list/holiday_list.py index 6df7bc88c0..67630a0abe 100644 --- a/erpnext/hr/doctype/holiday_list/holiday_list.py +++ b/erpnext/hr/doctype/holiday_list/holiday_list.py @@ -16,6 +16,7 @@ class HolidayList(Document): self.validate_days() self.total_holidays = len(self.holidays) + @frappe.whitelist() def get_weekly_off_dates(self): self.validate_values() date_list = self.get_weekly_off_date_list(self.from_date, self.to_date) From 3e5c6424ed4f15c16be0f909f0cf110879fa50d5 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 27 Apr 2021 20:28:01 +0550 Subject: [PATCH 3/3] bumped to version 13.1.1 --- erpnext/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/__init__.py b/erpnext/__init__.py index 4da0605370..ea83d08bf2 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '13.1.0' +__version__ = '13.1.1' def get_default_company(user=None): '''Get default company for user'''