mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-14 04:15:10 +00:00
chore: resolve conflicts
This commit is contained in:
@@ -21,14 +21,8 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frm.set_query("paid_from", function() {
|
||||
frm.events.validate_company(frm);
|
||||
|
||||
<<<<<<< HEAD
|
||||
var account_types = in_list(["Pay", "Internal Transfer"], frm.doc.payment_type) ?
|
||||
var account_types = ["Pay", "Internal Transfer"].includes(frm.doc.payment_type) ?
|
||||
["Bank", "Cash"] : [frappe.boot.party_account_types[frm.doc.party_type]];
|
||||
=======
|
||||
var account_types = ["Pay", "Internal Transfer"].includes(frm.doc.payment_type)
|
||||
? ["Bank", "Cash"]
|
||||
: [frappe.boot.party_account_types[frm.doc.party_type]];
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
return {
|
||||
filters: {
|
||||
"account_type": ["in", account_types],
|
||||
@@ -81,14 +75,8 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frm.set_query("paid_to", function() {
|
||||
frm.events.validate_company(frm);
|
||||
|
||||
<<<<<<< HEAD
|
||||
var account_types = in_list(["Receive", "Internal Transfer"], frm.doc.payment_type) ?
|
||||
var account_types = ["Receive", "Internal Transfer"].includes(frm.doc.payment_type) ?
|
||||
["Bank", "Cash"] : [frappe.boot.party_account_types[frm.doc.party_type]];
|
||||
=======
|
||||
var account_types = ["Receive", "Internal Transfer"].includes(frm.doc.payment_type)
|
||||
? ["Bank", "Cash"]
|
||||
: [frappe.boot.party_account_types[frm.doc.party_type]];
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
return {
|
||||
filters: {
|
||||
"account_type": ["in", account_types],
|
||||
@@ -133,14 +121,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
|
||||
frm.set_query('payment_term', 'references', function(frm, cdt, cdn) {
|
||||
const child = locals[cdt][cdn];
|
||||
<<<<<<< HEAD
|
||||
if (in_list(['Purchase Invoice', 'Sales Invoice'], child.reference_doctype) && child.reference_name) {
|
||||
=======
|
||||
if (
|
||||
["Purchase Invoice", "Sales Invoice"].includes(child.reference_doctype) &&
|
||||
child.reference_name
|
||||
) {
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
if (['Purchase Invoice', 'Sales Invoice'].includes(child.reference_doctype) && child.reference_name) {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.get_payment_terms_for_references",
|
||||
filters: {
|
||||
@@ -503,13 +484,8 @@ frappe.ui.form.on('Payment Entry', {
|
||||
|
||||
if (frm.doc.paid_from_account_currency == company_currency) {
|
||||
frm.set_value("source_exchange_rate", 1);
|
||||
<<<<<<< HEAD
|
||||
} else if (frm.doc.paid_from){
|
||||
if (in_list(["Internal Transfer", "Pay"], frm.doc.payment_type)) {
|
||||
=======
|
||||
} else if (frm.doc.paid_from) {
|
||||
if (["Internal Transfer", "Pay"].includes(frm.doc.payment_type)) {
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
let company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
|
||||
frappe.call({
|
||||
method: "erpnext.setup.utils.get_exchange_rate",
|
||||
@@ -876,19 +852,11 @@ frappe.ui.form.on('Payment Entry', {
|
||||
total_negative_outstanding : remaining_outstanding;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
var allocated_positive_outstanding = paid_amount + allocated_negative_outstanding;
|
||||
} else if (in_list(["Customer", "Supplier"], frm.doc.party_type)) {
|
||||
} else if (["Customer", "Supplier"].includes(frm.doc.party_type)) {
|
||||
total_negative_outstanding = flt(total_negative_outstanding, precision("outstanding_amount"))
|
||||
if(paid_amount > total_negative_outstanding) {
|
||||
if(total_negative_outstanding == 0) {
|
||||
=======
|
||||
var allocated_positive_outstanding = paid_amount + allocated_negative_outstanding;
|
||||
} else if (["Customer", "Supplier"].includes(frm.doc.party_type)) {
|
||||
total_negative_outstanding = flt(total_negative_outstanding, precision("outstanding_amount"));
|
||||
if (paid_amount > total_negative_outstanding) {
|
||||
if (total_negative_outstanding == 0) {
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
frappe.msgprint(
|
||||
__("Cannot {0} {1} {2} without any negative outstanding invoice", [frm.doc.payment_type,
|
||||
(frm.doc.party_type=="Customer" ? "to" : "from"), frm.doc.party_type])
|
||||
@@ -1019,28 +987,16 @@ frappe.ui.form.on('Payment Entry', {
|
||||
return;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if(frm.doc.party_type=="Customer" &&
|
||||
!in_list(["Sales Order", "Sales Invoice", "Journal Entry", "Dunning"], row.reference_doctype)
|
||||
=======
|
||||
if (
|
||||
frm.doc.party_type == "Customer" &&
|
||||
!["Sales Order", "Sales Invoice", "Journal Entry", "Dunning"].includes(row.reference_doctype)
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
) {
|
||||
frappe.model.set_value(row.doctype, row.name, "reference_doctype", null);
|
||||
frappe.msgprint(__("Row #{0}: Reference Document Type must be one of Sales Order, Sales Invoice, Journal Entry or Dunning", [row.idx]));
|
||||
return false;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if(frm.doc.party_type=="Supplier" &&
|
||||
!in_list(["Purchase Order", "Purchase Invoice", "Journal Entry"], row.reference_doctype)
|
||||
=======
|
||||
if (
|
||||
frm.doc.party_type == "Supplier" &&
|
||||
!["Purchase Order", "Purchase Invoice", "Journal Entry"].includes(row.reference_doctype)
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
) {
|
||||
frappe.model.set_value(row.doctype, row.name, "against_voucher_type", null);
|
||||
frappe.msgprint(__("Row #{0}: Reference Document Type must be one of Purchase Order, Purchase Invoice or Journal Entry", [row.idx]));
|
||||
@@ -1122,15 +1078,9 @@ frappe.ui.form.on('Payment Entry', {
|
||||
}
|
||||
},
|
||||
|
||||
<<<<<<< HEAD
|
||||
bank_account: function(frm) {
|
||||
const field = frm.doc.payment_type == "Pay" ? "paid_from":"paid_to";
|
||||
if (frm.doc.bank_account && in_list(['Pay', 'Receive'], frm.doc.payment_type)) {
|
||||
=======
|
||||
bank_account: function (frm) {
|
||||
const field = frm.doc.payment_type == "Pay" ? "paid_from" : "paid_to";
|
||||
if (frm.doc.bank_account && ["Pay", "Receive"].includes(frm.doc.payment_type)) {
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
if (frm.doc.bank_account && ['Pay', 'Receive'].includes(frm.doc.payment_type)) {
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.bank_account.bank_account.get_bank_account_details",
|
||||
args: {
|
||||
|
||||
@@ -200,7 +200,7 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends e
|
||||
if(cur_frm.meta._default_print_format) {
|
||||
cur_frm.meta.default_print_format = cur_frm.meta._default_print_format;
|
||||
cur_frm.meta._default_print_format = null;
|
||||
} else if(in_list([cur_frm.pos_print_format, cur_frm.return_print_format], cur_frm.meta.default_print_format)) {
|
||||
} else if([cur_frm.pos_print_format, cur_frm.return_print_format].includes(cur_frm.meta.default_print_format)) {
|
||||
cur_frm.meta.default_print_format = null;
|
||||
cur_frm.meta._default_print_format = null;
|
||||
}
|
||||
|
||||
@@ -180,22 +180,11 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends e
|
||||
this.frm.fields_dict.items_section.wrapper.removeClass("hide-border");
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if(!in_list(["Closed", "Delivered"], doc.status)) {
|
||||
if(!["Closed", "Delivered"].includes(doc.status)) {
|
||||
if(this.frm.doc.status !== 'Closed' && flt(this.frm.doc.per_received) < 100 && flt(this.frm.doc.per_billed) < 100) {
|
||||
// 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)) {
|
||||
this.frm.add_custom_button(__('Update Items'), () => {
|
||||
=======
|
||||
if (!["Closed", "Delivered"].includes(doc.status)) {
|
||||
if (
|
||||
this.frm.doc.status !== "Closed" &&
|
||||
flt(this.frm.doc.per_received, 2) < 100 &&
|
||||
flt(this.frm.doc.per_billed, 2) < 100
|
||||
) {
|
||||
if (!this.frm.doc.__onload || this.frm.doc.__onload.can_update_items) {
|
||||
this.frm.add_custom_button(__("Update Items"), () => {
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
erpnext.utils.update_child_items({
|
||||
frm: this.frm,
|
||||
child_docname: "items",
|
||||
@@ -222,11 +211,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends e
|
||||
|
||||
this.frm.page.set_inner_btn_group_as_primary(__("Status"));
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
} else if(in_list(["Closed", "Delivered"], doc.status)) {
|
||||
=======
|
||||
} else if (["Closed", "Delivered"].includes(doc.status)) {
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
} else if(["Closed", "Delivered"].includes(doc.status)) {
|
||||
if (this.frm.has_perm("submit")) {
|
||||
this.frm.add_custom_button(__('Re-open'), () => this.unclose_purchase_order(), __("Status"));
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ erpnext.AccountTreeGrid = class AccountTreeGrid extends frappe.views.TreeGridRep
|
||||
flt(account.closing_dr) -
|
||||
flt(account.closing_cr);
|
||||
me.set_debit_or_credit(parent_account, "closing", bal);
|
||||
} else if (in_list(["debit", "credit"], col.field)) {
|
||||
} else if (["debit", "credit"].includes(col.field)) {
|
||||
parent_account[col.field] =
|
||||
flt(parent_account[col.field]) + flt(account[col.field]);
|
||||
}
|
||||
|
||||
@@ -5,66 +5,13 @@
|
||||
frappe.provide("erpnext.taxes");
|
||||
frappe.provide("erpnext.taxes.flags");
|
||||
|
||||
<<<<<<< HEAD
|
||||
frappe.ui.form.on(cur_frm.doctype, {
|
||||
setup: function(frm) {
|
||||
// set conditional display for rate column in taxes
|
||||
$(frm.wrapper).on('grid-row-render', function(e, grid_row) {
|
||||
if(in_list(['Sales Taxes and Charges', 'Purchase Taxes and Charges'], grid_row.doc.doctype)) {
|
||||
if(['Sales Taxes and Charges', 'Purchase Taxes and Charges'].includes(grid_row.doc.doctype)) {
|
||||
erpnext.taxes.set_conditional_mandatory_rate_or_amount(grid_row);
|
||||
}
|
||||
=======
|
||||
erpnext.accounts.taxes = {
|
||||
setup_tax_validations: function(doctype) {
|
||||
let me = this;
|
||||
frappe.ui.form.on(doctype, {
|
||||
setup: function(frm) {
|
||||
// set conditional display for rate column in taxes
|
||||
$(frm.wrapper).on('grid-row-render', function(e, grid_row) {
|
||||
if(['Sales Taxes and Charges', 'Purchase Taxes and Charges'].includes(grid_row.doc.doctype)) {
|
||||
me.set_conditional_mandatory_rate_or_amount(grid_row);
|
||||
}
|
||||
});
|
||||
},
|
||||
onload: function(frm) {
|
||||
if(frm.get_field("taxes")) {
|
||||
frm.set_query("account_head", "taxes", function(doc) {
|
||||
if(frm.cscript.tax_table == "Sales Taxes and Charges") {
|
||||
var account_type = ["Tax", "Chargeable", "Expense Account"];
|
||||
} else {
|
||||
var account_type = ["Tax", "Chargeable", "Income Account", "Expenses Included In Valuation"];
|
||||
}
|
||||
|
||||
return {
|
||||
query: "erpnext.controllers.queries.tax_account_query",
|
||||
filters: {
|
||||
"account_type": account_type,
|
||||
"company": doc.company,
|
||||
}
|
||||
}
|
||||
});
|
||||
frm.set_query("cost_center", "taxes", function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
"company": doc.company,
|
||||
"is_group": 0
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
validate: function(frm) {
|
||||
// neither is absolutely mandatory
|
||||
if(frm.get_docfield("taxes")) {
|
||||
frm.get_docfield("taxes", "rate").reqd = 0;
|
||||
frm.get_docfield("taxes", "tax_amount").reqd = 0;
|
||||
}
|
||||
|
||||
},
|
||||
taxes_on_form_rendered: function(frm) {
|
||||
me.set_conditional_mandatory_rate_or_amount(frm.open_grid_row());
|
||||
},
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
});
|
||||
},
|
||||
onload: function(frm) {
|
||||
|
||||
@@ -9,408 +9,9 @@ cur_frm.cscript.tax_table = "Purchase Taxes and Charges";
|
||||
|
||||
cur_frm.email_field = "contact_email";
|
||||
|
||||
<<<<<<< HEAD
|
||||
erpnext.buying.BuyingController = class BuyingController extends erpnext.TransactionController {
|
||||
setup() {
|
||||
super.setup();
|
||||
=======
|
||||
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", () => {
|
||||
if(this.frm.doc.customer) {
|
||||
return {
|
||||
query: 'frappe.contacts.doctype.address.address.address_query',
|
||||
filters: { link_doctype: 'Customer', link_name: this.frm.doc.customer }
|
||||
};
|
||||
} else
|
||||
return erpnext.queries.company_address_query(this.frm.doc)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setup_queries(doc, cdt, cdn) {
|
||||
var me = this;
|
||||
|
||||
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("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);
|
||||
|
||||
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}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.frm.set_query("manufacturer", "items", function(doc, cdt, cdn) {
|
||||
const row = locals[cdt][cdn];
|
||||
return {
|
||||
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 (['Purchase Receipt', 'Purchase Invoice'].includes(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) {
|
||||
var item = frappe.get_doc(cdt, cdn);
|
||||
if(item.project) {
|
||||
$.each(this.frm.doc["items"] || [],
|
||||
function(i, other_item) {
|
||||
if(!other_item.project) {
|
||||
other_item.project = item.project;
|
||||
refresh_field("project", other_item.name, other_item.parentfield);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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 qty = Math.abs(r.total_qty);
|
||||
if (doc.is_return) {
|
||||
qty = qty * -1;
|
||||
}
|
||||
|
||||
let update_values = {
|
||||
"serial_and_batch_bundle": r.name,
|
||||
"use_serial_batch_fields": 0,
|
||||
"qty": qty / flt(item.conversion_factor || 1, precision("conversion_factor", item))
|
||||
}
|
||||
|
||||
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 qty = Math.abs(r.total_qty);
|
||||
if (doc.is_return) {
|
||||
qty = qty * -1;
|
||||
}
|
||||
|
||||
let update_values = {
|
||||
"serial_and_batch_bundle": r.name,
|
||||
"use_serial_batch_fields": 0,
|
||||
"rejected_qty": qty / flt(item.conversion_factor || 1, precision("conversion_factor", item))
|
||||
}
|
||||
|
||||
if (r.warehouse) {
|
||||
update_values["rejected_warehouse"] = r.warehouse;
|
||||
}
|
||||
|
||||
frappe.model.set_value(item.doctype, item.name, update_values);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
}
|
||||
|
||||
onload(doc, cdt, cdn) {
|
||||
@@ -535,7 +136,7 @@ erpnext.buying.BuyingController = class BuyingController extends erpnext.Transac
|
||||
}
|
||||
|
||||
toggle_subcontracting_fields() {
|
||||
if (in_list(['Purchase Receipt', 'Purchase Invoice'], this.frm.doc.doctype)) {
|
||||
if (['Purchase Receipt', 'Purchase Invoice'].includes(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');
|
||||
|
||||
|
||||
@@ -260,11 +260,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
}
|
||||
|
||||
setup_quality_inspection() {
|
||||
<<<<<<< HEAD
|
||||
if(!in_list(["Delivery Note", "Sales Invoice", "Purchase Receipt", "Purchase Invoice"], this.frm.doc.doctype)) {
|
||||
=======
|
||||
if(!["Delivery Note", "Sales Invoice", "Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"].includes(this.frm.doc.doctype)) {
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
if(!["Delivery Note", "Sales Invoice", "Purchase Receipt", "Purchase Invoice"].includes(this.frm.doc.doctype)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -276,11 +272,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
this.frm.page.set_inner_btn_group_as_primary(__('Create'));
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
const inspection_type = in_list(["Purchase Receipt", "Purchase Invoice"], this.frm.doc.doctype)
|
||||
=======
|
||||
const inspection_type = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"].includes(this.frm.doc.doctype)
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
const inspection_type = ["Purchase Receipt", "Purchase Invoice"].includes(this.frm.doc.doctype)
|
||||
? "Incoming" : "Outgoing";
|
||||
|
||||
let quality_inspection_field = this.frm.get_docfield("items", "quality_inspection");
|
||||
@@ -699,24 +691,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
on_submit() {
|
||||
if (["Purchase Invoice", "Sales Invoice"].includes(this.frm.doc.doctype)
|
||||
&& !this.frm.doc.update_stock) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.refresh_serial_batch_bundle_field();
|
||||
}
|
||||
|
||||
refresh_serial_batch_bundle_field() {
|
||||
frappe.route_hooks.after_submit = (frm_obj) => {
|
||||
frm_obj.reload_doc();
|
||||
}
|
||||
}
|
||||
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
update_qty(cdt, cdn) {
|
||||
var valid_serial_nos = [];
|
||||
var serialnos = [];
|
||||
@@ -2377,7 +2351,6 @@ erpnext.show_serial_batch_selector = function (frm, d, callback, on_close, show_
|
||||
}
|
||||
|
||||
frappe.require("assets/erpnext/js/utils/serial_no_batch_selector.js", function() {
|
||||
<<<<<<< HEAD
|
||||
new erpnext.SerialNoBatchSelector({
|
||||
frm: frm,
|
||||
item: d,
|
||||
@@ -2388,28 +2361,6 @@ erpnext.show_serial_batch_selector = function (frm, d, callback, on_close, show_
|
||||
callback: callback,
|
||||
on_close: on_close
|
||||
}, show_dialog);
|
||||
=======
|
||||
if (["Sales Invoice", "Delivery Note"].includes(frm.doc.doctype)) {
|
||||
item_row.type_of_transaction = frm.doc.is_return ? "Inward" : "Outward";
|
||||
} else {
|
||||
item_row.type_of_transaction = frm.doc.is_return ? "Outward" : "Inward";
|
||||
}
|
||||
|
||||
new erpnext.SerialBatchPackageSelector(frm, item_row, (r) => {
|
||||
if (r) {
|
||||
let update_values = {
|
||||
"serial_and_batch_bundle": r.name,
|
||||
"qty": Math.abs(r.total_qty)
|
||||
}
|
||||
|
||||
if (r.warehouse) {
|
||||
update_values[warehouse_field] = r.warehouse;
|
||||
}
|
||||
|
||||
frappe.model.set_value(item_row.doctype, item_row.name, update_values);
|
||||
}
|
||||
});
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran
|
||||
serial_no: item.serial_no || "",
|
||||
},
|
||||
callback:function(r){
|
||||
if (in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
|
||||
if (['Delivery Note', 'Sales Invoice'].includes(doc.doctype)) {
|
||||
if (doc.doctype === 'Sales Invoice' && (!doc.update_stock)) return;
|
||||
if (has_batch_no) {
|
||||
me.set_batch_number(cdt, cdn);
|
||||
@@ -332,7 +332,7 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran
|
||||
if ((doc.packed_items || []).length) {
|
||||
$(cur_frm.fields_dict.packing_list.row.wrapper).toggle(true);
|
||||
|
||||
if (in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
|
||||
if (['Delivery Note', 'Sales Invoice'].includes(doc.doctype)) {
|
||||
var help_msg = "<div class='alert alert-warning'>" +
|
||||
__("For 'Product Bundle' items, Warehouse, Serial No and Batch No will be considered from the 'Packing List' table. If Warehouse and Batch No are same for all packing items for any 'Product Bundle' item, those values can be entered in the main Item table, values will be copied to 'Packing List' table.")+
|
||||
"</div>";
|
||||
@@ -340,7 +340,7 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran
|
||||
}
|
||||
} else {
|
||||
$(cur_frm.fields_dict.packing_list.row.wrapper).toggle(false);
|
||||
if (in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
|
||||
if (['Delivery Note', 'Sales Invoice'].includes(doc.doctype)) {
|
||||
frappe.meta.get_docfield(doc.doctype, 'product_bundle_help', doc.name).options = '';
|
||||
}
|
||||
}
|
||||
@@ -367,7 +367,7 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran
|
||||
conversion_factor(doc, cdt, cdn, dont_fetch_price_list_rate) {
|
||||
super.conversion_factor(doc, cdt, cdn, dont_fetch_price_list_rate);
|
||||
if(frappe.meta.get_docfield(cdt, "stock_qty", cdn) &&
|
||||
in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
|
||||
['Delivery Note', 'Sales Invoice'].includes(doc.doctype)) {
|
||||
if (doc.doctype === 'Sales Invoice' && (!doc.update_stock)) return;
|
||||
this.set_batch_number(cdt, cdn);
|
||||
}
|
||||
@@ -376,7 +376,7 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran
|
||||
qty(doc, cdt, cdn) {
|
||||
super.qty(doc, cdt, cdn);
|
||||
|
||||
if(in_list(['Delivery Note', 'Sales Invoice'], doc.doctype)) {
|
||||
if(['Delivery Note', 'Sales Invoice'].includes(doc.doctype)) {
|
||||
if (doc.doctype === 'Sales Invoice' && (!doc.update_stock)) return;
|
||||
this.set_batch_number(cdt, cdn);
|
||||
}
|
||||
@@ -440,7 +440,7 @@ erpnext.selling.SellingController = class SellingController extends erpnext.Tran
|
||||
};
|
||||
|
||||
frappe.ui.form.on(cur_frm.doctype,"project", function(frm) {
|
||||
if(in_list(["Delivery Note", "Sales Invoice"], frm.doc.doctype)) {
|
||||
if(["Delivery Note", "Sales Invoice"].includes(frm.doc.doctype)) {
|
||||
if(frm.doc.project) {
|
||||
frappe.call({
|
||||
method:'erpnext.projects.doctype.project.project.get_cost_center_name' ,
|
||||
|
||||
@@ -77,7 +77,7 @@ frappe.ui.form.on('Stock Entry', {
|
||||
if(!item.item_code) {
|
||||
frappe.throw(__("Please enter Item Code to get Batch Number"));
|
||||
} else {
|
||||
if (in_list(["Material Transfer for Manufacture", "Manufacture", "Repack", "Send to Subcontractor"], doc.purpose)) {
|
||||
if (["Material Transfer for Manufacture", "Manufacture", "Repack", "Send to Subcontractor"].includes(doc.purpose)) {
|
||||
var filters = {
|
||||
'item_code': item.item_code,
|
||||
'posting_date': frm.doc.posting_date || frappe.datetime.nowdate()
|
||||
|
||||
@@ -17,13 +17,8 @@
|
||||
title = "Warehouse",
|
||||
actual_qty = (frm.doc.doctype==="Sales Order"
|
||||
? doc.projected_qty : doc.actual_qty);
|
||||
<<<<<<< HEAD
|
||||
if(flt(frm.doc.per_delivered) < 100
|
||||
&& in_list(["Sales Order Item", "Delivery Note Item"], doc.doctype)) {
|
||||
=======
|
||||
if(flt(frm.doc.per_delivered, 2) < 100
|
||||
&& ["Sales Order Item", "Delivery Note Item"].includes(doc.doctype)) {
|
||||
>>>>>>> d238751e6b (refactor: usage of in_list)
|
||||
if(actual_qty != undefined) {
|
||||
if(actual_qty >= doc.qty) {
|
||||
var color = "green";
|
||||
|
||||
Reference in New Issue
Block a user