fixed merge conflict
This commit is contained in:
commit
46753de6d7
@ -2,7 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
__version__ = '7.1.13'
|
__version__ = '7.1.14'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -73,7 +73,16 @@ class JournalEntry(AccountsController):
|
|||||||
self.make_gl_entries(1)
|
self.make_gl_entries(1)
|
||||||
self.update_advance_paid()
|
self.update_advance_paid()
|
||||||
self.update_expense_claim()
|
self.update_expense_claim()
|
||||||
|
self.unlink_advance_entry_reference()
|
||||||
|
|
||||||
|
def unlink_advance_entry_reference(self):
|
||||||
|
for d in self.get("accounts"):
|
||||||
|
if d.is_advance and d.reference_type in ("Sales Invoice", "Purchase Invoice"):
|
||||||
|
doc = frappe.get_doc(d.reference_type, d.reference_name)
|
||||||
|
doc.delink_advance_entries(self.name)
|
||||||
|
d.reference_type = ''
|
||||||
|
d.reference_name = ''
|
||||||
|
d.db_update()
|
||||||
|
|
||||||
def validate_party(self):
|
def validate_party(self):
|
||||||
for d in self.get("accounts"):
|
for d in self.get("accounts"):
|
||||||
|
@ -406,7 +406,10 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
|
|
||||||
if(!frm.doc.paid_amount && frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) {
|
if(!frm.doc.paid_amount && frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency) {
|
||||||
frm.set_value("paid_amount", frm.doc.received_amount);
|
frm.set_value("paid_amount", frm.doc.received_amount);
|
||||||
frm.set_value("source_exchange_rate", frm.doc.target_exchange_rate);
|
|
||||||
|
if(frm.doc.target_exchange_rate) {
|
||||||
|
frm.set_value("source_exchange_rate", frm.doc.target_exchange_rate);
|
||||||
|
}
|
||||||
frm.set_value("base_paid_amount", frm.doc.base_received_amount);
|
frm.set_value("base_paid_amount", frm.doc.base_received_amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,7 +429,10 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency)) {
|
(frm.doc.paid_from_account_currency == frm.doc.paid_to_account_currency)) {
|
||||||
|
|
||||||
frm.set_value("received_amount", frm.doc.paid_amount);
|
frm.set_value("received_amount", frm.doc.paid_amount);
|
||||||
frm.set_value("target_exchange_rate", frm.doc.source_exchange_rate);
|
|
||||||
|
if(frm.doc.source_exchange_rate) {
|
||||||
|
frm.set_value("target_exchange_rate", frm.doc.source_exchange_rate);
|
||||||
|
}
|
||||||
frm.set_value("base_received_amount", frm.doc.base_paid_amount);
|
frm.set_value("base_received_amount", frm.doc.base_paid_amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,13 @@ class PaymentEntry(AccountsController):
|
|||||||
self.setup_party_account_field()
|
self.setup_party_account_field()
|
||||||
self.make_gl_entries(cancel=1)
|
self.make_gl_entries(cancel=1)
|
||||||
self.update_advance_paid()
|
self.update_advance_paid()
|
||||||
|
self.delink_advance_entry_references()
|
||||||
|
|
||||||
|
def delink_advance_entry_references(self):
|
||||||
|
for reference in self.references:
|
||||||
|
if reference.reference_doctype in ("Sales Invoice", "Purchase Invoice"):
|
||||||
|
doc = frappe.get_doc(reference.reference_doctype, reference.reference_name)
|
||||||
|
doc.delink_advance_entries(self.name)
|
||||||
|
|
||||||
def set_missing_values(self):
|
def set_missing_values(self):
|
||||||
if self.payment_type == "Internal Transfer":
|
if self.payment_type == "Internal Transfer":
|
||||||
|
@ -438,6 +438,85 @@ class TestPurchaseInvoice(unittest.TestCase):
|
|||||||
self.assertEquals(frappe.db.get_value("Serial No", pi.get("items")[0].rejected_serial_no,
|
self.assertEquals(frappe.db.get_value("Serial No", pi.get("items")[0].rejected_serial_no,
|
||||||
"warehouse"), pi.get("items")[0].rejected_warehouse)
|
"warehouse"), pi.get("items")[0].rejected_warehouse)
|
||||||
|
|
||||||
|
def test_outstanding_amount_after_advance_jv_cancelation(self):
|
||||||
|
from erpnext.accounts.doctype.journal_entry.test_journal_entry \
|
||||||
|
import test_records as jv_test_records
|
||||||
|
|
||||||
|
jv = frappe.copy_doc(jv_test_records[1])
|
||||||
|
jv.insert()
|
||||||
|
jv.submit()
|
||||||
|
|
||||||
|
pi = frappe.copy_doc(test_records[0])
|
||||||
|
pi.append("advances", {
|
||||||
|
"reference_type": "Journal Entry",
|
||||||
|
"reference_name": jv.name,
|
||||||
|
"reference_row": jv.get("accounts")[0].name,
|
||||||
|
"advance_amount": 400,
|
||||||
|
"allocated_amount": 300,
|
||||||
|
"remarks": jv.remark
|
||||||
|
})
|
||||||
|
pi.insert()
|
||||||
|
pi.submit()
|
||||||
|
pi.load_from_db()
|
||||||
|
|
||||||
|
#check outstanding after advance allocation
|
||||||
|
self.assertEqual(flt(pi.outstanding_amount), flt(pi.grand_total - pi.total_advance))
|
||||||
|
|
||||||
|
#added to avoid Document has been modified exception
|
||||||
|
jv = frappe.get_doc("Journal Entry", jv.name)
|
||||||
|
jv.cancel()
|
||||||
|
|
||||||
|
pi.load_from_db()
|
||||||
|
#check outstanding after advance cancellation
|
||||||
|
self.assertEqual(flt(pi.outstanding_amount), flt(pi.grand_total + pi.total_advance))
|
||||||
|
|
||||||
|
def test_outstanding_amount_after_advance_payment_entry_cancelation(self):
|
||||||
|
pe = frappe.get_doc({
|
||||||
|
"doctype": "Payment Entry",
|
||||||
|
"payment_type": "Pay",
|
||||||
|
"party_type": "Supplier",
|
||||||
|
"party": "_Test Supplier",
|
||||||
|
"company": "_Test Company",
|
||||||
|
"paid_from_account_currency": "INR",
|
||||||
|
"paid_to_account_currency": "INR",
|
||||||
|
"source_exchange_rate": 1,
|
||||||
|
"target_exchange_rate": 1,
|
||||||
|
"reference_no": "1",
|
||||||
|
"reference_date": nowdate(),
|
||||||
|
"received_amount": 300,
|
||||||
|
"paid_amount": 300,
|
||||||
|
"paid_from": "_Test Cash - _TC",
|
||||||
|
"paid_to": "_Test Payable - _TC"
|
||||||
|
})
|
||||||
|
pe.insert()
|
||||||
|
pe.submit()
|
||||||
|
|
||||||
|
pi = frappe.copy_doc(test_records[0])
|
||||||
|
pi.is_pos = 0
|
||||||
|
pi.append("advances", {
|
||||||
|
"doctype": "Purchase Invoice Advance",
|
||||||
|
"reference_type": "Payment Entry",
|
||||||
|
"reference_name": pe.name,
|
||||||
|
"advance_amount": 300,
|
||||||
|
"allocated_amount": 300,
|
||||||
|
"remarks": pe.remarks
|
||||||
|
})
|
||||||
|
pi.insert()
|
||||||
|
pi.submit()
|
||||||
|
|
||||||
|
pi.load_from_db()
|
||||||
|
|
||||||
|
#check outstanding after advance allocation
|
||||||
|
self.assertEqual(flt(pi.outstanding_amount), flt(pi.grand_total - pi.total_advance))
|
||||||
|
|
||||||
|
#added to avoid Document has been modified exception
|
||||||
|
pe = frappe.get_doc("Payment Entry", pe.name)
|
||||||
|
pe.cancel()
|
||||||
|
|
||||||
|
pi.load_from_db()
|
||||||
|
#check outstanding after advance cancellation
|
||||||
|
self.assertEqual(flt(pi.outstanding_amount), flt(pi.grand_total + pi.total_advance))
|
||||||
|
|
||||||
def unlink_payment_on_cancel_of_invoice(enable=1):
|
def unlink_payment_on_cancel_of_invoice(enable=1):
|
||||||
accounts_settings = frappe.get_doc("Accounts Settings")
|
accounts_settings = frappe.get_doc("Accounts Settings")
|
||||||
accounts_settings.unlink_payment_on_cancellation_of_invoice = enable
|
accounts_settings.unlink_payment_on_cancellation_of_invoice = enable
|
||||||
|
@ -981,6 +981,86 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Active')
|
self.assertEquals(frappe.db.get_value('Customer', customer.name, 'status'), 'Active')
|
||||||
|
|
||||||
|
def test_outstanding_amount_after_advance_jv_cancelation(self):
|
||||||
|
from erpnext.accounts.doctype.journal_entry.test_journal_entry \
|
||||||
|
import test_records as jv_test_records
|
||||||
|
|
||||||
|
jv = frappe.copy_doc(jv_test_records[0])
|
||||||
|
jv.insert()
|
||||||
|
jv.submit()
|
||||||
|
|
||||||
|
si = frappe.copy_doc(test_records[0])
|
||||||
|
si.append("advances", {
|
||||||
|
"doctype": "Sales Invoice Advance",
|
||||||
|
"reference_type": "Journal Entry",
|
||||||
|
"reference_name": jv.name,
|
||||||
|
"reference_row": jv.get("accounts")[0].name,
|
||||||
|
"advance_amount": 400,
|
||||||
|
"allocated_amount": 300,
|
||||||
|
"remarks": jv.remark
|
||||||
|
})
|
||||||
|
si.insert()
|
||||||
|
si.submit()
|
||||||
|
si.load_from_db()
|
||||||
|
|
||||||
|
#check outstanding after advance allocation
|
||||||
|
self.assertEqual(flt(si.outstanding_amount), flt(si.grand_total - si.total_advance, si.precision("outstanding_amount")))
|
||||||
|
|
||||||
|
#added to avoid Document has been modified exception
|
||||||
|
jv = frappe.get_doc("Journal Entry", jv.name)
|
||||||
|
jv.cancel()
|
||||||
|
|
||||||
|
si.load_from_db()
|
||||||
|
#check outstanding after advance cancellation
|
||||||
|
self.assertEqual(flt(si.outstanding_amount), flt(si.grand_total + si.total_advance, si.precision("outstanding_amount")))
|
||||||
|
|
||||||
|
def test_outstanding_amount_after_advance_payment_entry_cancelation(self):
|
||||||
|
pe = frappe.get_doc({
|
||||||
|
"doctype": "Payment Entry",
|
||||||
|
"payment_type": "Receive",
|
||||||
|
"party_type": "Customer",
|
||||||
|
"party": "_Test Customer",
|
||||||
|
"company": "_Test Company",
|
||||||
|
"paid_from_account_currency": "INR",
|
||||||
|
"paid_to_account_currency": "INR",
|
||||||
|
"source_exchange_rate": 1,
|
||||||
|
"target_exchange_rate": 1,
|
||||||
|
"reference_no": "1",
|
||||||
|
"reference_date": nowdate(),
|
||||||
|
"received_amount": 300,
|
||||||
|
"paid_amount": 300,
|
||||||
|
"paid_from": "_Test Receivable - _TC",
|
||||||
|
"paid_to": "_Test Cash - _TC"
|
||||||
|
})
|
||||||
|
pe.insert()
|
||||||
|
pe.submit()
|
||||||
|
|
||||||
|
si = frappe.copy_doc(test_records[0])
|
||||||
|
si.is_pos = 0
|
||||||
|
si.append("advances", {
|
||||||
|
"doctype": "Sales Invoice Advance",
|
||||||
|
"reference_type": "Payment Entry",
|
||||||
|
"reference_name": pe.name,
|
||||||
|
"advance_amount": 300,
|
||||||
|
"allocated_amount": 300,
|
||||||
|
"remarks": pe.remarks
|
||||||
|
})
|
||||||
|
si.insert()
|
||||||
|
si.submit()
|
||||||
|
|
||||||
|
si.load_from_db()
|
||||||
|
|
||||||
|
#check outstanding after advance allocation
|
||||||
|
self.assertEqual(flt(si.outstanding_amount), flt(si.grand_total - si.total_advance, si.precision("outstanding_amount")))
|
||||||
|
|
||||||
|
#added to avoid Document has been modified exception
|
||||||
|
pe = frappe.get_doc("Payment Entry", pe.name)
|
||||||
|
pe.cancel()
|
||||||
|
|
||||||
|
si.load_from_db()
|
||||||
|
#check outstanding after advance cancellation
|
||||||
|
self.assertEqual(flt(si.outstanding_amount), flt(si.grand_total + si.total_advance, si.precision("outstanding_amount")))
|
||||||
|
|
||||||
def create_sales_invoice(**args):
|
def create_sales_invoice(**args):
|
||||||
si = frappe.new_doc("Sales Invoice")
|
si = frappe.new_doc("Sales Invoice")
|
||||||
args = frappe._dict(args)
|
args = frappe._dict(args)
|
||||||
|
@ -32,12 +32,13 @@ def get_filters_cond(doctype, filters, conditions):
|
|||||||
|
|
||||||
# searches for active employees
|
# searches for active employees
|
||||||
def employee_query(doctype, txt, searchfield, start, page_len, filters):
|
def employee_query(doctype, txt, searchfield, start, page_len, filters):
|
||||||
|
conditions = []
|
||||||
return frappe.db.sql("""select name, employee_name from `tabEmployee`
|
return frappe.db.sql("""select name, employee_name from `tabEmployee`
|
||||||
where status = 'Active'
|
where status = 'Active'
|
||||||
and docstatus < 2
|
and docstatus < 2
|
||||||
and ({key} like %(txt)s
|
and ({key} like %(txt)s
|
||||||
or employee_name like %(txt)s)
|
or employee_name like %(txt)s)
|
||||||
{mcond}
|
{fcond} {mcond}
|
||||||
order by
|
order by
|
||||||
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
|
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
|
||||||
if(locate(%(_txt)s, employee_name), locate(%(_txt)s, employee_name), 99999),
|
if(locate(%(_txt)s, employee_name), locate(%(_txt)s, employee_name), 99999),
|
||||||
@ -45,6 +46,7 @@ def employee_query(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
name, employee_name
|
name, employee_name
|
||||||
limit %(start)s, %(page_len)s""".format(**{
|
limit %(start)s, %(page_len)s""".format(**{
|
||||||
'key': searchfield,
|
'key': searchfield,
|
||||||
|
'fcond': get_filters_cond(doctype, filters, conditions),
|
||||||
'mcond': get_match_cond(doctype)
|
'mcond': get_match_cond(doctype)
|
||||||
}), {
|
}), {
|
||||||
'txt': "%%%s%%" % txt,
|
'txt': "%%%s%%" % txt,
|
||||||
|
@ -164,14 +164,18 @@ class SellingController(StockController):
|
|||||||
frappe.throw(_("Maxiumm discount for Item {0} is {1}%").format(d.item_code, discount))
|
frappe.throw(_("Maxiumm discount for Item {0} is {1}%").format(d.item_code, discount))
|
||||||
|
|
||||||
def validate_selling_price(self):
|
def validate_selling_price(self):
|
||||||
|
def throw_message(item_name, rate, ref_rate_field):
|
||||||
|
frappe.throw(_("""Selling price for item {0} is lower than its {1}. Selling price should be atleast {2}""")
|
||||||
|
.format(item_name, ref_rate_field, rate))
|
||||||
|
|
||||||
if not frappe.db.get_single_value("Selling Settings", "validate_selling_price"):
|
if not frappe.db.get_single_value("Selling Settings", "validate_selling_price"):
|
||||||
return
|
return
|
||||||
|
|
||||||
for it in self.get("items"):
|
for it in self.get("items"):
|
||||||
last_purchase_rate, is_stock_item = frappe.db.get_value("Item", it.name, ["last_purchase_rate", "is_stock_item"])
|
last_purchase_rate, is_stock_item = frappe.db.get_value("Item", it.item_code, ["last_purchase_rate", "is_stock_item"])
|
||||||
|
|
||||||
if flt(it.base_rate) < flt(last_purchase_rate):
|
if flt(it.base_rate) < flt(last_purchase_rate):
|
||||||
throw(it.name, last_purchase_rate, "last purchase rate")
|
throw_message(it.item_name, last_purchase_rate, "last purchase rate")
|
||||||
|
|
||||||
last_valuation_rate = frappe.db.sql("""
|
last_valuation_rate = frappe.db.sql("""
|
||||||
SELECT valuation_rate FROM `tabStock Ledger Entry` WHERE item_code = %s
|
SELECT valuation_rate FROM `tabStock Ledger Entry` WHERE item_code = %s
|
||||||
@ -182,9 +186,6 @@ class SellingController(StockController):
|
|||||||
if is_stock_item and flt(it.base_rate) < flt(last_valuation_rate):
|
if is_stock_item and flt(it.base_rate) < flt(last_valuation_rate):
|
||||||
throw_message(it.name, last_valuation_rate, "valuation rate")
|
throw_message(it.name, last_valuation_rate, "valuation rate")
|
||||||
|
|
||||||
def throw_message(item_name, rate, ref_rate_field):
|
|
||||||
frappe.throw(_("""Selling price for item {0} is lower than its {1}. Selling price should be atleast {2}""")
|
|
||||||
.format(item_name, ref_rate_field, rate))
|
|
||||||
|
|
||||||
def get_item_list(self):
|
def get_item_list(self):
|
||||||
il = []
|
il = []
|
||||||
|
@ -22,7 +22,7 @@ class ProcessPayroll(Document):
|
|||||||
|
|
||||||
sal_struct = frappe.db.sql("""
|
sal_struct = frappe.db.sql("""
|
||||||
select name from `tabSalary Structure`
|
select name from `tabSalary Structure`
|
||||||
where docstatus != 2 and company = %(company)s and
|
where docstatus != 2 and is_active = 'Yes' and company = %(company)s and
|
||||||
ifnull(salary_slip_based_on_timesheet,0) = %(salary_slip_based_on_timesheet)s""",
|
ifnull(salary_slip_based_on_timesheet,0) = %(salary_slip_based_on_timesheet)s""",
|
||||||
{"company": self.company, "salary_slip_based_on_timesheet":self.salary_slip_based_on_timesheet})
|
{"company": self.company, "salary_slip_based_on_timesheet":self.salary_slip_based_on_timesheet})
|
||||||
|
|
||||||
@ -51,8 +51,8 @@ class ProcessPayroll(Document):
|
|||||||
|
|
||||||
def get_joining_releiving_condition(self):
|
def get_joining_releiving_condition(self):
|
||||||
cond = """
|
cond = """
|
||||||
and ifnull(t1.date_of_joining, '0000-00-00') <= '%(from_date)s'
|
and ifnull(t1.date_of_joining, '0000-00-00') <= '%(to_date)s'
|
||||||
and ifnull(t1.relieving_date, '2199-12-31') >= '%(to_date)s'
|
and ifnull(t1.relieving_date, '2199-12-31') >= '%(from_date)s'
|
||||||
""" % {"from_date": self.from_date, "to_date": self.to_date}
|
""" % {"from_date": self.from_date, "to_date": self.to_date}
|
||||||
return cond
|
return cond
|
||||||
|
|
||||||
|
@ -28,7 +28,15 @@ frappe.ui.form.on('Salary Structure', {
|
|||||||
type: "deduction"
|
type: "deduction"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
frm.set_query("employee", "employees", function(doc) {
|
||||||
|
return {
|
||||||
|
query: "erpnext.controllers.queries.employee_query",
|
||||||
|
filters: {
|
||||||
|
company: doc.company
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
@ -182,11 +190,3 @@ frappe.ui.form.on('Salary Detail', {
|
|||||||
calculate_totals(frm.doc);
|
calculate_totals(frm.doc);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
frappe.ui.form.on('Salary Structure Employee', {
|
|
||||||
onload: function(frm) {
|
|
||||||
frm.set_query("employee","employees", function(doc,cdt,cdn) {
|
|
||||||
return{ query: "erpnext.controllers.queries.employee_query" }
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
@ -816,7 +816,7 @@
|
|||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-08-17 05:35:34.331954",
|
"modified": "2016-11-16 05:35:34.331954",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "Production Planning Tool",
|
"name": "Production Planning Tool",
|
||||||
|
@ -9,6 +9,8 @@ earnings or deductions in existing salary slips
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
|
frappe.reload_doc("accounts", "doctype", "salary_component_account")
|
||||||
|
|
||||||
for s in frappe.db.sql('''select name, type, salary_component_abbr from `tabSalary Component`
|
for s in frappe.db.sql('''select name, type, salary_component_abbr from `tabSalary Component`
|
||||||
where ifnull(type, "")="" or ifnull(salary_component_abbr, "") = ""''', as_dict=1):
|
where ifnull(type, "")="" or ifnull(salary_component_abbr, "") = ""''', as_dict=1):
|
||||||
|
|
||||||
|
@ -988,7 +988,7 @@
|
|||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"menu_index": 0,
|
"menu_index": 0,
|
||||||
"modified": "2016-11-07 05:23:37.934779",
|
"modified": "2016-11-17 10:26:13.225135",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Schools",
|
"module": "Schools",
|
||||||
"name": "Student Applicant",
|
"name": "Student Applicant",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<div class="row item_name_and_description">
|
<div class="row item_name_and_description">
|
||||||
<div class="col-xs-4 col-sm-2 order-image-col">
|
<div class="col-xs-4 col-sm-2 order-image-col">
|
||||||
<div class="order-image">
|
<div class="order-image">
|
||||||
{{ product_image_square(d.image) }}
|
{{ product_image_square(d.thumbnail or d.image) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-8 col-sm-10">
|
<div class="col-xs-8 col-sm-10">
|
||||||
@ -18,7 +18,7 @@
|
|||||||
<div class="row item_name_dropdown">
|
<div class="row item_name_dropdown">
|
||||||
<div class="col-xs-4 col-sm-4 order-image-col">
|
<div class="col-xs-4 col-sm-4 order-image-col">
|
||||||
<div class="order-image">
|
<div class="order-image">
|
||||||
{{ product_image_square(d.image) }}
|
{{ product_image_square(d.thumbnail or d.image) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-8 col-sm-8">
|
<div class="col-xs-8 col-sm-8">
|
||||||
|
@ -126,6 +126,20 @@ class TransactionBase(StatusUpdater):
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def delink_advance_entries(self, linked_doc_name):
|
||||||
|
total_allocated_amount = 0
|
||||||
|
for adv in self.advances:
|
||||||
|
consider_for_total_advance = True
|
||||||
|
if adv.reference_name == linked_doc_name:
|
||||||
|
frappe.db.sql("""delete from `tab{0} Advance`
|
||||||
|
where name = %s""".format(self.doctype), adv.name)
|
||||||
|
consider_for_total_advance = False
|
||||||
|
|
||||||
|
if consider_for_total_advance:
|
||||||
|
total_allocated_amount += flt(adv.allocated_amount, adv.precision("allocated_amount"))
|
||||||
|
|
||||||
|
frappe.db.set_value(self.doctype, self.name, "total_advance", total_allocated_amount, update_modified=False)
|
||||||
|
|
||||||
def delete_events(ref_type, ref_name):
|
def delete_events(ref_type, ref_name):
|
||||||
frappe.delete_doc("Event", frappe.db.sql_list("""select name from `tabEvent`
|
frappe.delete_doc("Event", frappe.db.sql_list("""select name from `tabEvent`
|
||||||
where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
|
where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user