-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_method.py
56 lines (43 loc) · 1.72 KB
/
custom_method.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
import frappe
@frappe.whitelist()
def set_si_autoname(doc, method):
doc.name = doc.po_no # or in your case doc.my_order_no
def set_indicator(self):
"""Set indicator for portal"""
if self.outstanding_amount > 0:
self.indicator_color = "orange"
self.indicator_title = _("Unpaid")
else:
self.indicator_color = "green"
self.indicator_title = _("Paid")
# def material_request_data(self,Document):
# query = frappe.db.sql("""select name, material_transfer_type
# from `tabMaterial Transfer`
# WHERE material_request='{0}' """.format(self.material_request),as_dict=1)
# doc_details=""
# for i in query :
# doc_details += i.name+" - "+i.material_transfer_type+" \n"
# self.doc_details=doc_details
# def update_material_request_data(self,doc):
# query = frappe.db.sql("""select name, material_transfer_type
# from `tabMaterial Transfer`
# WHERE material_request='{0}' """.format(self.material_request),as_dict=1)
# doc_details=""
# for i in query :
# doc_details += i.name+" - "+i.material_transfer_type+" \n"
# frappe.db.set_value("Material Request", self.material_request, 'doc_details', doc_details)
# # self.doc_details=doc_details
# # add_to_on_material_transfer(self,doc)
# def add_to_on_material_transfer(self,doc):
# todo = frappe.new_doc("ToDo")
# todo.owner = self.receiver
# todo.assigned_by = self.owner
# todo.description = "Material To Be Transfered"
# todo.date = frappe.utils.nowdate()
# todo.reference_type = "Material Transfer"
# todo.reference_name = self.name
# todo.insert(ignore_permissions=True)
# frappe.db.commit()