frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
22.11k stars 7.4k forks source link

Purchase Receipt Item Quanities - Quality Inspections Do Not Work Logically with Quantity Types #43486

Open pmjd-code opened 2 months ago

pmjd-code commented 2 months ago

Information about bug

A Quality Inspection is a binary option of accepted/rejected, so it should not be possible to put quantities in both the Accepted Quantity and Rejected Quantity fields in the same line of a Purchase Receipt Item when the item has a Quality Inspection. image

When this does happen, separate batch numbers are created for both the Accepted and Rejected quantities but the Quality Inspection is only linked to the Accepted Quantity batch number not the Rejected Quantity batch number, regardless of the Quality Inspection result of pass/fail. So the Accepted Quantity can be linked to a failed QI.

Would the solution be for items that have a Quality Inspection, the Received Quantity field should be allowed to be used for data entry (or a new QI Quantity field) and on saving the status of the Quality Inspection updates either the Accepted Quantity or Rejected Quantity field (which are read only) to match the result of the QI?

Module

stock

Version

Frappe version - 15.42 ERPNext version - 15.37

Installation method

manual install

Relevant log output / Stack trace / Full Error Message.

No response

pmjd-code commented 1 month ago

The following script from NCP on the Frappe forum prevents having values entered in both accepted and rejected columns, if a value is entered in one the other is reset to zero. May be of use to others.

frappe.ui.form.on('Purchase Receipt Item', {
    qty: function(frm, cdt, cdn) {
        var d = locals[cdt][cdn];
        d.rejected_qty = 0;
        frm.refresh_field('items');
    },
    rejected_qty: function(frm, cdt, cdn) {
        var d = locals[cdt][cdn];
        d.qty = 0;
        frm.refresh_field('items');
    }
});