Merge branch 'staging-fixes' into pr_staging_fixes
This commit is contained in:
commit
3b16dd7377
@ -335,7 +335,7 @@ def get_due_date_from_template(template_name, posting_date, bill_date):
|
|||||||
|
|
||||||
def validate_due_date(posting_date, due_date, party_type, party, company=None, bill_date=None, template_name=None):
|
def validate_due_date(posting_date, due_date, party_type, party, company=None, bill_date=None, template_name=None):
|
||||||
if getdate(due_date) < getdate(posting_date):
|
if getdate(due_date) < getdate(posting_date):
|
||||||
frappe.throw(_("Due Date cannot be before Posting Date"))
|
frappe.throw(_("Due Date cannot be before Posting / Supplier Invoice Date"))
|
||||||
else:
|
else:
|
||||||
if not template_name: return
|
if not template_name: return
|
||||||
|
|
||||||
|
@ -57,6 +57,8 @@ class AccountsController(TransactionBase):
|
|||||||
_('{0} is blocked so this transaction cannot proceed'.format(supplier_name)), raise_exception=1)
|
_('{0} is blocked so this transaction cannot proceed'.format(supplier_name)), raise_exception=1)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
|
||||||
|
self.validate_qty_is_not_zero()
|
||||||
if self.get("_action") and self._action != "update_after_submit":
|
if self.get("_action") and self._action != "update_after_submit":
|
||||||
self.set_missing_values(for_validate=True)
|
self.set_missing_values(for_validate=True)
|
||||||
|
|
||||||
@ -179,7 +181,7 @@ class AccountsController(TransactionBase):
|
|||||||
validate_due_date(self.posting_date, self.due_date,
|
validate_due_date(self.posting_date, self.due_date,
|
||||||
"Customer", self.customer, self.company, self.payment_terms_template)
|
"Customer", self.customer, self.company, self.payment_terms_template)
|
||||||
elif self.doctype == "Purchase Invoice":
|
elif self.doctype == "Purchase Invoice":
|
||||||
validate_due_date(self.posting_date, self.due_date,
|
validate_due_date(self.bill_date or self.posting_date, self.due_date,
|
||||||
"Supplier", self.supplier, self.company, self.bill_date, self.payment_terms_template)
|
"Supplier", self.supplier, self.company, self.bill_date, self.payment_terms_template)
|
||||||
|
|
||||||
def set_price_list_currency(self, buying_or_selling):
|
def set_price_list_currency(self, buying_or_selling):
|
||||||
@ -359,6 +361,11 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
return gl_dict
|
return gl_dict
|
||||||
|
|
||||||
|
def validate_qty_is_not_zero(self):
|
||||||
|
for item in self.items:
|
||||||
|
if not item.qty:
|
||||||
|
frappe.throw("Item quantity can not be zero")
|
||||||
|
|
||||||
def validate_account_currency(self, account, account_currency=None):
|
def validate_account_currency(self, account, account_currency=None):
|
||||||
valid_currency = [self.company_currency]
|
valid_currency = [self.company_currency]
|
||||||
if self.get("currency") and self.currency != self.company_currency:
|
if self.get("currency") and self.currency != self.company_currency:
|
||||||
@ -405,7 +412,8 @@ class AccountsController(TransactionBase):
|
|||||||
if d.against_order:
|
if d.against_order:
|
||||||
allocated_amount = flt(d.amount)
|
allocated_amount = flt(d.amount)
|
||||||
else:
|
else:
|
||||||
allocated_amount = min(self.grand_total - advance_allocated, d.amount)
|
amount = self.rounded_total or self.grand_total
|
||||||
|
allocated_amount = min(amount - advance_allocated, d.amount)
|
||||||
advance_allocated += flt(allocated_amount)
|
advance_allocated += flt(allocated_amount)
|
||||||
|
|
||||||
self.append("advances", {
|
self.append("advances", {
|
||||||
|
@ -41,6 +41,7 @@ class SellingController(StockController):
|
|||||||
self.validate_selling_price()
|
self.validate_selling_price()
|
||||||
self.set_qty_as_per_stock_uom()
|
self.set_qty_as_per_stock_uom()
|
||||||
self.set_po_nos()
|
self.set_po_nos()
|
||||||
|
self.set_gross_profit()
|
||||||
set_default_income_account_for_item(self)
|
set_default_income_account_for_item(self)
|
||||||
|
|
||||||
def set_missing_values(self, for_validate=False):
|
def set_missing_values(self, for_validate=False):
|
||||||
@ -348,6 +349,12 @@ class SellingController(StockController):
|
|||||||
if po_nos and po_nos[0].get('po_no'):
|
if po_nos and po_nos[0].get('po_no'):
|
||||||
self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
|
self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
|
||||||
|
|
||||||
|
def set_gross_profit(self):
|
||||||
|
if self.doctype == "Sales Order":
|
||||||
|
for item in self.items:
|
||||||
|
item.gross_profit = flt(((item.base_rate - item.valuation_rate) * item.stock_qty), self.precision("amount", item))
|
||||||
|
|
||||||
|
|
||||||
def validate_items(self):
|
def validate_items(self):
|
||||||
# validate items to see if they have is_sales_item enabled
|
# validate items to see if they have is_sales_item enabled
|
||||||
from erpnext.controllers.buying_controller import validate_item_type
|
from erpnext.controllers.buying_controller import validate_item_type
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
|
"allow_events_in_timeline": 0,
|
||||||
"allow_guest_to_view": 0,
|
"allow_guest_to_view": 0,
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
@ -991,39 +992,6 @@
|
|||||||
"translatable": 0,
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"allow_bulk_edit": 0,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"columns": 0,
|
|
||||||
"default": "0",
|
|
||||||
"fieldname": "paid_amount",
|
|
||||||
"fieldtype": "Currency",
|
|
||||||
"hidden": 1,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"label": "Paid Amount",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 1,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"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,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
"allow_in_quick_entry": 0,
|
"allow_in_quick_entry": 0,
|
||||||
@ -1360,7 +1328,7 @@
|
|||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"menu_index": 0,
|
"menu_index": 0,
|
||||||
"modified": "2018-08-21 14:44:48.968839",
|
"modified": "2018-11-26 20:42:14.467284",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Education",
|
"module": "Education",
|
||||||
"name": "Fees",
|
"name": "Fees",
|
||||||
|
@ -112,7 +112,10 @@ def get_fee_list(doctype, txt, filters, limit_start, limit_page_length=20, order
|
|||||||
user = frappe.session.user
|
user = frappe.session.user
|
||||||
student = frappe.db.sql("select name from `tabStudent` where student_email_id= %s", user)
|
student = frappe.db.sql("select name from `tabStudent` where student_email_id= %s", user)
|
||||||
if student:
|
if student:
|
||||||
return frappe. db.sql('''select name, program, due_date, paid_amount, outstanding_amount, grand_total from `tabFees`
|
return frappe. db.sql('''
|
||||||
|
select name, program, due_date, grand_total - outstanding_amount as paid_amount,
|
||||||
|
outstanding_amount, grand_total, currency
|
||||||
|
from `tabFees`
|
||||||
where student= %s and docstatus=1
|
where student= %s and docstatus=1
|
||||||
order by due_date asc limit {0} , {1}'''
|
order by due_date asc limit {0} , {1}'''
|
||||||
.format(limit_start, limit_page_length), student, as_dict = True)
|
.format(limit_start, limit_page_length), student, as_dict = True)
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
frappe.listview_settings['Leave Application'] = {
|
frappe.listview_settings['Leave Application'] = {
|
||||||
add_fields: ["leave_type", "employee", "employee_name", "total_leave_days", "from_date", "to_date"]
|
add_fields: ["leave_type", "employee", "employee_name", "total_leave_days", "from_date", "to_date"],
|
||||||
|
get_indicator: function (doc) {
|
||||||
|
if (doc.status === "Approved") {
|
||||||
|
return [__("Approved"), "green", "status,=,Approved"];
|
||||||
|
} else if (doc.status === "Rejected") {
|
||||||
|
return [__("Rejected"), "red", "status,=,Rejected"];
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -177,7 +177,7 @@ var calculate_earning_total = function(doc, dt, dn, reset_amount) {
|
|||||||
if(cint(tbl[i].depends_on_lwp) == 1) {
|
if(cint(tbl[i].depends_on_lwp) == 1) {
|
||||||
tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days) /
|
tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days) /
|
||||||
cint(doc.total_working_days)*100)/100;
|
cint(doc.total_working_days)*100)/100;
|
||||||
} else if(reset_amount) {
|
} else if(reset_amount && tbl[i].default_amount) {
|
||||||
tbl[i].amount = tbl[i].default_amount;
|
tbl[i].amount = tbl[i].default_amount;
|
||||||
}
|
}
|
||||||
if(!tbl[i].do_not_include_in_total) {
|
if(!tbl[i].do_not_include_in_total) {
|
||||||
@ -198,7 +198,7 @@ var calculate_ded_total = function(doc, dt, dn, reset_amount) {
|
|||||||
for(var i = 0; i < tbl.length; i++){
|
for(var i = 0; i < tbl.length; i++){
|
||||||
if(cint(tbl[i].depends_on_lwp) == 1) {
|
if(cint(tbl[i].depends_on_lwp) == 1) {
|
||||||
tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days)/cint(doc.total_working_days)*100)/100;
|
tbl[i].amount = Math.round(tbl[i].default_amount)*(flt(doc.payment_days)/cint(doc.total_working_days)*100)/100;
|
||||||
} else if(reset_amount) {
|
} else if(reset_amount && tbl[i].default_amount) {
|
||||||
tbl[i].amount = tbl[i].default_amount;
|
tbl[i].amount = tbl[i].default_amount;
|
||||||
}
|
}
|
||||||
if(!tbl[i].do_not_include_in_total) {
|
if(!tbl[i].do_not_include_in_total) {
|
||||||
|
@ -13,3 +13,11 @@ class ManufacturingSettings(Document):
|
|||||||
def get_mins_between_operations():
|
def get_mins_between_operations():
|
||||||
return relativedelta(minutes=cint(frappe.db.get_single_value("Manufacturing Settings",
|
return relativedelta(minutes=cint(frappe.db.get_single_value("Manufacturing Settings",
|
||||||
"mins_between_operations")) or 10)
|
"mins_between_operations")) or 10)
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def is_material_consumption_enabled():
|
||||||
|
if not hasattr(frappe.local, 'material_consumption'):
|
||||||
|
frappe.local.material_consumption = cint(frappe.db.get_single_value('Manufacturing Settings',
|
||||||
|
'material_consumption'))
|
||||||
|
|
||||||
|
return frappe.local.material_consumption
|
@ -80,15 +80,15 @@ frappe.ui.form.on("Task", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
is_group: function(frm) {
|
is_group: function (frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method:"erpnext.projects.doctype.task.task.check_if_child_exists",
|
method: "erpnext.projects.doctype.task.task.check_if_child_exists",
|
||||||
args: {
|
args: {
|
||||||
name: frm.doc.name
|
name: frm.doc.name
|
||||||
},
|
},
|
||||||
callback: function(r){
|
callback: function (r) {
|
||||||
if(r.message){
|
if (r.message.length > 0) {
|
||||||
frappe.msgprint(__('Cannot convert it to non-group. Child Tasks exist.'));
|
frappe.msgprint(__(`Cannot convert it to non-group. The following child Tasks exist: ${r.message.join(", ")}.`));
|
||||||
frm.reload_doc();
|
frm.reload_doc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,15 @@
|
|||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe, json
|
|
||||||
|
|
||||||
from frappe.utils import getdate, date_diff, add_days, cstr
|
import json
|
||||||
|
|
||||||
|
import frappe
|
||||||
from frappe import _, throw
|
from frappe import _, throw
|
||||||
|
from frappe.utils import add_days, cstr, date_diff, get_link_to_form, getdate
|
||||||
from frappe.utils.nestedset import NestedSet
|
from frappe.utils.nestedset import NestedSet
|
||||||
|
|
||||||
|
|
||||||
class CircularReferenceError(frappe.ValidationError): pass
|
class CircularReferenceError(frappe.ValidationError): pass
|
||||||
|
|
||||||
class Task(NestedSet):
|
class Task(NestedSet):
|
||||||
@ -157,8 +160,10 @@ class Task(NestedSet):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def check_if_child_exists(name):
|
def check_if_child_exists(name):
|
||||||
return frappe.db.sql("""select name from `tabTask`
|
child_tasks = frappe.get_all("Task", filters={"parent_task": name})
|
||||||
where parent_task = %s""", name)
|
child_tasks = [get_link_to_form("Task", task.name) for task in child_tasks]
|
||||||
|
return child_tasks
|
||||||
|
|
||||||
|
|
||||||
def get_project(doctype, txt, searchfield, start, page_len, filters):
|
def get_project(doctype, txt, searchfield, start, page_len, filters):
|
||||||
from erpnext.controllers.queries import get_match_cond
|
from erpnext.controllers.queries import get_match_cond
|
||||||
|
@ -32,7 +32,6 @@ class SalesOrder(SellingController):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
super(SalesOrder, self).validate()
|
super(SalesOrder, self).validate()
|
||||||
|
|
||||||
self.validate_order_type()
|
self.validate_order_type()
|
||||||
self.validate_delivery_date()
|
self.validate_delivery_date()
|
||||||
self.validate_proj_cust()
|
self.validate_proj_cust()
|
||||||
@ -343,8 +342,10 @@ class SalesOrder(SellingController):
|
|||||||
delivered_qty += item.delivered_qty
|
delivered_qty += item.delivered_qty
|
||||||
tot_qty += item.qty
|
tot_qty += item.qty
|
||||||
|
|
||||||
self.db_set("per_delivered", flt(delivered_qty/tot_qty) * 100,
|
if tot_qty != 0:
|
||||||
update_modified=False)
|
self.db_set("per_delivered", flt(delivered_qty/tot_qty) * 100,
|
||||||
|
update_modified=False)
|
||||||
|
|
||||||
|
|
||||||
def set_indicator(self):
|
def set_indicator(self):
|
||||||
"""Set indicator for portal"""
|
"""Set indicator for portal"""
|
||||||
|
@ -73,7 +73,8 @@ frappe.query_reports["Sales Analytics"] = {
|
|||||||
events: {
|
events: {
|
||||||
onCheckRow: function(data) {
|
onCheckRow: function(data) {
|
||||||
row_name = data[2].content;
|
row_name = data[2].content;
|
||||||
row_values = data.slice(4).map(function (column) {
|
length = data.length
|
||||||
|
row_values = data.slice(4,length-1).map(function (column) {
|
||||||
return column.content;
|
return column.content;
|
||||||
})
|
})
|
||||||
entry = {
|
entry = {
|
||||||
|
@ -275,7 +275,8 @@ class Analytics(object):
|
|||||||
self.parent_child_map = frappe._dict(frappe.db.sql(""" select name, supplier_group from `tabSupplier`"""))
|
self.parent_child_map = frappe._dict(frappe.db.sql(""" select name, supplier_group from `tabSupplier`"""))
|
||||||
|
|
||||||
def get_chart_data(self):
|
def get_chart_data(self):
|
||||||
labels = [d.get("label") for d in self.columns[2:]]
|
length = len(self.columns)
|
||||||
|
labels = [d.get("label") for d in self.columns[2:length-1]]
|
||||||
self.chart = {
|
self.chart = {
|
||||||
"data": {
|
"data": {
|
||||||
'labels': labels,
|
'labels': labels,
|
||||||
|
@ -363,7 +363,8 @@ def replace_abbr(company, old, new):
|
|||||||
for d in doc:
|
for d in doc:
|
||||||
_rename_record(d)
|
_rename_record(d)
|
||||||
|
|
||||||
for dt in ["Warehouse", "Account", "Cost Center"]:
|
for dt in ["Warehouse", "Account", "Cost Center", "Department", "Location",
|
||||||
|
"Sales Taxes and Charges Template", "Purchase Taxes and Charges Template"]:
|
||||||
_rename_records(dt)
|
_rename_records(dt)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
|
@ -199,12 +199,15 @@ frappe.ui.form.on('Stock Entry', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
validate_purpose_consumption: function(frm) {
|
validate_purpose_consumption: function(frm) {
|
||||||
frappe.model.get_value('Manufacturing Settings', {'name': 'Manufacturing Settings'}, 'material_consumption', function(d) {
|
frappe.call({
|
||||||
if (d.material_consumption==0 && frm.doc.purpose=="Material Consumption for Manufacture") {
|
method: "erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings.is_material_consumption_enabled",
|
||||||
|
}).then(r => {
|
||||||
|
if (cint(r.message) == 0
|
||||||
|
&& frm.doc.purpose=="Material Consumption for Manufacture") {
|
||||||
frm.set_value("purpose", 'Manufacture');
|
frm.set_value("purpose", 'Manufacture');
|
||||||
frappe.throw(__('Material Consumption is not set in Manufacturing Settings.'));
|
frappe.throw(__('Material Consumption is not set in Manufacturing Settings.'));
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
company: function(frm) {
|
company: function(frm) {
|
||||||
|
@ -88,10 +88,9 @@ frappe.query_reports["Stock Analytics"] = {
|
|||||||
events: {
|
events: {
|
||||||
onCheckRow: function(data) {
|
onCheckRow: function(data) {
|
||||||
row_name = data[2].content;
|
row_name = data[2].content;
|
||||||
row_values = data.slice(6).map(function (column) {
|
row_values = data.slice(7).map(function (column) {
|
||||||
return column.content;
|
return column.content;
|
||||||
})
|
})
|
||||||
|
|
||||||
entry = {
|
entry = {
|
||||||
'name':row_name,
|
'name':row_name,
|
||||||
'values':row_values
|
'values':row_values
|
||||||
|
@ -167,13 +167,11 @@ def get_data(filters):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
def get_chart_data(columns):
|
def get_chart_data(columns):
|
||||||
labels = [d.get("label") for d in columns[4:]]
|
labels = [d.get("label") for d in columns[5:]]
|
||||||
chart = {
|
chart = {
|
||||||
"data": {
|
"data": {
|
||||||
'labels': labels,
|
'labels': labels,
|
||||||
'datasets':[
|
'datasets':[]
|
||||||
{ "values": ['0' for d in columns[4:]] }
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chart["type"] = "line"
|
chart["type"] = "line"
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
{{ doc.program }}
|
{{ doc.program }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-2">
|
<div class="col-xs-2">
|
||||||
{{ doc.get_formatted("total_amount") }}
|
{{ frappe.utils.fmt_money(doc.grand_total, currency=doc.currency) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-2">
|
<div class="col-xs-2">
|
||||||
{{ doc.get_formatted("paid_amount") }}
|
{{ frappe.utils.fmt_money(doc.paid_amount, currency=doc.currency) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-2">
|
<div class="col-xs-2">
|
||||||
{{ doc.get_formatted("outstanding_amount") }}
|
{{ frappe.utils.fmt_money(doc.outstanding_amount, currency=doc.currency) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user