feat(marketplace): unpublish item from hub
This commit is contained in:
parent
370cdc0170
commit
8287c3d05a
@ -147,6 +147,23 @@ def publish_selected_items(items_to_publish):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
frappe.log_error(message=e, title='Hub Sync Error')
|
frappe.log_error(message=e, title='Hub Sync Error')
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def unpublish_item(item):
|
||||||
|
''' Remove item listing from the marketplace '''
|
||||||
|
item = json.loads(item)
|
||||||
|
|
||||||
|
item_code = item.get('item_code')
|
||||||
|
frappe.db.set_value('Item', item_code, 'publish_in_hub', 0)
|
||||||
|
|
||||||
|
item = map_fields([item])[0]
|
||||||
|
|
||||||
|
try:
|
||||||
|
connection = get_hub_connection()
|
||||||
|
connection.set_value('Hub Item', item.get('name'), 'published', 0)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
frappe.log_error(message=e, title='Hub Sync Error')
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_unregistered_users():
|
def get_unregistered_users():
|
||||||
settings = frappe.get_single('Marketplace Settings')
|
settings = frappe.get_single('Marketplace Settings')
|
||||||
|
@ -300,7 +300,21 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
unpublish_item() {
|
unpublish_item() {
|
||||||
frappe.msgprint(__('This feature is under development...'));
|
let me = this;
|
||||||
|
frappe.confirm(__(`Unpublish ${this.item.item_name}?`), function () {
|
||||||
|
frappe.call(
|
||||||
|
'erpnext.hub_node.api.unpublish_item',
|
||||||
|
{
|
||||||
|
item: me.item
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then((r) => {
|
||||||
|
frappe.set_route(`marketplace/home`);
|
||||||
|
frappe.show_alert(__('Item listing removed'))
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user