mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 13:09:17 +00:00
Merge branch 'hotfix'
This commit is contained in:
@@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '10.1.38'
|
__version__ = '10.1.39'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
|||||||
@@ -588,6 +588,10 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
allocate_party_amount_against_ref_docs: function(frm, paid_amount) {
|
allocate_party_amount_against_ref_docs: function(frm, paid_amount) {
|
||||||
var total_positive_outstanding_including_order = 0;
|
var total_positive_outstanding_including_order = 0;
|
||||||
var total_negative_outstanding = 0;
|
var total_negative_outstanding = 0;
|
||||||
|
var total_deductions = frappe.utils.sum($.map(frm.doc.deductions || [],
|
||||||
|
function(d) { return flt(d.amount) }));
|
||||||
|
|
||||||
|
paid_amount -= total_deductions;
|
||||||
|
|
||||||
$.each(frm.doc.references || [], function(i, row) {
|
$.each(frm.doc.references || [], function(i, row) {
|
||||||
if(flt(row.outstanding_amount) > 0)
|
if(flt(row.outstanding_amount) > 0)
|
||||||
|
|||||||
@@ -337,14 +337,15 @@ class PaymentEntry(AccountsController):
|
|||||||
total_negative_outstanding = sum([abs(flt(d.outstanding_amount))
|
total_negative_outstanding = sum([abs(flt(d.outstanding_amount))
|
||||||
for d in self.get("references") if flt(d.outstanding_amount) < 0])
|
for d in self.get("references") if flt(d.outstanding_amount) < 0])
|
||||||
|
|
||||||
party_amount = self.paid_amount if self.payment_type=="Receive" else self.received_amount
|
paid_amount = self.paid_amount if self.payment_type=="Receive" else self.received_amount
|
||||||
|
additional_charges = sum([flt(d.amount) for d in self.deductions])
|
||||||
|
|
||||||
if not total_negative_outstanding:
|
if not total_negative_outstanding:
|
||||||
frappe.throw(_("Cannot {0} {1} {2} without any negative outstanding invoice")
|
frappe.throw(_("Cannot {0} {1} {2} without any negative outstanding invoice")
|
||||||
.format(self.payment_type, ("to" if self.party_type=="Customer" else "from"),
|
.format(self.payment_type, ("to" if self.party_type=="Customer" else "from"),
|
||||||
self.party_type), InvalidPaymentEntry)
|
self.party_type), InvalidPaymentEntry)
|
||||||
|
|
||||||
elif party_amount > total_negative_outstanding:
|
elif paid_amount - additional_charges > total_negative_outstanding:
|
||||||
frappe.throw(_("Paid Amount cannot be greater than total negative outstanding amount {0}")
|
frappe.throw(_("Paid Amount cannot be greater than total negative outstanding amount {0}")
|
||||||
.format(total_negative_outstanding), InvalidPaymentEntry)
|
.format(total_negative_outstanding), InvalidPaymentEntry)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"allow_guest_to_view": 0,
|
"allow_guest_to_view": 0,
|
||||||
"allow_import": 0,
|
"allow_import": 0,
|
||||||
"allow_rename": 0,
|
"allow_rename": 0,
|
||||||
"autoname": "field:maintenance_task",
|
"autoname": "",
|
||||||
"beta": 0,
|
"beta": 0,
|
||||||
"creation": "2017-10-20 07:10:55.903571",
|
"creation": "2017-10-20 07:10:55.903571",
|
||||||
"custom": 0,
|
"custom": 0,
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 1
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
@@ -625,7 +625,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-11-28 12:22:34.151430",
|
"modified": "2018-06-18 16:12:04.330021",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Assets",
|
"module": "Assets",
|
||||||
"name": "Asset Maintenance Task",
|
"name": "Asset Maintenance Task",
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ import frappe
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class AssetMaintenanceTask(Document):
|
class AssetMaintenanceTask(Document):
|
||||||
pass
|
def autoname(self):
|
||||||
|
self.name = self.maintenance_task
|
||||||
|
|||||||
@@ -459,6 +459,7 @@ class BuyingController(StockController):
|
|||||||
|
|
||||||
def validate_items(self):
|
def validate_items(self):
|
||||||
# validate items to see if they have is_purchase_item or is_subcontracted_item enabled
|
# validate items to see if they have is_purchase_item or is_subcontracted_item enabled
|
||||||
|
if self.doctype=="Material Request": return
|
||||||
|
|
||||||
if hasattr(self, "is_subcontracted") and self.is_subcontracted == 'Yes':
|
if hasattr(self, "is_subcontracted") and self.is_subcontracted == 'Yes':
|
||||||
validate_item_type(self, "is_sub_contracted_item", "subcontracted")
|
validate_item_type(self, "is_sub_contracted_item", "subcontracted")
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class LeaveApplication(Document):
|
|||||||
frappe.db.sql("""update `tabAttendance` set status = %s, leave_type = %s\
|
frappe.db.sql("""update `tabAttendance` set status = %s, leave_type = %s\
|
||||||
where name = %s""",(status, self.leave_type, d.name))
|
where name = %s""",(status, self.leave_type, d.name))
|
||||||
|
|
||||||
elif self.to_date <= nowdate():
|
elif getdate(self.to_date) <= getdate(nowdate()):
|
||||||
for dt in daterange(getdate(self.from_date), getdate(self.to_date)):
|
for dt in daterange(getdate(self.from_date), getdate(self.to_date)):
|
||||||
date = dt.strftime("%Y-%m-%d")
|
date = dt.strftime("%Y-%m-%d")
|
||||||
if not date == self.half_day_date:
|
if not date == self.half_day_date:
|
||||||
|
|||||||
@@ -420,9 +420,10 @@ def get_timesheets_list(doctype, txt, filters, limit_start, limit_page_length=20
|
|||||||
# find customer name from contact.
|
# find customer name from contact.
|
||||||
customer = frappe.db.sql('''SELECT dl.link_name FROM `tabContact` AS c inner join \
|
customer = frappe.db.sql('''SELECT dl.link_name FROM `tabContact` AS c inner join \
|
||||||
`tabDynamic Link` AS dl ON c.first_name=dl.link_name WHERE c.email_id=%s''',user)
|
`tabDynamic Link` AS dl ON c.first_name=dl.link_name WHERE c.email_id=%s''',user)
|
||||||
# find list of Sales Invoice for made for customer.
|
|
||||||
sales_invoice = frappe.db.sql('''SELECT name FROM `tabSales Invoice` WHERE customer = %s''',customer)
|
|
||||||
if customer:
|
if customer:
|
||||||
|
# find list of Sales Invoice for made for customer.
|
||||||
|
sales_invoice = frappe.db.sql('''SELECT name FROM `tabSales Invoice` WHERE customer = %s''',customer)
|
||||||
# Return timesheet related data to web portal.
|
# Return timesheet related data to web portal.
|
||||||
return frappe. db.sql('''SELECT ts.name, tsd.activity_type, ts.status, ts.total_billable_hours, \
|
return frappe. db.sql('''SELECT ts.name, tsd.activity_type, ts.status, ts.total_billable_hours, \
|
||||||
tsd.sales_invoice, tsd.project FROM `tabTimesheet` AS ts inner join `tabTimesheet Detail` \
|
tsd.sales_invoice, tsd.project FROM `tabTimesheet` AS ts inner join `tabTimesheet Detail` \
|
||||||
|
|||||||
@@ -339,11 +339,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
|||||||
set_item_wise_tax: function(item, tax, tax_rate, current_tax_amount) {
|
set_item_wise_tax: function(item, tax, tax_rate, current_tax_amount) {
|
||||||
// store tax breakup for each item
|
// store tax breakup for each item
|
||||||
let tax_detail = tax.item_wise_tax_detail;
|
let tax_detail = tax.item_wise_tax_detail;
|
||||||
|
let key = item.item_code || item.item_name;
|
||||||
let key = item.item_code;
|
|
||||||
if(item.item_name && !Object.keys(tax_detail).includes(item.item_name)) {
|
|
||||||
key = item.item_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
let item_wise_tax_amount = current_tax_amount * this.frm.doc.conversion_rate;
|
let item_wise_tax_amount = current_tax_amount * this.frm.doc.conversion_rate;
|
||||||
if (tax_detail && tax_detail[key])
|
if (tax_detail && tax_detail[key])
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ def _make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
|
|||||||
target.run_method("calculate_taxes_and_totals")
|
target.run_method("calculate_taxes_and_totals")
|
||||||
|
|
||||||
def update_item(obj, target, source_parent):
|
def update_item(obj, target, source_parent):
|
||||||
|
target.cost_center = None
|
||||||
target.stock_qty = flt(obj.qty) * flt(obj.conversion_factor)
|
target.stock_qty = flt(obj.qty) * flt(obj.conversion_factor)
|
||||||
|
|
||||||
doclist = get_mapped_doc("Quotation", source_name, {
|
doclist = get_mapped_doc("Quotation", source_name, {
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 3,
|
"idx": 3,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2017-02-24 20:08:44.614482",
|
"modified": "2018-06-18 16:42:05.860309",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Item-wise Sales History",
|
"name": "Item-wise Sales History",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"query": "select\n so_item.item_code as \"Item Code:Link/Item:120\",\n\tso_item.item_name as \"Item Name::120\",\n so_item.item_group as \"Item Group:Link/Item Group:120\",\n\tso_item.description as \"Description::150\",\n\tso_item.qty as \"Qty:Float:100\",\n\tso_item.stock_uom as \"UOM:Link/UOM:80\",\n\tso_item.base_rate as \"Rate:Currency:120\",\n\tso_item.base_amount as \"Amount:Currency:120\",\n\tso.name as \"Sales Order:Link/Sales Order:120\",\n\tso.transaction_date as \"Transaction Date:Date:140\",\n\tso.customer as \"Customer:Link/Customer:130\",\n cu.customer_name as \"Customer Name::150\",\n\tso.territory as \"Territory:Link/Territory:130\",\n so.project as \"Project:Link/Project:130\",\n\tifnull(so_item.delivered_qty, 0) as \"Delivered Qty:Float:120\",\n\tifnull(so_item.billed_amt, 0) as \"Billed Amount:Currency:120\",\n\tso.company as \"Company:Link/Company:\"\nfrom\n\t`tabSales Order` so, `tabSales Order Item` so_item, `tabCustomer` cu\nwhere\n\tso.name = so_item.parent and so.customer=cu.name\n\tand so.docstatus = 1\norder by so.name desc",
|
"query": "select\n so_item.item_code as \"Item Code:Link/Item:120\",\n\tso_item.item_name as \"Item Name::120\",\n so_item.item_group as \"Item Group:Link/Item Group:120\",\n\tso_item.description as \"Description::150\",\n\tso_item.qty as \"Qty:Data:100\",\n\tso_item.uom as \"UOM:Link/UOM:80\",\n\tso_item.base_rate as \"Rate:Currency:120\",\n\tso_item.base_amount as \"Amount:Currency:120\",\n\tso.name as \"Sales Order:Link/Sales Order:120\",\n\tso.transaction_date as \"Transaction Date:Date:140\",\n\tso.customer as \"Customer:Link/Customer:130\",\n cu.customer_name as \"Customer Name::150\",\n\tso.territory as \"Territory:Link/Territory:130\",\n so.project as \"Project:Link/Project:130\",\n\tifnull(so_item.delivered_qty, 0) as \"Delivered Qty:Float:120\",\n\tifnull(so_item.billed_amt, 0) as \"Billed Amount:Currency:120\",\n\tso.company as \"Company:Link/Company:\"\nfrom\n\t`tabSales Order` so, `tabSales Order Item` so_item, `tabCustomer` cu\nwhere\n\tso.name = so_item.parent and so.customer=cu.name\n\tand so.docstatus = 1\norder by so.name desc",
|
||||||
"ref_doctype": "Sales Order",
|
"ref_doctype": "Sales Order",
|
||||||
"report_name": "Item-wise Sales History",
|
"report_name": "Item-wise Sales History",
|
||||||
"report_type": "Query Report",
|
"report_type": "Query Report",
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class AuthorizationControl(TransactionBase):
|
|||||||
chk = 1
|
chk = 1
|
||||||
add_cond1,add_cond2 = '',''
|
add_cond1,add_cond2 = '',''
|
||||||
if based_on == 'Itemwise Discount':
|
if based_on == 'Itemwise Discount':
|
||||||
add_cond1 += " and master_name = '"+cstr(frappe.db.escape(item)).replace("'", "\\'")+"'"
|
add_cond1 += " and master_name = '"+frappe.db.escape(cstr(item))+"'"
|
||||||
itemwise_exists = frappe.db.sql("""select value from `tabAuthorization Rule`
|
itemwise_exists = frappe.db.sql("""select value from `tabAuthorization Rule`
|
||||||
where transaction = %s and value <= %s
|
where transaction = %s and value <= %s
|
||||||
and based_on = %s and company = %s and docstatus != 2 %s %s""" %
|
and based_on = %s and company = %s and docstatus != 2 %s %s""" %
|
||||||
|
|||||||
Reference in New Issue
Block a user