Merge pull request #19815 from Mangesh-Khairnar/publish-item
feat(marketplace): allow user to un-publish item
diff --git a/erpnext/accounts/doctype/subscription/subscription.py b/erpnext/accounts/doctype/subscription/subscription.py
index f13ca4c..5482750 100644
--- a/erpnext/accounts/doctype/subscription/subscription.py
+++ b/erpnext/accounts/doctype/subscription/subscription.py
@@ -338,6 +338,16 @@
# Check invoice dates and make sure it doesn't have outstanding invoices
return getdate(nowdate()) >= getdate(self.current_invoice_start) and not self.has_outstanding_invoice()
+
+ def is_current_invoice_paid(self):
+ if self.is_new_subscription():
+ return False
+
+ last_invoice = frappe.get_doc('Sales Invoice', self.invoices[-1].invoice)
+ if getdate(last_invoice.posting_date) == getdate(self.current_invoice_start) and last_invoice.status == 'Paid':
+ return True
+
+ return False
def process_for_active(self):
"""
@@ -348,7 +358,7 @@
2. Change the `Subscription` status to 'Past Due Date'
3. Change the `Subscription` status to 'Cancelled'
"""
- if self.is_postpaid_to_invoice() or self.is_prepaid_to_invoice():
+ if not self.is_current_invoice_paid() and (self.is_postpaid_to_invoice() or self.is_prepaid_to_invoice()):
self.generate_invoice()
if self.current_invoice_is_past_due():
self.status = 'Past Due Date'
diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py
index e24d7b8..03e26b2 100644
--- a/erpnext/config/stock.py
+++ b/erpnext/config/stock.py
@@ -336,6 +336,18 @@
"is_query_report": True,
"name": "Item Variant Details",
"doctype": "Item"
+ },
+ {
+ "type": "report",
+ "is_query_report": True,
+ "name": "Subcontracted Raw Materials To Be Transferred",
+ "doctype": "Purchase Order"
+ },
+ {
+ "type": "report",
+ "is_query_report": True,
+ "name": "Subcontracted Item To Be Received",
+ "doctype": "Purchase Order"
}
]
},
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.js b/erpnext/manufacturing/doctype/work_order/work_order.js
index 176ca2e..80bd89d 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.js
+++ b/erpnext/manufacturing/doctype/work_order/work_order.js
@@ -77,8 +77,7 @@
return {
query: "erpnext.controllers.queries.item_query",
filters:[
- ['is_stock_item', '=',1],
- ['default_bom', '!=', '']
+ ['is_stock_item', '=',1]
]
};
});
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index f4a371c..757e414 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -586,6 +586,7 @@
erpnext.patches.v11_1.setup_guardian_role
execute:frappe.delete_doc('DocType', 'Notification Control')
erpnext.patches.v12_0.set_gst_category
+erpnext.patches.v12_0.update_gst_category
erpnext.patches.v11_0.remove_barcodes_field_from_copy_fields_to_variants
erpnext.patches.v12_0.set_task_status
erpnext.patches.v11_0.make_italian_localization_fields # 26-03-2019
diff --git a/erpnext/patches/v12_0/set_employee_preferred_emails.py b/erpnext/patches/v12_0/set_employee_preferred_emails.py
index 2763561..f6eb12e 100644
--- a/erpnext/patches/v12_0/set_employee_preferred_emails.py
+++ b/erpnext/patches/v12_0/set_employee_preferred_emails.py
@@ -7,10 +7,10 @@
fields=["name", "prefered_contact_email", "company_email", "personal_email", "user_id"])
for employee in employees:
- preferred_email_field = frappe.scrub(employee.prefered_contact_email)
-
- if not preferred_email_field:
+ if not employee.prefered_contact_email:
continue
+ preferred_email_field = frappe.scrub(employee.prefered_contact_email)
+
preferred_email = employee.get(preferred_email_field)
frappe.db.set_value("Employee", employee.name, "prefered_email", preferred_email, update_modified=False)
diff --git a/erpnext/patches/v12_0/update_gst_category.py b/erpnext/patches/v12_0/update_gst_category.py
new file mode 100644
index 0000000..963edad
--- /dev/null
+++ b/erpnext/patches/v12_0/update_gst_category.py
@@ -0,0 +1,19 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+
+ company = frappe.get_all('Company', filters = {'country': 'India'})
+ if not company:
+ return
+
+ frappe.db.sql(""" UPDATE `tabSales Invoice` set gst_category = 'Unregistered'
+ where gst_category = 'Registered Regular'
+ and ifnull(customer_gstin, '')=''
+ and ifnull(billing_address_gstin,'')=''
+ """)
+
+ frappe.db.sql(""" UPDATE `tabPurchase Invoice` set gst_category = 'Unregistered'
+ where gst_category = 'Registered Regular'
+ and ifnull(supplier_gstin, '')=''
+ """)
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 151be11..a1f06b2 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -551,7 +551,7 @@
"""select parent from `tabItem Barcode` where barcode = %s and parent != %s""", (item_barcode.barcode, self.name))
if duplicate:
frappe.throw(_("Barcode {0} already used in Item {1}").format(
- item_barcode.barcode, duplicate[0][0]), frappe.DuplicateEntryError)
+ item_barcode.barcode, duplicate[0][0]))
item_barcode.barcode_type = "" if item_barcode.barcode_type not in options else item_barcode.barcode_type
if item_barcode.barcode_type and item_barcode.barcode_type.upper() in ('EAN', 'UPC-A', 'EAN-13', 'EAN-8'):
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 79ce231..38e1bc4 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -922,8 +922,6 @@
this.frm.toggle_enable("from_warehouse", doc.purpose!='Material Receipt');
this.frm.toggle_enable("to_warehouse", doc.purpose!='Material Issue');
- this.frm.fields_dict["items"].grid.set_column_disp("s_warehouse", doc.purpose!='Material Receipt');
- this.frm.fields_dict["items"].grid.set_column_disp("t_warehouse", doc.purpose!='Material Issue');
this.frm.fields_dict["items"].grid.set_column_disp("retain_sample", doc.purpose=='Material Receipt');
this.frm.fields_dict["items"].grid.set_column_disp("sample_quantity", doc.purpose=='Material Receipt');