chore: Move buying controller to utils

This commit is contained in:
Deepesh Garg
2023-07-23 18:50:44 +05:30
parent 7205fb9b97
commit 8ccb8e3c5b
10 changed files with 418 additions and 428 deletions

View File

@@ -3,11 +3,10 @@
frappe.provide("erpnext.buying");
frappe.provide("erpnext.accounts.dimensions");
{% include 'erpnext/public/js/controllers/buying.js' %};
erpnext.accounts.taxes.setup_tax_filters("Purchase Taxes and Charges");
erpnext.accounts.taxes.setup_tax_validations("Purchase Order");
erpnext.buying.setup_buying_controller();
frappe.ui.form.on("Purchase Order", {
setup: function(frm) {

View File

@@ -1,11 +1,10 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
{% include 'erpnext/public/js/controllers/buying.js' %};
cur_frm.add_fetch('contact', 'email_id', 'email_id')
erpnext.buying.setup_buying_controller();
frappe.ui.form.on("Request for Quotation",{
setup: function(frm) {
frm.custom_make_buttons = {
@@ -436,7 +435,7 @@ erpnext.buying.RequestforQuotationController = class RequestforQuotationControll
//Remove blanks
for (var j = 0; j < frm.doc.suppliers.length; j++) {
if(!frm.doc.suppliers[j].hasOwnProperty("supplier")) {
if(!Object.prototype.hasOwnProperty.call(frm.doc.suppliers[j], "supplier")) {
frm.get_field("suppliers").grid.grid_rows[j].remove();
}
}
@@ -445,10 +444,11 @@ erpnext.buying.RequestforQuotationController = class RequestforQuotationControll
if(r.message) {
for (var i = 0; i < r.message.length; i++) {
var exists = false;
let supplier = "";
if (r.message[i].constructor === Array){
var supplier = r.message[i][0];
supplier = r.message[i][0];
} else {
var supplier = r.message[i].name;
supplier = r.message[i].name;
}
for (var j = 0; j < doc.suppliers.length;j++) {

View File

@@ -1,9 +1,7 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
// attach required files
{% include 'erpnext/public/js/controllers/buying.js' %};
erpnext.buying.setup_buying_controller();
erpnext.buying.SupplierQuotationController = class SupplierQuotationController extends erpnext.buying.BuyingController {
setup() {
this.frm.custom_make_buttons = {