JoEz
April 15, 2017, 8:42am
1
Hi,
is there any why customize form_grid for particular child table? I mean something like form_grid_templates
used in PO, SO etc.
My goal is to customize Item Supplier child table in orde to display green if supplier
and supplier_part_no
are enabled.
Any hint, beside hack item.py
? i’d like to have it not changed each bench update
.
Thx
@JoEz
Why don’t you try set_indicator_formatter
method? It will show indicator in child table
as per your condition.
1 Like
JoEz
April 15, 2017, 10:09am
3
Many thanks for the hint, i’ll have a look at that
JoEz
April 15, 2017, 11:12am
4
It seems that delivery note load form_grid_template as well:
from frappe.contacts.doctype.address.address import get_company_address
from frappe.desk.notifications import clear_doctype_notifications
from frappe.model.mapper import get_mapped_doc
from frappe.model.utils import get_fetch_values
from frappe.utils import cint, flt
from erpnext.controllers.accounts_controller import get_taxes_and_charges
from erpnext.controllers.selling_controller import SellingController
from erpnext.stock.doctype.batch.batch import set_batch_nos
from erpnext.stock.doctype.serial_no.serial_no import get_delivery_note_serial_no
form_grid_templates = {"items": "templates/form_grid/item_grid.html"}
class DeliveryNote(SellingController):
def __init__(self, *args, **kwargs):
super(DeliveryNote, self).__init__(*args, **kwargs)
self.status_updater = [
{
"source_dt": "Delivery Note Item",
"target_dt": "Sales Order Item",
JoEz
April 17, 2017, 6:57am
6
Modified item.py code by adding form_grid_template
for supplier_items
, added the template to load …but nothing happens, no indicators are shown in item supplier form grid.
Any help appreciated, thx
@JoEz
Please check method syntax of set_indicator_formatter
. It’s .js
method. Template is not required for this.
e.g. Check Purchase Order .js
here is the syntax of set_indicator_formatter
options,
doc
) {
return repl('<span class="indicator %(color)s">%(name)s</span>', {
color: get_color(),
name: get_text(),
});
};
},
JoEz
April 17, 2017, 7:15am
8
@Sangram Can you explain why even in purchase order is loaded a form_grid_template? Is not required?
Where ?
Just write your script in .js
file as per given example and check.
JoEz
April 17, 2017, 7:32am
10
@Sangram check purchase_order.py
I think it shouldn’t work …the js method make a replacement in color indicator spam tag …but, as far as i know it’s not there in default form_grid
JoEz
April 17, 2017, 7:42am
12
@Sangram I tried using form_grid_template load but it seems not working …going to try using js …but not convinced it could work …
Please share your script.
JoEz
April 17, 2017, 9:27am
15
I got the problem …it’s because i’m using GitHub - techmaxsolucoes/title_links: Frappe Hack: Links using related title, instead of name to format links …need to fix it in some way …
Fixed!
adnan
April 17, 2017, 9:32am
16
Hi JoEz,
did you fix the above challange? as you are working on PO. i also have few thoughts and challenges see if you can help me with that.
is there a way we can define a default UOM for PO and Different UOM for POS?
in the POS can we do the update of master data once the invoice is settled?
also can we manage to minimize the use of Mouse and assign Key shortcuts for POS?
Thanks in Advance
JoEz
April 17, 2017, 6:29pm
17
@adnan please open a new post for that, i’m closing this as i fixed.