Merge branch 'develop' of https://github.com/frappe/erpnext into demo_data_on_install

This commit is contained in:
Deepesh Garg
2023-07-31 13:02:34 +05:30
9 changed files with 36 additions and 28 deletions

View File

@@ -903,12 +903,12 @@ frappe.ui.form.on('Payment Entry', {
if(frm.doc.payment_type == "Receive" if(frm.doc.payment_type == "Receive"
&& frm.doc.base_total_allocated_amount < frm.doc.base_received_amount + total_deductions && frm.doc.base_total_allocated_amount < frm.doc.base_received_amount + total_deductions
&& frm.doc.total_allocated_amount < frm.doc.paid_amount + (total_deductions / frm.doc.source_exchange_rate)) { && frm.doc.total_allocated_amount < frm.doc.paid_amount + (total_deductions / frm.doc.source_exchange_rate)) {
unallocated_amount = (frm.doc.base_received_amount + total_deductions + frm.doc.base_total_taxes_and_charges unallocated_amount = (frm.doc.base_received_amount + total_deductions + flt(frm.doc.base_total_taxes_and_charges)
- frm.doc.base_total_allocated_amount) / frm.doc.source_exchange_rate; - frm.doc.base_total_allocated_amount) / frm.doc.source_exchange_rate;
} else if (frm.doc.payment_type == "Pay" } else if (frm.doc.payment_type == "Pay"
&& frm.doc.base_total_allocated_amount < frm.doc.base_paid_amount - total_deductions && frm.doc.base_total_allocated_amount < frm.doc.base_paid_amount - total_deductions
&& frm.doc.total_allocated_amount < frm.doc.received_amount + (total_deductions / frm.doc.target_exchange_rate)) { && frm.doc.total_allocated_amount < frm.doc.received_amount + (total_deductions / frm.doc.target_exchange_rate)) {
unallocated_amount = (frm.doc.base_paid_amount + frm.doc.base_total_taxes_and_charges - (total_deductions unallocated_amount = (frm.doc.base_paid_amount + flt(frm.doc.base_total_taxes_and_charges) - (total_deductions
+ frm.doc.base_total_allocated_amount)) / frm.doc.target_exchange_rate; + frm.doc.base_total_allocated_amount)) / frm.doc.target_exchange_rate;
} }
} }

View File

