some minor changes get fixed for PO/PI
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 680c6a0..90f463a 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -232,7 +232,6 @@
}
}
-//added by sambhaji
cur_frm.cscript.is_recurring = function(doc, dt, dn) {
@@ -267,7 +266,7 @@
}
}
-//end of added by sambhajii
+
cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
if(doc.select_print_heading){
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index ea3eb8a..e29d3d9 100755
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -800,6 +800,7 @@
},
{
"allow_on_submit": 1,
+ "depends_on": "eval:doc.is_recurring==1",
"description": "Select the period when the invoice will be generated automatically",
"fieldname": "recurring_type",
"fieldtype": "Select",
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 7d35f41..77c7ea9 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -265,11 +265,11 @@
self.update_against_document_in_jv()
self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
- convert_to_recurring(self, "RECINV.#####", self.posting_date)
+ convert_to_recurring(self, "RECPI.#####", self.posting_date)
def on_update_after_submit(self):
validate_recurring_document(self)
- convert_to_recurring(self, "RECINV.#####", self.posting_date)
+ convert_to_recurring(self, "RECPI.#####", self.posting_date)
def make_gl_entries(self):
auto_accounting_for_stock = \
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index 071d622..5495845 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -205,7 +205,7 @@
cur_frm.email_doc(frappe.boot.notification_settings.purchase_order_message);
}
}
-//added by sambhaji
+
cur_frm.cscript.is_recurring = function(doc, dt, dn) {
// set default values for recurring orders
@@ -238,7 +238,7 @@
}
}
-//end of added by sambhaji
+
cur_frm.cscript.send_sms = function() {
frappe.require("assets/erpnext/js/sms_manager.js");
var sms_man = new SMSManager(cur_frm.doc);
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index beebf0b..66083be 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -179,7 +179,7 @@
frappe.db.set(self,'status','Submitted')
- convert_to_recurring(self, "SO/REC/.#####", self.transaction_date)
+ convert_to_recurring(self, "SO/REP/.#####", self.transaction_date)
def on_cancel(self):
pc_obj = frappe.get_doc('Purchase Common')
@@ -204,9 +204,9 @@
def on_update(self):
pass
-def on_update_after_submit(self):
+ def on_update_after_submit(self):
validate_recurring_document(self)
- convert_to_recurring(self, "SO/REC/.#####", self.transaction_date)
+ convert_to_recurring(self, "SO/REP/.#####", self.transaction_date)
def set_missing_values(source, target):
target.ignore_pricing_rule = 1
diff --git a/erpnext/controllers/tests/test_recurring_document.py b/erpnext/controllers/tests/test_recurring_document.py
index 0e7cb1bc..1051082 100644
--- a/erpnext/controllers/tests/test_recurring_document.py
+++ b/erpnext/controllers/tests/test_recurring_document.py
@@ -41,6 +41,20 @@
date_field = "transaction_date"
elif base_doc.doctype == "Sales Invoice":
date_field = "posting_date"
+ #for Purchase order/purchase invoice
+ if base_doc.doctype == "Purchase Order":
+ base_doc.update({
+ "transaction_date": today
+ })
+ elif base_doc.doctype == "Purchase Invoice":
+ base_doc.update({
+ "posting_date": today
+ })
+
+ if base_doc.doctype == "Purchase Order":
+ date_field = "transaction_date"
+ elif base_doc.doctype == "Purchase Invoice":
+ date_field = "posting_date"
# monthly
doc1 = frappe.copy_doc(base_doc)