Merge pull request #32104 from frappe/version-13-hotfix

chore: release v13
This commit is contained in:
Deepesh Garg
2022-09-06 21:33:13 +05:30
committed by GitHub
14 changed files with 102 additions and 105 deletions

View File

@@ -2,7 +2,7 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on("Journal Entry Template", { frappe.ui.form.on("Journal Entry Template", {
setup: function(frm) { refresh: function(frm) {
frappe.model.set_default_values(frm.doc); frappe.model.set_default_values(frm.doc);
frm.set_query("account" ,"accounts", function(){ frm.set_query("account" ,"accounts", function(){

View File

@@ -43,6 +43,7 @@
"currency", "currency",
"write_off_account", "write_off_account",
"write_off_cost_center", "write_off_cost_center",
"write_off_limit",
"account_for_change_amount", "account_for_change_amount",
"disable_rounded_total", "disable_rounded_total",
"column_break_23", "column_break_23",
@@ -360,6 +361,14 @@
"fieldtype": "Check", "fieldtype": "Check",
"label": "Validate Stock on Save" "label": "Validate Stock on Save"
}, },
{
"default": "1",
"description": "Auto write off precision loss while consolidation",
"fieldname": "write_off_limit",
"fieldtype": "Currency",
"label": "Write Off Limit",
"reqd": 1
},
{ {
"default": "0", "default": "0",
"description": "If enabled, the consolidated invoices will have rounded total disabled", "description": "If enabled, the consolidated invoices will have rounded total disabled",
@@ -393,7 +402,7 @@
"link_fieldname": "pos_profile" "link_fieldname": "pos_profile"
} }
], ],
"modified": "2022-07-21 11:16:46.911173", "modified": "2022-08-10 12:57:06.241439",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Profile", "name": "POS Profile",

View File

@@ -34,4 +34,4 @@ class ProcessDeferredAccounting(Document):
filters={"against_voucher_type": self.doctype, "against_voucher": self.name}, filters={"against_voucher_type": self.doctype, "against_voucher": self.name},
) )
make_gl_entries(gl_entries=gl_entries, cancel=1) make_gl_entries(gl_map=gl_entries, cancel=1)

View File

@@ -57,3 +57,16 @@ class TestProcessDeferredAccounting(unittest.TestCase):
] ]
check_gl_entries(self, si.name, expected_gle, "2019-01-10") check_gl_entries(self, si.name, expected_gle, "2019-01-10")
def test_pda_submission_and_cancellation(self):
pda = frappe.get_doc(
dict(
doctype="Process Deferred Accounting",
posting_date="2019-01-01",
start_date="2019-01-01",
end_date="2019-01-31",
type="Income",
)
)
pda.submit()
pda.cancel()

View File

@@ -535,7 +535,11 @@ def get_accounts(root_type, companies):
): ):
if account.account_name not in added_accounts: if account.account_name not in added_accounts:
accounts.append(account) accounts.append(account)
added_accounts.append(account.account_name) if account.account_number:
account_key = account.account_number + "-" + account.account_name
else:
account_key = account.account_name
added_accounts.append(account_key)
return accounts return accounts

View File

