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);
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(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'), () => {
@ -126,16 +131,25 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
if(doc.status != "Closed") {
if (doc.status != "On Hold") {
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()) {
cur_frm.add_custom_button(__('Material to Supplier'),
function() { me.make_stock_entry(); }, __("Transfer"));
}
}
if(flt(doc.per_billed) < 100)
cur_frm.add_custom_button(__('Invoice'),
cur_frm.add_custom_button(__('Purchase Invoice'),
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) {
cur_frm.add_custom_button(__('Subscription'), function() {
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'));
}
} 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",
source_doctype: "Material Request",
target: me.frm,
setters: {},
setters: {
schedule_date: undefined,
status: undefined
},
get_query_filters: {
material_request_type: "Purchase",
docstatus: 1,
status: ["!=", "Stopped"],
per_ordered: ["<", 99.99],
company: me.frm.doc.company
}
})
}, __("Get Items From"));
@ -375,16 +387,17 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
source_doctype: "Supplier Quotation",
target: me.frm,
setters: {
supplier: me.frm.doc.supplier
supplier: me.frm.doc.supplier,
valid_till: undefined
},
get_query_filters: {
docstatus: 1,
status: ["!=", "Stopped"],
status: ["not in", ["Stopped", "Expired"]],
}
})
}, __("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() {
frappe.call({
"method": "get_last_purchase_rate",

View File

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

View File

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