chore: frappe.whitelist for doc methods (#25465)

This commit is contained in:
Walstan Baptista 2021-04-24 14:23:08 +05:30 committed by GitHub
parent 184317d5bd
commit 4a805b5622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 20 additions and 4 deletions

View File

@ -592,6 +592,7 @@ class JournalEntry(AccountsController):
self.validate_total_debit_and_credit() self.validate_total_debit_and_credit()
@frappe.whitelist()
def get_outstanding_invoices(self): def get_outstanding_invoices(self):
self.set('accounts', []) self.set('accounts', [])
total = 0 total = 0

View File

@ -17,10 +17,12 @@ class AmazonMWSSettings(Document):
else: else:
self.enable_sync = 0 self.enable_sync = 0
@frappe.whitelist()
def get_products_details(self): def get_products_details(self):
if self.enable_amazon == 1: if self.enable_amazon == 1:
frappe.enqueue('erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_methods.get_products_details') frappe.enqueue('erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_methods.get_products_details')
@frappe.whitelist()
def get_order_details(self): def get_order_details(self):
if self.enable_amazon == 1: if self.enable_amazon == 1:
after_date = dateutil.parser.parse(self.after_date).strftime("%Y-%m-%d") after_date = dateutil.parser.parse(self.after_date).strftime("%Y-%m-%d")

View File

@ -50,6 +50,7 @@ class TherapyType(Document):
self.db_set('change_in_item', 0) self.db_set('change_in_item', 0)
@frappe.whitelist()
def add_exercises(self): def add_exercises(self):
exercises = self.get_exercises_for_body_parts() exercises = self.get_exercises_for_body_parts()
last_idx = max([cint(d.idx) for d in self.get('exercises')] or [0,]) last_idx = max([cint(d.idx) for d in self.get('exercises')] or [0,])

View File

@ -62,6 +62,7 @@ class HolidayList(Document):
return date_list return date_list
@frappe.whitelist()
def clear_table(self): def clear_table(self):
self.set('holidays', []) self.set('holidays', [])

View File

@ -29,6 +29,7 @@ class LeaveControlPanel(Document):
frappe.throw(_("{0} is required").format(self.meta.get_label(f))) frappe.throw(_("{0} is required").format(self.meta.get_label(f)))
self.validate_from_to_dates('from_date', 'to_date') self.validate_from_to_dates('from_date', 'to_date')
@frappe.whitelist()
def allocate_leave(self): def allocate_leave(self):
self.validate_values() self.validate_values()
leave_allocated_for = [] leave_allocated_for = []

View File

@ -124,6 +124,7 @@ class ImportSupplierInvoice(Document):
if disc_line.find("Percentuale"): if disc_line.find("Percentuale"):
invoices_args["total_discount"] += flt((flt(disc_line.Percentuale.text) / 100) * (rate * qty)) invoices_args["total_discount"] += flt((flt(disc_line.Percentuale.text) / 100) * (rate * qty))
@frappe.whitelist()
def process_file_data(self): def process_file_data(self):
self.status = "Processing File Data" self.status = "Processing File Data"
self.save() self.save()

View File

@ -12,6 +12,7 @@ from frappe.model.document import Document
from frappe.core.doctype.sms_settings.sms_settings import send_sms from frappe.core.doctype.sms_settings.sms_settings import send_sms
class SMSCenter(Document): class SMSCenter(Document):
@frappe.whitelist()
def create_receiver_list(self): def create_receiver_list(self):
rec, where_clause = '', '' rec, where_clause = '', ''
if self.send_to == 'All Customer Contact': if self.send_to == 'All Customer Contact':
@ -73,6 +74,7 @@ class SMSCenter(Document):
return receiver_nos return receiver_nos
@frappe.whitelist()
def send_sms(self): def send_sms(self):
receiver_list = [] receiver_list = []
if not self.message: if not self.message:

View File

@ -159,6 +159,7 @@ class NamingSeries(Document):
if frappe.db.get_value('Series', series, 'name', order_by="name") == None: if frappe.db.get_value('Series', series, 'name', order_by="name") == None:
frappe.db.sql("insert into tabSeries (name, current) values (%s, 0)", (series)) frappe.db.sql("insert into tabSeries (name, current) values (%s, 0)", (series))
@frappe.whitelist()
def update_series_start(self): def update_series_start(self):
if self.prefix: if self.prefix:
prefix = self.parse_naming_series() prefix = self.parse_naming_series()

View File

@ -221,6 +221,7 @@ class PurchaseReceipt(BuyingController):
self.ignore_linked_doctypes = ('GL Entry', 'Stock Ledger Entry', 'Repost Item Valuation') self.ignore_linked_doctypes = ('GL Entry', 'Stock Ledger Entry', 'Repost Item Valuation')
self.delete_auto_created_batches() self.delete_auto_created_batches()
@frappe.whitelist()
def get_current_stock(self): def get_current_stock(self):
for d in self.get('supplied_items'): for d in self.get('supplied_items'):
if self.supplier_warehouse: if self.supplier_warehouse:

View File

@ -398,8 +398,12 @@ class StockEntry(StockController):
and item_code = %s and item_code = %s
and ifnull(s_warehouse,'')='' """ % (", ".join(["%s" * len(other_ste)]), "%s"), args)[0][0] and ifnull(s_warehouse,'')='' """ % (", ".join(["%s" * len(other_ste)]), "%s"), args)[0][0]
if fg_qty_already_entered and fg_qty_already_entered >= qty: if fg_qty_already_entered and fg_qty_already_entered >= qty:
frappe.throw(_("Stock Entries already created for Work Order ") frappe.throw(
+ self.work_order + ":" + ", ".join(other_ste), DuplicateEntryForWorkOrderError) _("Stock Entries already created for Work Order {0}: {1}").format(
self.work_order, ", ".join(other_ste)
),
DuplicateEntryForWorkOrderError,
)
def set_actual_qty(self): def set_actual_qty(self):
allow_negative_stock = cint(frappe.db.get_value("Stock Settings", None, "allow_negative_stock")) allow_negative_stock = cint(frappe.db.get_value("Stock Settings", None, "allow_negative_stock"))
@ -435,6 +439,7 @@ class StockEntry(StockController):
if transferred_serial_no: if transferred_serial_no:
d.serial_no = transferred_serial_no d.serial_no = transferred_serial_no
@frappe.whitelist()
def get_stock_and_rate(self): def get_stock_and_rate(self):
""" """
Updates rate and availability of all the items. Updates rate and availability of all the items.