@@ -770,6 +770,18 @@ class calculate_taxes_and_totals(object):
self.doc.precision("outstanding_amount"), self.doc.precision("outstanding_amount"),
) )
if (
self.doc.doctype == "Sales Invoice"
and self.doc.get("is_pos")
and self.doc.get("pos_profile")
and self.doc.get("is_consolidated")
):
write_off_limit = flt(
frappe.db.get_value("POS Profile", self.doc.pos_profile, "write_off_limit")
)
if write_off_limit and abs(self.doc.outstanding_amount) <= write_off_limit:
self.doc.write_off_outstanding_amount_automatically = 1
if ( if (
self.doc.doctype == "Sales Invoice" self.doc.doctype == "Sales Invoice"
and self.doc.get("is_pos") and self.doc.get("is_pos")

View File

@@ -236,7 +236,7 @@ def get_term_loans(date, term_loan=None, loan_type=None):
AND l.is_term_loan =1 AND l.is_term_loan =1
AND rs.payment_date <= %s AND rs.payment_date <= %s
AND rs.is_accrued=0 {0} AND rs.is_accrued=0 {0}
AND rs.interest_amount > 0 AND rs.principal_amount > 0
AND l.status = 'Disbursed' AND l.status = 'Disbursed'
ORDER BY rs.payment_date""".format( ORDER BY rs.payment_date""".format(
condition condition

View File

@@ -16,18 +16,18 @@ def execute():
delete_auto_email_reports(report) delete_auto_email_reports(report)
check_and_delete_linked_reports(report) check_and_delete_linked_reports(report)
frappe.delete_doc("Report", report) frappe.delete_doc("Report", report, force=True)
def delete_auto_email_reports(report): def delete_auto_email_reports(report):
"""Check for one or multiple Auto Email Reports and delete""" """Check for one or multiple Auto Email Reports and delete"""
auto_email_reports = frappe.db.get_values("Auto Email Report", {"report": report}, ["name"]) auto_email_reports = frappe.db.get_values("Auto Email Report", {"report": report}, ["name"])
for auto_email_report in auto_email_reports: for auto_email_report in auto_email_reports:
frappe.delete_doc("Auto Email Report", auto_email_report[0]) frappe.delete_doc("Auto Email Report", auto_email_report[0], force=True)
def delete_links_from_desktop_icons(report): def delete_links_from_desktop_icons(report):
"""Check for one or multiple Desktop Icons and delete""" """Check for one or multiple Desktop Icons and delete"""
desktop_icons = frappe.db.get_values("Desktop Icon", {"_report": report}, ["name"]) desktop_icons = frappe.db.get_values("Desktop Icon", {"_report": report}, ["name"])
for desktop_icon in desktop_icons: for desktop_icon in desktop_icons:
frappe.delete_doc("Desktop Icon", desktop_icon[0]) frappe.delete_doc("Desktop Icon", desktop_icon[0], force=True)

View File

@@ -177,16 +177,16 @@ def get_tax_data_for_each_vat_setting(vat_setting, filters, doctype):
"parent": invoice.name, "parent": invoice.name,
"item_tax_template": vat_setting.item_tax_template, "item_tax_template": vat_setting.item_tax_template,
}, },
fields=["item_code", "net_amount"], fields=["item_code", "base_net_amount"],
) )
for item in invoice_items: for item in invoice_items:
# Summing up total taxable amount # Summing up total taxable amount
if invoice.is_return == 0: if invoice.is_return == 0:
total_taxable_amount += item.net_amount total_taxable_amount += item.base_net_amount
if invoice.is_return == 1: if invoice.is_return == 1:
total_taxable_adjustment_amount += item.net_amount total_taxable_adjustment_amount += item.base_net_amount
# Summing up total tax # Summing up total tax
total_tax += get_tax_amount(item.item_code, vat_setting.account, doctype, invoice.name) total_tax += get_tax_amount(item.item_code, vat_setting.account, doctype, invoice.name)

View File

@@ -87,7 +87,7 @@ def create_qr_code(doc, method=None):
tlv_array.append("".join([tag, length, value])) tlv_array.append("".join([tag, length, value]))
# Invoice Amount # Invoice Amount
invoice_amount = str(doc.grand_total) invoice_amount = str(doc.base_grand_total)
tag = bytes([4]).hex() tag = bytes([4]).hex()
length = bytes([len(invoice_amount)]).hex() length = bytes([len(invoice_amount)]).hex()
value = invoice_amount.encode("utf-8").hex() value = invoice_amount.encode("utf-8").hex()
@@ -147,7 +147,7 @@ def get_vat_amount(doc):
for tax in doc.get("taxes"): for tax in doc.get("taxes"):
if tax.account_head in vat_accounts: if tax.account_head in vat_accounts:
vat_amount += tax.tax_amount vat_amount += tax.base_tax_amount
return vat_amount return vat_amount

