chore: Move buying controller to utils
This commit is contained in:
parent
7205fb9b97
commit
8ccb8e3c5b
@ -2,11 +2,11 @@
|
|||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
frappe.provide("erpnext.accounts");
|
frappe.provide("erpnext.accounts");
|
||||||
{% include 'erpnext/public/js/controllers/buying.js' %};
|
|
||||||
|
|
||||||
erpnext.accounts.payment_triggers.setup("Purchase Invoice");
|
erpnext.accounts.payment_triggers.setup("Purchase Invoice");
|
||||||
erpnext.accounts.taxes.setup_tax_filters("Purchase Taxes and Charges");
|
erpnext.accounts.taxes.setup_tax_filters("Purchase Taxes and Charges");
|
||||||
erpnext.accounts.taxes.setup_tax_validations("Purchase Invoice");
|
erpnext.accounts.taxes.setup_tax_validations("Purchase Invoice");
|
||||||
|
erpnext.buying.setup_buying_controller();
|
||||||
|
|
||||||
erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.BuyingController {
|
erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.BuyingController {
|
||||||
setup(doc) {
|
setup(doc) {
|
||||||
@ -550,8 +550,8 @@ frappe.ui.form.on("Purchase Invoice", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mode_of_payment: function(frm) {
|
mode_of_payment: function(frm) {
|
||||||
get_payment_mode_account(frm, frm.doc.mode_of_payment, function(account){
|
erpnext.accounts.pos.get_payment_mode_account(frm, frm.doc.mode_of_payment, function(account) {
|
||||||
frm.set_value('cash_bank_account', account);
|
frm.set_value("cash_bank_account", account);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
{% include "erpnext/regional/italy/sales_invoice.js" %}
|
frappe.ui.form.on("Sales Invoice", {
|
||||||
|
refresh: (frm) => {
|
||||||
erpnext.setup_e_invoice_button('Sales Invoice')
|
if(frm.doc.docstatus == 1) {
|
||||||
|
frm.add_custom_button('Generate E-Invoice', () => {
|
||||||
|
frm.call({
|
||||||
|
method: "erpnext.regional.italy.utils.generate_single_invoice",
|
||||||
|
args: {
|
||||||
|
docname: frm.doc.name
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
frm.reload_doc();
|
||||||
|
if(r.message) {
|
||||||
|
open_url_post(frappe.request.url, {
|
||||||
|
cmd: 'frappe.core.doctype.file.file.download_file',
|
||||||
|
file_url: r.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
@ -3,11 +3,10 @@
|
|||||||
|
|
||||||
frappe.provide("erpnext.buying");
|
frappe.provide("erpnext.buying");
|
||||||
frappe.provide("erpnext.accounts.dimensions");
|
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_filters("Purchase Taxes and Charges");
|
||||||
erpnext.accounts.taxes.setup_tax_validations("Purchase Order");
|
erpnext.accounts.taxes.setup_tax_validations("Purchase Order");
|
||||||
|
erpnext.buying.setup_buying_controller();
|
||||||
|
|
||||||
frappe.ui.form.on("Purchase Order", {
|
frappe.ui.form.on("Purchase Order", {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// 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')
|
cur_frm.add_fetch('contact', 'email_id', 'email_id')
|
||||||
|
|
||||||
|
erpnext.buying.setup_buying_controller();
|
||||||
|
|
||||||
frappe.ui.form.on("Request for Quotation",{
|
frappe.ui.form.on("Request for Quotation",{
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
frm.custom_make_buttons = {
|
frm.custom_make_buttons = {
|
||||||
@ -436,7 +435,7 @@ erpnext.buying.RequestforQuotationController = class RequestforQuotationControll
|
|||||||
|
|
||||||
//Remove blanks
|
//Remove blanks
|
||||||
for (var j = 0; j < frm.doc.suppliers.length; j++) {
|
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();
|
frm.get_field("suppliers").grid.grid_rows[j].remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -445,10 +444,11 @@ erpnext.buying.RequestforQuotationController = class RequestforQuotationControll
|
|||||||
if(r.message) {
|
if(r.message) {
|
||||||
for (var i = 0; i < r.message.length; i++) {
|
for (var i = 0; i < r.message.length; i++) {
|
||||||
var exists = false;
|
var exists = false;
|
||||||
|
let supplier = "";
|
||||||
if (r.message[i].constructor === Array){
|
if (r.message[i].constructor === Array){
|
||||||
var supplier = r.message[i][0];
|
supplier = r.message[i][0];
|
||||||
} else {
|
} else {
|
||||||
var supplier = r.message[i].name;
|
supplier = r.message[i].name;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var j = 0; j < doc.suppliers.length;j++) {
|
for (var j = 0; j < doc.suppliers.length;j++) {
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
// attach required files
|
erpnext.buying.setup_buying_controller();
|
||||||
{% include 'erpnext/public/js/controllers/buying.js' %};
|
|
||||||
|
|
||||||
erpnext.buying.SupplierQuotationController = class SupplierQuotationController extends erpnext.buying.BuyingController {
|
erpnext.buying.SupplierQuotationController = class SupplierQuotationController extends erpnext.buying.BuyingController {
|
||||||
setup() {
|
setup() {
|
||||||
this.frm.custom_make_buttons = {
|
this.frm.custom_make_buttons = {
|
||||||
|
@ -3,421 +3,419 @@
|
|||||||
|
|
||||||
frappe.provide("erpnext.buying");
|
frappe.provide("erpnext.buying");
|
||||||
|
|
||||||
cur_frm.cscript.tax_table = "Purchase Taxes and Charges";
|
// cur_frm.email_field = "contact_email";
|
||||||
|
// cur_frm.add_fetch('project', 'cost_center', 'cost_center');
|
||||||
|
|
||||||
{% include 'erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.js' %}
|
erpnext.buying = {
|
||||||
|
setup_buying_controller: function() {
|
||||||
|
erpnext.buying.BuyingController = class BuyingController extends erpnext.TransactionController {
|
||||||
|
setup() {
|
||||||
|
super.setup();
|
||||||
|
}
|
||||||
|
|
||||||
cur_frm.email_field = "contact_email";
|
onload(doc, cdt, cdn) {
|
||||||
|
this.setup_queries(doc, cdt, cdn);
|
||||||
|
super.onload();
|
||||||
|
|
||||||
erpnext.buying.BuyingController = class BuyingController extends erpnext.TransactionController {
|
this.frm.set_query('shipping_rule', function() {
|
||||||
setup() {
|
|
||||||
super.setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
onload(doc, cdt, cdn) {
|
|
||||||
this.setup_queries(doc, cdt, cdn);
|
|
||||||
super.onload();
|
|
||||||
|
|
||||||
this.frm.set_query('shipping_rule', function() {
|
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
"shipping_rule_type": "Buying"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this.frm.doc.__islocal
|
|
||||||
&& frappe.meta.has_field(this.frm.doc.doctype, "disable_rounded_total")) {
|
|
||||||
|
|
||||||
var df = frappe.meta.get_docfield(this.frm.doc.doctype, "disable_rounded_total");
|
|
||||||
var disable = cint(df.default) || cint(frappe.sys_defaults.disable_rounded_total);
|
|
||||||
this.frm.set_value("disable_rounded_total", disable);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// no idea where me is coming from
|
|
||||||
if(this.frm.get_field('shipping_address')) {
|
|
||||||
this.frm.set_query("shipping_address", function() {
|
|
||||||
if(me.frm.doc.customer) {
|
|
||||||
return {
|
return {
|
||||||
query: 'frappe.contacts.doctype.address.address.address_query',
|
filters: {
|
||||||
filters: { link_doctype: 'Customer', link_name: me.frm.doc.customer }
|
"shipping_rule_type": "Buying"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} else
|
});
|
||||||
return erpnext.queries.company_address_query(me.frm.doc)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/* eslint-enable */
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_queries(doc, cdt, cdn) {
|
if (this.frm.doc.__islocal
|
||||||
var me = this;
|
&& frappe.meta.has_field(this.frm.doc.doctype, "disable_rounded_total")) {
|
||||||
|
|
||||||
if(this.frm.fields_dict.buying_price_list) {
|
var df = frappe.meta.get_docfield(this.frm.doc.doctype, "disable_rounded_total");
|
||||||
this.frm.set_query("buying_price_list", function() {
|
var disable = cint(df.default) || cint(frappe.sys_defaults.disable_rounded_total);
|
||||||
return{
|
this.frm.set_value("disable_rounded_total", disable);
|
||||||
filters: { 'buying': 1 }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.frm.fields_dict.tc_name) {
|
|
||||||
this.frm.set_query("tc_name", function() {
|
|
||||||
return{
|
|
||||||
filters: { 'buying': 1 }
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
me.frm.set_query('supplier', erpnext.queries.supplier);
|
|
||||||
me.frm.set_query('contact_person', erpnext.queries.contact_query);
|
|
||||||
me.frm.set_query('supplier_address', erpnext.queries.address_query);
|
|
||||||
|
|
||||||
me.frm.set_query('billing_address', erpnext.queries.company_address_query);
|
|
||||||
erpnext.accounts.dimensions.setup_dimension_filters(me.frm, me.frm.doctype);
|
|
||||||
|
|
||||||
if(this.frm.fields_dict.supplier) {
|
|
||||||
this.frm.set_query("supplier", function() {
|
|
||||||
return{ query: "erpnext.controllers.queries.supplier_query" }});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.frm.set_query("item_code", "items", function() {
|
|
||||||
if (me.frm.doc.is_subcontracted) {
|
|
||||||
var filters = {'supplier': me.frm.doc.supplier};
|
|
||||||
if (me.frm.doc.is_old_subcontracting_flow) {
|
|
||||||
filters["is_sub_contracted_item"] = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
filters["is_stock_item"] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return{
|
|
||||||
query: "erpnext.controllers.queries.item_query",
|
// no idea where me is coming from
|
||||||
filters: filters
|
if(this.frm.get_field('shipping_address')) {
|
||||||
|
this.frm.set_query("shipping_address", function() {
|
||||||
|
if(me.frm.doc.customer) {
|
||||||
|
return {
|
||||||
|
query: 'frappe.contacts.doctype.address.address.address_query',
|
||||||
|
filters: { link_doctype: 'Customer', link_name: me.frm.doc.customer }
|
||||||
|
};
|
||||||
|
} else
|
||||||
|
return erpnext.queries.company_address_query(me.frm.doc)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return{
|
setup_queries(doc, cdt, cdn) {
|
||||||
query: "erpnext.controllers.queries.item_query",
|
var me = this;
|
||||||
filters: { 'supplier': me.frm.doc.supplier, 'is_purchase_item': 1, 'has_variants': 0}
|
|
||||||
|
if(this.frm.fields_dict.buying_price_list) {
|
||||||
|
this.frm.set_query("buying_price_list", function() {
|
||||||
|
return{
|
||||||
|
filters: { 'buying': 1 }
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
if(this.frm.fields_dict.tc_name) {
|
||||||
this.frm.set_query("manufacturer", "items", function(doc, cdt, cdn) {
|
this.frm.set_query("tc_name", function() {
|
||||||
const row = locals[cdt][cdn];
|
return{
|
||||||
return {
|
filters: { 'buying': 1 }
|
||||||
query: "erpnext.controllers.queries.item_manufacturer_query",
|
}
|
||||||
filters:{ 'item_code': row.item_code }
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if(this.frm.fields_dict["items"].grid.get_field('item_code')) {
|
|
||||||
this.frm.set_query("item_tax_template", "items", function(doc, cdt, cdn) {
|
|
||||||
return me.set_query_for_item_tax_template(doc, cdt, cdn)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
refresh(doc) {
|
|
||||||
frappe.dynamic_link = {doc: this.frm.doc, fieldname: 'supplier', doctype: 'Supplier'};
|
|
||||||
|
|
||||||
this.frm.toggle_display("supplier_name",
|
|
||||||
(this.frm.doc.supplier_name && this.frm.doc.supplier_name!==this.frm.doc.supplier));
|
|
||||||
|
|
||||||
if(this.frm.doc.docstatus==0 &&
|
|
||||||
(this.frm.doctype==="Purchase Order" || this.frm.doctype==="Material Request")) {
|
|
||||||
this.set_from_product_bundle();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.toggle_subcontracting_fields();
|
|
||||||
super.refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
toggle_subcontracting_fields() {
|
|
||||||
if (in_list(['Purchase Receipt', 'Purchase Invoice'], this.frm.doc.doctype)) {
|
|
||||||
this.frm.fields_dict.supplied_items.grid.update_docfield_property('consumed_qty',
|
|
||||||
'read_only', this.frm.doc.__onload && this.frm.doc.__onload.backflush_based_on === 'BOM');
|
|
||||||
|
|
||||||
this.frm.set_df_property('supplied_items', 'cannot_add_rows', 1);
|
|
||||||
this.frm.set_df_property('supplied_items', 'cannot_delete_rows', 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
supplier() {
|
|
||||||
var me = this;
|
|
||||||
erpnext.utils.get_party_details(this.frm, null, null, function(){
|
|
||||||
me.apply_price_list();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
supplier_address() {
|
|
||||||
erpnext.utils.get_address_display(this.frm);
|
|
||||||
erpnext.utils.set_taxes_from_address(this.frm, "supplier_address", "supplier_address", "supplier_address");
|
|
||||||
}
|
|
||||||
|
|
||||||
buying_price_list() {
|
|
||||||
this.apply_price_list();
|
|
||||||
}
|
|
||||||
|
|
||||||
discount_percentage(doc, cdt, cdn) {
|
|
||||||
var item = frappe.get_doc(cdt, cdn);
|
|
||||||
item.discount_amount = 0.0;
|
|
||||||
this.price_list_rate(doc, cdt, cdn);
|
|
||||||
}
|
|
||||||
|
|
||||||
discount_amount(doc, cdt, cdn) {
|
|
||||||
var item = frappe.get_doc(cdt, cdn);
|
|
||||||
item.discount_percentage = 0.0;
|
|
||||||
this.price_list_rate(doc, cdt, cdn);
|
|
||||||
}
|
|
||||||
|
|
||||||
qty(doc, cdt, cdn) {
|
|
||||||
if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && (doc.update_stock || doc.is_return))) {
|
|
||||||
this.calculate_received_qty(doc, cdt, cdn)
|
|
||||||
}
|
|
||||||
super.qty(doc, cdt, cdn);
|
|
||||||
}
|
|
||||||
|
|
||||||
rejected_qty(doc, cdt, cdn) {
|
|
||||||
this.calculate_received_qty(doc, cdt, cdn)
|
|
||||||
}
|
|
||||||
|
|
||||||
calculate_received_qty(doc, cdt, cdn){
|
|
||||||
var item = frappe.get_doc(cdt, cdn);
|
|
||||||
frappe.model.round_floats_in(item, ["qty", "rejected_qty"]);
|
|
||||||
|
|
||||||
if(!doc.is_return && this.validate_negative_quantity(cdt, cdn, item, ["qty", "rejected_qty"])){ return }
|
|
||||||
|
|
||||||
let received_qty = flt(item.qty + item.rejected_qty, precision("received_qty", item));
|
|
||||||
let received_stock_qty = flt(item.conversion_factor, precision("conversion_factor", item)) * flt(received_qty);
|
|
||||||
|
|
||||||
frappe.model.set_value(cdt, cdn, "received_qty", received_qty);
|
|
||||||
frappe.model.set_value(cdt, cdn, "received_stock_qty", received_stock_qty);
|
|
||||||
}
|
|
||||||
|
|
||||||
batch_no(doc, cdt, cdn) {
|
|
||||||
super.batch_no(doc, cdt, cdn);
|
|
||||||
}
|
|
||||||
|
|
||||||
validate_negative_quantity(cdt, cdn, item, fieldnames){
|
|
||||||
if(!item || !fieldnames) { return }
|
|
||||||
|
|
||||||
var is_negative_qty = false;
|
|
||||||
for(var i = 0; i<fieldnames.length; i++) {
|
|
||||||
if(item[fieldnames[i]] < 0){
|
|
||||||
frappe.msgprint(__("Row #{0}: {1} can not be negative for item {2}", [item.idx,__(frappe.meta.get_label(cdt, fieldnames[i], cdn)), item.item_code]));
|
|
||||||
is_negative_qty = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_negative_qty
|
|
||||||
}
|
|
||||||
|
|
||||||
warehouse(doc, cdt, cdn) {
|
|
||||||
var item = frappe.get_doc(cdt, cdn);
|
|
||||||
if(item.item_code && item.warehouse) {
|
|
||||||
return this.frm.call({
|
|
||||||
method: "erpnext.stock.get_item_details.get_bin_details",
|
|
||||||
child: item,
|
|
||||||
args: {
|
|
||||||
item_code: item.item_code,
|
|
||||||
warehouse: item.warehouse,
|
|
||||||
company: doc.company,
|
|
||||||
include_child_warehouses: true
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
project(doc, cdt, cdn) {
|
me.frm.set_query('supplier', erpnext.queries.supplier);
|
||||||
var item = frappe.get_doc(cdt, cdn);
|
me.frm.set_query('contact_person', erpnext.queries.contact_query);
|
||||||
if(item.project) {
|
me.frm.set_query('supplier_address', erpnext.queries.address_query);
|
||||||
$.each(this.frm.doc["items"] || [],
|
|
||||||
function(i, other_item) {
|
me.frm.set_query('billing_address', erpnext.queries.company_address_query);
|
||||||
if(!other_item.project) {
|
erpnext.accounts.dimensions.setup_dimension_filters(me.frm, me.frm.doctype);
|
||||||
other_item.project = item.project;
|
|
||||||
refresh_field("project", other_item.name, other_item.parentfield);
|
if(this.frm.fields_dict.supplier) {
|
||||||
|
this.frm.set_query("supplier", function() {
|
||||||
|
return{ query: "erpnext.controllers.queries.supplier_query" }});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.frm.set_query("item_code", "items", function() {
|
||||||
|
if (me.frm.doc.is_subcontracted) {
|
||||||
|
var filters = {'supplier': me.frm.doc.supplier};
|
||||||
|
if (me.frm.doc.is_old_subcontracting_flow) {
|
||||||
|
filters["is_sub_contracted_item"] = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
filters["is_stock_item"] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return{
|
||||||
|
query: "erpnext.controllers.queries.item_query",
|
||||||
|
filters: filters
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return{
|
||||||
|
query: "erpnext.controllers.queries.item_query",
|
||||||
|
filters: { 'supplier': me.frm.doc.supplier, 'is_purchase_item': 1, 'has_variants': 0}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rejected_warehouse(doc, cdt) {
|
|
||||||
// trigger autofill_warehouse only if parent rejected_warehouse field is triggered
|
|
||||||
if (["Purchase Invoice", "Purchase Receipt"].includes(cdt)) {
|
|
||||||
this.autofill_warehouse(doc.items, "rejected_warehouse", doc.rejected_warehouse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
category(doc, cdt, cdn) {
|
this.frm.set_query("manufacturer", "items", function(doc, cdt, cdn) {
|
||||||
// should be the category field of tax table
|
const row = locals[cdt][cdn];
|
||||||
if(cdt != doc.doctype) {
|
return {
|
||||||
this.calculate_taxes_and_totals();
|
query: "erpnext.controllers.queries.item_manufacturer_query",
|
||||||
}
|
filters:{ 'item_code': row.item_code }
|
||||||
}
|
}
|
||||||
add_deduct_tax(doc, cdt, cdn) {
|
});
|
||||||
this.calculate_taxes_and_totals();
|
|
||||||
}
|
|
||||||
|
|
||||||
set_from_product_bundle() {
|
if(this.frm.fields_dict["items"].grid.get_field('item_code')) {
|
||||||
var me = this;
|
this.frm.set_query("item_tax_template", "items", function(doc, cdt, cdn) {
|
||||||
this.frm.add_custom_button(__("Product Bundle"), function() {
|
return me.set_query_for_item_tax_template(doc, cdt, cdn)
|
||||||
erpnext.buying.get_items_from_product_bundle(me.frm);
|
});
|
||||||
}, __("Get Items From"));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shipping_address(){
|
refresh(doc) {
|
||||||
var me = this;
|
frappe.dynamic_link = {doc: this.frm.doc, fieldname: 'supplier', doctype: 'Supplier'};
|
||||||
erpnext.utils.get_address_display(this.frm, "shipping_address",
|
|
||||||
"shipping_address_display", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
billing_address() {
|
this.frm.toggle_display("supplier_name",
|
||||||
erpnext.utils.get_address_display(this.frm, "billing_address",
|
(this.frm.doc.supplier_name && this.frm.doc.supplier_name!==this.frm.doc.supplier));
|
||||||
"billing_address_display", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
tc_name() {
|
if(this.frm.doc.docstatus==0 &&
|
||||||
this.get_terms();
|
(this.frm.doctype==="Purchase Order" || this.frm.doctype==="Material Request")) {
|
||||||
}
|
this.set_from_product_bundle();
|
||||||
|
}
|
||||||
|
|
||||||
update_auto_repeat_reference(doc) {
|
this.toggle_subcontracting_fields();
|
||||||
if (doc.auto_repeat) {
|
super.refresh();
|
||||||
frappe.call({
|
}
|
||||||
method:"frappe.automation.doctype.auto_repeat.auto_repeat.update_reference",
|
|
||||||
args:{
|
toggle_subcontracting_fields() {
|
||||||
docname: doc.auto_repeat,
|
if (in_list(['Purchase Receipt', 'Purchase Invoice'], this.frm.doc.doctype)) {
|
||||||
reference:doc.name
|
this.frm.fields_dict.supplied_items.grid.update_docfield_property('consumed_qty',
|
||||||
},
|
'read_only', this.frm.doc.__onload && this.frm.doc.__onload.backflush_based_on === 'BOM');
|
||||||
callback: function(r){
|
|
||||||
if (r.message=="success") {
|
this.frm.set_df_property('supplied_items', 'cannot_add_rows', 1);
|
||||||
frappe.show_alert({message:__("Auto repeat document updated"), indicator:'green'});
|
this.frm.set_df_property('supplied_items', 'cannot_delete_rows', 1);
|
||||||
} else {
|
}
|
||||||
frappe.show_alert({message:__("An error occurred during the update process"), indicator:'red'});
|
}
|
||||||
|
|
||||||
|
supplier() {
|
||||||
|
var me = this;
|
||||||
|
erpnext.utils.get_party_details(this.frm, null, null, function(){
|
||||||
|
me.apply_price_list();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
supplier_address() {
|
||||||
|
erpnext.utils.get_address_display(this.frm);
|
||||||
|
erpnext.utils.set_taxes_from_address(this.frm, "supplier_address", "supplier_address", "supplier_address");
|
||||||
|
}
|
||||||
|
|
||||||
|
buying_price_list() {
|
||||||
|
this.apply_price_list();
|
||||||
|
}
|
||||||
|
|
||||||
|
discount_percentage(doc, cdt, cdn) {
|
||||||
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
|
item.discount_amount = 0.0;
|
||||||
|
this.price_list_rate(doc, cdt, cdn);
|
||||||
|
}
|
||||||
|
|
||||||
|
discount_amount(doc, cdt, cdn) {
|
||||||
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
|
item.discount_percentage = 0.0;
|
||||||
|
this.price_list_rate(doc, cdt, cdn);
|
||||||
|
}
|
||||||
|
|
||||||
|
qty(doc, cdt, cdn) {
|
||||||
|
if ((doc.doctype == "Purchase Receipt") || (doc.doctype == "Purchase Invoice" && (doc.update_stock || doc.is_return))) {
|
||||||
|
this.calculate_received_qty(doc, cdt, cdn)
|
||||||
|
}
|
||||||
|
super.qty(doc, cdt, cdn);
|
||||||
|
}
|
||||||
|
|
||||||
|
rejected_qty(doc, cdt, cdn) {
|
||||||
|
this.calculate_received_qty(doc, cdt, cdn)
|
||||||
|
}
|
||||||
|
|
||||||
|
calculate_received_qty(doc, cdt, cdn){
|
||||||
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
|
frappe.model.round_floats_in(item, ["qty", "rejected_qty"]);
|
||||||
|
|
||||||
|
if(!doc.is_return && this.validate_negative_quantity(cdt, cdn, item, ["qty", "rejected_qty"])){ return }
|
||||||
|
|
||||||
|
let received_qty = flt(item.qty + item.rejected_qty, precision("received_qty", item));
|
||||||
|
let received_stock_qty = flt(item.conversion_factor, precision("conversion_factor", item)) * flt(received_qty);
|
||||||
|
|
||||||
|
frappe.model.set_value(cdt, cdn, "received_qty", received_qty);
|
||||||
|
frappe.model.set_value(cdt, cdn, "received_stock_qty", received_stock_qty);
|
||||||
|
}
|
||||||
|
|
||||||
|
batch_no(doc, cdt, cdn) {
|
||||||
|
super.batch_no(doc, cdt, cdn);
|
||||||
|
}
|
||||||
|
|
||||||
|
validate_negative_quantity(cdt, cdn, item, fieldnames){
|
||||||
|
if(!item || !fieldnames) { return }
|
||||||
|
|
||||||
|
var is_negative_qty = false;
|
||||||
|
for(var i = 0; i<fieldnames.length; i++) {
|
||||||
|
if(item[fieldnames[i]] < 0){
|
||||||
|
frappe.msgprint(__("Row #{0}: {1} can not be negative for item {2}", [item.idx,__(frappe.meta.get_label(cdt, fieldnames[i], cdn)), item.item_code]));
|
||||||
|
is_negative_qty = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
manufacturer(doc, cdt, cdn) {
|
return is_negative_qty
|
||||||
const row = locals[cdt][cdn];
|
}
|
||||||
|
|
||||||
if(row.manufacturer) {
|
warehouse(doc, cdt, cdn) {
|
||||||
frappe.call({
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
method: "erpnext.stock.doctype.item_manufacturer.item_manufacturer.get_item_manufacturer_part_no",
|
if(item.item_code && item.warehouse) {
|
||||||
args: {
|
return this.frm.call({
|
||||||
'item_code': row.item_code,
|
method: "erpnext.stock.get_item_details.get_bin_details",
|
||||||
'manufacturer': row.manufacturer
|
child: item,
|
||||||
},
|
args: {
|
||||||
callback: function(r) {
|
item_code: item.item_code,
|
||||||
if (r.message) {
|
warehouse: item.warehouse,
|
||||||
frappe.model.set_value(cdt, cdn, 'manufacturer_part_no', r.message);
|
company: doc.company,
|
||||||
}
|
include_child_warehouses: true
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
manufacturer_part_no(doc, cdt, cdn) {
|
|
||||||
const row = locals[cdt][cdn];
|
|
||||||
|
|
||||||
if (row.manufacturer_part_no) {
|
|
||||||
frappe.model.get_value('Item Manufacturer',
|
|
||||||
{
|
|
||||||
'item_code': row.item_code,
|
|
||||||
'manufacturer': row.manufacturer,
|
|
||||||
'manufacturer_part_no': row.manufacturer_part_no
|
|
||||||
},
|
|
||||||
'name',
|
|
||||||
function(data) {
|
|
||||||
if (!data) {
|
|
||||||
let msg = {
|
|
||||||
message: __("Manufacturer Part Number <b>{0}</b> is invalid", [row.manufacturer_part_no]),
|
|
||||||
title: __("Invalid Part Number")
|
|
||||||
}
|
}
|
||||||
frappe.throw(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
add_serial_batch_bundle(doc, cdt, cdn) {
|
|
||||||
let item = locals[cdt][cdn];
|
|
||||||
let me = this;
|
|
||||||
let path = "assets/erpnext/js/utils/serial_no_batch_selector.js";
|
|
||||||
|
|
||||||
frappe.db.get_value("Item", item.item_code, ["has_batch_no", "has_serial_no"])
|
|
||||||
.then((r) => {
|
|
||||||
if (r.message && (r.message.has_batch_no || r.message.has_serial_no)) {
|
|
||||||
item.has_serial_no = r.message.has_serial_no;
|
|
||||||
item.has_batch_no = r.message.has_batch_no;
|
|
||||||
item.type_of_transaction = item.qty > 0 ? "Inward" : "Outward";
|
|
||||||
item.is_rejected = false;
|
|
||||||
|
|
||||||
frappe.require(path, function() {
|
|
||||||
new erpnext.SerialBatchPackageSelector(
|
|
||||||
me.frm, item, (r) => {
|
|
||||||
if (r) {
|
|
||||||
let update_values = {
|
|
||||||
"serial_and_batch_bundle": r.name,
|
|
||||||
"qty": Math.abs(r.total_qty)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r.warehouse) {
|
|
||||||
update_values["warehouse"] = r.warehouse;
|
|
||||||
}
|
|
||||||
|
|
||||||
frappe.model.set_value(item.doctype, item.name, update_values);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
|
||||||
add_serial_batch_for_rejected_qty(doc, cdt, cdn) {
|
project(doc, cdt, cdn) {
|
||||||
let item = locals[cdt][cdn];
|
var item = frappe.get_doc(cdt, cdn);
|
||||||
let me = this;
|
if(item.project) {
|
||||||
let path = "assets/erpnext/js/utils/serial_no_batch_selector.js";
|
$.each(this.frm.doc["items"] || [],
|
||||||
|
function(i, other_item) {
|
||||||
frappe.db.get_value("Item", item.item_code, ["has_batch_no", "has_serial_no"])
|
if(!other_item.project) {
|
||||||
.then((r) => {
|
other_item.project = item.project;
|
||||||
if (r.message && (r.message.has_batch_no || r.message.has_serial_no)) {
|
refresh_field("project", other_item.name, other_item.parentfield);
|
||||||
item.has_serial_no = r.message.has_serial_no;
|
|
||||||
item.has_batch_no = r.message.has_batch_no;
|
|
||||||
item.type_of_transaction = item.qty > 0 ? "Inward" : "Outward";
|
|
||||||
item.is_rejected = true;
|
|
||||||
|
|
||||||
frappe.require(path, function() {
|
|
||||||
new erpnext.SerialBatchPackageSelector(
|
|
||||||
me.frm, item, (r) => {
|
|
||||||
if (r) {
|
|
||||||
let update_values = {
|
|
||||||
"serial_and_batch_bundle": r.name,
|
|
||||||
"rejected_qty": Math.abs(r.total_qty)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r.warehouse) {
|
|
||||||
update_values["rejected_warehouse"] = r.warehouse;
|
|
||||||
}
|
|
||||||
|
|
||||||
frappe.model.set_value(item.doctype, item.name, update_values);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rejected_warehouse(doc, cdt) {
|
||||||
|
// trigger autofill_warehouse only if parent rejected_warehouse field is triggered
|
||||||
|
if (["Purchase Invoice", "Purchase Receipt"].includes(cdt)) {
|
||||||
|
this.autofill_warehouse(doc.items, "rejected_warehouse", doc.rejected_warehouse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
category(doc, cdt, cdn) {
|
||||||
|
// should be the category field of tax table
|
||||||
|
if(cdt != doc.doctype) {
|
||||||
|
this.calculate_taxes_and_totals();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_deduct_tax(doc, cdt, cdn) {
|
||||||
|
this.calculate_taxes_and_totals();
|
||||||
|
}
|
||||||
|
|
||||||
|
set_from_product_bundle() {
|
||||||
|
var me = this;
|
||||||
|
this.frm.add_custom_button(__("Product Bundle"), function() {
|
||||||
|
erpnext.buying.get_items_from_product_bundle(me.frm);
|
||||||
|
}, __("Get Items From"));
|
||||||
|
}
|
||||||
|
|
||||||
|
shipping_address(){
|
||||||
|
var me = this;
|
||||||
|
erpnext.utils.get_address_display(this.frm, "shipping_address",
|
||||||
|
"shipping_address_display", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
billing_address() {
|
||||||
|
erpnext.utils.get_address_display(this.frm, "billing_address",
|
||||||
|
"billing_address_display", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
tc_name() {
|
||||||
|
this.get_terms();
|
||||||
|
}
|
||||||
|
|
||||||
|
update_auto_repeat_reference(doc) {
|
||||||
|
if (doc.auto_repeat) {
|
||||||
|
frappe.call({
|
||||||
|
method:"frappe.automation.doctype.auto_repeat.auto_repeat.update_reference",
|
||||||
|
args:{
|
||||||
|
docname: doc.auto_repeat,
|
||||||
|
reference:doc.name
|
||||||
|
},
|
||||||
|
callback: function(r){
|
||||||
|
if (r.message=="success") {
|
||||||
|
frappe.show_alert({message:__("Auto repeat document updated"), indicator:'green'});
|
||||||
|
} else {
|
||||||
|
frappe.show_alert({message:__("An error occurred during the update process"), indicator:'red'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
manufacturer(doc, cdt, cdn) {
|
||||||
|
const row = locals[cdt][cdn];
|
||||||
|
|
||||||
|
if(row.manufacturer) {
|
||||||
|
frappe.call({
|
||||||
|
method: "erpnext.stock.doctype.item_manufacturer.item_manufacturer.get_item_manufacturer_part_no",
|
||||||
|
args: {
|
||||||
|
'item_code': row.item_code,
|
||||||
|
'manufacturer': row.manufacturer
|
||||||
|
},
|
||||||
|
callback: function(r) {
|
||||||
|
if (r.message) {
|
||||||
|
frappe.model.set_value(cdt, cdn, 'manufacturer_part_no', r.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
cur_frm.add_fetch('project', 'cost_center', 'cost_center');
|
manufacturer_part_no(doc, cdt, cdn) {
|
||||||
|
const row = locals[cdt][cdn];
|
||||||
|
|
||||||
|
if (row.manufacturer_part_no) {
|
||||||
|
frappe.model.get_value('Item Manufacturer',
|
||||||
|
{
|
||||||
|
'item_code': row.item_code,
|
||||||
|
'manufacturer': row.manufacturer,
|
||||||
|
'manufacturer_part_no': row.manufacturer_part_no
|
||||||
|
},
|
||||||
|
'name',
|
||||||
|
function(data) {
|
||||||
|
if (!data) {
|
||||||
|
let msg = {
|
||||||
|
message: __("Manufacturer Part Number <b>{0}</b> is invalid", [row.manufacturer_part_no]),
|
||||||
|
title: __("Invalid Part Number")
|
||||||
|
}
|
||||||
|
frappe.throw(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
add_serial_batch_bundle(doc, cdt, cdn) {
|
||||||
|
let item = locals[cdt][cdn];
|
||||||
|
let me = this;
|
||||||
|
let path = "assets/erpnext/js/utils/serial_no_batch_selector.js";
|
||||||
|
|
||||||
|
frappe.db.get_value("Item", item.item_code, ["has_batch_no", "has_serial_no"])
|
||||||
|
.then((r) => {
|
||||||
|
if (r.message && (r.message.has_batch_no || r.message.has_serial_no)) {
|
||||||
|
item.has_serial_no = r.message.has_serial_no;
|
||||||
|
item.has_batch_no = r.message.has_batch_no;
|
||||||
|
item.type_of_transaction = item.qty > 0 ? "Inward" : "Outward";
|
||||||
|
item.is_rejected = false;
|
||||||
|
|
||||||
|
frappe.require(path, function() {
|
||||||
|
new erpnext.SerialBatchPackageSelector(
|
||||||
|
me.frm, item, (r) => {
|
||||||
|
if (r) {
|
||||||
|
let update_values = {
|
||||||
|
"serial_and_batch_bundle": r.name,
|
||||||
|
"qty": Math.abs(r.total_qty)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r.warehouse) {
|
||||||
|
update_values["warehouse"] = r.warehouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
frappe.model.set_value(item.doctype, item.name, update_values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
add_serial_batch_for_rejected_qty(doc, cdt, cdn) {
|
||||||
|
let item = locals[cdt][cdn];
|
||||||
|
let me = this;
|
||||||
|
let path = "assets/erpnext/js/utils/serial_no_batch_selector.js";
|
||||||
|
|
||||||
|
frappe.db.get_value("Item", item.item_code, ["has_batch_no", "has_serial_no"])
|
||||||
|
.then((r) => {
|
||||||
|
if (r.message && (r.message.has_batch_no || r.message.has_serial_no)) {
|
||||||
|
item.has_serial_no = r.message.has_serial_no;
|
||||||
|
item.has_batch_no = r.message.has_batch_no;
|
||||||
|
item.type_of_transaction = item.qty > 0 ? "Inward" : "Outward";
|
||||||
|
item.is_rejected = true;
|
||||||
|
|
||||||
|
frappe.require(path, function() {
|
||||||
|
new erpnext.SerialBatchPackageSelector(
|
||||||
|
me.frm, item, (r) => {
|
||||||
|
if (r) {
|
||||||
|
let update_values = {
|
||||||
|
"serial_and_batch_bundle": r.name,
|
||||||
|
"rejected_qty": Math.abs(r.total_qty)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r.warehouse) {
|
||||||
|
update_values["rejected_warehouse"] = r.warehouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
frappe.model.set_value(item.doctype, item.name, update_values);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
erpnext.buying.link_to_mrs = function(frm) {
|
erpnext.buying.link_to_mrs = function(frm) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
|
@ -26,6 +26,7 @@ import "./templates/crm_activities.html";
|
|||||||
import "./templates/crm_notes.html";
|
import "./templates/crm_notes.html";
|
||||||
import "./controllers/accounts.js"
|
import "./controllers/accounts.js"
|
||||||
import "./utils/landed_taxes_and_charges_common.js";
|
import "./utils/landed_taxes_and_charges_common.js";
|
||||||
import "./utils/sales_common.js"
|
import "./utils/sales_common.js";
|
||||||
|
import "./controllers/buying.js";
|
||||||
|
|
||||||
// import { sum } from 'frappe/public/utils/util.js'
|
// import { sum } from 'frappe/public/utils/util.js'
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
erpnext.setup_e_invoice_button = (doctype) => {
|
|
||||||
frappe.ui.form.on(doctype, {
|
|
||||||
refresh: (frm) => {
|
|
||||||
if(frm.doc.docstatus == 1) {
|
|
||||||
frm.add_custom_button('Generate E-Invoice', () => {
|
|
||||||
frm.call({
|
|
||||||
method: "erpnext.regional.italy.utils.generate_single_invoice",
|
|
||||||
args: {
|
|
||||||
docname: frm.doc.name
|
|
||||||
},
|
|
||||||
callback: function(r) {
|
|
||||||
frm.reload_doc();
|
|
||||||
if(r.message) {
|
|
||||||
open_url_post(frappe.request.url, {
|
|
||||||
cmd: 'frappe.core.doctype.file.file.download_file',
|
|
||||||
file_url: r.message
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
frappe.provide("erpnext.accounts.dimensions");
|
frappe.provide("erpnext.accounts.dimensions");
|
||||||
{% include 'erpnext/public/js/controllers/buying.js' %};
|
erpnext.buying.setup_buying_controller();
|
||||||
|
|
||||||
frappe.ui.form.on('Material Request', {
|
frappe.ui.form.on('Material Request', {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
@ -472,13 +472,13 @@ erpnext.buying.MaterialRequestController = class MaterialRequestController exten
|
|||||||
set_schedule_date(this.frm);
|
set_schedule_date(this.frm);
|
||||||
}
|
}
|
||||||
|
|
||||||
onload(doc, cdt, cdn) {
|
onload() {
|
||||||
this.frm.set_query("item_code", "items", function() {
|
this.frm.set_query("item_code", "items", function(doc, cdt, cdn) {
|
||||||
if (doc.material_request_type == "Customer Provided") {
|
if (doc.material_request_type == "Customer Provided") {
|
||||||
return{
|
return{
|
||||||
query: "erpnext.controllers.queries.item_query",
|
query: "erpnext.controllers.queries.item_query",
|
||||||
filters:{
|
filters:{
|
||||||
'customer': me.frm.doc.customer,
|
'customer': doc.customer,
|
||||||
'is_stock_item':1
|
'is_stock_item':1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
// License: GNU General Public License v3. See license.txt
|
// License: GNU General Public License v3. See license.txt
|
||||||
|
|
||||||
{% include 'erpnext/public/js/controllers/buying.js' %};
|
|
||||||
|
|
||||||
frappe.provide("erpnext.stock");
|
frappe.provide("erpnext.stock");
|
||||||
|
|
||||||
erpnext.accounts.taxes.setup_tax_filters("Purchase Taxes and Charges");
|
erpnext.accounts.taxes.setup_tax_filters("Purchase Taxes and Charges");
|
||||||
erpnext.accounts.taxes.setup_tax_validations("Purchase Receipt");
|
erpnext.accounts.taxes.setup_tax_validations("Purchase Receipt");
|
||||||
|
erpnext.buying.setup_buying_controller();
|
||||||
|
|
||||||
frappe.ui.form.on("Purchase Receipt", {
|
frappe.ui.form.on("Purchase Receipt", {
|
||||||
setup: (frm) => {
|
setup: (frm) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user