Merge branch 'develop' into payments-based-dunning
This commit is contained in:
commit
b497436d4f
@ -36,7 +36,7 @@ frappe.ui.form.on('Exchange Rate Revaluation', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
validate_rounding_loss: function(frm) {
|
validate_rounding_loss: function(frm) {
|
||||||
allowance = frm.doc.rounding_loss_allowance;
|
let allowance = frm.doc.rounding_loss_allowance;
|
||||||
if (!(allowance > 0 && allowance < 1)) {
|
if (!(allowance > 0 && allowance < 1)) {
|
||||||
frappe.throw(__("Rounding Loss Allowance should be between 0 and 1"));
|
frappe.throw(__("Rounding Loss Allowance should be between 0 and 1"));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -186,7 +186,7 @@ class ExchangeRateRevaluation(Document):
|
|||||||
# round off balance based on currency precision
|
# round off balance based on currency precision
|
||||||
# and consider debit-credit difference allowance
|
# and consider debit-credit difference allowance
|
||||||
currency_precision = get_currency_precision()
|
currency_precision = get_currency_precision()
|
||||||
rounding_loss_allowance = rounding_loss_allowance or 0.05
|
rounding_loss_allowance = float(rounding_loss_allowance) or 0.05
|
||||||
for acc in account_details:
|
for acc in account_details:
|
||||||
acc.balance_in_account_currency = flt(acc.balance_in_account_currency, currency_precision)
|
acc.balance_in_account_currency = flt(acc.balance_in_account_currency, currency_precision)
|
||||||
if abs(acc.balance_in_account_currency) <= rounding_loss_allowance:
|
if abs(acc.balance_in_account_currency) <= rounding_loss_allowance:
|
||||||
@ -552,7 +552,7 @@ def calculate_exchange_rate_using_last_gle(company, account, party_type, party):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_account_details(
|
def get_account_details(
|
||||||
company, posting_date, account, party_type=None, party=None, rounding_loss_allowance=None
|
company, posting_date, account, party_type=None, party=None, rounding_loss_allowance: float = None
|
||||||
):
|
):
|
||||||
if not (company and posting_date):
|
if not (company and posting_date):
|
||||||
frappe.throw(_("Company and Posting Date is mandatory"))
|
frappe.throw(_("Company and Posting Date is mandatory"))
|
||||||
|
|||||||
@ -65,6 +65,18 @@ erpnext.assets.AssetCapitalization = class AssetCapitalization extends erpnext.s
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
me.frm.set_query("serial_and_batch_bundle", "stock_items", (doc, cdt, cdn) => {
|
||||||
|
let row = locals[cdt][cdn];
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'item_code': row.item_code,
|
||||||
|
'voucher_type': doc.doctype,
|
||||||
|
'voucher_no': ["in", [doc.name, ""]],
|
||||||
|
'is_cancelled': 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
me.frm.set_query("item_code", "stock_items", function() {
|
me.frm.set_query("item_code", "stock_items", function() {
|
||||||
return erpnext.queries.item({"is_stock_item": 1});
|
return erpnext.queries.item({"is_stock_item": 1});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -28,6 +28,18 @@ frappe.ui.form.on('Asset Repair', {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
frm.set_query("serial_and_batch_bundle", "stock_items", (doc, cdt, cdn) => {
|
||||||
|
let row = locals[cdt][cdn];
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'item_code': row.item_code,
|
||||||
|
'voucher_type': doc.doctype,
|
||||||
|
'voucher_no': ["in", [doc.name, ""]],
|
||||||
|
'is_cancelled': 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
|
|||||||
@ -12,6 +12,17 @@ frappe.ui.form.on('Job Card', {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query("serial_and_batch_bundle", () => {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'item_code': frm.doc.production_item,
|
||||||
|
'voucher_type': frm.doc.doctype,
|
||||||
|
'voucher_no': ["in", [frm.doc.name, ""]],
|
||||||
|
'is_cancelled': 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
frm.set_indicator_formatter('sub_operation',
|
frm.set_indicator_formatter('sub_operation',
|
||||||
function(doc) {
|
function(doc) {
|
||||||
if (doc.status == "Pending") {
|
if (doc.status == "Pending") {
|
||||||
|
|||||||
@ -130,6 +130,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
'item_code': item_row.item_code,
|
'item_code': item_row.item_code,
|
||||||
'voucher_type': doc.doctype,
|
'voucher_type': doc.doctype,
|
||||||
'voucher_no': ["in", [doc.name, ""]],
|
'voucher_no': ["in", [doc.name, ""]],
|
||||||
|
'is_cancelled': 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -8,7 +8,7 @@ frappe.ui.form.ControlData = class ControlData extends frappe.ui.form.ControlDat
|
|||||||
Object.values(this.frm.fields_dict).forEach(function(field) {
|
Object.values(this.frm.fields_dict).forEach(function(field) {
|
||||||
if (field.df.read_only === 1 && field.df.options === 'Phone'
|
if (field.df.read_only === 1 && field.df.options === 'Phone'
|
||||||
&& field.disp_area.style[0] != 'display' && !field.has_icon) {
|
&& field.disp_area.style[0] != 'display' && !field.has_icon) {
|
||||||
field.setup_phone();
|
field.setup_phone && field.setup_phone();
|
||||||
field.has_icon = true;
|
field.has_icon = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -7,6 +7,17 @@ frappe.ui.form.on('Installation Note', {
|
|||||||
frm.set_query('customer_address', erpnext.queries.address_query);
|
frm.set_query('customer_address', erpnext.queries.address_query);
|
||||||
frm.set_query('contact_person', erpnext.queries.contact_query);
|
frm.set_query('contact_person', erpnext.queries.contact_query);
|
||||||
frm.set_query('customer', erpnext.queries.customer);
|
frm.set_query('customer', erpnext.queries.customer);
|
||||||
|
frm.set_query("serial_and_batch_bundle", "items", (doc, cdt, cdn) => {
|
||||||
|
let row = locals[cdt][cdn];
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'item_code': row.item_code,
|
||||||
|
'voucher_type': doc.doctype,
|
||||||
|
'voucher_no': ["in", [doc.name, ""]],
|
||||||
|
'is_cancelled': 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
if(!frm.doc.status) {
|
if(!frm.doc.status) {
|
||||||
|
|||||||
@ -34,6 +34,18 @@ frappe.ui.form.on('Quotation', {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query("serial_and_batch_bundle", "packed_items", (doc, cdt, cdn) => {
|
||||||
|
let row = locals[cdt][cdn];
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'item_code': row.item_code,
|
||||||
|
'voucher_type': doc.doctype,
|
||||||
|
'voucher_no': ["in", [doc.name, ""]],
|
||||||
|
'is_cancelled': 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
|
|||||||
@ -12,6 +12,7 @@ frappe.ui.form.on('Pick List', {
|
|||||||
'Delivery Note': 'Delivery Note',
|
'Delivery Note': 'Delivery Note',
|
||||||
'Stock Entry': 'Stock Entry',
|
'Stock Entry': 'Stock Entry',
|
||||||
};
|
};
|
||||||
|
|
||||||
frm.set_query('parent_warehouse', () => {
|
frm.set_query('parent_warehouse', () => {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@ -20,6 +21,7 @@ frappe.ui.form.on('Pick List', {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query('work_order', () => {
|
frm.set_query('work_order', () => {
|
||||||
return {
|
return {
|
||||||
query: 'erpnext.stock.doctype.pick_list.pick_list.get_pending_work_orders',
|
query: 'erpnext.stock.doctype.pick_list.pick_list.get_pending_work_orders',
|
||||||
@ -28,6 +30,7 @@ frappe.ui.form.on('Pick List', {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query('material_request', () => {
|
frm.set_query('material_request', () => {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@ -35,9 +38,11 @@ frappe.ui.form.on('Pick List', {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query('item_code', 'locations', () => {
|
frm.set_query('item_code', 'locations', () => {
|
||||||
return erpnext.queries.item({ "is_stock_item": 1 });
|
return erpnext.queries.item({ "is_stock_item": 1 });
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query('batch_no', 'locations', (frm, cdt, cdn) => {
|
frm.set_query('batch_no', 'locations', (frm, cdt, cdn) => {
|
||||||
const row = locals[cdt][cdn];
|
const row = locals[cdt][cdn];
|
||||||
return {
|
return {
|
||||||
@ -48,6 +53,18 @@ frappe.ui.form.on('Pick List', {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query("serial_and_batch_bundle", "locations", (doc, cdt, cdn) => {
|
||||||
|
let row = locals[cdt][cdn];
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'item_code': row.item_code,
|
||||||
|
'voucher_type': doc.doctype,
|
||||||
|
'voucher_no': ["in", [doc.name, ""]],
|
||||||
|
'is_cancelled': 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
set_item_locations:(frm, save) => {
|
set_item_locations:(frm, save) => {
|
||||||
if (!(frm.doc.locations && frm.doc.locations.length)) {
|
if (!(frm.doc.locations && frm.doc.locations.length)) {
|
||||||
|
|||||||
@ -161,6 +161,23 @@ frappe.ui.form.on('Serial and Batch Bundle', {
|
|||||||
'istable': 0,
|
'istable': 0,
|
||||||
'issingle': 0,
|
'issingle': 0,
|
||||||
'is_submittable': 1,
|
'is_submittable': 1,
|
||||||
|
'name': ['in', [
|
||||||
|
"Asset Capitalization",
|
||||||
|
"Asset Repair",
|
||||||
|
"Delivery Note",
|
||||||
|
"Installation Note",
|
||||||
|
"Job Card",
|
||||||
|
"Maintenance Schedule",
|
||||||
|
"POS Invoice",
|
||||||
|
"Pick List",
|
||||||
|
"Purchase Invoice",
|
||||||
|
"Purchase Receipt",
|
||||||
|
"Quotation",
|
||||||
|
"Sales Invoice",
|
||||||
|
"Stock Entry",
|
||||||
|
"Stock Reconciliation",
|
||||||
|
"Subcontracting Receipt",
|
||||||
|
]],
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -194,6 +211,7 @@ frappe.ui.form.on('Serial and Batch Bundle', {
|
|||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
item: frm.doc.item_code,
|
item: frm.doc.item_code,
|
||||||
|
disabled: 0,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -122,7 +122,12 @@ class SerialandBatchBundle(Document):
|
|||||||
frappe.throw(_(message), exception, title=_("Error"))
|
frappe.throw(_(message), exception, title=_("Error"))
|
||||||
|
|
||||||
def set_incoming_rate(self, row=None, save=False):
|
def set_incoming_rate(self, row=None, save=False):
|
||||||
if self.type_of_transaction not in ["Inward", "Outward"]:
|
if self.type_of_transaction not in ["Inward", "Outward"] or self.voucher_type in [
|
||||||
|
"Installation Note",
|
||||||
|
"Job Card",
|
||||||
|
"Maintenance Schedule",
|
||||||
|
"Pick List",
|
||||||
|
]:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.type_of_transaction == "Outward":
|
if self.type_of_transaction == "Outward":
|
||||||
@ -220,7 +225,7 @@ class SerialandBatchBundle(Document):
|
|||||||
|
|
||||||
def set_incoming_rate_for_inward_transaction(self, row=None, save=False):
|
def set_incoming_rate_for_inward_transaction(self, row=None, save=False):
|
||||||
valuation_field = "valuation_rate"
|
valuation_field = "valuation_rate"
|
||||||
if self.voucher_type in ["Sales Invoice", "Delivery Note"]:
|
if self.voucher_type in ["Sales Invoice", "Delivery Note", "Quotation"]:
|
||||||
valuation_field = "incoming_rate"
|
valuation_field = "incoming_rate"
|
||||||
|
|
||||||
if self.voucher_type == "POS Invoice":
|
if self.voucher_type == "POS Invoice":
|
||||||
@ -229,8 +234,10 @@ class SerialandBatchBundle(Document):
|
|||||||
rate = row.get(valuation_field) if row else 0.0
|
rate = row.get(valuation_field) if row else 0.0
|
||||||
child_table = self.child_table
|
child_table = self.child_table
|
||||||
|
|
||||||
if self.voucher_type == "Subcontracting Receipt" and self.voucher_detail_no:
|
if self.voucher_type == "Subcontracting Receipt":
|
||||||
if frappe.db.exists("Subcontracting Receipt Supplied Item", self.voucher_detail_no):
|
if not self.voucher_detail_no:
|
||||||
|
return
|
||||||
|
elif frappe.db.exists("Subcontracting Receipt Supplied Item", self.voucher_detail_no):
|
||||||
valuation_field = "rate"
|
valuation_field = "rate"
|
||||||
child_table = "Subcontracting Receipt Supplied Item"
|
child_table = "Subcontracting Receipt Supplied Item"
|
||||||
else:
|
else:
|
||||||
@ -563,11 +570,21 @@ class SerialandBatchBundle(Document):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def child_table(self):
|
def child_table(self):
|
||||||
table = f"{self.voucher_type} Item"
|
if self.voucher_type == "Job Card":
|
||||||
if self.voucher_type == "Stock Entry":
|
return
|
||||||
table = f"{self.voucher_type} Detail"
|
|
||||||
|
|
||||||
return table
|
parent_child_map = {
|
||||||
|
"Asset Capitalization": "Asset Capitalization Stock Item",
|
||||||
|
"Asset Repair": "Asset Repair Consumed Item",
|
||||||
|
"Quotation": "Packed Item",
|
||||||
|
"Stock Entry": "Stock Entry Detail",
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
parent_child_map[self.voucher_type]
|
||||||
|
if self.voucher_type in parent_child_map
|
||||||
|
else f"{self.voucher_type} Item"
|
||||||
|
)
|
||||||
|
|
||||||
def delink_refernce_from_voucher(self):
|
def delink_refernce_from_voucher(self):
|
||||||
or_filters = {"serial_and_batch_bundle": self.name}
|
or_filters = {"serial_and_batch_bundle": self.name}
|
||||||
|
|||||||
@ -103,6 +103,18 @@ frappe.ui.form.on('Stock Entry', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query("serial_and_batch_bundle", "items", (doc, cdt, cdn) => {
|
||||||
|
let row = locals[cdt][cdn];
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'item_code': row.item_code,
|
||||||
|
'voucher_type': doc.doctype,
|
||||||
|
'voucher_no': ["in", [doc.name, ""]],
|
||||||
|
'is_cancelled': 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
frm.add_fetch("bom_no", "inspection_required", "inspection_required");
|
frm.add_fetch("bom_no", "inspection_required", "inspection_required");
|
||||||
erpnext.accounts.dimensions.setup_dimension_filters(frm, frm.doctype);
|
erpnext.accounts.dimensions.setup_dimension_filters(frm, frm.doctype);
|
||||||
|
|||||||
@ -30,6 +30,18 @@ frappe.ui.form.on("Stock Reconciliation", {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query("serial_and_batch_bundle", "items", (doc, cdt, cdn) => {
|
||||||
|
let row = locals[cdt][cdn];
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'item_code': row.item_code,
|
||||||
|
'voucher_type': doc.doctype,
|
||||||
|
'voucher_no': ["in", [doc.name, ""]],
|
||||||
|
'is_cancelled': 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (frm.doc.company) {
|
if (frm.doc.company) {
|
||||||
erpnext.queries.setup_queries(frm, "Warehouse", function() {
|
erpnext.queries.setup_queries(frm, "Warehouse", function() {
|
||||||
return erpnext.queries.warehouse(frm.doc);
|
return erpnext.queries.warehouse(frm.doc);
|
||||||
|
|||||||
@ -962,6 +962,7 @@ class update_entries_after(object):
|
|||||||
item.current_amount = flt(item.current_qty) * flt(item.current_valuation_rate)
|
item.current_amount = flt(item.current_qty) * flt(item.current_valuation_rate)
|
||||||
|
|
||||||
item.amount = flt(item.qty) * flt(item.valuation_rate)
|
item.amount = flt(item.qty) * flt(item.valuation_rate)
|
||||||
|
item.quantity_difference = item.qty - item.current_qty
|
||||||
item.amount_difference = item.amount - item.current_amount
|
item.amount_difference = item.amount - item.current_amount
|
||||||
else:
|
else:
|
||||||
sr.difference_amount = sum([item.amount_difference for item in sr.items])
|
sr.difference_amount = sum([item.amount_difference for item in sr.items])
|
||||||
|
|||||||
@ -77,6 +77,18 @@ frappe.ui.form.on('Subcontracting Receipt', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query("serial_and_batch_bundle", "supplied_items", (doc, cdt, cdn) => {
|
||||||
|
let row = locals[cdt][cdn];
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'item_code': row.rm_item_code,
|
||||||
|
'voucher_type': doc.doctype,
|
||||||
|
'voucher_no': ["in", [doc.name, ""]],
|
||||||
|
'is_cancelled': 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let batch_no_field = frm.get_docfield('items', 'batch_no');
|
let batch_no_field = frm.get_docfield('items', 'batch_no');
|
||||||
if (batch_no_field) {
|
if (batch_no_field) {
|
||||||
batch_no_field.get_route_options_for_new_doc = function(row) {
|
batch_no_field.get_route_options_for_new_doc = function(row) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user