View File

@@ -265,7 +265,7 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False):
def set_expired_status(): def set_expired_status():
# filter out submitted non expired quotations whose validity has been ended # filter out submitted non expired quotations whose validity has been ended
cond = "qo.docstatus = 1 and qo.status != 'Expired' and qo.valid_till < %s" cond = "qo.docstatus = 1 and qo.status NOT IN ('Expired', 'Lost') and qo.valid_till < %s"
# check if those QUO have SO against it # check if those QUO have SO against it
so_against_quo = """ so_against_quo = """
SELECT SELECT

View File

@@ -48,41 +48,31 @@
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "Item", "options": "Item",
"reqd": 1, "reqd": 1,
"search_index": 1, "search_index": 1
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "uom", "fieldname": "uom",
"fieldtype": "Link", "fieldtype": "Link",
"label": "UOM", "label": "UOM",
"options": "UOM", "options": "UOM"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"default": "0", "default": "0",
"description": "Quantity that must be bought or sold per UOM", "description": "Quantity that must be bought or sold per UOM",
"fieldname": "packing_unit", "fieldname": "packing_unit",
"fieldtype": "Int", "fieldtype": "Int",
"label": "Packing Unit", "label": "Packing Unit"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "column_break_17", "fieldname": "column_break_17",
"fieldtype": "Column Break", "fieldtype": "Column Break"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "item_name", "fieldname": "item_name",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Item Name", "label": "Item Name",
"read_only": 1, "read_only": 1
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fetch_from": "item_code.brand", "fetch_from": "item_code.brand",
@@ -90,36 +80,29 @@
"fieldtype": "Read Only", "fieldtype": "Read Only",
"in_list_view": 1, "in_list_view": 1,
"label": "Brand", "label": "Brand",
"read_only": 1, "read_only": 1
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "item_description", "fieldname": "item_description",
"fieldtype": "Text", "fieldtype": "Text",
"label": "Item Description", "label": "Item Description",
"read_only": 1, "read_only": 1
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "price_list_details", "fieldname": "price_list_details",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Price List", "label": "Price List",
"options": "fa fa-tags", "options": "fa fa-tags"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "price_list", "fieldname": "price_list",
"fieldtype": "Link", "fieldtype": "Link",
"in_global_search": 1, "in_global_search": 1,
"in_list_view": 1,
"in_standard_filter": 1, "in_standard_filter": 1,
"label": "Price List", "label": "Price List",
"options": "Price List", "options": "Price List",
"reqd": 1, "reqd": 1
"show_days": 1,
"show_seconds": 1
}, },
{ {
"bold": 1, "bold": 1,
@@ -127,49 +110,37 @@
"fieldname": "customer", "fieldname": "customer",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Customer", "label": "Customer",
"options": "Customer", "options": "Customer"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"depends_on": "eval:doc.buying == 1", "depends_on": "eval:doc.buying == 1",
"fieldname": "supplier", "fieldname": "supplier",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Supplier", "label": "Supplier",
"options": "Supplier", "options": "Supplier"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "column_break_3", "fieldname": "column_break_3",
"fieldtype": "Column Break", "fieldtype": "Column Break"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "buying", "fieldname": "buying",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Buying", "label": "Buying",
"read_only": 1, "read_only": 1
"show_days": 1,
"show_seconds": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "selling", "fieldname": "selling",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Selling", "label": "Selling",
"read_only": 1, "read_only": 1
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "item_details", "fieldname": "item_details",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"options": "fa fa-tag", "options": "fa fa-tag"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"bold": 1, "bold": 1,
@@ -177,15 +148,11 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Currency", "label": "Currency",
"options": "Currency", "options": "Currency",
"read_only": 1, "read_only": 1
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "col_br_1", "fieldname": "col_br_1",
"fieldtype": "Column Break", "fieldtype": "Column Break"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "price_list_rate", "fieldname": "price_list_rate",
@@ -197,80 +164,61 @@
"oldfieldname": "ref_rate", "oldfieldname": "ref_rate",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "currency", "options": "currency",
"reqd": 1, "reqd": 1
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "section_break_15", "fieldname": "section_break_15",
"fieldtype": "Section Break", "fieldtype": "Section Break"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"default": "Today", "default": "Today",
"fieldname": "valid_from", "fieldname": "valid_from",
"fieldtype": "Date", "fieldtype": "Date",
"label": "Valid From", "label": "Valid From"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"default": "0", "default": "0",
"fieldname": "lead_time_days", "fieldname": "lead_time_days",
"fieldtype": "Int", "fieldtype": "Int",
"label": "Lead Time in days", "label": "Lead Time in days"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "column_break_18", "fieldname": "column_break_18",
"fieldtype": "Column Break", "fieldtype": "Column Break"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "valid_upto", "fieldname": "valid_upto",
"fieldtype": "Date", "fieldtype": "Date",
"label": "Valid Upto", "label": "Valid Upto"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "section_break_24", "fieldname": "section_break_24",
"fieldtype": "Section Break", "fieldtype": "Section Break"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "note", "fieldname": "note",
"fieldtype": "Text", "fieldtype": "Text",
"label": "Note", "label": "Note"
"show_days": 1,
"show_seconds": 1
}, },
{ {
"fieldname": "reference", "fieldname": "reference",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Reference", "in_standard_filter": 1,
"show_days": 1, "label": "Reference"
"show_seconds": 1
}, },
{ {
"fieldname": "batch_no", "fieldname": "batch_no",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Batch No", "label": "Batch No",
"options": "Batch", "options": "Batch"
"show_days": 1,
"show_seconds": 1
} }
], ],
"icon": "fa fa-flag", "icon": "fa fa-flag",
"idx": 1, "idx": 1,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2020-12-08 18:12:15.395772", "modified": "2022-09-02 16:33:55.612992",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Item Price", "name": "Item Price",
@@ -307,6 +255,7 @@
"quick_entry": 1, "quick_entry": 1,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "ASC", "sort_order": "ASC",
"states": [],
"title_field": "item_name", "title_field": "item_name",
"track_changes": 1 "track_changes": 1
} }

