Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7105c4b76c | ||
|
|
54c725dcd1 | ||
|
|
1e2c554e61 | ||
|
|
65dfd09947 | ||
|
|
0cc93538ed | ||
|
|
c83e793ce8 | ||
|
|
4d68e03a97 | ||
|
|
eaec4695f7 | ||
|
|
5049edb494 | ||
|
|
d17bea0a31 | ||
|
|
f6580268e6 | ||
|
|
e3a468ed1b | ||
|
|
9e6f2a49e8 | ||
|
|
445e8a2e57 | ||
|
|
c26e3f1569 | ||
|
|
c4e52e5f95 | ||
|
|
d977333a99 | ||
|
|
3a2834c7ad | ||
|
|
88491715e0 | ||
|
|
00a48ad4e5 | ||
|
|
def308a433 | ||
|
|
9b98d7fa14 | ||
|
|
cb48404bd2 | ||
|
|
5b58e489a8 | ||
|
|
b9fe14631d |
@@ -4,7 +4,7 @@ import inspect
|
||||
import frappe
|
||||
from erpnext.hooks import regional_overrides
|
||||
|
||||
__version__ = '9.0.4'
|
||||
__version__ = '9.0.9'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
|
||||
@@ -417,6 +417,7 @@ def make_contact(args,customer):
|
||||
'link_doctype': 'Customer',
|
||||
'link_name': customer
|
||||
})
|
||||
doc.flags.ignore_mandatory = True
|
||||
doc.save(ignore_permissions=True)
|
||||
|
||||
def make_address(args, customer):
|
||||
@@ -441,6 +442,7 @@ def make_address(args, customer):
|
||||
address.is_primary_address = 1
|
||||
address.is_shipping_address = 1
|
||||
address.update(args)
|
||||
address.flags.ignore_mandatory = True
|
||||
address.save(ignore_permissions = True)
|
||||
|
||||
def make_email_queue(email_queue):
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
|
||||
frappe.ui.form.on('Subscription', {
|
||||
setup: function(frm) {
|
||||
frm.fields_dict['reference_doctype'].get_query = function(doc) {
|
||||
return {
|
||||
query: "erpnext.accounts.doctype.subscription.subscription.subscription_doctype_query"
|
||||
};
|
||||
};
|
||||
|
||||
frm.fields_dict['reference_document'].get_query = function() {
|
||||
return {
|
||||
filters: {
|
||||
|
||||
@@ -135,66 +135,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "disabled",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Disabled",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "submit_on_creation",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Submit on Creation",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -286,12 +226,12 @@
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "next_schedule_date",
|
||||
"fieldtype": "Date",
|
||||
"fieldname": "submit_on_creation",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
@@ -299,14 +239,44 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Next Schedule Date",
|
||||
"label": "Submit on Creation",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "disabled",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Disabled",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -320,7 +290,7 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "frequency_detail",
|
||||
"fieldname": "section_break_10",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
@@ -329,7 +299,95 @@
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "from_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "From Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "to_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "To Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_13",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
@@ -375,35 +433,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_12",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
@@ -435,6 +464,36 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "next_schedule_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Next Schedule Date",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
@@ -690,7 +749,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-09-14 12:09:38.471458",
|
||||
"modified": "2017-10-03 17:20:26.919630",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Subscription",
|
||||
@@ -700,7 +759,7 @@
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
@@ -720,7 +779,7 @@
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
@@ -740,7 +799,7 @@
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
|
||||
@@ -9,7 +9,7 @@ from frappe import _
|
||||
from frappe.desk.form import assign_to
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from frappe.utils.user import get_system_managers
|
||||
from frappe.utils import cstr, getdate, split_emails, add_days, today
|
||||
from frappe.utils import cstr, getdate, split_emails, add_days, today, get_last_day, get_first_day
|
||||
from frappe.model.document import Document
|
||||
|
||||
month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
|
||||
@@ -24,12 +24,23 @@ class Subscription(Document):
|
||||
self.set_next_schedule_date()
|
||||
|
||||
def on_submit(self):
|
||||
self.update_subscription_id()
|
||||
# self.update_subscription_id()
|
||||
self.update_subscription_data()
|
||||
|
||||
def on_update_after_submit(self):
|
||||
self.update_subscription_data()
|
||||
self.validate_dates()
|
||||
self.set_next_schedule_date()
|
||||
|
||||
def before_cancel(self):
|
||||
self.unlink_subscription_id()
|
||||
|
||||
def unlink_subscription_id(self):
|
||||
doc = frappe.get_doc(self.reference_doctype, self.reference_document)
|
||||
if doc.meta.get_field('subscription'):
|
||||
doc.subscription = None
|
||||
doc.db_update()
|
||||
|
||||
def validate_dates(self):
|
||||
if self.end_date and getdate(self.start_date) > getdate(self.end_date):
|
||||
frappe.throw(_("End date must be greater than start date"))
|
||||
@@ -64,6 +75,21 @@ class Subscription(Document):
|
||||
self.next_schedule_date = get_next_schedule_date(self.start_date,
|
||||
self.frequency, self.repeat_on_day)
|
||||
|
||||
def update_subscription_data(self):
|
||||
update_doc = False
|
||||
doc = frappe.get_doc(self.reference_doctype, self.reference_document)
|
||||
if frappe.get_meta(self.reference_doctype).get_field("from_date"):
|
||||
doc.from_date = self.from_date
|
||||
doc.to_date = self.to_date
|
||||
update_doc = True
|
||||
|
||||
if not doc.subscription:
|
||||
doc.subscription = self.name
|
||||
update_doc = True
|
||||
|
||||
if update_doc:
|
||||
doc.db_update()
|
||||
|
||||
def update_subscription_id(self):
|
||||
doc = frappe.get_doc(self.reference_doctype, self.reference_document)
|
||||
if not doc.meta.get_field('subscription'):
|
||||
@@ -112,6 +138,9 @@ def get_subscription_entries(date):
|
||||
def create_documents(data, schedule_date):
|
||||
try:
|
||||
doc = make_new_document(data, schedule_date)
|
||||
if doc.from_date:
|
||||
update_subscription_period(data, doc)
|
||||
|
||||
if data.notify_by_email and data.recipients:
|
||||
print_format = data.print_format or "Standard"
|
||||
send_notification(doc, print_format, data.recipients)
|
||||
@@ -126,6 +155,13 @@ def create_documents(data, schedule_date):
|
||||
if data.reference_document and not frappe.flags.in_test:
|
||||
notify_error_to_user(data)
|
||||
|
||||
def update_subscription_period(data, doc):
|
||||
from_date = doc.from_date
|
||||
to_date = doc.to_date
|
||||
|
||||
frappe.db.set_value('Subscription', data.name, 'from_date', from_date)
|
||||
frappe.db.set_value('Subscription', data.name, 'to_date', to_date)
|
||||
|
||||
def disabled_subscription(data):
|
||||
subscription = frappe.get_doc('Subscription', data.name)
|
||||
subscription.db_set('disabled', 1)
|
||||
@@ -160,9 +196,24 @@ def update_doc(new_document, reference_doc, args, schedule_date):
|
||||
if new_document.meta.get_field('set_posting_time'):
|
||||
new_document.set('set_posting_time', 1)
|
||||
|
||||
mcount = month_map.get(args.frequency)
|
||||
|
||||
if new_document.meta.get_field('subscription'):
|
||||
new_document.set('subscription', args.name)
|
||||
|
||||
if args.from_date and args.to_date:
|
||||
from_date = get_next_date(args.from_date, mcount)
|
||||
|
||||
if (cstr(get_first_day(args.from_date)) == cstr(args.from_date)) and \
|
||||
(cstr(get_last_day(args.to_date)) == cstr(args.to_date)):
|
||||
to_date = get_last_day(get_next_date(args.to_date, mcount))
|
||||
else:
|
||||
to_date = get_next_date(args.to_date, mcount)
|
||||
|
||||
if new_document.meta.get_field('from_date'):
|
||||
new_document.set('from_date', from_date)
|
||||
new_document.set('to_date', to_date)
|
||||
|
||||
new_document.run_method("on_recurring", reference_doc=reference_doc, subscription_doc=args)
|
||||
for data in new_document.meta.fields:
|
||||
if data.fieldtype == 'Date' and data.reqd:
|
||||
@@ -225,4 +276,20 @@ def stop_resume_subscription(subscription, status):
|
||||
doc.update_status(status)
|
||||
doc.save()
|
||||
|
||||
return doc.status
|
||||
return doc.status
|
||||
|
||||
def subscription_doctype_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
return frappe.db.sql("""select parent from `tabDocField`
|
||||
where fieldname = 'subscription'
|
||||
and parent like %(txt)s
|
||||
order by
|
||||
if(locate(%(_txt)s, parent), locate(%(_txt)s, parent), 99999),
|
||||
parent
|
||||
limit %(start)s, %(page_len)s""".format(**{
|
||||
'key': searchfield,
|
||||
}), {
|
||||
'txt': "%%%s%%" % txt,
|
||||
'_txt': txt.replace("%", ""),
|
||||
'start': start,
|
||||
'page_len': page_len
|
||||
})
|
||||
@@ -113,6 +113,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
});
|
||||
|
||||
this.page.add_menu_item(__("Sync Offline Invoices"), function () {
|
||||
me.freeze_screen = true;
|
||||
me.sync_sales_invoice()
|
||||
});
|
||||
|
||||
@@ -1684,6 +1685,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
set_interval_for_si_sync: function () {
|
||||
var me = this;
|
||||
setInterval(function () {
|
||||
me.freeze_screen = false;
|
||||
me.sync_sales_invoice()
|
||||
}, 60000)
|
||||
},
|
||||
@@ -1697,9 +1699,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
this.freeze = this.customer_doc.display
|
||||
}
|
||||
|
||||
freeze_screen = this.freeze_screen || false;
|
||||
|
||||
if ((this.si_docs.length || this.email_queue_list || this.customers_list) && !this.freeze) {
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.sales_invoice.pos.make_invoice",
|
||||
freeze: freeze_screen,
|
||||
args: {
|
||||
doc_list: me.si_docs,
|
||||
email_queue_list: me.email_queue_list,
|
||||
|
||||
@@ -21,7 +21,7 @@ class JobOpening(WebsiteGenerator):
|
||||
self.route = frappe.scrub(self.job_title).replace('_', '-')
|
||||
|
||||
def get_context(self, context):
|
||||
context.parents = [{'name': 'jobs', 'title': _('All Jobs') }]
|
||||
context.parents = [{'route': 'jobs', 'title': _('All Jobs') }]
|
||||
|
||||
def get_list_context(context):
|
||||
context.title = _("Jobs")
|
||||
|
||||
@@ -284,7 +284,7 @@ class ProcessPayroll(Document):
|
||||
})
|
||||
|
||||
# Deductions
|
||||
for acc, amt in deductions.items():
|
||||
for acc, amount in deductions.items():
|
||||
payable_amount -= flt(amount, precision)
|
||||
accounts.append({
|
||||
"account": acc,
|
||||
|
||||
@@ -370,8 +370,13 @@ class ProductionOrder(Document):
|
||||
self.actual_start_date = None
|
||||
self.actual_end_date = None
|
||||
if self.get("operations"):
|
||||
self.actual_start_date = min([d.actual_start_time for d in self.get("operations") if d.actual_start_time])
|
||||
self.actual_end_date = max([d.actual_end_time for d in self.get("operations") if d.actual_end_time])
|
||||
actual_start_dates = [d.actual_start_time for d in self.get("operations") if d.actual_start_time]
|
||||
if actual_start_dates:
|
||||
self.actual_start_date = min(actual_start_dates)
|
||||
|
||||
actual_end_dates = [d.actual_end_time for d in self.get("operations") if d.actual_end_time]
|
||||
if actual_end_dates:
|
||||
self.actual_end_date = max(actual_end_dates)
|
||||
|
||||
def delete_timesheet(self):
|
||||
for timesheet in frappe.get_all("Timesheet", ["name"], {"production_order": self.name}):
|
||||
@@ -621,4 +626,4 @@ def stop_unstop(production_order, status):
|
||||
frappe.msgprint(_("Production Order has been {0}").format(status))
|
||||
pro_order.notify_update()
|
||||
|
||||
return pro_order.status
|
||||
return pro_order.status
|
||||
|
||||
@@ -445,4 +445,5 @@ erpnext.patches.v8_9.set_print_zero_amount_taxes
|
||||
erpnext.patches.v8_9.set_default_customer_group
|
||||
erpnext.patches.v8_9.remove_employee_from_salary_structure_parent
|
||||
erpnext.patches.v8_9.delete_gst_doctypes_for_outside_india_accounts
|
||||
erpnext.patches.v8_9.update_billing_gstin_for_indian_account
|
||||
erpnext.patches.v8_9.update_billing_gstin_for_indian_account
|
||||
erpnext.patches.v9_0.fix_subscription_next_date
|
||||
27
erpnext/patches/v9_0/fix_subscription_next_date.py
Normal file
27
erpnext/patches/v9_0/fix_subscription_next_date.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doctype('Subscription')
|
||||
|
||||
doctypes = ('Purchase Order', 'Sales Order', 'Purchase Invoice', 'Sales Invoice')
|
||||
for data in frappe.get_all('Subscription', fields = ["name", "reference_doctype", "reference_document"],
|
||||
filters = {'reference_doctype': ('in', doctypes)}):
|
||||
doc = frappe.get_doc('Subscription', data.name)
|
||||
fields = ['transaction_date']
|
||||
if doc.reference_doctype in ['Sales Invoice', 'Purchase Invoice']:
|
||||
fields = ['posting_date']
|
||||
|
||||
fields.extend(['from_date', 'to_date'])
|
||||
reference_data = frappe.db.get_value(data.reference_doctype,
|
||||
data.reference_document, fields, as_dict=1)
|
||||
|
||||
if reference_data:
|
||||
doc.start_date = reference_data.get('posting_date') or reference_data.get('transaction_date')
|
||||
doc.from_date = reference_data.get('from_date')
|
||||
doc.to_date = reference_data.get('to_date')
|
||||
doc.set_next_schedule_date()
|
||||
doc.db_update()
|
||||
@@ -96,7 +96,17 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
|
||||
if(this.show_dialog) {
|
||||
let d = this.item;
|
||||
this.dialog.set_value('serial_no', d.serial_no);
|
||||
if (d.has_serial_no && d.serial_no) {
|
||||
this.dialog.set_value('serial_no', d.serial_no);
|
||||
} else if (d.batch_no) {
|
||||
this.dialog.fields_dict.batches.df.data.push({
|
||||
'batch_no': d.batch_no,
|
||||
'actual_qty': d.actual_qty,
|
||||
'selected_qty': d.qty
|
||||
});
|
||||
|
||||
this.dialog.fields_dict.batches.grid.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
this.dialog.show();
|
||||
@@ -116,8 +126,10 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
}
|
||||
values.batches.map((batch, i) => {
|
||||
if(!batch.selected_qty || batch.selected_qty === 0 ) {
|
||||
frappe.throw(__("Please select quantity on row " + (i+1)));
|
||||
return false;
|
||||
if (!this.show_dialog) {
|
||||
frappe.throw(__("Please select quantity on row " + (i+1)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
@@ -125,9 +137,11 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
||||
} else {
|
||||
let serial_nos = values.serial_no || '';
|
||||
if (!serial_nos || !serial_nos.replace(/\s/g, '').length) {
|
||||
frappe.throw(__("Please enter serial numbers for serialized item "
|
||||
+ values.item_code));
|
||||
return false;
|
||||
if (!this.show_dialog) {
|
||||
frappe.throw(__("Please enter serial numbers for serialized item "
|
||||
+ values.item_code));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -84,34 +84,13 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-31 14:38:52.220743",
|
||||
"modified_by": "ewdszx@ed.ews",
|
||||
"modified": "2017-09-29 14:38:52.220743",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Regional",
|
||||
"name": "GST HSN Code",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
|
||||
@@ -83,34 +83,13 @@
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-08-31 14:39:15.625952",
|
||||
"modified_by": "ewdszx@ed.ews",
|
||||
"modified": "2017-09-29 14:39:15.625952",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Regional",
|
||||
"name": "GST Settings",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
|
||||
@@ -72,7 +72,6 @@ def add_custom_roles_for_reports():
|
||||
|
||||
def add_permissions():
|
||||
for doctype in ('GST HSN Code', 'GST Settings'):
|
||||
add_permission(doctype, 'Accounts Manager', 0)
|
||||
add_permission(doctype, 'All', 0)
|
||||
|
||||
def add_print_formats():
|
||||
|
||||
@@ -89,6 +89,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
this.cart = new POSCart({
|
||||
frm: this.frm,
|
||||
wrapper: this.wrapper.find('.cart-container'),
|
||||
pos_profile: this.pos_profile,
|
||||
events: {
|
||||
on_customer_change: (customer) => this.frm.set_value('customer', customer),
|
||||
on_field_change: (item_code, field, value) => {
|
||||
@@ -98,6 +99,17 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
if (value == 'Pay') {
|
||||
if (!this.payment) {
|
||||
this.make_payment_modal();
|
||||
} else {
|
||||
const mop_field = this.payment.default_mop;
|
||||
let amount = 0.0;
|
||||
this.frm.doc.payments.map(p => {
|
||||
if (p.mode_of_payment == mop_field) {
|
||||
amount = p.amount;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
this.payment.dialog.set_value(mop_field, flt(amount));
|
||||
}
|
||||
this.payment.open_modal();
|
||||
}
|
||||
@@ -196,6 +208,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
this.update_item_in_frm(item)
|
||||
.then(() => {
|
||||
// update cart
|
||||
this.remove_item_from_cart(item);
|
||||
this.update_cart_data(item);
|
||||
});
|
||||
}, true);
|
||||
@@ -215,12 +228,18 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
return this.frm.script_manager
|
||||
.trigger('qty', item.doctype, item.name)
|
||||
.then(() => {
|
||||
if (field === 'qty' && value === 0) {
|
||||
frappe.model.clear_doc(item.doctype, item.name);
|
||||
if (field === 'qty') {
|
||||
this.remove_item_from_cart(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
remove_item_from_cart(item) {
|
||||
if (item.qty === 0) {
|
||||
frappe.model.clear_doc(item.doctype, item.name);
|
||||
}
|
||||
}
|
||||
|
||||
make_payment_modal() {
|
||||
this.payment = new Payment({
|
||||
frm: this.frm,
|
||||
@@ -363,10 +382,11 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
||||
};
|
||||
|
||||
class POSCart {
|
||||
constructor({frm, wrapper, events}) {
|
||||
constructor({frm, wrapper, pos_profile, events}) {
|
||||
this.frm = frm;
|
||||
this.wrapper = wrapper;
|
||||
this.events = events;
|
||||
this.pos_profile = pos_profile;
|
||||
this.make();
|
||||
this.bind_events();
|
||||
}
|
||||
@@ -428,6 +448,12 @@ class POSCart {
|
||||
this.$taxes_and_totals.html(this.get_taxes_and_totals());
|
||||
this.numpad && this.numpad.reset_value();
|
||||
this.customer_field.set_value("");
|
||||
|
||||
this.wrapper.find('.grand-total-value').text(
|
||||
format_currency(this.frm.doc.grand_total, this.frm.currency));
|
||||
|
||||
const customer = this.frm.doc.customer || this.pos_profile.customer;
|
||||
this.customer_field.set_value(customer);
|
||||
}
|
||||
|
||||
get_grand_total() {
|
||||
@@ -514,6 +540,7 @@ class POSCart {
|
||||
}
|
||||
|
||||
make_customer_field() {
|
||||
let customer = this.frm.doc.customer || this.pos_profile['customer'];
|
||||
this.customer_field = frappe.ui.form.make_control({
|
||||
df: {
|
||||
fieldtype: 'Link',
|
||||
@@ -521,7 +548,6 @@ class POSCart {
|
||||
fieldname: 'customer',
|
||||
options: 'Customer',
|
||||
reqd: 1,
|
||||
default: this.frm.doc.customer,
|
||||
onchange: () => {
|
||||
this.events.on_customer_change(this.customer_field.get_value());
|
||||
}
|
||||
@@ -529,6 +555,10 @@ class POSCart {
|
||||
parent: this.wrapper.find('.customer-field'),
|
||||
render_input: true
|
||||
});
|
||||
|
||||
if (customer) {
|
||||
this.customer_field.set_value(customer);
|
||||
}
|
||||
}
|
||||
|
||||
make_numpad() {
|
||||
@@ -733,28 +763,41 @@ class POSCart {
|
||||
// });
|
||||
|
||||
this.wrapper.find('.additional_discount_percentage').on('change', (e) => {
|
||||
const discount_percentage = flt(e.target.value,
|
||||
precision("additional_discount_percentage"));
|
||||
|
||||
frappe.model.set_value(this.frm.doctype, this.frm.docname,
|
||||
'additional_discount_percentage', e.target.value)
|
||||
'additional_discount_percentage', discount_percentage)
|
||||
.then(() => {
|
||||
let discount_wrapper = this.wrapper.find('.discount_amount');
|
||||
discount_wrapper.val(this.frm.doc.discount_amount);
|
||||
discount_wrapper.val(flt(this.frm.doc.discount_amount,
|
||||
precision('discount_amount')));
|
||||
discount_wrapper.trigger('change');
|
||||
});
|
||||
});
|
||||
|
||||
this.wrapper.find('.discount_amount').on('change', (e) => {
|
||||
const discount_amount = flt(e.target.value, precision('discount_amount'));
|
||||
frappe.model.set_value(this.frm.doctype, this.frm.docname,
|
||||
'discount_amount', flt(e.target.value));
|
||||
'discount_amount', discount_amount);
|
||||
this.frm.trigger('discount_amount')
|
||||
.then(() => {
|
||||
let discount_wrapper = this.wrapper.find('.additional_discount_percentage');
|
||||
discount_wrapper.val(this.frm.doc.additional_discount_percentage);
|
||||
this.update_discount_fields();
|
||||
this.update_taxes_and_totals();
|
||||
this.update_grand_total();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
update_discount_fields() {
|
||||
let discount_wrapper = this.wrapper.find('.additional_discount_percentage');
|
||||
let discount_amt_wrapper = this.wrapper.find('.discount_amount');
|
||||
discount_wrapper.val(flt(this.frm.doc.additional_discount_percentage,
|
||||
precision('additional_discount_percentage')));
|
||||
discount_amt_wrapper.val(flt(this.frm.doc.discount_amount,
|
||||
precision('discount_amount')));
|
||||
}
|
||||
|
||||
set_selected_item($item) {
|
||||
this.selected_item = $item;
|
||||
this.$cart_items.find('.list-item').removeClass('current-item qty disc rate');
|
||||
@@ -818,7 +861,7 @@ class POSItems {
|
||||
this.search_field = frappe.ui.form.make_control({
|
||||
df: {
|
||||
fieldtype: 'Data',
|
||||
label: 'Search Item (Ctrl + I)',
|
||||
label: 'Search Item ( Ctrl + i )',
|
||||
placeholder: 'Search by item code, serial number, batch no or barcode'
|
||||
},
|
||||
parent: this.wrapper.find('.search-field'),
|
||||
@@ -915,16 +958,21 @@ class POSItems {
|
||||
if(serial_no) {
|
||||
this.events.update_cart(items[0].item_code,
|
||||
'serial_no', serial_no);
|
||||
this.search_field.set_value('');
|
||||
this.reset_search_field();
|
||||
}
|
||||
if(batch_no) {
|
||||
this.events.update_cart(items[0].item_code,
|
||||
'batch_no', serial_no);
|
||||
this.search_field.set_value('');
|
||||
'batch_no', batch_no);
|
||||
this.reset_search_field();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
reset_search_field() {
|
||||
this.search_field.set_value('');
|
||||
this.search_field.$input.trigger("input");
|
||||
}
|
||||
|
||||
bind_events() {
|
||||
var me = this;
|
||||
this.wrapper.on('click', '.pos-item-wrapper', function() {
|
||||
@@ -1166,6 +1214,10 @@ class Payment {
|
||||
const me = this;
|
||||
|
||||
let fields = this.frm.doc.payments.map(p => {
|
||||
if (p.default) {
|
||||
this.default_mop = p.mode_of_payment;
|
||||
}
|
||||
|
||||
return {
|
||||
fieldtype: 'Currency',
|
||||
label: __(p.mode_of_payment),
|
||||
|
||||
@@ -24,6 +24,8 @@ def get_items(start, page_length, price_list, item_group, search_value=""):
|
||||
if batch_no_data:
|
||||
batch_no, item_code = batch_no_data
|
||||
|
||||
item_code, condition = get_conditions(item_code, serial_no, batch_no)
|
||||
|
||||
lft, rgt = frappe.db.get_value('Item Group', item_group, ['lft', 'rgt'])
|
||||
# locate function is used to sort by closest match from the beginning of the value
|
||||
res = frappe.db.sql("""select i.name as item_code, i.item_name, i.image as item_image,
|
||||
@@ -36,11 +38,11 @@ def get_items(start, page_length, price_list, item_group, search_value=""):
|
||||
where
|
||||
i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1
|
||||
and i.item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt})
|
||||
and (i.item_code like %(item_code)s
|
||||
or i.item_name like %(item_code)s or i.barcode like %(item_code)s)
|
||||
limit {start}, {page_length}""".format(start=start, page_length=page_length, lft=lft, rgt=rgt),
|
||||
and {condition}
|
||||
limit {start}, {page_length}""".format(start=start,
|
||||
page_length=page_length, lft=lft, rgt=rgt, condition=condition),
|
||||
{
|
||||
'item_code': '%%%s%%'%(frappe.db.escape(item_code)),
|
||||
'item_code': item_code,
|
||||
'price_list': price_list
|
||||
} , as_dict=1)
|
||||
|
||||
@@ -60,6 +62,15 @@ def get_items(start, page_length, price_list, item_group, search_value=""):
|
||||
|
||||
return res
|
||||
|
||||
def get_conditions(item_code, serial_no, batch_no):
|
||||
if serial_no or batch_no:
|
||||
return frappe.db.escape(item_code), "i.item_code = %(item_code)s"
|
||||
|
||||
condition = """(i.item_code like %(item_code)s
|
||||
or i.item_name like %(item_code)s or i.barcode like %(item_code)s)"""
|
||||
|
||||
return '%%%s%%'%(frappe.db.escape(item_code)), condition
|
||||
|
||||
@frappe.whitelist()
|
||||
def submit_invoice(doc):
|
||||
if isinstance(doc, basestring):
|
||||
|
||||
@@ -191,21 +191,21 @@ def create_healthcare_item_groups():
|
||||
def create_lab_test_items():
|
||||
records = [
|
||||
{"doctype": "Item", "item_code": "MCH", "item_name": "MCH", "item_group": "Laboratory",
|
||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
{"doctype": "Item", "item_code": "LDL", "item_name": "LDL", "item_group": "Laboratory",
|
||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
{"doctype": "Item", "item_code": "GTT", "item_name": "GTT", "item_group": "Laboratory",
|
||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
{"doctype": "Item", "item_code": "HDL", "item_name": "HDL", "item_group": "Laboratory",
|
||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
{"doctype": "Item", "item_code": "BILT", "item_name": "BILT", "item_group": "Laboratory",
|
||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
{"doctype": "Item", "item_code": "BILD", "item_name": "BILD", "item_group": "Laboratory",
|
||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
{"doctype": "Item", "item_code": "BP", "item_name": "BP", "item_group": "Laboratory",
|
||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||
{"doctype": "Item", "item_code": "BS", "item_name": "BS", "item_group": "Laboratory",
|
||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}
|
||||
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}
|
||||
]
|
||||
insert_record(records)
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ def split_batch(batch_no, item_code, warehouse, qty, new_batch_id = None):
|
||||
def set_batch_nos(doc, warehouse_field, throw = False):
|
||||
'''Automatically select `batch_no` for outgoing items in item table'''
|
||||
for d in doc.items:
|
||||
qty = d.get('stock_qty') or d.get('qty') or 0
|
||||
qty = d.get('stock_qty') or d.get('transfer_qty') or d.get('qty') or 0
|
||||
has_batch_no = frappe.db.get_value('Item', d.item_code, 'has_batch_no')
|
||||
warehouse = d.get(warehouse_field, None)
|
||||
if has_batch_no and warehouse and qty > 0:
|
||||
|
||||
Reference in New Issue
Block a user