chore: PO cleanup (#23774)

* chore: Subcontracting section and items section enhancement

- Set target warehouse moved to Items section
- Added subcontraction label to supply RM section

* chore: PO & PO Item Form Cleanup

* chore: PO Get Items from cleanup

* fix: Taxes and Charges field visibility

* chore: Cleanup

* fix: Translation styling
This commit is contained in:
Marica 2020-11-15 09:17:42 +05:30 committed by GitHub
parent a8eedb057b
commit 188ecd7b39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 106 additions and 70 deletions

View File

@ -90,6 +90,11 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
this.frm.set_df_property("drop_ship", "hidden", !is_drop_ship); this.frm.set_df_property("drop_ship", "hidden", !is_drop_ship);
if(doc.docstatus == 1) { if(doc.docstatus == 1) {
this.frm.fields_dict.items_section.wrapper.addClass("hide-border");
if(!this.frm.doc.set_warehouse) {
this.frm.fields_dict.items_section.wrapper.removeClass("hide-border");
}
if(!in_list(["Closed", "Delivered"], doc.status)) { if(!in_list(["Closed", "Delivered"], doc.status)) {
if(this.frm.doc.status !== 'Closed' && flt(this.frm.doc.per_received) < 100 && flt(this.frm.doc.per_billed) < 100) { if(this.frm.doc.status !== 'Closed' && flt(this.frm.doc.per_received) < 100 && flt(this.frm.doc.per_billed) < 100) {
this.frm.add_custom_button(__('Update Items'), () => { this.frm.add_custom_button(__('Update Items'), () => {
@ -126,16 +131,25 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
if(doc.status != "Closed") { if(doc.status != "Closed") {
if (doc.status != "On Hold") { if (doc.status != "On Hold") {
if(flt(doc.per_received) < 100 && allow_receipt) { if(flt(doc.per_received) < 100 && allow_receipt) {
cur_frm.add_custom_button(__('Receipt'), this.make_purchase_receipt, __('Create')); cur_frm.add_custom_button(__('Purchase Receipt'), this.make_purchase_receipt, __('Create'));
if(doc.is_subcontracted==="Yes" && me.has_unsupplied_items()) { if(doc.is_subcontracted==="Yes" && me.has_unsupplied_items()) {
cur_frm.add_custom_button(__('Material to Supplier'), cur_frm.add_custom_button(__('Material to Supplier'),
function() { me.make_stock_entry(); }, __("Transfer")); function() { me.make_stock_entry(); }, __("Transfer"));
} }
} }
if(flt(doc.per_billed) < 100) if(flt(doc.per_billed) < 100)
cur_frm.add_custom_button(__('Invoice'), cur_frm.add_custom_button(__('Purchase Invoice'),
this.make_purchase_invoice, __('Create')); this.make_purchase_invoice, __('Create'));
if(flt(doc.per_billed)==0 && doc.status != "Delivered") {
cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_payment_entry, __('Create'));
}
if(flt(doc.per_billed)==0) {
this.frm.add_custom_button(__('Payment Request'),
function() { me.make_payment_request() }, __('Create'));
}
if(!doc.auto_repeat) { if(!doc.auto_repeat) {
cur_frm.add_custom_button(__('Subscription'), function() { cur_frm.add_custom_button(__('Subscription'), function() {
erpnext.utils.make_subscription(doc.doctype, doc.name) erpnext.utils.make_subscription(doc.doctype, doc.name)
@ -156,13 +170,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
}); });
} }
} }
if(flt(doc.per_billed)==0) {
this.frm.add_custom_button(__('Payment Request'),
function() { me.make_payment_request() }, __('Create'));
}
if(flt(doc.per_billed)==0 && doc.status != "Delivered") {
cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_payment_entry, __('Create'));
}
cur_frm.page.set_inner_btn_group_as_primary(__('Create')); cur_frm.page.set_inner_btn_group_as_primary(__('Create'));
} }
} else if(doc.docstatus===0) { } else if(doc.docstatus===0) {
@ -358,12 +366,16 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order", method: "erpnext.stock.doctype.material_request.material_request.make_purchase_order",
source_doctype: "Material Request", source_doctype: "Material Request",
target: me.frm, target: me.frm,
setters: {}, setters: {
schedule_date: undefined,
status: undefined
},
get_query_filters: { get_query_filters: {
material_request_type: "Purchase", material_request_type: "Purchase",
docstatus: 1, docstatus: 1,
status: ["!=", "Stopped"], status: ["!=", "Stopped"],
per_ordered: ["<", 99.99], per_ordered: ["<", 99.99],
company: me.frm.doc.company
} }
}) })
}, __("Get Items From")); }, __("Get Items From"));
@ -375,16 +387,17 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
source_doctype: "Supplier Quotation", source_doctype: "Supplier Quotation",
target: me.frm, target: me.frm,
setters: { setters: {
supplier: me.frm.doc.supplier supplier: me.frm.doc.supplier,
valid_till: undefined
}, },
get_query_filters: { get_query_filters: {
docstatus: 1, docstatus: 1,
status: ["!=", "Stopped"], status: ["not in", ["Stopped", "Expired"]],
} }
}) })
}, __("Get Items From")); }, __("Get Items From"));
this.frm.add_custom_button(__('Update rate as per last purchase'), this.frm.add_custom_button(__('Update Rate as per Last Purchase'),
function() { function() {
frappe.call({ frappe.call({
"method": "get_last_purchase_rate", "method": "get_last_purchase_rate",

View File

@ -30,8 +30,8 @@
"customer_contact_email", "customer_contact_email",
"section_addresses", "section_addresses",
"supplier_address", "supplier_address",
"contact_person",
"address_display", "address_display",
"contact_person",
"contact_display", "contact_display",
"contact_mobile", "contact_mobile",
"contact_email", "contact_email",
@ -49,12 +49,14 @@
"plc_conversion_rate", "plc_conversion_rate",
"ignore_pricing_rule", "ignore_pricing_rule",
"sec_warehouse", "sec_warehouse",
"set_warehouse",
"col_break_warehouse",
"is_subcontracted", "is_subcontracted",
"col_break_warehouse",
"supplier_warehouse", "supplier_warehouse",
"items_section", "before_items_section",
"scan_barcode", "scan_barcode",
"items_col_break",
"set_warehouse",
"items_section",
"items", "items",
"sb_last_purchase", "sb_last_purchase",
"total_qty", "total_qty",
@ -108,18 +110,13 @@
"payment_terms_template", "payment_terms_template",
"payment_schedule", "payment_schedule",
"tracking_section", "tracking_section",
"per_billed", "status",
"column_break_75", "column_break_75",
"per_billed",
"per_received", "per_received",
"terms_section_break", "terms_section_break",
"tc_name", "tc_name",
"terms", "terms",
"more_info",
"status",
"ref_sq",
"column_break_74",
"party_account_currency",
"inter_company_order_reference",
"column_break5", "column_break5",
"letter_head", "letter_head",
"select_print_heading", "select_print_heading",
@ -131,7 +128,12 @@
"to_date", "to_date",
"column_break_97", "column_break_97",
"auto_repeat", "auto_repeat",
"update_auto_repeat_reference" "update_auto_repeat_reference",
"more_info",
"ref_sq",
"column_break_74",
"party_account_currency",
"inter_company_order_reference"
], ],
"fields": [ "fields": [
{ {
@ -313,34 +315,34 @@
{ {
"fieldname": "supplier_address", "fieldname": "supplier_address",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Select Supplier Address", "label": "Supplier Address",
"options": "Address", "options": "Address",
"print_hide": 1 "print_hide": 1
}, },
{ {
"fieldname": "contact_person", "fieldname": "contact_person",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Contact Person", "label": "Supplier Contact",
"options": "Contact", "options": "Contact",
"print_hide": 1 "print_hide": 1
}, },
{ {
"fieldname": "address_display", "fieldname": "address_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"label": "Address", "label": "Supplier Address Details",
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "contact_display", "fieldname": "contact_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"in_global_search": 1, "in_global_search": 1,
"label": "Contact", "label": "Contact Name",
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "contact_mobile", "fieldname": "contact_mobile",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"label": "Mobile No", "label": "Contact Mobile No",
"read_only": 1 "read_only": 1
}, },
{ {
@ -358,14 +360,14 @@
{ {
"fieldname": "shipping_address", "fieldname": "shipping_address",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Select Shipping Address", "label": "Company Shipping Address",
"options": "Address", "options": "Address",
"print_hide": 1 "print_hide": 1
}, },
{ {
"fieldname": "shipping_address_display", "fieldname": "shipping_address_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"label": "Shipping Address", "label": "Shipping Address Details",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
@ -433,7 +435,8 @@
}, },
{ {
"fieldname": "sec_warehouse", "fieldname": "sec_warehouse",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"label": "Subcontracting"
}, },
{ {
"description": "Sets 'Warehouse' in each row of the Items table.", "description": "Sets 'Warehouse' in each row of the Items table.",
@ -466,6 +469,7 @@
{ {
"fieldname": "items_section", "fieldname": "items_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hide_border": 1,
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "fa fa-shopping-cart" "options": "fa fa-shopping-cart"
}, },
@ -598,7 +602,8 @@
}, },
{ {
"fieldname": "section_break_52", "fieldname": "section_break_52",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"hide_border": 1
}, },
{ {
"fieldname": "taxes", "fieldname": "taxes",
@ -626,10 +631,12 @@
{ {
"fieldname": "totals", "fieldname": "totals",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Taxes and Charges",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "fa fa-money" "options": "fa fa-money"
}, },
{ {
"depends_on": "base_taxes_and_charges_added",
"fieldname": "base_taxes_and_charges_added", "fieldname": "base_taxes_and_charges_added",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Taxes and Charges Added (Company Currency)", "label": "Taxes and Charges Added (Company Currency)",
@ -640,6 +647,7 @@
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "base_taxes_and_charges_deducted",
"fieldname": "base_taxes_and_charges_deducted", "fieldname": "base_taxes_and_charges_deducted",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Taxes and Charges Deducted (Company Currency)", "label": "Taxes and Charges Deducted (Company Currency)",
@ -650,6 +658,7 @@
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "base_total_taxes_and_charges",
"fieldname": "base_total_taxes_and_charges", "fieldname": "base_total_taxes_and_charges",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Total Taxes and Charges (Company Currency)", "label": "Total Taxes and Charges (Company Currency)",
@ -665,6 +674,7 @@
"fieldtype": "Column Break" "fieldtype": "Column Break"
}, },
{ {
"depends_on": "taxes_and_charges_added",
"fieldname": "taxes_and_charges_added", "fieldname": "taxes_and_charges_added",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Taxes and Charges Added", "label": "Taxes and Charges Added",
@ -675,6 +685,7 @@
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "taxes_and_charges_deducted",
"fieldname": "taxes_and_charges_deducted", "fieldname": "taxes_and_charges_deducted",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Taxes and Charges Deducted", "label": "Taxes and Charges Deducted",
@ -685,6 +696,7 @@
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "total_taxes_and_charges",
"fieldname": "total_taxes_and_charges", "fieldname": "total_taxes_and_charges",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Total Taxes and Charges", "label": "Total Taxes and Charges",
@ -694,7 +706,7 @@
}, },
{ {
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "discount_amount", "collapsible_depends_on": "apply_discount_on",
"fieldname": "discount_section", "fieldname": "discount_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Additional Discount" "label": "Additional Discount"
@ -734,7 +746,8 @@
}, },
{ {
"fieldname": "totals_section", "fieldname": "totals_section",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"label": "Totals"
}, },
{ {
"fieldname": "base_grand_total", "fieldname": "base_grand_total",
@ -902,12 +915,12 @@
}, },
{ {
"fieldname": "ref_sq", "fieldname": "ref_sq",
"fieldtype": "Data", "fieldtype": "Link",
"hidden": 1, "label": "Supplier Quotation",
"label": "Ref SQ",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "ref_sq", "oldfieldname": "ref_sq",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "Supplier Quotation",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
@ -1061,7 +1074,7 @@
"collapsible": 1, "collapsible": 1,
"fieldname": "tracking_section", "fieldname": "tracking_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Tracking" "label": "Order Status"
}, },
{ {
"fieldname": "column_break_75", "fieldname": "column_break_75",
@ -1070,21 +1083,29 @@
{ {
"fieldname": "billing_address", "fieldname": "billing_address",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Select Billing Address", "label": "Company Billing Address",
"options": "Address" "options": "Address"
}, },
{ {
"fieldname": "billing_address_display", "fieldname": "billing_address_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"label": "Billing Address", "label": "Billing Address Details",
"read_only": 1 "read_only": 1
},
{
"fieldname": "before_items_section",
"fieldtype": "Section Break"
},
{
"fieldname": "items_col_break",
"fieldtype": "Column Break"
} }
], ],
"icon": "fa fa-file-text", "icon": "fa fa-file-text",
"idx": 105, "idx": 105,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-10-07 14:31:57.661221", "modified": "2020-10-30 11:39:37.388249",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Purchase Order", "name": "Purchase Order",

View File

@ -24,6 +24,7 @@
"col_break2", "col_break2",
"uom", "uom",
"conversion_factor", "conversion_factor",
"stock_qty",
"sec_break1", "sec_break1",
"price_list_rate", "price_list_rate",
"discount_percentage", "discount_percentage",
@ -46,11 +47,8 @@
"column_break_32", "column_break_32",
"base_net_rate", "base_net_rate",
"base_net_amount", "base_net_amount",
"billed_amt",
"warehouse_and_reference", "warehouse_and_reference",
"warehouse", "warehouse",
"delivered_by_supplier",
"project",
"material_request", "material_request",
"material_request_item", "material_request_item",
"sales_order", "sales_order",
@ -58,36 +56,37 @@
"supplier_quotation", "supplier_quotation",
"supplier_quotation_item", "supplier_quotation_item",
"col_break5", "col_break5",
"delivered_by_supplier",
"against_blanket_order", "against_blanket_order",
"blanket_order", "blanket_order",
"blanket_order_rate", "blanket_order_rate",
"item_group", "item_group",
"brand", "brand",
"bom",
"include_exploded_items",
"section_break_56", "section_break_56",
"stock_qty",
"column_break_60",
"received_qty", "received_qty",
"returned_qty", "returned_qty",
"manufacture_details", "column_break_60",
"manufacturer", "billed_amt",
"column_break_14",
"manufacturer_part_no",
"more_info_section_break",
"is_fixed_asset",
"item_tax_rate",
"accounting_details", "accounting_details",
"expense_account", "expense_account",
"column_break_68", "manufacture_details",
"manufacturer",
"manufacturer_part_no",
"column_break_14",
"bom",
"include_exploded_items",
"item_weight_details", "item_weight_details",
"weight_per_unit", "weight_per_unit",
"total_weight", "total_weight",
"column_break_40", "column_break_40",
"weight_uom", "weight_uom",
"accounting_dimensions_section", "accounting_dimensions_section",
"cost_center", "project",
"dimension_col_break", "dimension_col_break",
"cost_center",
"more_info_section_break",
"is_fixed_asset",
"item_tax_rate",
"section_break_72", "section_break_72",
"page_break" "page_break"
], ],
@ -346,6 +345,7 @@
}, },
{ {
"default": "0", "default": "0",
"depends_on": "is_free_item",
"fieldname": "is_free_item", "fieldname": "is_free_item",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Is Free Item", "label": "Is Free Item",
@ -508,9 +508,10 @@
}, },
{ {
"default": "0", "default": "0",
"depends_on": "delivered_by_supplier",
"fieldname": "delivered_by_supplier", "fieldname": "delivered_by_supplier",
"fieldtype": "Check", "fieldtype": "Check",
"label": "To be delivered to customer", "label": "To be Delivered to Customer",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
@ -558,6 +559,7 @@
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "eval:parent.is_subcontracted == 'Yes'",
"fieldname": "bom", "fieldname": "bom",
"fieldtype": "Link", "fieldtype": "Link",
"label": "BOM", "label": "BOM",
@ -574,21 +576,21 @@
}, },
{ {
"fieldname": "section_break_56", "fieldname": "section_break_56",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"label": "Billed, Received & Returned"
}, },
{ {
"fieldname": "stock_qty", "fieldname": "stock_qty",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Qty as per Stock UOM", "label": "Qty in Stock UOM",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "stock_qty",
"oldfieldtype": "Currency",
"print_hide": 1, "print_hide": 1,
"print_width": "100px", "print_width": "100px",
"read_only": 1, "read_only": 1,
"width": "100px" "width": "100px"
}, },
{ {
"depends_on": "received_qty",
"fieldname": "received_qty", "fieldname": "received_qty",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Received Qty", "label": "Received Qty",
@ -612,9 +614,10 @@
"fieldtype": "Column Break" "fieldtype": "Column Break"
}, },
{ {
"depends_on": "billed_amt",
"fieldname": "billed_amt", "fieldname": "billed_amt",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Billed Amt", "label": "Billed Amount",
"no_copy": 1, "no_copy": 1,
"options": "currency", "options": "currency",
"print_hide": 1, "print_hide": 1,
@ -633,6 +636,7 @@
"report_hide": 1 "report_hide": 1
}, },
{ {
"collapsible": 1,
"fieldname": "accounting_details", "fieldname": "accounting_details",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Accounting Details" "label": "Accounting Details"
@ -644,10 +648,6 @@
"options": "Account", "options": "Account",
"print_hide": 1 "print_hide": 1
}, },
{
"fieldname": "column_break_68",
"fieldtype": "Column Break"
},
{ {
"fieldname": "cost_center", "fieldname": "cost_center",
"fieldtype": "Link", "fieldtype": "Link",
@ -715,6 +715,7 @@
}, },
{ {
"default": "0", "default": "0",
"depends_on": "is_fixed_asset",
"fetch_from": "item_code.is_fixed_asset", "fetch_from": "item_code.is_fixed_asset",
"fieldname": "is_fixed_asset", "fieldname": "is_fixed_asset",
"fieldtype": "Check", "fieldtype": "Check",
@ -728,9 +729,10 @@
} }
], ],
"idx": 1, "idx": 1,
"index_web_pages_for_search": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2020-04-21 11:55:58.643393", "modified": "2020-10-30 11:59:47.670951",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Purchase Order Item", "name": "Purchase Order Item",