View File

@@ -0,0 +1,3 @@
frappe.listview_settings['Item Price'] = {
hide_name_column: true,
};

View File

@@ -856,15 +856,22 @@ class StockEntry(StockController):
se_item.item_code, self.purchase_order se_item.item_code, self.purchase_order
) )
) )
total_supplied = frappe.db.sql(
"""select sum(transfer_qty) se = frappe.qb.DocType("Stock Entry")
from `tabStock Entry Detail`, `tabStock Entry` se_detail = frappe.qb.DocType("Stock Entry Detail")
where `tabStock Entry`.purchase_order = %s
and `tabStock Entry`.docstatus = 1 total_supplied = (
and `tabStock Entry Detail`.item_code = %s frappe.qb.from_(se)
and `tabStock Entry Detail`.parent = `tabStock Entry`.name""", .inner_join(se_detail)
(self.purchase_order, se_item.item_code), .on(se.name == se_detail.parent)
)[0][0] .select(Sum(se_detail.transfer_qty))
.where(
(se.purpose == "Send to Subcontractor")
& (se.purchase_order == self.purchase_order)
& (se_detail.item_code == se_item.item_code)
& (se.docstatus == 1)
)
).run()[0][0]
if flt(total_supplied, precision) > flt(total_allowed, precision): if flt(total_supplied, precision) > flt(total_allowed, precision):
frappe.throw( frappe.throw(