Merge branch 'version-11-hotfix' into hooks-update-v11
This commit is contained in:
@@ -294,7 +294,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
() => {
|
||||
frm.set_party_account_based_on_party = false;
|
||||
if (r.message.bank_account) {
|
||||
frm.set_value("bank_account", r.message.bank_account);
|
||||
frm.set_value("party_bank_account", r.message.bank_account);
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -16,7 +16,7 @@ frappe.ui.form.on('Share Transfer', {
|
||||
};
|
||||
};
|
||||
});
|
||||
if (frm.doc.docstatus == 1) {
|
||||
if (frm.doc.docstatus == 1 && frm.doc.equity_or_liability_account && frm.doc.asset_account ) {
|
||||
frm.add_custom_button(__('Make Journal Entry'), function () {
|
||||
erpnext.share_transfer.make_jv(frm);
|
||||
});
|
||||
@@ -92,6 +92,7 @@ erpnext.share_transfer.make_jv = function (frm) {
|
||||
debit_applicant_type = "Shareholder";
|
||||
debit_applicant = frm.doc.from_shareholder;
|
||||
}
|
||||
|
||||
frappe.call({
|
||||
args: {
|
||||
"company": frm.doc.company,
|
||||
|
||||
@@ -292,11 +292,14 @@ def make_jv_entry( company, account, amount, payment_account,\
|
||||
"party_type": debit_applicant_type,
|
||||
"party": debit_applicant,
|
||||
})
|
||||
|
||||
account_amt_list.append({
|
||||
"account": payment_account,
|
||||
"credit_in_account_currency": amount,
|
||||
"party_type": credit_applicant_type,
|
||||
"party": credit_applicant,
|
||||
})
|
||||
|
||||
journal_entry.set("accounts", account_amt_list)
|
||||
|
||||
return journal_entry.as_dict()
|
||||
@@ -280,22 +280,31 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
|
||||
"page_len": page_len
|
||||
}
|
||||
|
||||
having_clause = "having sum(sle.actual_qty) > 0"
|
||||
if filters.get("is_return"):
|
||||
having_clause = ""
|
||||
|
||||
if args.get('warehouse'):
|
||||
batch_nos = frappe.db.sql("""select sle.batch_no, round(sum(sle.actual_qty),2), sle.stock_uom, concat('MFG-',batch.manufacturing_date), concat('EXP-',batch.expiry_date)
|
||||
from `tabStock Ledger Entry` sle
|
||||
INNER JOIN `tabBatch` batch on sle.batch_no = batch.name
|
||||
where
|
||||
batch.disabled = 0
|
||||
and sle.item_code = %(item_code)s
|
||||
and sle.warehouse = %(warehouse)s
|
||||
and (sle.batch_no like %(txt)s
|
||||
or batch.manufacturing_date like %(txt)s)
|
||||
and batch.docstatus < 2
|
||||
{0}
|
||||
{match_conditions}
|
||||
group by batch_no having sum(sle.actual_qty) > 0
|
||||
order by batch.expiry_date, sle.batch_no desc
|
||||
limit %(start)s, %(page_len)s""".format(cond, match_conditions=get_match_cond(doctype)), args)
|
||||
batch_nos = frappe.db.sql("""select sle.batch_no, round(sum(sle.actual_qty),2), sle.stock_uom,
|
||||
concat('MFG-',batch.manufacturing_date), concat('EXP-',batch.expiry_date)
|
||||
from `tabStock Ledger Entry` sle
|
||||
INNER JOIN `tabBatch` batch on sle.batch_no = batch.name
|
||||
where
|
||||
batch.disabled = 0
|
||||
and sle.item_code = %(item_code)s
|
||||
and sle.warehouse = %(warehouse)s
|
||||
and (sle.batch_no like %(txt)s
|
||||
or batch.manufacturing_date like %(txt)s)
|
||||
and batch.docstatus < 2
|
||||
{cond}
|
||||
{match_conditions}
|
||||
group by batch_no {having_clause}
|
||||
order by batch.expiry_date, sle.batch_no desc
|
||||
limit %(start)s, %(page_len)s""".format(
|
||||
cond=cond,
|
||||
match_conditions=get_match_cond(doctype),
|
||||
having_clause = having_clause
|
||||
), args)
|
||||
|
||||
return batch_nos
|
||||
else:
|
||||
|
||||
@@ -1468,7 +1468,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2019-05-17 19:03:32.740910",
|
||||
"modified": "2019-10-22 11:11:32.740910",
|
||||
"modified_by": "Administrator",
|
||||
"module": "CRM",
|
||||
"name": "Opportunity",
|
||||
|
||||
@@ -34,12 +34,15 @@ class BOM(WebsiteGenerator):
|
||||
# name can be BOM/ITEM/001, BOM/ITEM/001-1, BOM-ITEM-001, BOM-ITEM-001-1
|
||||
|
||||
# split by item
|
||||
names = [name.split(self.item)[-1][1:] for name in names]
|
||||
names = [name.split(self.item, 1) for name in names]
|
||||
names = [d[-1][1:] for d in filter(lambda x: len(x) > 1 and x[-1], names)]
|
||||
|
||||
# split by (-) if cancelled
|
||||
names = [cint(name.split('-')[-1]) for name in names]
|
||||
|
||||
idx = max(names) + 1
|
||||
if names:
|
||||
names = [cint(name.split('-')[-1]) for name in names]
|
||||
idx = max(names) + 1
|
||||
else:
|
||||
idx = 1
|
||||
else:
|
||||
idx = 1
|
||||
|
||||
|
||||
@@ -1422,6 +1422,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
'item_code': item.item_code,
|
||||
'posting_date': me.frm.doc.posting_date || frappe.datetime.nowdate(),
|
||||
}
|
||||
|
||||
if (doc.is_return) {
|
||||
filters["is_return"] = 1;
|
||||
}
|
||||
|
||||
if (item.warehouse) filters["warehouse"] = item.warehouse;
|
||||
|
||||
return {
|
||||
|
||||
@@ -645,12 +645,15 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
|
||||
|
||||
if source_parent.project:
|
||||
target.cost_center = frappe.db.get_value("Project", source_parent.project, "cost_center")
|
||||
if not target.cost_center and target.item_code:
|
||||
if target.item_code:
|
||||
item = get_item_defaults(target.item_code, source_parent.company)
|
||||
item_group = get_item_group_defaults(target.item_code, source_parent.company)
|
||||
target.cost_center = item.get("selling_cost_center") \
|
||||
cost_center = item.get("selling_cost_center") \
|
||||
or item_group.get("selling_cost_center")
|
||||
|
||||
if cost_center:
|
||||
target.cost_center = cost_center
|
||||
|
||||
doclist = get_mapped_doc("Sales Order", source_name, {
|
||||
"Sales Order": {
|
||||
"doctype": "Sales Invoice",
|
||||
|
||||
@@ -6,9 +6,9 @@ frappe.listview_settings['Delivery Note'] = {
|
||||
return [__("Return"), "darkgrey", "is_return,=,Yes"];
|
||||
} else if (doc.status === "Closed") {
|
||||
return [__("Closed"), "green", "status,=,Closed"];
|
||||
} else if (doc.grand_total !== 0 && flt(doc.per_billed, 2) < 100) {
|
||||
} else if (flt(doc.per_billed, 2) < 100) {
|
||||
return [__("To Bill"), "orange", "per_billed,<,100"];
|
||||
} else if (doc.grand_total === 0 || flt(doc.per_billed, 2) == 100) {
|
||||
} else if (flt(doc.per_billed, 2) == 100) {
|
||||
return [__("Completed"), "green", "per_billed,=,100"];
|
||||
}
|
||||
},
|
||||
|
||||
@@ -227,7 +227,9 @@ class StockEntry(StockController):
|
||||
|
||||
for d in self.get("items"):
|
||||
if not d.expense_account:
|
||||
frappe.throw(_("Please enter Difference Account"))
|
||||
frappe.throw(_("Please enter <b>Difference Account</b> or set default <b>Stock Adjustment Account</b> for company {0}")
|
||||
.format(frappe.bold(self.company)))
|
||||
|
||||
elif self.is_opening == "Yes" and frappe.db.get_value("Account", d.expense_account, "report_type") == "Profit and Loss":
|
||||
frappe.throw(_("Difference Account must be a Asset/Liability type account, since this Stock Entry is an Opening Entry"), OpeningEntryAccountError)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ def execute(filters=None):
|
||||
|
||||
data = []
|
||||
for item in items:
|
||||
total_outgoing = consumed_item_map.get(item.name, 0) + delivered_item_map.get(item.name,0)
|
||||
total_outgoing = flt(consumed_item_map.get(item.name, 0)) + flt(delivered_item_map.get(item.name,0))
|
||||
avg_daily_outgoing = flt(total_outgoing / diff, float_preceision)
|
||||
reorder_level = (avg_daily_outgoing * flt(item.lead_time_days)) + flt(item.safety_stock)
|
||||
|
||||
@@ -55,18 +55,20 @@ def get_item_info(filters):
|
||||
|
||||
|
||||
def get_consumed_items(condition):
|
||||
cn_items = frappe.db.sql("""select se_item.item_code,
|
||||
sum(se_item.transfer_qty) as 'consume_qty'
|
||||
from `tabStock Entry` se, `tabStock Entry Detail` se_item
|
||||
where se.name = se_item.parent and se.docstatus = 1
|
||||
and (ifnull(se_item.t_warehouse, '') = '' or se.purpose = 'Subcontract') %s
|
||||
group by se_item.item_code""" % (condition), as_dict=1)
|
||||
consumed_items = frappe.db.sql("""
|
||||
select item_code, abs(sum(actual_qty)) as consumed_qty
|
||||
from `tabStock Ledger Entry`
|
||||
where actual_qty < 0
|
||||
and voucher_type not in ('Delivery Note', 'Sales Invoice')
|
||||
%s
|
||||
group by item_code
|
||||
""" % condition, as_dict=1)
|
||||
|
||||
cn_items_map = {}
|
||||
for item in cn_items:
|
||||
cn_items_map.setdefault(item.item_code, item.consume_qty)
|
||||
consumed_items_map = {}
|
||||
for item in consumed_items:
|
||||
consumed_items_map.setdefault(item.item_code, item.consumed_qty)
|
||||
|
||||
return cn_items_map
|
||||
return consumed_items_map
|
||||
|
||||
def get_delivered_items(condition):
|
||||
dn_items = frappe.db.sql("""select dn_item.item_code, sum(dn_item.stock_qty) as dn_qty
|
||||
|
||||
Reference in New Issue
Block a user