Merge branch 'develop' into fix-pos-validate-qty-if-is_stock_item

This commit is contained in:
Maharshi Patel 2022-09-27 23:45:50 +05:30 committed by GitHub
commit d850b0adb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 29 deletions

View File

@ -1553,7 +1553,7 @@
"icon": "fa fa-file-text", "icon": "fa fa-file-text",
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2022-03-22 13:00:24.166684", "modified": "2022-09-27 13:00:24.166684",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "POS Invoice", "name": "POS Invoice",

View File

@ -743,3 +743,7 @@ def add_return_modes(doc, pos_profile):
]: ]:
payment_mode = get_mode_of_payment_info(mode_of_payment, doc.company) payment_mode = get_mode_of_payment_info(mode_of_payment, doc.company)
append_payment(payment_mode[0]) append_payment(payment_mode[0])
def on_doctype_update():
frappe.db.add_index("POS Invoice", ["return_against"])

View File

@ -391,12 +391,12 @@ scheduler_events = {
"erpnext.crm.doctype.social_media_post.social_media_post.process_scheduled_social_media_posts", "erpnext.crm.doctype.social_media_post.social_media_post.process_scheduled_social_media_posts",
], ],
"hourly": [ "hourly": [
"erpnext.accounts.doctype.subscription.subscription.process_all",
"erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings.automatic_synchronization", "erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings.automatic_synchronization",
"erpnext.projects.doctype.project.project.hourly_reminder", "erpnext.projects.doctype.project.project.hourly_reminder",
"erpnext.projects.doctype.project.project.collect_project_status", "erpnext.projects.doctype.project.project.collect_project_status",
], ],
"hourly_long": [ "hourly_long": [
"erpnext.accounts.doctype.subscription.subscription.process_all",
"erpnext.stock.doctype.repost_item_valuation.repost_item_valuation.repost_entries", "erpnext.stock.doctype.repost_item_valuation.repost_item_valuation.repost_entries",
"erpnext.bulk_transaction.doctype.bulk_transaction_log.bulk_transaction_log.retry_failing_transaction", "erpnext.bulk_transaction.doctype.bulk_transaction_log.bulk_transaction_log.retry_failing_transaction",
], ],

View File

@ -557,8 +557,8 @@ erpnext.work_order = {
if(!frm.doc.skip_transfer){ if(!frm.doc.skip_transfer){
// If "Material Consumption is check in Manufacturing Settings, allow Material Consumption // If "Material Consumption is check in Manufacturing Settings, allow Material Consumption
if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing)) if (flt(doc.material_transferred_for_manufacturing) > 0 && frm.doc.status != 'Stopped') {
&& frm.doc.status != 'Stopped') { if ((flt(doc.produced_qty) < flt(doc.material_transferred_for_manufacturing))) {
frm.has_finish_btn = true; frm.has_finish_btn = true;
if (frm.doc.__onload && frm.doc.__onload.material_consumption == 1) { if (frm.doc.__onload && frm.doc.__onload.material_consumption == 1) {
@ -589,6 +589,21 @@ erpnext.work_order = {
// all materials transferred for manufacturing, make this primary // all materials transferred for manufacturing, make this primary
finish_btn.addClass('btn-primary'); finish_btn.addClass('btn-primary');
} }
} else {
frappe.db.get_doc("Manufacturing Settings").then((doc) => {
let allowance_percentage = doc.overproduction_percentage_for_work_order;
if (allowance_percentage > 0) {
let allowed_qty = frm.doc.qty + ((allowance_percentage / 100) * frm.doc.qty);
if ((flt(doc.produced_qty) < allowed_qty)) {
frm.add_custom_button(__('Finish'), function() {
erpnext.work_order.make_se(frm, 'Manufacture');
});
}
}
});
}
} }
} else { } else {
if ((flt(doc.produced_qty) < flt(doc.qty)) && frm.doc.status != 'Stopped') { if ((flt(doc.produced_qty) < flt(doc.qty)) && frm.doc.status != 'Stopped') {

View File

@ -1073,8 +1073,8 @@ class StockEntry(StockController):
# No work order could mean independent Manufacture entry, if so skip validation # No work order could mean independent Manufacture entry, if so skip validation
if self.work_order and self.fg_completed_qty > allowed_qty: if self.work_order and self.fg_completed_qty > allowed_qty:
frappe.throw( frappe.throw(
_("For quantity {0} should not be greater than work order quantity {1}").format( _("For quantity {0} should not be greater than allowed quantity {1}").format(
flt(self.fg_completed_qty), wo_qty flt(self.fg_completed_qty), allowed_qty
) )
) )