mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-04 05:58:27 +00:00
Merge branch 'version-14-hotfix' into mergify/bp/version-14-hotfix/pr-33013
This commit is contained in:
@@ -37,6 +37,14 @@ frappe.ui.form.on("Bank Clearance", {
|
||||
|
||||
refresh: function(frm) {
|
||||
frm.disable_save();
|
||||
|
||||
if (frm.doc.account && frm.doc.from_date && frm.doc.to_date) {
|
||||
frm.add_custom_button(__('Get Payment Entries'), () =>
|
||||
frm.trigger("get_payment_entries")
|
||||
);
|
||||
|
||||
frm.change_custom_button_type('Get Payment Entries', null, 'primary');
|
||||
}
|
||||
},
|
||||
|
||||
update_clearance_date: function(frm) {
|
||||
@@ -46,22 +54,30 @@ frappe.ui.form.on("Bank Clearance", {
|
||||
callback: function(r, rt) {
|
||||
frm.refresh_field("payment_entries");
|
||||
frm.refresh_fields();
|
||||
|
||||
if (!frm.doc.payment_entries.length) {
|
||||
frm.change_custom_button_type('Get Payment Entries', null, 'primary');
|
||||
frm.change_custom_button_type('Update Clearance Date', null, 'default');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
get_payment_entries: function(frm) {
|
||||
return frappe.call({
|
||||
method: "get_payment_entries",
|
||||
doc: frm.doc,
|
||||
callback: function(r, rt) {
|
||||
frm.refresh_field("payment_entries");
|
||||
frm.refresh_fields();
|
||||
|
||||
$(frm.fields_dict.payment_entries.wrapper).find("[data-fieldname=amount]").each(function(i,v){
|
||||
if (i !=0){
|
||||
$(v).addClass("text-right")
|
||||
}
|
||||
})
|
||||
if (frm.doc.payment_entries.length) {
|
||||
frm.add_custom_button(__('Update Clearance Date'), () =>
|
||||
frm.trigger("update_clearance_date")
|
||||
);
|
||||
|
||||
frm.change_custom_button_type('Get Payment Entries', null, 'default');
|
||||
frm.change_custom_button_type('Update Clearance Date', null, 'primary');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_copy": 1,
|
||||
"creation": "2013-01-10 16:34:05",
|
||||
"doctype": "DocType",
|
||||
@@ -13,11 +14,8 @@
|
||||
"bank_account",
|
||||
"include_reconciled_entries",
|
||||
"include_pos_transactions",
|
||||
"get_payment_entries",
|
||||
"section_break_10",
|
||||
"payment_entries",
|
||||
"update_clearance_date",
|
||||
"total_amount"
|
||||
"payment_entries"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -76,11 +74,6 @@
|
||||
"fieldtype": "Check",
|
||||
"label": "Include POS Transactions"
|
||||
},
|
||||
{
|
||||
"fieldname": "get_payment_entries",
|
||||
"fieldtype": "Button",
|
||||
"label": "Get Payment Entries"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_10",
|
||||
"fieldtype": "Section Break"
|
||||
@@ -91,25 +84,14 @@
|
||||
"fieldtype": "Table",
|
||||
"label": "Payment Entries",
|
||||
"options": "Bank Clearance Detail"
|
||||
},
|
||||
{
|
||||
"fieldname": "update_clearance_date",
|
||||
"fieldtype": "Button",
|
||||
"label": "Update Clearance Date"
|
||||
},
|
||||
{
|
||||
"fieldname": "total_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Amount",
|
||||
"options": "account_currency",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"hide_toolbar": 1,
|
||||
"icon": "fa fa-check",
|
||||
"idx": 1,
|
||||
"issingle": 1,
|
||||
"modified": "2020-04-06 16:12:06.628008",
|
||||
"links": [],
|
||||
"modified": "2022-11-28 17:24:13.008692",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Bank Clearance",
|
||||
@@ -126,5 +108,6 @@
|
||||
"quick_entry": 1,
|
||||
"read_only": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "ASC"
|
||||
"sort_order": "ASC",
|
||||
"states": []
|
||||
}
|
||||
@@ -179,7 +179,6 @@ class BankClearance(Document):
|
||||
)
|
||||
|
||||
self.set("payment_entries", [])
|
||||
self.total_amount = 0.0
|
||||
default_currency = erpnext.get_default_currency()
|
||||
|
||||
for d in entries:
|
||||
@@ -198,7 +197,6 @@ class BankClearance(Document):
|
||||
d.pop("debit")
|
||||
d.pop("account_currency")
|
||||
row.update(d)
|
||||
self.total_amount += flt(amount)
|
||||
|
||||
@frappe.whitelist()
|
||||
def update_clearance_date(self):
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
frappe.provide("erpnext.accounts");
|
||||
|
||||
erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnext.selling.SellingController {
|
||||
settings = {};
|
||||
|
||||
setup(doc) {
|
||||
this.setup_posting_date_time_check();
|
||||
super.setup(doc);
|
||||
@@ -12,21 +14,37 @@ erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnex
|
||||
|
||||
company() {
|
||||
erpnext.accounts.dimensions.update_dimension(this.frm, this.frm.doctype);
|
||||
this.frm.set_value("set_warehouse", "");
|
||||
this.frm.set_value("taxes_and_charges", "");
|
||||
}
|
||||
|
||||
onload(doc) {
|
||||
super.onload();
|
||||
this.frm.ignore_doctypes_on_cancel_all = ['POS Invoice Merge Log', 'POS Closing Entry'];
|
||||
|
||||
if(doc.__islocal && doc.is_pos && frappe.get_route_str() !== 'point-of-sale') {
|
||||
this.frm.script_manager.trigger("is_pos");
|
||||
this.frm.refresh_fields();
|
||||
}
|
||||
|
||||
this.frm.set_query("set_warehouse", function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
company: doc.company ? doc.company : '',
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
erpnext.accounts.dimensions.setup_dimension_filters(this.frm, this.frm.doctype);
|
||||
}
|
||||
|
||||
onload_post_render(frm) {
|
||||
this.pos_profile(frm);
|
||||
}
|
||||
|
||||
refresh(doc) {
|
||||
super.refresh();
|
||||
|
||||
if (doc.docstatus == 1 && !doc.is_return) {
|
||||
this.frm.add_custom_button(__('Return'), this.make_sales_return, __('Create'));
|
||||
this.frm.page.set_inner_btn_group_as_primary(__('Create'));
|
||||
@@ -36,6 +54,18 @@ erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnex
|
||||
this.frm.return_print_format = "Sales Invoice Return";
|
||||
this.frm.set_value('consolidated_invoice', '');
|
||||
}
|
||||
|
||||
this.frm.set_query("customer", (function () {
|
||||
const customer_groups = this.settings?.customer_groups;
|
||||
|
||||
if (!customer_groups?.length) return {};
|
||||
|
||||
return {
|
||||
filters: {
|
||||
customer_group: ["in", customer_groups],
|
||||
}
|
||||
}
|
||||
}).bind(this));
|
||||
}
|
||||
|
||||
is_pos() {
|
||||
@@ -88,6 +118,25 @@ erpnext.selling.POSInvoiceController = class POSInvoiceController extends erpnex
|
||||
});
|
||||
}
|
||||
|
||||
pos_profile(frm) {
|
||||
if (!frm.pos_profile || frm.pos_profile == '') {
|
||||
this.update_customer_groups_settings([]);
|
||||
return;
|
||||
}
|
||||
|
||||
frappe.call({
|
||||
method: "erpnext.selling.page.point_of_sale.point_of_sale.get_pos_profile_data",
|
||||
args: { "pos_profile": frm.pos_profile },
|
||||
callback: ({ message: profile }) => {
|
||||
this.update_customer_groups_settings(profile?.customer_groups);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
update_customer_groups_settings(customer_groups) {
|
||||
this.settings.customer_groups = customer_groups?.map((group) => group.name)
|
||||
}
|
||||
|
||||
amount(){
|
||||
this.write_off_outstanding_amount_automatically()
|
||||
}
|
||||
|
||||
@@ -239,6 +239,14 @@ class AccountsController(TransactionBase):
|
||||
else:
|
||||
item.set(field_map.get(self.doctype), default_deferred_account)
|
||||
|
||||
def validate_auto_repeat_subscription_dates(self):
|
||||
if (
|
||||
self.get("from_date")
|
||||
and self.get("to_date")
|
||||
and getdate(self.from_date) > getdate(self.to_date)
|
||||
):
|
||||
frappe.throw(_("To Date cannot be before From Date"), title=_("Invalid Auto Repeat Date"))
|
||||
|
||||
def validate_deferred_start_and_end_date(self):
|
||||
for d in self.items:
|
||||
if d.get("enable_deferred_revenue") or d.get("enable_deferred_expense"):
|
||||
|
||||
@@ -41,6 +41,7 @@ class BuyingController(SubcontractingController):
|
||||
self.validate_from_warehouse()
|
||||
self.set_supplier_address()
|
||||
self.validate_asset_return()
|
||||
self.validate_auto_repeat_subscription_dates()
|
||||
|
||||
if self.doctype == "Purchase Invoice":
|
||||
self.validate_purchase_receipt_if_update_stock()
|
||||
|
||||
@@ -40,6 +40,7 @@ class SellingController(StockController):
|
||||
self.set_customer_address()
|
||||
self.validate_for_duplicate_items()
|
||||
self.validate_target_warehouse()
|
||||
self.validate_auto_repeat_subscription_dates()
|
||||
|
||||
def set_missing_values(self, for_validate=False):
|
||||
|
||||
|
||||
@@ -1079,7 +1079,8 @@ erpnext.stock.select_batch_and_serial_no = (frm, item) => {
|
||||
if (frm.doc.purpose === 'Material Receipt') return;
|
||||
|
||||
frappe.require("assets/erpnext/js/utils/serial_no_batch_selector.js", function() {
|
||||
new erpnext.SerialNoBatchSelector({
|
||||
if (frm.batch_selector?.dialog?.display) return;
|
||||
frm.batch_selector = new erpnext.SerialNoBatchSelector({
|
||||
frm: frm,
|
||||
item: item,
|
||||
warehouse_details: get_warehouse_type_and_name(item),
|
||||
|
||||
@@ -230,7 +230,7 @@ class StockReconciliation(StockController):
|
||||
|
||||
if item.has_serial_no or item.has_batch_no:
|
||||
has_serial_no = True
|
||||
self.get_sle_for_serialized_items(row, sl_entries)
|
||||
self.get_sle_for_serialized_items(row, sl_entries, item)
|
||||
else:
|
||||
if row.serial_no or row.batch_no:
|
||||
frappe.throw(
|
||||
@@ -282,7 +282,7 @@ class StockReconciliation(StockController):
|
||||
if has_serial_no and sl_entries:
|
||||
self.update_valuation_rate_for_serial_no()
|
||||
|
||||
def get_sle_for_serialized_items(self, row, sl_entries):
|
||||
def get_sle_for_serialized_items(self, row, sl_entries, item):
|
||||
from erpnext.stock.stock_ledger import get_previous_sle
|
||||
|
||||
serial_nos = get_serial_nos(row.serial_no)
|
||||
@@ -348,6 +348,9 @@ class StockReconciliation(StockController):
|
||||
if row.qty:
|
||||
args = self.get_sle_for_items(row)
|
||||
|
||||
if item.has_serial_no and item.has_batch_no:
|
||||
args["qty_after_transaction"] = row.qty
|
||||
|
||||
args.update(
|
||||
{
|
||||
"actual_qty": row.qty,
|
||||
|
||||
@@ -644,6 +644,38 @@ class TestStockReconciliation(FrappeTestCase, StockTestMixin):
|
||||
)
|
||||
self.assertEqual(len(active_sr_no), 0)
|
||||
|
||||
def test_serial_no_batch_no_item(self):
|
||||
item = self.make_item(
|
||||
"Test Serial No Batch No Item",
|
||||
{
|
||||
"is_stock_item": 1,
|
||||
"has_serial_no": 1,
|
||||
"has_batch_no": 1,
|
||||
"serial_no_series": "SRS9.####",
|
||||
"batch_number_series": "BNS9.####",
|
||||
"create_new_batch": 1,
|
||||
},
|
||||
)
|
||||
|
||||
warehouse = "_Test Warehouse - _TC"
|
||||
|
||||
sr = create_stock_reconciliation(
|
||||
item_code=item.name,
|
||||
warehouse=warehouse,
|
||||
qty=1,
|
||||
rate=100,
|
||||
)
|
||||
|
||||
sl_entry = frappe.db.get_value(
|
||||
"Stock Ledger Entry",
|
||||
{"voucher_type": "Stock Reconciliation", "voucher_no": sr.name},
|
||||
["actual_qty", "qty_after_transaction"],
|
||||
as_dict=1,
|
||||
)
|
||||
|
||||
self.assertEqual(flt(sl_entry.actual_qty), 1.0)
|
||||
self.assertEqual(flt(sl_entry.qty_after_transaction), 1.0)
|
||||
|
||||
|
||||
def create_batch_item_with_batch(item_name, batch_id):
|
||||
batch_item_doc = create_item(item_name, is_stock_item=1)
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<div class="product-container mt-4 {{ padding_top }} {{ info_col }}">
|
||||
<div class="item-content {{ 'mt-minus-2' if (show_tabs and tabs) else '' }}">
|
||||
<div class="product-page-content" itemscope itemtype="http://schema.org/Product">
|
||||
<div class="product-page-content">
|
||||
<!-- Product Specifications Table Section -->
|
||||
{% if show_tabs and tabs %}
|
||||
<div class="category-tabs">
|
||||
|
||||
Reference in New Issue
Block a user