@@ -1833,7 +1833,7 @@ def validate_inter_company_party(doctype, party, company, inter_company_referenc
doc = frappe.get_doc(ref_doc, inter_company_reference) doc = frappe.get_doc(ref_doc, inter_company_reference)
ref_party = doc.supplier if doctype in ["Sales Invoice", "Sales Order"] else doc.customer ref_party = doc.supplier if doctype in ["Sales Invoice", "Sales Order"] else doc.customer
if not frappe.db.get_value(partytype, {"represents_company": doc.company}, "name") == party: if not frappe.db.get_value(partytype, {"represents_company": doc.company}, "name") == party:
frappe.throw(_("Invalid {0} for Inter Company Transaction.").format(partytype)) frappe.throw(_("Invalid {0} for Inter Company Transaction.").format(_(partytype)))
if not frappe.get_cached_value(ref_partytype, ref_party, "represents_company") == company: if not frappe.get_cached_value(ref_partytype, ref_party, "represents_company") == company:
frappe.throw(_("Invalid Company for Inter Company Transaction.")) frappe.throw(_("Invalid Company for Inter Company Transaction."))
@@ -1847,7 +1847,7 @@ def validate_inter_company_party(doctype, party, company, inter_company_referenc
if not company in companies: if not company in companies:
frappe.throw( frappe.throw(
_("{0} not allowed to transact with {1}. Please change the Company.").format( _("{0} not allowed to transact with {1}. Please change the Company.").format(
partytype, company _(partytype), company
) )
) )

View File

@@ -65,7 +65,7 @@ frappe.ui.form.on("Purchase Order", {
get_materials_from_supplier: function(frm) { get_materials_from_supplier: function(frm) {
let po_details = []; let po_details = [];
if (frm.doc.supplied_items && (frm.doc.per_received == 100 || frm.doc.status === 'Closed')) { if (frm.doc.supplied_items && (flt(frm.doc.per_received, 2) == 100 || frm.doc.status === 'Closed')) {
frm.doc.supplied_items.forEach(d => { frm.doc.supplied_items.forEach(d => {
if (d.total_supplied_qty && d.total_supplied_qty != d.consumed_qty) { if (d.total_supplied_qty && d.total_supplied_qty != d.consumed_qty) {
po_details.push(d.name) po_details.push(d.name)
@@ -184,7 +184,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends e
} }
if(!in_list(["Closed", "Delivered"], doc.status)) { if(!in_list(["Closed", "Delivered"], doc.status)) {
if(this.frm.doc.status !== 'Closed' && flt(this.frm.doc.per_received) < 100 && flt(this.frm.doc.per_billed) < 100) { if(this.frm.doc.status !== 'Closed' && flt(this.frm.doc.per_received, 2) < 100 && flt(this.frm.doc.per_billed, 2) < 100) {
// Don't add Update Items button if the PO is following the new subcontracting flow. // Don't add Update Items button if the PO is following the new subcontracting flow.
if (!(this.frm.doc.is_subcontracted && !this.frm.doc.is_old_subcontracting_flow)) { if (!(this.frm.doc.is_subcontracted && !this.frm.doc.is_old_subcontracting_flow)) {
this.frm.add_custom_button(__('Update Items'), () => { this.frm.add_custom_button(__('Update Items'), () => {
@@ -198,7 +198,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends e
} }
} }
if (this.frm.has_perm("submit")) { if (this.frm.has_perm("submit")) {
if(flt(doc.per_billed, 6) < 100 || flt(doc.per_received, 6) < 100) { if(flt(doc.per_billed, 2) < 100 || flt(doc.per_received, 2) < 100) {
if (doc.status != "On Hold") { if (doc.status != "On Hold") {
this.frm.add_custom_button(__('Hold'), () => this.hold_purchase_order(), __("Status")); this.frm.add_custom_button(__('Hold'), () => this.hold_purchase_order(), __("Status"));
} else{ } else{
@@ -221,7 +221,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends e
} }
if(doc.status != "Closed") { if(doc.status != "Closed") {
if (doc.status != "On Hold") { if (doc.status != "On Hold") {
if(flt(doc.per_received) < 100 && allow_receipt) { if(flt(doc.per_received, 2) < 100 && allow_receipt) {
cur_frm.add_custom_button(__('Purchase Receipt'), this.make_purchase_receipt, __('Create')); cur_frm.add_custom_button(__('Purchase Receipt'), this.make_purchase_receipt, __('Create'));
if (doc.is_subcontracted) { if (doc.is_subcontracted) {
if (doc.is_old_subcontracting_flow) { if (doc.is_old_subcontracting_flow) {
@@ -234,11 +234,11 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends e
} }
} }
} }
if(flt(doc.per_billed) < 100) if(flt(doc.per_billed, 2) < 100)
cur_frm.add_custom_button(__('Purchase Invoice'), cur_frm.add_custom_button(__('Purchase Invoice'),
this.make_purchase_invoice, __('Create')); this.make_purchase_invoice, __('Create'));
if(flt(doc.per_billed) < 100 && doc.status != "Delivered") { if(flt(doc.per_billed, 2) < 100 && doc.status != "Delivered") {
this.frm.add_custom_button( this.frm.add_custom_button(
__('Payment'), __('Payment'),
() => this.make_payment_entry(), () => this.make_payment_entry(),
@@ -246,7 +246,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends e
); );
} }
if(flt(doc.per_billed) < 100) { if(flt(doc.per_billed, 2) < 100) {
this.frm.add_custom_button(__('Payment Request'), this.frm.add_custom_button(__('Payment Request'),
function() { me.make_payment_request() }, __('Create')); function() { me.make_payment_request() }, __('Create'));
} }

View File

@@ -206,9 +206,11 @@ def post_process(doctype, data):
) )
if doc.get("per_delivered"): if doc.get("per_delivered"):
doc.status_percent += flt(doc.per_delivered) doc.status_percent += flt(doc.per_delivered, 2)
doc.status_display.append( doc.status_display.append(
_("Delivered") if doc.per_delivered == 100 else _("{0}% Delivered").format(doc.per_delivered) _("Delivered")
if flt(doc.per_delivered, 2) == 100
else _("{0}% Delivered").format(doc.per_delivered)
) )
if hasattr(doc, "set_indicator"): if hasattr(doc, "set_indicator"):

View File

@@ -6,7 +6,9 @@ def execute():
frappe.reload_doc("selling", "doctype", "sales_order_item") frappe.reload_doc("selling", "doctype", "sales_order_item")
for doctype in ["Sales Order", "Material Request"]: for doctype in ["Sales Order", "Material Request"]:
condition = " and child_doc.stock_qty > child_doc.produced_qty and doc.per_delivered < 100" condition = (
" and child_doc.stock_qty > child_doc.produced_qty and ROUND(doc.per_delivered, 2) < 100"
)
if doctype == "Material Request": if doctype == "Material Request":
condition = " and doc.per_ordered < 100 and doc.material_request_type = 'Manufacture'" condition = " and doc.per_ordered < 100 and doc.material_request_type = 'Manufacture'"

View File

@@ -52,7 +52,7 @@ frappe.ui.form.on("Sales Order", {
refresh: function(frm) { refresh: function(frm) {
if(frm.doc.docstatus === 1) { if(frm.doc.docstatus === 1) {
if (frm.doc.status !== 'Closed' && flt(frm.doc.per_delivered, 6) < 100 && flt(frm.doc.per_billed, 6) < 100) { if (frm.doc.status !== 'Closed' && flt(frm.doc.per_delivered, 2) < 100 && flt(frm.doc.per_billed, 2) < 100) {
frm.add_custom_button(__('Update Items'), () => { frm.add_custom_button(__('Update Items'), () => {
erpnext.utils.update_child_items({ erpnext.utils.update_child_items({
frm: frm, frm: frm,
@@ -309,7 +309,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
me.frm.cscript.update_status('Resume', 'Draft') me.frm.cscript.update_status('Resume', 'Draft')
}, __("Status")); }, __("Status"));
if(flt(doc.per_delivered, 6) < 100 || flt(doc.per_billed) < 100) { if(flt(doc.per_delivered, 2) < 100 || flt(doc.per_billed, 2) < 100) {
// close // close
this.frm.add_custom_button(__('Close'), () => this.close_sales_order(), __("Status")) this.frm.add_custom_button(__('Close'), () => this.close_sales_order(), __("Status"))
} }
@@ -327,7 +327,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
&& !this.frm.doc.skip_delivery_note && !this.frm.doc.skip_delivery_note
if (this.frm.has_perm("submit")) { if (this.frm.has_perm("submit")) {
if(flt(doc.per_delivered, 6) < 100 || flt(doc.per_billed) < 100) { if(flt(doc.per_delivered, 2) < 100 || flt(doc.per_billed, 2) < 100) {
// hold // hold
this.frm.add_custom_button(__('Hold'), () => this.hold_sales_order(), __("Status")) this.frm.add_custom_button(__('Hold'), () => this.hold_sales_order(), __("Status"))
// close // close
@@ -335,7 +335,7 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
} }
} }
if (flt(doc.per_picked, 6) < 100 && flt(doc.per_delivered, 6) < 100) { if (flt(doc.per_picked, 2) < 100 && flt(doc.per_delivered, 2) < 100) {
this.frm.add_custom_button(__('Pick List'), () => this.create_pick_list(), __('Create')); this.frm.add_custom_button(__('Pick List'), () => this.create_pick_list(), __('Create'));
} }
@@ -345,18 +345,18 @@ erpnext.selling.SalesOrderController = class SalesOrderController extends erpnex
const order_is_a_custom_sale = ["Sales", "Shopping Cart", "Maintenance"].indexOf(doc.order_type) === -1; const order_is_a_custom_sale = ["Sales", "Shopping Cart", "Maintenance"].indexOf(doc.order_type) === -1;
// delivery note // delivery note
if(flt(doc.per_delivered, 6) < 100 && (order_is_a_sale || order_is_a_custom_sale) && allow_delivery) { if(flt(doc.per_delivered, 2) < 100 && (order_is_a_sale || order_is_a_custom_sale) && allow_delivery) {
this.frm.add_custom_button(__('Delivery Note'), () => this.make_delivery_note_based_on_delivery_date(), __('Create')); this.frm.add_custom_button(__('Delivery Note'), () => this.make_delivery_note_based_on_delivery_date(), __('Create'));
this.frm.add_custom_button(__('Work Order'), () => this.make_work_order(), __('Create')); this.frm.add_custom_button(__('Work Order'), () => this.make_work_order(), __('Create'));
} }
// sales invoice // sales invoice
if(flt(doc.per_billed, 6) < 100) { if(flt(doc.per_billed, 2) < 100) {
this.frm.add_custom_button(__('Sales Invoice'), () => me.make_sales_invoice(), __('Create')); this.frm.add_custom_button(__('Sales Invoice'), () => me.make_sales_invoice(), __('Create'));
} }
// material request // material request
if(!doc.order_type || (order_is_a_sale || order_is_a_custom_sale) && flt(doc.per_delivered, 6) < 100) { if(!doc.order_type || (order_is_a_sale || order_is_a_custom_sale) && flt(doc.per_delivered, 2) < 100) {
this.frm.add_custom_button(__('Material Request'), () => this.make_material_request(), __('Create')); this.frm.add_custom_button(__('Material Request'), () => this.make_material_request(), __('Create'));
this.frm.add_custom_button(__('Request for Raw Materials'), () => this.make_raw_material_request(), __('Create')); this.frm.add_custom_button(__('Request for Raw Materials'), () => this.make_raw_material_request(), __('Create'));
} }

View File

@@ -10,7 +10,7 @@ frappe.listview_settings['Sales Order'] = {
return [__("On Hold"), "orange", "status,=,On Hold"]; return [__("On Hold"), "orange", "status,=,On Hold"];
} else if (doc.status === "Completed") { } else if (doc.status === "Completed") {
return [__("Completed"), "green", "status,=,Completed"]; return [__("Completed"), "green", "status,=,Completed"];
} else if (!doc.skip_delivery_note && flt(doc.per_delivered, 6) < 100) { } else if (!doc.skip_delivery_note && flt(doc.per_delivered, 2) < 100) {
if (frappe.datetime.get_diff(doc.delivery_date) < 0) { if (frappe.datetime.get_diff(doc.delivery_date) < 0) {
// not delivered & overdue // not delivered & overdue
return [__("Overdue"), "red", return [__("Overdue"), "red",
@@ -19,7 +19,7 @@ frappe.listview_settings['Sales Order'] = {
// not delivered (zeroount order) // not delivered (zeroount order)
return [__("To Deliver"), "orange", return [__("To Deliver"), "orange",
"per_delivered,<,100|grand_total,=,0|status,!=,Closed"]; "per_delivered,<,100|grand_total,=,0|status,!=,Closed"];
} else if (flt(doc.per_billed, 6) < 100) { } else if (flt(doc.per_billed, 2) < 100) {
// not delivered & not billed // not delivered & not billed
return [__("To Deliver and Bill"), "orange", return [__("To Deliver and Bill"), "orange",
"per_delivered,<,100|per_billed,<,100|status,!=,Closed"]; "per_delivered,<,100|per_billed,<,100|status,!=,Closed"];
@@ -28,12 +28,12 @@ frappe.listview_settings['Sales Order'] = {
return [__("To Deliver"), "orange", return [__("To Deliver"), "orange",
"per_delivered,<,100|per_billed,=,100|status,!=,Closed"]; "per_delivered,<,100|per_billed,=,100|status,!=,Closed"];
} }
} else if ((flt(doc.per_delivered, 6) === 100) && flt(doc.grand_total) !== 0 } else if ((flt(doc.per_delivered, 2) === 100) && flt(doc.grand_total) !== 0
&& flt(doc.per_billed, 6) < 100) { && flt(doc.per_billed, 2) < 100) {
// to bill // to bill
return [__("To Bill"), "orange", return [__("To Bill"), "orange",
"per_delivered,=,100|per_billed,<,100|status,!=,Closed"]; "per_delivered,=,100|per_billed,<,100|status,!=,Closed"];
} else if (doc.skip_delivery_note && flt(doc.per_billed, 6) < 100){ } else if (doc.skip_delivery_note && flt(doc.per_billed, 2) < 100){
return [__("To Bill"), "orange", "per_billed,<,100|status,!=,Closed"]; return [__("To Bill"), "orange", "per_billed,<,100|status,!=,Closed"];
} }
}, },

View File

@@ -17,7 +17,7 @@
title = "Warehouse", title = "Warehouse",
actual_qty = (frm.doc.doctype==="Sales Order" actual_qty = (frm.doc.doctype==="Sales Order"
? doc.projected_qty : doc.actual_qty); ? doc.projected_qty : doc.actual_qty);
if(flt(frm.doc.per_delivered) < 100 if(flt(frm.doc.per_delivered, 2) < 100
&& in_list(["Sales Order Item", "Delivery Note Item"], doc.doctype)) { && in_list(["Sales Order Item", "Delivery Note Item"], doc.doctype)) {
if(actual_qty != undefined) { if(actual_qty != undefined) {
if(actual_qty >= doc.qty) { if(actual_qty >= doc.qty) {

View File

@@ -1063,6 +1063,7 @@ Get Items from Prescriptions,Holen Sie sich Artikel aus Verordnungen,
Get Items from Product Bundle,Artikel aus dem Produkt-Bundle übernehmen, Get Items from Product Bundle,Artikel aus dem Produkt-Bundle übernehmen,
Get Suppliers,Holen Sie sich Lieferanten, Get Suppliers,Holen Sie sich Lieferanten,
Get Suppliers By,Holen Sie sich Lieferanten durch, Get Suppliers By,Holen Sie sich Lieferanten durch,
Get Supplier Group Details,Werte aus Lieferantengruppe übernehmen,
Get Updates,Newsletter abonnieren, Get Updates,Newsletter abonnieren,
Get customers from,Holen Sie Kunden von, Get customers from,Holen Sie Kunden von,
Get from Patient Encounter,Von der Patientenbegegnung erhalten, Get from Patient Encounter,Von der Patientenbegegnung erhalten,
@@ -4726,6 +4727,7 @@ Credit To,Gutschreiben auf,
Party Account Currency,Währung des Kontos der Partei, Party Account Currency,Währung des Kontos der Partei,
Against Expense Account,Zu Aufwandskonto, Against Expense Account,Zu Aufwandskonto,
Inter Company Invoice Reference,Unternehmensübergreifende Rechnungsreferenz, Inter Company Invoice Reference,Unternehmensübergreifende Rechnungsreferenz,
Internal Supplier,Interner Lieferant,
Is Internal Supplier,Ist interner Lieferant, Is Internal Supplier,Ist interner Lieferant,
Start date of current invoice's period,Startdatum der laufenden Rechnungsperiode, Start date of current invoice's period,Startdatum der laufenden Rechnungsperiode,
End date of current invoice's period,Schlußdatum der laufenden Eingangsrechnungsperiode, End date of current invoice's period,Schlußdatum der laufenden Eingangsrechnungsperiode,
@@ -5172,6 +5174,8 @@ Tracking,Verfolgung,
Ref SQ,Ref-SQ, Ref SQ,Ref-SQ,
Inter Company Order Reference,Inter Company Bestellreferenz, Inter Company Order Reference,Inter Company Bestellreferenz,
Supplier Part Number,Lieferanten-Artikelnummer, Supplier Part Number,Lieferanten-Artikelnummer,
Supplier Primary Contact,Hauptkontakt des Lieferanten,
Supplier Primary Address,Hauptadresse des Lieferanten,
Billed Amt,Rechnungsbetrag, Billed Amt,Rechnungsbetrag,
Warehouse and Reference,Lager und Referenz, Warehouse and Reference,Lager und Referenz,
To be delivered to customer,Zur Auslieferung an den Kunden, To be delivered to customer,Zur Auslieferung an den Kunden,
@@ -6773,7 +6777,7 @@ Accounts Manager,Buchhalter,
Allow Sales Invoice Creation Without Sales Order,Ermöglichen Sie die Erstellung von Kundenrechnungen ohne Auftrag, Allow Sales Invoice Creation Without Sales Order,Ermöglichen Sie die Erstellung von Kundenrechnungen ohne Auftrag,
Allow Sales Invoice Creation Without Delivery Note,Ermöglichen Sie die Erstellung einer Ausgangsrechnung ohne Lieferschein, Allow Sales Invoice Creation Without Delivery Note,Ermöglichen Sie die Erstellung einer Ausgangsrechnung ohne Lieferschein,
Default Price List,Standardpreisliste, Default Price List,Standardpreisliste,
Primary Address and Contact Detail,Primäre Adresse und Kontaktdetails, Primary Address and Contact,Hauptadresse und -kontakt,
"Select, to make the customer searchable with these fields","Wählen Sie, um den Kunden mit diesen Feldern durchsuchbar zu machen", "Select, to make the customer searchable with these fields","Wählen Sie, um den Kunden mit diesen Feldern durchsuchbar zu machen",
Customer Primary Contact,Hauptkontakt des Kunden, Customer Primary Contact,Hauptkontakt des Kunden,
"Reselect, if the chosen contact is edited after save","Wählen Sie erneut, wenn der ausgewählte Kontakt nach dem Speichern bearbeitet wird", "Reselect, if the chosen contact is edited after save","Wählen Sie erneut, wenn der ausgewählte Kontakt nach dem Speichern bearbeitet wird",
Can't render this file because it is too large.