Merge pull request #318 from akhileshdarjee/master
Permissions in Invoices fixed.
This commit is contained in:
commit
b70b93260c
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-30 12:49:46",
|
||||
"creation": "2013-03-07 12:35:57",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-02-01 10:50:16",
|
||||
"modified": "2013-03-21 13:02:27",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -24,6 +24,9 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Journal Voucher",
|
||||
@ -31,7 +34,9 @@
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1
|
||||
"report": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
@ -278,6 +283,7 @@
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"description": "Considered as Opening Balance",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_opening",
|
||||
"fieldtype": "Select",
|
||||
@ -290,7 +296,7 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"description": "For opening invoice entry, this date will reflect in the period-wise aging report.",
|
||||
"description": "Actual Posting Date",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "aging_date",
|
||||
"fieldtype": "Date",
|
||||
@ -444,30 +450,11 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
"role": "Accounts Manager"
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Auditor",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
"role": "Accounts User"
|
||||
}
|
||||
]
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-29 17:54:09",
|
||||
"creation": "2013-03-07 13:16:13",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-01-29 18:25:24",
|
||||
"modified": "2013-03-22 18:17:14",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -636,6 +636,7 @@
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"description": "Considered as Opening Balance",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_opening",
|
||||
"fieldtype": "Select",
|
||||
@ -648,6 +649,7 @@
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"description": "Actual Invoice Date",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "aging_date",
|
||||
"fieldtype": "Date",
|
||||
@ -774,40 +776,8 @@
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Purchase User",
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "supplier",
|
||||
"role": "Supplier",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Auditor",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
"role": "Supplier"
|
||||
}
|
||||
]
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-20 17:01:58",
|
||||
"creation": "2013-03-19 17:03:01",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-20 19:17:38",
|
||||
"modified": "2013-03-22 18:16:45",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -750,11 +750,12 @@
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
"description": "Considered as an Opening Balance",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_opening",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 1,
|
||||
"label": "Is Opening",
|
||||
"label": "Is Opening Entry",
|
||||
"oldfieldname": "is_opening",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "No\nYes",
|
||||
@ -762,6 +763,7 @@
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"description": "Actual Invoice Date",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "aging_date",
|
||||
"fieldtype": "Date",
|
||||
@ -1093,7 +1095,7 @@
|
||||
"description": "The day of the month on which auto invoice will be generated e.g. 05, 28 etc ",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "repeat_on_day_of_month",
|
||||
"fieldtype": "Int",
|
||||
"fieldtype": "Data",
|
||||
"label": "Repeat on Day of Month",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1
|
||||
|
@ -81,18 +81,17 @@ def backup_to_dropbox():
|
||||
upload_file_to_dropbox(filename, "database", dropbox_client)
|
||||
|
||||
response = dropbox_client.metadata("/files")
|
||||
|
||||
# upload files to files folder
|
||||
filename = os.path.join(get_base_path(), "public", "files")
|
||||
for filename in os.listdir(filename):
|
||||
path = os.path.join(get_base_path(), "public", "files")
|
||||
for filename in os.listdir(path):
|
||||
found = False
|
||||
filepath = os.path.join(path, filename)
|
||||
for file_metadata in response["contents"]:
|
||||
if filename==os.path.basename(file_metadata["path"]):
|
||||
if os.stat(filename).st_size==file_metadata["bytes"]:
|
||||
found=True
|
||||
|
||||
if os.path.basename(filepath) == os.path.basename(file_metadata["path"]) and os.stat(filepath).st_size == int(file_metadata["bytes"]):
|
||||
found = True
|
||||
break
|
||||
if not found:
|
||||
upload_file_to_dropbox(os.path.join(get_base_path(),"public", "files", filename), "files", dropbox_client)
|
||||
upload_file_to_dropbox(filepath, "files", dropbox_client)
|
||||
|
||||
def get_dropbox_session():
|
||||
from dropbox import session
|
||||
@ -112,11 +111,11 @@ def upload_file_to_dropbox(filename, folder, dropbox_client):
|
||||
while uploader.offset < size:
|
||||
try:
|
||||
uploader.upload_chunked()
|
||||
finish(folder + '/' + os.path.basename(filename), overwrite='True')
|
||||
uploader.finish(os.path.join(folder, os.path.basename(filename)), overwrite='True')
|
||||
except rest.ErrorResponse, e:
|
||||
pass
|
||||
else:
|
||||
response = dropbox_client.put_file(folder + "/" + os.path.basename(filename), f, overwrite=True)
|
||||
response = dropbox_client.put_file(os.path.join(folder, os.path.basename(filename)), f, overwrite=True)
|
||||
|
||||
if __name__=="__main__":
|
||||
backup_to_dropbox()
|
@ -51,8 +51,6 @@ def upload_files(name, mimetype, service, folder_id):
|
||||
|
||||
def backup_to_gdrive():
|
||||
from webnotes.utils.backups import new_backup
|
||||
found_database = False
|
||||
found_files = False
|
||||
if not webnotes.conn:
|
||||
webnotes.connect()
|
||||
flow = get_gdrive_flow()
|
||||
@ -73,10 +71,11 @@ def backup_to_gdrive():
|
||||
|
||||
# upload files to files folder
|
||||
path = os.path.join(get_base_path(), "public", "files")
|
||||
for files in os.listdir(path):
|
||||
filename = path + "/" + files
|
||||
for filename in os.listdir(path):
|
||||
found = False
|
||||
filepath = os.path.join(path, filename)
|
||||
ext = filename.split('.')[-1]
|
||||
size = os.path.getsize(filename)
|
||||
size = os.path.getsize(filepath)
|
||||
if ext == 'gz' or ext == 'gzip':
|
||||
mimetype = 'application/x-gzip'
|
||||
else:
|
||||
@ -88,11 +87,11 @@ def backup_to_gdrive():
|
||||
**param).execute()
|
||||
for child in children.get('items', []):
|
||||
file = drive_service.files().get(fileId=child['id']).execute()
|
||||
if files == file['title'] and size == int(file['fileSize']):
|
||||
found_files = True
|
||||
if filename == file['title'] and size == int(file['fileSize']):
|
||||
found = True
|
||||
break
|
||||
if not found_files:
|
||||
upload_files(filename, mimetype, drive_service, webnotes.conn.get_value("Backup Manager", None, "files_folder_id"))
|
||||
if not found:
|
||||
upload_files(filepath, mimetype, drive_service, webnotes.conn.get_value("Backup Manager", None, "files_folder_id"))
|
||||
|
||||
def get_gdrive_flow():
|
||||
from oauth2client.client import OAuth2WebServerFlow
|
||||
@ -106,10 +105,9 @@ def get_gdrive_flow():
|
||||
# + "?cmd=setup.doctype.backup_manager.backup_googledrive.googledrive_callback"
|
||||
|
||||
# for installed apps since google does not support subdomains
|
||||
redirect_uri = "urn:ietf:wg:oauth:2.0:oob"
|
||||
|
||||
flow = OAuth2WebServerFlow(conf.gdrive_client_id, conf.gdrive_client_secret,
|
||||
"https://www.googleapis.com/auth/drive", redirect_uri)
|
||||
"https://www.googleapis.com/auth/drive", 'urn:ietf:wg:oauth:2.0:oob')
|
||||
return flow
|
||||
|
||||
@webnotes.whitelist()
|
||||
|
@ -10,9 +10,9 @@ class DocType:
|
||||
def onload(self):
|
||||
"""load address"""
|
||||
if self.doc.query_options:
|
||||
self.doc.query_options = filter(None, self.doc.query_options.replace(",", "\n").split())
|
||||
self.query_options = filter(None, self.doc.query_options.replace(",", "\n").split())
|
||||
else:
|
||||
self.doc.query_options = ["Sales", "Support", "General"]
|
||||
self.query_options = ["Sales", "Support", "General"]
|
||||
if self.doc.address:
|
||||
self.address = webnotes.bean("Address", self.doc.address).doc
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<p><select class="span6" name="subject">
|
||||
{% for option in obj.doc.query_options %}
|
||||
{% for option in obj.query_options %}
|
||||
<option value="{{ option }}">{{ option }}</option>
|
||||
{% endfor %}
|
||||
</select></p>
|
||||
|
@ -166,6 +166,7 @@ def prepare_args(page_name):
|
||||
args.update(webnotes.get_method(target)())
|
||||
else:
|
||||
args.obj = webnotes.bean(page_settings_map[page_name]).obj
|
||||
|
||||
else:
|
||||
args = get_doc_fields(page_name)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user