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
frappe.ui.form.on("Journal Entry Template", {
setup: function(frm) {
refresh: function(frm) {
frappe.model.set_default_values(frm.doc);
frm.set_query("account" ,"accounts", function(){

View File

@@ -43,6 +43,7 @@
"currency",
"write_off_account",
"write_off_cost_center",
"write_off_limit",
"account_for_change_amount",
"disable_rounded_total",
"column_break_23",
@@ -360,6 +361,14 @@
"fieldtype": "Check",
"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",
"description": "If enabled, the consolidated invoices will have rounded total disabled",
@@ -393,7 +402,7 @@
"link_fieldname": "pos_profile"
}
],
"modified": "2022-07-21 11:16:46.911173",
"modified": "2022-08-10 12:57:06.241439",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Profile",

View File

@@ -34,4 +34,4 @@ class ProcessDeferredAccounting(Document):
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")
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:
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

View File

@@ -770,6 +770,18 @@ class calculate_taxes_and_totals(object):
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 (
self.doc.doctype == "Sales Invoice"
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 rs.payment_date <= %s
AND rs.is_accrued=0 {0}
AND rs.interest_amount > 0
AND rs.principal_amount > 0
AND l.status = 'Disbursed'
ORDER BY rs.payment_date""".format(
condition

View File

@@ -16,18 +16,18 @@ def execute():
delete_auto_email_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):
"""Check for one or multiple Auto Email Reports and delete"""
auto_email_reports = frappe.db.get_values("Auto Email Report", {"report": report}, ["name"])
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):
"""Check for one or multiple Desktop Icons and delete"""
desktop_icons = frappe.db.get_values("Desktop Icon", {"_report": report}, ["name"])
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,
"item_tax_template": vat_setting.item_tax_template,
},
fields=["item_code", "net_amount"],
fields=["item_code", "base_net_amount"],
)
for item in invoice_items:
# Summing up total taxable amount
if invoice.is_return == 0:
total_taxable_amount += item.net_amount
total_taxable_amount += item.base_net_amount
if invoice.is_return == 1:
total_taxable_adjustment_amount += item.net_amount
total_taxable_adjustment_amount += item.base_net_amount
# Summing up total tax
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]))
# Invoice Amount
invoice_amount = str(doc.grand_total)
invoice_amount = str(doc.base_grand_total)
tag = bytes([4]).hex()
length = bytes([len(invoice_amount)]).hex()
value = invoice_amount.encode("utf-8").hex()
@@ -147,7 +147,7 @@ def get_vat_amount(doc):
for tax in doc.get("taxes"):
if tax.account_head in vat_accounts:
vat_amount += tax.tax_amount
vat_amount += tax.base_tax_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():
# 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
so_against_quo = """
SELECT

View File

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