Merge branch 'hub-multiuser' of https://github.com/frappe/erpnext into hub-multiuser
This commit is contained in:
commit
ad6948844e
@ -142,7 +142,7 @@ def publish_selected_items(items_to_publish):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
item_sync_preprocess(len(items))
|
item_sync_preprocess(len(items))
|
||||||
load_base64_image_from_items(items)
|
convert_relative_image_urls_to_absolute(items)
|
||||||
|
|
||||||
# TODO: Publish Progress
|
# TODO: Publish Progress
|
||||||
connection = get_hub_connection()
|
connection = get_hub_connection()
|
||||||
@ -183,29 +183,14 @@ def item_sync_postprocess():
|
|||||||
frappe.db.set_value('Marketplace Settings', 'Marketplace Settings', 'sync_in_progress', 0)
|
frappe.db.set_value('Marketplace Settings', 'Marketplace Settings', 'sync_in_progress', 0)
|
||||||
|
|
||||||
|
|
||||||
def load_base64_image_from_items(items):
|
def convert_relative_image_urls_to_absolute(items):
|
||||||
|
from urlparse import urljoin
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
file_path = item['image']
|
file_path = item['image']
|
||||||
file_name = os.path.basename(file_path)
|
|
||||||
base64content = None
|
|
||||||
|
|
||||||
if file_path.startswith('http'):
|
if file_path.startswith('/files/'):
|
||||||
# fetch content and then base64 it
|
item['image'] = urljoin(frappe.utils.get_url(), file_path)
|
||||||
url = file_path
|
|
||||||
response = requests.get(url)
|
|
||||||
base64content = base64.b64encode(response.content)
|
|
||||||
else:
|
|
||||||
# read file then base64 it
|
|
||||||
file_path = os.path.abspath(get_file_path(file_path))
|
|
||||||
with io.open(file_path, 'rb') as f:
|
|
||||||
base64content = base64.b64encode(f.read())
|
|
||||||
|
|
||||||
image_data = json.dumps({
|
|
||||||
'file_name': file_name,
|
|
||||||
'base64': base64content
|
|
||||||
})
|
|
||||||
|
|
||||||
item['image'] = image_data
|
|
||||||
|
|
||||||
|
|
||||||
def get_hub_connection():
|
def get_hub_connection():
|
||||||
|
@ -1,28 +1,15 @@
|
|||||||
const ProfileDialog = (title = __('Edit Profile'), action={}) => {
|
const ProfileDialog = (title = __('Edit Profile'), action={}) => {
|
||||||
const fields = [
|
const fields = [
|
||||||
{
|
|
||||||
fieldname: 'company_email',
|
|
||||||
label: __('Email'),
|
|
||||||
fieldtype: 'Read Only'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
fieldtype: 'Link',
|
fieldtype: 'Link',
|
||||||
fieldname: 'company',
|
fieldname: 'company',
|
||||||
label: __('Company'),
|
label: __('Company'),
|
||||||
options: 'Company',
|
options: 'Company'
|
||||||
onchange: () => {
|
},
|
||||||
const value = dialog.get_value('company');
|
{
|
||||||
if (value) {
|
fieldtype: 'Read Only',
|
||||||
frappe.db.get_doc('Company', value)
|
fieldname: 'email',
|
||||||
.then(company => {
|
label: __('Email')
|
||||||
console.log(company.company_logo);
|
|
||||||
dialog.set_values({
|
|
||||||
company_logo: company.company_logo,
|
|
||||||
company_description: company.company_description
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: __('About your company'),
|
label: __('About your company'),
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
</section-header>
|
</section-header>
|
||||||
|
|
||||||
<item-cards-container
|
<item-cards-container
|
||||||
:container_name="page_title"
|
:container_name="__('Published Items')"
|
||||||
:items="items"
|
:items="items"
|
||||||
:item_id_fieldname="item_id_fieldname"
|
:item_id_fieldname="item_id_fieldname"
|
||||||
:on_click="go_to_item_details_page"
|
:on_click="go_to_item_details_page"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user