mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 03:39:11 +00:00
Merge branch 'hotfix' of https://github.com/frappe/erpnext into payment_entry
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__ = '11.1.17'
|
__version__ = '11.1.18'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
|||||||
@@ -112,6 +112,8 @@ class Account(NestedSet):
|
|||||||
["company", "name"], as_dict=True):
|
["company", "name"], as_dict=True):
|
||||||
acc_name_map[d["company"]] = d["name"]
|
acc_name_map[d["company"]] = d["name"]
|
||||||
|
|
||||||
|
if not acc_name_map: return
|
||||||
|
|
||||||
for company in descendants:
|
for company in descendants:
|
||||||
doc = frappe.copy_doc(self)
|
doc = frappe.copy_doc(self)
|
||||||
doc.flags.ignore_root_company_validation = True
|
doc.flags.ignore_root_company_validation = True
|
||||||
|
|||||||
@@ -23,36 +23,36 @@ class BankReconciliation(Document):
|
|||||||
|
|
||||||
|
|
||||||
journal_entries = frappe.db.sql("""
|
journal_entries = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
"Journal Entry" as payment_document, t1.name as payment_entry,
|
"Journal Entry" as payment_document, t1.name as payment_entry,
|
||||||
t1.cheque_no as cheque_number, t1.cheque_date,
|
t1.cheque_no as cheque_number, t1.cheque_date,
|
||||||
sum(t2.debit_in_account_currency) as debit, sum(t2.credit_in_account_currency) as credit,
|
sum(t2.debit_in_account_currency) as debit, sum(t2.credit_in_account_currency) as credit,
|
||||||
t1.posting_date, t2.against_account, t1.clearance_date, t2.account_currency
|
t1.posting_date, t2.against_account, t1.clearance_date, t2.account_currency
|
||||||
from
|
from
|
||||||
`tabJournal Entry` t1, `tabJournal Entry Account` t2
|
`tabJournal Entry` t1, `tabJournal Entry Account` t2
|
||||||
where
|
where
|
||||||
t2.parent = t1.name and t2.account = %s and t1.docstatus=1
|
t2.parent = t1.name and t2.account = %s and t1.docstatus=1
|
||||||
and t1.posting_date >= %s and t1.posting_date <= %s
|
and t1.posting_date >= %s and t1.posting_date <= %s
|
||||||
and ifnull(t1.is_opening, 'No') = 'No' {0}
|
and ifnull(t1.is_opening, 'No') = 'No' {0}
|
||||||
group by t2.account, t1.name
|
group by t2.account, t1.name
|
||||||
order by t1.posting_date ASC, t1.name DESC
|
order by t1.posting_date ASC, t1.name DESC
|
||||||
""".format(condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
|
""".format(condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
|
||||||
|
|
||||||
payment_entries = frappe.db.sql("""
|
payment_entries = frappe.db.sql("""
|
||||||
select
|
select
|
||||||
"Payment Entry" as payment_document, name as payment_entry,
|
"Payment Entry" as payment_document, name as payment_entry,
|
||||||
reference_no as cheque_number, reference_date as cheque_date,
|
reference_no as cheque_number, reference_date as cheque_date,
|
||||||
if(paid_from=%(account)s, paid_amount, "") as credit,
|
if(paid_from=%(account)s, paid_amount, 0) as credit,
|
||||||
if(paid_from=%(account)s, "", received_amount) as debit,
|
if(paid_from=%(account)s, 0, received_amount) as debit,
|
||||||
posting_date, ifnull(party,if(paid_from=%(account)s,paid_to,paid_from)) as against_account, clearance_date,
|
posting_date, ifnull(party,if(paid_from=%(account)s,paid_to,paid_from)) as against_account, clearance_date,
|
||||||
if(paid_to=%(account)s, paid_to_account_currency, paid_from_account_currency) as account_currency
|
if(paid_to=%(account)s, paid_to_account_currency, paid_from_account_currency) as account_currency
|
||||||
from `tabPayment Entry`
|
from `tabPayment Entry`
|
||||||
where
|
where
|
||||||
(paid_from=%(account)s or paid_to=%(account)s) and docstatus=1
|
(paid_from=%(account)s or paid_to=%(account)s) and docstatus=1
|
||||||
and posting_date >= %(from)s and posting_date <= %(to)s {0}
|
and posting_date >= %(from)s and posting_date <= %(to)s {0}
|
||||||
order by
|
order by
|
||||||
posting_date ASC, name DESC
|
posting_date ASC, name DESC
|
||||||
""".format(condition),
|
""".format(condition),
|
||||||
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
|
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
|
||||||
|
|
||||||
pos_entries = []
|
pos_entries = []
|
||||||
@@ -107,10 +107,10 @@ class BankReconciliation(Document):
|
|||||||
d.clearance_date = None
|
d.clearance_date = None
|
||||||
|
|
||||||
frappe.db.set_value(d.payment_document, d.payment_entry, "clearance_date", d.clearance_date)
|
frappe.db.set_value(d.payment_document, d.payment_entry, "clearance_date", d.clearance_date)
|
||||||
frappe.db.sql("""update `tab{0}` set clearance_date = %s, modified = %s
|
frappe.db.sql("""update `tab{0}` set clearance_date = %s, modified = %s
|
||||||
where name=%s""".format(d.payment_document),
|
where name=%s""".format(d.payment_document),
|
||||||
(d.clearance_date, nowdate(), d.payment_entry))
|
(d.clearance_date, nowdate(), d.payment_entry))
|
||||||
|
|
||||||
clearance_date_updated = True
|
clearance_date_updated = True
|
||||||
|
|
||||||
if clearance_date_updated:
|
if clearance_date_updated:
|
||||||
|
|||||||
@@ -55,12 +55,15 @@ def get_result(filters):
|
|||||||
supplier = supplier_map[d]
|
supplier = supplier_map[d]
|
||||||
|
|
||||||
tds_doc = tds_docs[supplier.tax_withholding_category]
|
tds_doc = tds_docs[supplier.tax_withholding_category]
|
||||||
account = [i.account for i in tds_doc.accounts if i.company == filters.company][0]
|
account_list = [i.account for i in tds_doc.accounts if i.company == filters.company]
|
||||||
|
|
||||||
|
if account_list:
|
||||||
|
account = account_list[0]
|
||||||
|
|
||||||
for k in gle_map[d]:
|
for k in gle_map[d]:
|
||||||
if k.party == supplier_map[d] and k.credit > 0:
|
if k.party == supplier_map[d] and k.credit > 0:
|
||||||
total_amount_credited += k.credit
|
total_amount_credited += k.credit
|
||||||
elif k.account == account and k.credit > 0:
|
elif account_list and k.account == account and k.credit > 0:
|
||||||
tds_deducted = k.credit
|
tds_deducted = k.credit
|
||||||
total_amount_credited += k.credit
|
total_amount_credited += k.credit
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class WoocommerceSettings(Document):
|
|||||||
if not frappe.get_value("Item Group",{"name": "WooCommerce Products"}):
|
if not frappe.get_value("Item Group",{"name": "WooCommerce Products"}):
|
||||||
item_group = frappe.new_doc("Item Group")
|
item_group = frappe.new_doc("Item Group")
|
||||||
item_group.item_group_name = "WooCommerce Products"
|
item_group.item_group_name = "WooCommerce Products"
|
||||||
item_group.parent_item_group = "All Item Groups"
|
item_group.parent_item_group = _("All Item Groups")
|
||||||
item_group.save()
|
item_group.save()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ frappe.ui.form.on('Healthcare Service Unit Type', {
|
|||||||
var disable = function(frm){
|
var disable = function(frm){
|
||||||
var doc = frm.doc;
|
var doc = frm.doc;
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.healthcare.doctype.healthcare_service_unit_type.healthcare_service_unit_type.disable_enable",
|
method: "erpnext.healthcare.doctype.healthcare_service_unit_type.healthcare_service_unit_type.disable_enable",
|
||||||
args: {status: 1, doc_name: doc.name, item: doc.item, is_billable: doc.is_billable},
|
args: {status: 1, doc_name: doc.name, item: doc.item, is_billable: doc.is_billable},
|
||||||
callback: function(){
|
callback: function(){
|
||||||
cur_frm.reload_doc();
|
cur_frm.reload_doc();
|
||||||
@@ -60,7 +60,7 @@ var disable = function(frm){
|
|||||||
var enable = function(frm){
|
var enable = function(frm){
|
||||||
var doc = frm.doc;
|
var doc = frm.doc;
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.healthcare.doctype.healthcare_service_unit_type.healthcare_service_unit_type.disable_enable",
|
method: "erpnext.healthcare.doctype.healthcare_service_unit_type.healthcare_service_unit_type.disable_enable",
|
||||||
args: {status: 0, doc_name: doc.name, item: doc.item, is_billable: doc.is_billable},
|
args: {status: 0, doc_name: doc.name, item: doc.item, is_billable: doc.is_billable},
|
||||||
callback: function(){
|
callback: function(){
|
||||||
cur_frm.reload_doc();
|
cur_frm.reload_doc();
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ def change_item_code(item, item_code, doc_name):
|
|||||||
frappe.db.set_value("Healthcare Service Unit Type", doc_name, "item_code", item_code)
|
frappe.db.set_value("Healthcare Service Unit Type", doc_name, "item_code", item_code)
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def disable_enable(status, doc_name, item, is_billable):
|
def disable_enable(status, doc_name, item=None, is_billable=None):
|
||||||
frappe.db.set_value("Healthcare Service Unit Type", doc_name, "disabled", status)
|
frappe.db.set_value("Healthcare Service Unit Type", doc_name, "disabled", status)
|
||||||
if(is_billable == 1):
|
if(is_billable == 1):
|
||||||
frappe.db.set_value("Item", item, "disabled", status)
|
frappe.db.set_value("Item", item, "disabled", status)
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ def add_department_leaves(events, start, end, employee, company):
|
|||||||
department_employees = frappe.db.sql_list("""select name from tabEmployee where department=%s
|
department_employees = frappe.db.sql_list("""select name from tabEmployee where department=%s
|
||||||
and company=%s""", (department, company))
|
and company=%s""", (department, company))
|
||||||
|
|
||||||
filter_conditions = "employee in (\"%s\")" % '", "'.join(department_employees)
|
filter_conditions = " and employee in (\"%s\")" % '", "'.join(department_employees)
|
||||||
add_leaves(events, start, end, filter_conditions=filter_conditions)
|
add_leaves(events, start, end, filter_conditions=filter_conditions)
|
||||||
|
|
||||||
def add_leaves(events, start, end, filter_conditions=None):
|
def add_leaves(events, start, end, filter_conditions=None):
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ class SalarySlip(TransactionBase):
|
|||||||
def calculate_net_pay(self):
|
def calculate_net_pay(self):
|
||||||
if self.salary_structure:
|
if self.salary_structure:
|
||||||
self.calculate_component_amounts()
|
self.calculate_component_amounts()
|
||||||
|
|
||||||
disable_rounded_total = cint(frappe.db.get_value("Global Defaults", None, "disable_rounded_total"))
|
disable_rounded_total = cint(frappe.db.get_value("Global Defaults", None, "disable_rounded_total"))
|
||||||
precision = frappe.defaults.get_global_default("currency_precision")
|
precision = frappe.defaults.get_global_default("currency_precision")
|
||||||
self.total_deduction = 0
|
self.total_deduction = 0
|
||||||
@@ -452,10 +452,10 @@ class SalarySlip(TransactionBase):
|
|||||||
|
|
||||||
self.set_loan_repayment()
|
self.set_loan_repayment()
|
||||||
|
|
||||||
self.net_pay = flt(self.gross_pay) - (flt(self.total_deduction) + flt(self.total_loan_repayment))
|
self.net_pay = (flt(self.gross_pay) - (flt(self.total_deduction) + flt(self.total_loan_repayment))) * flt(self.payment_days / self.total_working_days)
|
||||||
self.rounded_total = rounded(self.net_pay,
|
self.rounded_total = rounded(self.net_pay,
|
||||||
self.precision("net_pay") if disable_rounded_total else 0)
|
self.precision("net_pay") if disable_rounded_total else 0)
|
||||||
|
|
||||||
if self.net_pay < 0:
|
if self.net_pay < 0:
|
||||||
frappe.throw(_("Net Pay cannnot be negative"))
|
frappe.throw(_("Net Pay cannnot be negative"))
|
||||||
|
|
||||||
|
|||||||
@@ -618,7 +618,7 @@ def get_bom_items_as_dict(bom, company, qty=1, fetch_exploded=1, fetch_scrap_ite
|
|||||||
is_stock_item=is_stock_item,
|
is_stock_item=is_stock_item,
|
||||||
qty_field="stock_qty",
|
qty_field="stock_qty",
|
||||||
select_columns = """, bom_item.source_warehouse, bom_item.operation, bom_item.include_item_in_manufacturing,
|
select_columns = """, bom_item.source_warehouse, bom_item.operation, bom_item.include_item_in_manufacturing,
|
||||||
(Select idx from `tabBOM Item` where item_code = bom_item.item_code and parent = %(parent)s ) as idx""")
|
(Select idx from `tabBOM Item` where item_code = bom_item.item_code and parent = %(parent)s limit 1) as idx""")
|
||||||
|
|
||||||
items = frappe.db.sql(query, { "parent": bom, "qty": qty, "bom": bom, "company": company }, as_dict=True)
|
items = frappe.db.sql(query, { "parent": bom, "qty": qty, "bom": bom, "company": company }, as_dict=True)
|
||||||
elif fetch_scrap_items:
|
elif fetch_scrap_items:
|
||||||
|
|||||||
@@ -159,6 +159,13 @@ class Task(NestedSet):
|
|||||||
|
|
||||||
self.update_nsm_model()
|
self.update_nsm_model()
|
||||||
|
|
||||||
|
def update_status(self):
|
||||||
|
if self.status not in ('Cancelled', 'Closed') and self.exp_end_date:
|
||||||
|
from datetime import datetime
|
||||||
|
if self.exp_end_date < datetime.now().date():
|
||||||
|
self.db_set('status', 'Overdue')
|
||||||
|
self.update_project()
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def check_if_child_exists(name):
|
def check_if_child_exists(name):
|
||||||
child_tasks = frappe.get_all("Task", filters={"parent_task": name})
|
child_tasks = frappe.get_all("Task", filters={"parent_task": name})
|
||||||
@@ -186,10 +193,9 @@ def set_multiple_status(names, status):
|
|||||||
task.save()
|
task.save()
|
||||||
|
|
||||||
def set_tasks_as_overdue():
|
def set_tasks_as_overdue():
|
||||||
frappe.db.sql("""update tabTask set `status`='Overdue'
|
tasks = frappe.get_all("Task", filters={'status':['not in',['Cancelled', 'Closed']]})
|
||||||
where exp_end_date is not null
|
for task in tasks:
|
||||||
and exp_end_date < CURDATE()
|
frappe.get_doc("Task", task.name).update_status()
|
||||||
and `status` not in ('Closed', 'Cancelled')""")
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_children(doctype, parent, task=None, project=None, is_root=False):
|
def get_children(doctype, parent, task=None, project=None, is_root=False):
|
||||||
|
|||||||
@@ -117,4 +117,4 @@ def create_task(subject, start=None, end=None, depends_on=None, project=None, sa
|
|||||||
if save:
|
if save:
|
||||||
task.save()
|
task.save()
|
||||||
|
|
||||||
return task
|
return task
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"brand": "_Test Brand",
|
"brand": "_Test Brand",
|
||||||
"doctype": "Brand"
|
"doctype": "Brand"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -758,6 +758,9 @@ class Item(WebsiteGenerator):
|
|||||||
d.conversion_factor = value
|
d.conversion_factor = value
|
||||||
|
|
||||||
def validate_attributes(self):
|
def validate_attributes(self):
|
||||||
|
if not self.variant_based_on:
|
||||||
|
self.variant_based_on = 'Item Attribute'
|
||||||
|
|
||||||
if (self.has_variants or self.variant_of) and self.variant_based_on == 'Item Attribute':
|
if (self.has_variants or self.variant_of) and self.variant_based_on == 'Item Attribute':
|
||||||
attributes = []
|
attributes = []
|
||||||
if not self.attributes:
|
if not self.attributes:
|
||||||
@@ -780,7 +783,7 @@ class Item(WebsiteGenerator):
|
|||||||
variant = get_variant(self.variant_of, args, self.name)
|
variant = get_variant(self.variant_of, args, self.name)
|
||||||
if variant:
|
if variant:
|
||||||
frappe.throw(_("Item variant {0} exists with same attributes")
|
frappe.throw(_("Item variant {0} exists with same attributes")
|
||||||
.format(variant), ItemVariantExistsError)
|
.format(variant), ItemVariantExistsError)
|
||||||
|
|
||||||
validate_item_variant_attributes(self, args)
|
validate_item_variant_attributes(self, args)
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ from erpnext.stock.get_item_details import get_item_details
|
|||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
|
||||||
test_ignore = ["BOM"]
|
test_ignore = ["BOM"]
|
||||||
test_dependencies = ["Warehouse", "Item Group"]
|
test_dependencies = ["Warehouse", "Item Group", "Brand"]
|
||||||
|
|
||||||
def make_item(item_code, properties=None):
|
def make_item(item_code, properties=None):
|
||||||
if frappe.db.exists("Item", item_code):
|
if frappe.db.exists("Item", item_code):
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<p class='text-muted'>Please update your GSTIN for us to issue correct tax invoice</p>
|
<p class='text-muted'>Please update your GSTIN for us to issue correct tax invoice</p>
|
||||||
<form method='GET' action='/regional/india/update-gstin.html'>
|
<form method='GET' action='/regional/india/update-gstin.html'>
|
||||||
<input type='hidden' value='{{ party.name }}' name='party'>
|
<input type='hidden' value='{{ party.name }}' name='party'>
|
||||||
{% for address in party.__onload.addr_list %}
|
{% for address in party.get_onload('addr_list') %}
|
||||||
<div class='bordered' style='max-width: 300px; margin-bottom: 15px;'>
|
<div class='bordered' style='max-width: 300px; margin-bottom: 15px;'>
|
||||||
{{ address.display }}
|
{{ address.display }}
|
||||||
<p><input type='text' class='form-control'
|
<p><input type='text' class='form-control'
|
||||||
|
|||||||
Reference in New Issue
Block a user