Merge branch 'develop' into membership-fixes
This commit is contained in:
commit
3f60801566
@ -319,7 +319,7 @@ class PaymentEntry(AccountsController):
|
|||||||
invoice_payment_amount_map.setdefault(key, 0.0)
|
invoice_payment_amount_map.setdefault(key, 0.0)
|
||||||
invoice_payment_amount_map[key] += reference.allocated_amount
|
invoice_payment_amount_map[key] += reference.allocated_amount
|
||||||
|
|
||||||
if not invoice_paid_amount_map.get(reference.reference_name):
|
if not invoice_paid_amount_map.get(key):
|
||||||
payment_schedule = frappe.get_all('Payment Schedule', filters={'parent': reference.reference_name},
|
payment_schedule = frappe.get_all('Payment Schedule', filters={'parent': reference.reference_name},
|
||||||
fields=['paid_amount', 'payment_amount', 'payment_term'])
|
fields=['paid_amount', 'payment_amount', 'payment_term'])
|
||||||
for term in payment_schedule:
|
for term in payment_schedule:
|
||||||
@ -332,12 +332,14 @@ class PaymentEntry(AccountsController):
|
|||||||
frappe.db.sql(""" UPDATE `tabPayment Schedule` SET paid_amount = `paid_amount` - %s
|
frappe.db.sql(""" UPDATE `tabPayment Schedule` SET paid_amount = `paid_amount` - %s
|
||||||
WHERE parent = %s and payment_term = %s""", (amount, key[1], key[0]))
|
WHERE parent = %s and payment_term = %s""", (amount, key[1], key[0]))
|
||||||
else:
|
else:
|
||||||
outstanding = invoice_paid_amount_map.get(key)['outstanding']
|
outstanding = flt(invoice_paid_amount_map.get(key, {}).get('outstanding'))
|
||||||
|
|
||||||
if amount > outstanding:
|
if amount > outstanding:
|
||||||
frappe.throw(_('Cannot allocate more than {0} against payment term {1}').format(outstanding, key[0]))
|
frappe.throw(_('Cannot allocate more than {0} against payment term {1}').format(outstanding, key[0]))
|
||||||
|
|
||||||
frappe.db.sql(""" UPDATE `tabPayment Schedule` SET paid_amount = `paid_amount` + %s
|
if amount and outstanding:
|
||||||
WHERE parent = %s and payment_term = %s""", (amount, key[1], key[0]))
|
frappe.db.sql(""" UPDATE `tabPayment Schedule` SET paid_amount = `paid_amount` + %s
|
||||||
|
WHERE parent = %s and payment_term = %s""", (amount, key[1], key[0]))
|
||||||
|
|
||||||
def set_status(self):
|
def set_status(self):
|
||||||
if self.docstatus == 2:
|
if self.docstatus == 2:
|
||||||
@ -1091,17 +1093,20 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
|
|||||||
def get_reference_as_per_payment_terms(payment_schedule, dt, dn, doc, grand_total, outstanding_amount):
|
def get_reference_as_per_payment_terms(payment_schedule, dt, dn, doc, grand_total, outstanding_amount):
|
||||||
references = []
|
references = []
|
||||||
for payment_term in payment_schedule:
|
for payment_term in payment_schedule:
|
||||||
references.append({
|
payment_term_outstanding = flt(payment_term.payment_amount - payment_term.paid_amount,
|
||||||
'reference_doctype': dt,
|
|
||||||
'reference_name': dn,
|
|
||||||
'bill_no': doc.get('bill_no'),
|
|
||||||
'due_date': doc.get('due_date'),
|
|
||||||
'total_amount': grand_total,
|
|
||||||
'outstanding_amount': outstanding_amount,
|
|
||||||
'payment_term': payment_term.payment_term,
|
|
||||||
'allocated_amount': flt(payment_term.payment_amount - payment_term.paid_amount,
|
|
||||||
payment_term.precision('payment_amount'))
|
payment_term.precision('payment_amount'))
|
||||||
})
|
|
||||||
|
if payment_term_outstanding:
|
||||||
|
references.append({
|
||||||
|
'reference_doctype': dt,
|
||||||
|
'reference_name': dn,
|
||||||
|
'bill_no': doc.get('bill_no'),
|
||||||
|
'due_date': doc.get('due_date'),
|
||||||
|
'total_amount': grand_total,
|
||||||
|
'outstanding_amount': outstanding_amount,
|
||||||
|
'payment_term': payment_term.payment_term,
|
||||||
|
'allocated_amount': payment_term_outstanding
|
||||||
|
})
|
||||||
|
|
||||||
return references
|
return references
|
||||||
|
|
||||||
|
@ -1450,11 +1450,17 @@ def get_inter_company_details(doc, doctype):
|
|||||||
parties = frappe.db.get_all("Supplier", fields=["name"], filters={"disabled": 0, "is_internal_supplier": 1, "represents_company": doc.company})
|
parties = frappe.db.get_all("Supplier", fields=["name"], filters={"disabled": 0, "is_internal_supplier": 1, "represents_company": doc.company})
|
||||||
company = frappe.get_cached_value("Customer", doc.customer, "represents_company")
|
company = frappe.get_cached_value("Customer", doc.customer, "represents_company")
|
||||||
|
|
||||||
|
if not parties:
|
||||||
|
frappe.throw(_('No Supplier found for Inter Company Transactions which represents company {0}').format(frappe.bold(doc.company)))
|
||||||
|
|
||||||
party = get_internal_party(parties, "Supplier", doc)
|
party = get_internal_party(parties, "Supplier", doc)
|
||||||
else:
|
else:
|
||||||
parties = frappe.db.get_all("Customer", fields=["name"], filters={"disabled": 0, "is_internal_customer": 1, "represents_company": doc.company})
|
parties = frappe.db.get_all("Customer", fields=["name"], filters={"disabled": 0, "is_internal_customer": 1, "represents_company": doc.company})
|
||||||
company = frappe.get_cached_value("Supplier", doc.supplier, "represents_company")
|
company = frappe.get_cached_value("Supplier", doc.supplier, "represents_company")
|
||||||
|
|
||||||
|
if not parties:
|
||||||
|
frappe.throw(_('No Customer found for Inter Company Transactions which represents company {0}').format(frappe.bold(doc.company)))
|
||||||
|
|
||||||
party = get_internal_party(parties, "Customer", doc)
|
party = get_internal_party(parties, "Customer", doc)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -265,13 +265,6 @@ def get_columns(additional_table_columns, filters):
|
|||||||
'fieldtype': 'Currency',
|
'fieldtype': 'Currency',
|
||||||
'options': 'currency',
|
'options': 'currency',
|
||||||
'width': 100
|
'width': 100
|
||||||
},
|
|
||||||
{
|
|
||||||
'fieldname': 'currency',
|
|
||||||
'label': _('Currency'),
|
|
||||||
'fieldtype': 'Currency',
|
|
||||||
'width': 80,
|
|
||||||
'hidden': 1
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ def get_columns(additional_table_columns, filters):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
if filters.get('group_by') != 'Terriotory':
|
if filters.get('group_by') != 'Territory':
|
||||||
columns.extend([
|
columns.extend([
|
||||||
{
|
{
|
||||||
'label': _("Territory"),
|
'label': _("Territory"),
|
||||||
@ -304,13 +304,6 @@ def get_columns(additional_table_columns, filters):
|
|||||||
'fieldtype': 'Currency',
|
'fieldtype': 'Currency',
|
||||||
'options': 'currency',
|
'options': 'currency',
|
||||||
'width': 100
|
'width': 100
|
||||||
},
|
|
||||||
{
|
|
||||||
'fieldname': 'currency',
|
|
||||||
'label': _('Currency'),
|
|
||||||
'fieldtype': 'Currency',
|
|
||||||
'width': 80,
|
|
||||||
'hidden': 1
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -536,6 +529,13 @@ def get_tax_accounts(item_list, columns, company_currency,
|
|||||||
'fieldtype': 'Currency',
|
'fieldtype': 'Currency',
|
||||||
'options': 'currency',
|
'options': 'currency',
|
||||||
'width': 100
|
'width': 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'fieldname': 'currency',
|
||||||
|
'label': _('Currency'),
|
||||||
|
'fieldtype': 'Currency',
|
||||||
|
'width': 80,
|
||||||
|
'hidden': 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -552,7 +552,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
if (show_batch_dialog)
|
if (show_batch_dialog)
|
||||||
return frappe.db.get_value("Item", item.item_code, ["has_batch_no", "has_serial_no"])
|
return frappe.db.get_value("Item", item.item_code, ["has_batch_no", "has_serial_no"])
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
if(r.message.has_batch_no || r.message.has_serial_no) {
|
if (r.message &&
|
||||||
|
(r.message.has_batch_no || r.message.has_serial_no)) {
|
||||||
frappe.flags.hide_serial_batch_dialog = false;
|
frappe.flags.hide_serial_batch_dialog = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -337,21 +337,17 @@ def set_price_list_and_rate(quotation, cart_settings):
|
|||||||
def _set_price_list(cart_settings, quotation=None):
|
def _set_price_list(cart_settings, quotation=None):
|
||||||
"""Set price list based on customer or shopping cart default"""
|
"""Set price list based on customer or shopping cart default"""
|
||||||
from erpnext.accounts.party import get_default_price_list
|
from erpnext.accounts.party import get_default_price_list
|
||||||
|
party_name = quotation.get("party_name") if quotation else get_party().get("name")
|
||||||
# check if customer price list exists
|
|
||||||
selling_price_list = None
|
selling_price_list = None
|
||||||
if quotation and quotation.get("party_name"):
|
|
||||||
selling_price_list = frappe.db.get_value('Customer', quotation.get("party_name"), 'default_price_list')
|
|
||||||
|
|
||||||
# else check for territory based price list
|
# check if default customer price list exists
|
||||||
|
if party_name:
|
||||||
|
selling_price_list = get_default_price_list(frappe.get_doc("Customer", party_name))
|
||||||
|
|
||||||
|
# check default price list in shopping cart
|
||||||
if not selling_price_list:
|
if not selling_price_list:
|
||||||
selling_price_list = cart_settings.price_list
|
selling_price_list = cart_settings.price_list
|
||||||
|
|
||||||
party_name = quotation.get("party_name") if quotation else get_party().get("name")
|
|
||||||
|
|
||||||
if not selling_price_list and party_name:
|
|
||||||
selling_price_list = get_default_price_list(frappe.get_doc("Customer", party_name))
|
|
||||||
|
|
||||||
if quotation:
|
if quotation:
|
||||||
quotation.selling_price_list = selling_price_list
|
quotation.selling_price_list = selling_price_list
|
||||||
|
|
||||||
|
@ -119,11 +119,13 @@ def get_items_with_location_and_quantity(item_doc, item_location_map):
|
|||||||
if item_location.serial_no:
|
if item_location.serial_no:
|
||||||
serial_nos = '\n'.join(item_location.serial_no[0: cint(stock_qty)])
|
serial_nos = '\n'.join(item_location.serial_no[0: cint(stock_qty)])
|
||||||
|
|
||||||
|
auto_set_serial_no = frappe.db.get_single_value("Stock Settings", "automatically_set_serial_nos_based_on_fifo")
|
||||||
|
|
||||||
locations.append(frappe._dict({
|
locations.append(frappe._dict({
|
||||||
'qty': qty,
|
'qty': qty,
|
||||||
'stock_qty': stock_qty,
|
'stock_qty': stock_qty,
|
||||||
'warehouse': item_location.warehouse,
|
'warehouse': item_location.warehouse,
|
||||||
'serial_no': serial_nos,
|
'serial_no': serial_nos if auto_set_serial_no else item_doc.serial_no,
|
||||||
'batch_no': item_location.batch_no
|
'batch_no': item_location.batch_no
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@ -206,6 +208,7 @@ def get_available_item_locations_for_batched_item(item_code, from_warehouses, re
|
|||||||
sle.batch_no = batch.name
|
sle.batch_no = batch.name
|
||||||
and sle.`item_code`=%(item_code)s
|
and sle.`item_code`=%(item_code)s
|
||||||
and sle.`company` = %(company)s
|
and sle.`company` = %(company)s
|
||||||
|
and batch.disabled = 0
|
||||||
and IFNULL(batch.`expiry_date`, '2200-01-01') > %(today)s
|
and IFNULL(batch.`expiry_date`, '2200-01-01') > %(today)s
|
||||||
{warehouse_condition}
|
{warehouse_condition}
|
||||||
GROUP BY
|
GROUP BY
|
||||||
@ -471,4 +474,4 @@ def update_common_item_properties(item, location):
|
|||||||
item.material_request = location.material_request
|
item.material_request = location.material_request
|
||||||
item.serial_no = location.serial_no
|
item.serial_no = location.serial_no
|
||||||
item.batch_no = location.batch_no
|
item.batch_no = location.batch_no
|
||||||
item.material_request_item = location.material_request_item
|
item.material_request_item = location.material_request_item
|
||||||
|
Loading…
x
Reference in New Issue
Block a user