Merge branch 'develop'
This commit is contained in:
commit
8793b823af
@ -2,7 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
__version__ = '7.0.19'
|
__version__ = '7.0.20'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -108,13 +108,14 @@ def get_items(doc, pos_profile):
|
|||||||
|
|
||||||
item.price_list_rate = frappe.db.get_value('Item Price', {'item_code': item.name,
|
item.price_list_rate = frappe.db.get_value('Item Price', {'item_code': item.name,
|
||||||
'price_list': doc.selling_price_list}, 'price_list_rate') or 0
|
'price_list': doc.selling_price_list}, 'price_list_rate') or 0
|
||||||
item.default_warehouse = pos_profile.get('warehouse') or item.default_warehouse or None
|
item.default_warehouse = pos_profile.get('warehouse') or \
|
||||||
|
get_item_warehouse_for_company(doc.company, item.default_warehouse) or None
|
||||||
item.expense_account = pos_profile.get('expense_account') or item.expense_account
|
item.expense_account = pos_profile.get('expense_account') or item.expense_account
|
||||||
item.income_account = pos_profile.get('income_account') or item_doc.income_account
|
item.income_account = pos_profile.get('income_account') or item_doc.income_account
|
||||||
item.cost_center = pos_profile.get('cost_center') or item_doc.selling_cost_center
|
item.cost_center = pos_profile.get('cost_center') or item_doc.selling_cost_center
|
||||||
item.actual_qty = frappe.db.get_value('Bin', {'item_code': item.name,
|
item.actual_qty = frappe.db.get_value('Bin', {'item_code': item.name,
|
||||||
'warehouse': item.default_warehouse}, 'actual_qty') or 0
|
'warehouse': item.default_warehouse}, 'actual_qty') or 0
|
||||||
item.serial_nos = get_serial_nos(item, pos_profile)
|
item.serial_nos = get_serial_nos(item, pos_profile, doc.company)
|
||||||
item.batch_nos = frappe.db.sql_list("""select name from `tabBatch` where ifnull(expiry_date, '4000-10-10') > curdate()
|
item.batch_nos = frappe.db.sql_list("""select name from `tabBatch` where ifnull(expiry_date, '4000-10-10') > curdate()
|
||||||
and item = %(item_code)s""", {'item_code': item.item_code})
|
and item = %(item_code)s""", {'item_code': item.item_code})
|
||||||
|
|
||||||
@ -122,13 +123,19 @@ def get_items(doc, pos_profile):
|
|||||||
|
|
||||||
return item_list
|
return item_list
|
||||||
|
|
||||||
def get_serial_nos(item, pos_profile):
|
def get_item_warehouse_for_company(company, warehouse):
|
||||||
|
if frappe.db.get_value('Warehouse', warehouse, 'company') != company:
|
||||||
|
warehouse = None
|
||||||
|
return warehouse
|
||||||
|
|
||||||
|
def get_serial_nos(item, pos_profile, company):
|
||||||
cond = "1=1"
|
cond = "1=1"
|
||||||
if pos_profile.get('update_stock') and pos_profile.get('warehouse'):
|
if pos_profile.get('update_stock') and pos_profile.get('warehouse'):
|
||||||
cond = "warehouse = '{0}'".format(pos_profile.get('warehouse'))
|
cond = "warehouse = '{0}'".format(pos_profile.get('warehouse'))
|
||||||
|
|
||||||
serial_nos = frappe.db.sql("""select name, warehouse from `tabSerial No` where {0}
|
serial_nos = frappe.db.sql("""select name, warehouse from `tabSerial No` where {0}
|
||||||
and item_code = %(item_code)s""".format(cond), {'item_code': item.item_code}, as_dict=1)
|
and item_code = %(item_code)s and company = %(company)s
|
||||||
|
""".format(cond), {'item_code': item.item_code, 'company': company}, as_dict=1)
|
||||||
|
|
||||||
serial_no_list = {}
|
serial_no_list = {}
|
||||||
for serial_no in serial_nos:
|
for serial_no in serial_nos:
|
||||||
@ -214,9 +221,9 @@ def submit_invoice(si_doc, name):
|
|||||||
save_invoice(e, si_doc, name)
|
save_invoice(e, si_doc, name)
|
||||||
|
|
||||||
def save_invoice(e, si_doc, name):
|
def save_invoice(e, si_doc, name):
|
||||||
si_doc.docstatus = 0
|
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
|
||||||
si_doc.name = ''
|
si_doc.flags.ignore_mandatory = True
|
||||||
si_doc.save(ignore_permissions=True)
|
si_doc.insert()
|
||||||
make_scheduler_log(e, si_doc.name)
|
make_scheduler_log(e, si_doc.name)
|
||||||
|
|
||||||
def make_scheduler_log(e, sales_invoice):
|
def make_scheduler_log(e, sales_invoice):
|
||||||
|
@ -177,6 +177,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
doc = JSON.parse(localStorage.getItem('doc'))
|
doc = JSON.parse(localStorage.getItem('doc'))
|
||||||
if(this.frm.doc.payments.length == 0){
|
if(this.frm.doc.payments.length == 0){
|
||||||
this.frm.doc.payments = doc.payments;
|
this.frm.doc.payments = doc.payments;
|
||||||
|
this.calculate_outstanding_amount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.frm.doc.customer){
|
if(this.frm.doc.customer){
|
||||||
@ -869,6 +870,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
for(key in data){
|
for(key in data){
|
||||||
if(data[key].docstatus == 1 && index < 50){
|
if(data[key].docstatus == 1 && index < 50){
|
||||||
index++
|
index++
|
||||||
|
data[key].docstatus = 0;
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ frappe.ui.form.on("Request for Quotation",{
|
|||||||
},
|
},
|
||||||
|
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
frm.add_fetch('standard_reply', 'response', 'response');
|
frm.add_fetch('standard_reply', 'response', 'message_for_supplier');
|
||||||
|
|
||||||
if(!frm.doc.message_for_supplier) {
|
if(!frm.doc.message_for_supplier) {
|
||||||
frm.set_value("message_for_supplier", __("Please supply the specified items at the best possible rates"))
|
frm.set_value("message_for_supplier", __("Please supply the specified items at the best possible rates"))
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"document_type": "Document",
|
"document_type": "Document",
|
||||||
|
"editable_grid": 0,
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
@ -296,7 +297,7 @@
|
|||||||
"options": "Standard Reply",
|
"options": "Standard Reply",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 1,
|
||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
@ -638,7 +639,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-06-30 01:57:49.233065",
|
"modified": "2016-08-01 08:45:39.777405",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Request for Quotation",
|
"name": "Request for Quotation",
|
||||||
|
@ -36,6 +36,7 @@ class LeaveApplication(Document):
|
|||||||
self.validate_max_days()
|
self.validate_max_days()
|
||||||
self.show_block_day_warning()
|
self.show_block_day_warning()
|
||||||
self.validate_block_days()
|
self.validate_block_days()
|
||||||
|
self.validate_salary_processed_days()
|
||||||
self.validate_leave_approver()
|
self.validate_leave_approver()
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
@ -95,6 +96,15 @@ class LeaveApplication(Document):
|
|||||||
frappe.throw(_("Leave cannot be applied/cancelled before {0}, as leave balance has already been carry-forwarded in the future leave allocation record {1}")
|
frappe.throw(_("Leave cannot be applied/cancelled before {0}, as leave balance has already been carry-forwarded in the future leave allocation record {1}")
|
||||||
.format(formatdate(future_allocation[0].from_date), future_allocation[0].name))
|
.format(formatdate(future_allocation[0].from_date), future_allocation[0].name))
|
||||||
|
|
||||||
|
def validate_salary_processed_days(self):
|
||||||
|
last_processed_pay_slip = frappe.db.sql("""select start_date, end_date from `tabSalary Slip`
|
||||||
|
where docstatus != 2 and employee = %s and ((%s between start_date and end_date) or (%s between start_date and end_date)) order by modified desc limit 1""",(self.employee, self.to_date, self.from_date))
|
||||||
|
|
||||||
|
if last_processed_pay_slip:
|
||||||
|
frappe.throw(_("Salary already processed for period between {0} and {1}, Leave application period cannot be between this date range.").
|
||||||
|
format(formatdate(last_processed_pay_slip[0][0]), formatdate(last_processed_pay_slip[0][1])))
|
||||||
|
|
||||||
|
|
||||||
def show_block_day_warning(self):
|
def show_block_day_warning(self):
|
||||||
block_dates = get_applicable_block_dates(self.from_date, self.to_date,
|
block_dates = get_applicable_block_dates(self.from_date, self.to_date,
|
||||||
self.employee, self.company, all_lists=True)
|
self.employee, self.company, all_lists=True)
|
||||||
|
@ -6,15 +6,17 @@ frappe.ui.form.on("Timesheet", {
|
|||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
frm.get_field('time_logs').grid.editable_fields = [
|
frm.get_field('time_logs').grid.editable_fields = [
|
||||||
{fieldname: 'billable', columns: 1},
|
{fieldname: 'billable', columns: 1},
|
||||||
|
{fieldname: 'project', columns: 3},
|
||||||
{fieldname: 'activity_type', columns: 2},
|
{fieldname: 'activity_type', columns: 2},
|
||||||
{fieldname: 'from_time', columns: 3},
|
{fieldname: 'from_time', columns: 3},
|
||||||
{fieldname: 'hours', columns: 1},
|
{fieldname: 'hours', columns: 1}
|
||||||
{fieldname: 'project', columns: 3}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
frm.fields_dict.employee.get_query = function() {
|
frm.fields_dict.employee.get_query = function() {
|
||||||
return {
|
return {
|
||||||
query:"erpnext.projects.doctype.timesheet.timesheet.get_employee_list"
|
filters:{
|
||||||
|
'status': 'Active'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
"allow_import": 0,
|
"allow_import": 1,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"autoname": "naming_series:",
|
"autoname": "naming_series:",
|
||||||
"beta": 0,
|
"beta": 0,
|
||||||
@ -662,7 +662,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-07-26 00:01:56.055046",
|
"modified": "2016-08-01 08:54:31.840829",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Projects",
|
"module": "Projects",
|
||||||
"name": "Timesheet",
|
"name": "Timesheet",
|
||||||
|
@ -94,7 +94,7 @@ class Timesheet(Document):
|
|||||||
if self.production_order and flt(data.completed_qty) == 0:
|
if self.production_order and flt(data.completed_qty) == 0:
|
||||||
frappe.throw(_("Row {0}: Completed Qty must be greater than zero.").format(data.idx))
|
frappe.throw(_("Row {0}: Completed Qty must be greater than zero.").format(data.idx))
|
||||||
|
|
||||||
if self.production_order and flt(pending_qty) < flt(data.completed_qty):
|
if self.production_order and flt(pending_qty) < flt(data.completed_qty) and flt(pending_qty) > 0:
|
||||||
frappe.throw(_("Row {0}: Completed Qty cannot be more than {1} for operation {2}").format(data.idx, pending_qty, data.operation),
|
frappe.throw(_("Row {0}: Completed Qty cannot be more than {1} for operation {2}").format(data.idx, pending_qty, data.operation),
|
||||||
OverProductionLoggedError)
|
OverProductionLoggedError)
|
||||||
|
|
||||||
@ -290,10 +290,3 @@ def get_activity_cost(employee=None, activity_type=None):
|
|||||||
["costing_rate", "billing_rate"], as_dict=True)
|
["costing_rate", "billing_rate"], as_dict=True)
|
||||||
|
|
||||||
return rate[0] if rate else {}
|
return rate[0] if rate else {}
|
||||||
|
|
||||||
@frappe.whitelist()
|
|
||||||
def get_employee_list(doctype, txt, searchfield, start, page_len, filters):
|
|
||||||
return frappe.db.sql("""select distinct employee, employee_name
|
|
||||||
from `tabSalary Structure` where salary_slip_based_on_timesheet=1
|
|
||||||
and employee like %(txt)s or employee_name like %(txt)s limit %(start)s, %(page_len)s""",
|
|
||||||
{'txt': "%%%s%%"% txt, 'start': start, 'page_len': page_len})
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Billable",
|
"label": "Bill",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@ -121,7 +121,7 @@
|
|||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Hours",
|
"label": "Hrs",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@ -532,7 +532,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-07-26 00:07:58.267131",
|
"modified": "2016-08-06 03:14:31.691605",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Projects",
|
"module": "Projects",
|
||||||
"name": "Timesheet Detail",
|
"name": "Timesheet Detail",
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": 1,
|
"is_standard": 1,
|
||||||
"login_required": 1,
|
"login_required": 1,
|
||||||
"modified": "2016-07-07 06:04:30.979390",
|
"modified": "2016-08-06 11:59:21.494549",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Projects",
|
"module": "Projects",
|
||||||
"name": "tasks",
|
"name": "tasks",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"published": 1,
|
"published": 1,
|
||||||
"route": "tasks",
|
"route": "tasks",
|
||||||
"success_url": "/projects?project=Collaborative Project Management",
|
"success_url": "",
|
||||||
"title": "Task",
|
"title": "Task",
|
||||||
"web_form_fields": [
|
"web_form_fields": [
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,8 @@ import frappe
|
|||||||
def get_context(context):
|
def get_context(context):
|
||||||
if frappe.form_dict.project:
|
if frappe.form_dict.project:
|
||||||
context.parents = [{'title': frappe.form_dict.project, 'route': '/projects?project='+ frappe.form_dict.project}]
|
context.parents = [{'title': frappe.form_dict.project, 'route': '/projects?project='+ frappe.form_dict.project}]
|
||||||
|
context.success_url = "/projects?project=" + frappe.form_dict.project
|
||||||
|
|
||||||
elif context.doc and context.doc.get('project'):
|
elif context.doc and context.doc.get('project'):
|
||||||
context.parents = [{'title': context.doc.project, 'route': '/projects?project='+ context.doc.project}]
|
context.parents = [{'title': context.doc.project, 'route': '/projects?project='+ context.doc.project}]
|
||||||
|
context.success_url = "/projects?project=" + context.doc.project
|
||||||
|
Loading…
x
Reference in New Issue
Block a user