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()
@frappe.whitelist()
def get_outstanding_invoices(self):
self.set('accounts', [])
total = 0

View File

@ -17,10 +17,12 @@ class AmazonMWSSettings(Document):
else:
self.enable_sync = 0
@frappe.whitelist()
def get_products_details(self):
if self.enable_amazon == 1:
frappe.enqueue('erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_methods.get_products_details')
@frappe.whitelist()
def get_order_details(self):
if self.enable_amazon == 1:
after_date = dateutil.parser.parse(self.after_date).strftime("%Y-%m-%d")
@ -40,4 +42,4 @@ def setup_custom_fields():
fieldtype='Data', insert_after='title', read_only=1, print_hide=1)]
}
create_custom_fields(custom_fields)
create_custom_fields(custom_fields)

View File

@ -50,6 +50,7 @@ class TherapyType(Document):
self.db_set('change_in_item', 0)
@frappe.whitelist()
def add_exercises(self):
exercises = self.get_exercises_for_body_parts()
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
@frappe.whitelist()
def clear_table(self):
self.set('holidays', [])

View File

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

View File

@ -124,6 +124,7 @@ class ImportSupplierInvoice(Document):
if disc_line.find("Percentuale"):
invoices_args["total_discount"] += flt((flt(disc_line.Percentuale.text) / 100) * (rate * qty))
@frappe.whitelist()
def process_file_data(self):
self.status = "Processing File Data"
self.save()
@ -400,4 +401,4 @@ def get_full_path(file_name):
elif not self.file_url:
frappe.throw(_("There is some problem with the file url: {0}").format(file_path))
return file_path
return file_path

View File

@ -12,6 +12,7 @@ from frappe.model.document import Document
from frappe.core.doctype.sms_settings.sms_settings import send_sms
class SMSCenter(Document):
@frappe.whitelist()
def create_receiver_list(self):
rec, where_clause = '', ''
if self.send_to == 'All Customer Contact':
@ -73,6 +74,7 @@ class SMSCenter(Document):
return receiver_nos
@frappe.whitelist()
def send_sms(self):
receiver_list = []
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:
frappe.db.sql("insert into tabSeries (name, current) values (%s, 0)", (series))
@frappe.whitelist()
def update_series_start(self):
if self.prefix:
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.delete_auto_created_batches()
@frappe.whitelist()
def get_current_stock(self):
for d in self.get('supplied_items'):
if self.supplier_warehouse:

View File

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