fix: create unpublish log on the hub
This commit is contained in:
parent
d249d4c947
commit
0cb2783f80
@ -148,21 +148,17 @@ def publish_selected_items(items_to_publish):
|
|||||||
frappe.log_error(message=e, title='Hub Sync Error')
|
frappe.log_error(message=e, title='Hub Sync Error')
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def unpublish_item(item):
|
def unpublish_item(item_code, hub_item_name):
|
||||||
''' Remove item listing from the marketplace '''
|
''' Remove item listing from the marketplace '''
|
||||||
item = json.loads(item)
|
|
||||||
|
|
||||||
item_code = item.get('item_code')
|
response = call_hub_method('unpublish_item', {
|
||||||
frappe.db.set_value('Item', item_code, 'publish_in_hub', 0)
|
'hub_item_name': hub_item_name
|
||||||
|
})
|
||||||
|
|
||||||
item = map_fields([item])[0]
|
if response:
|
||||||
|
frappe.db.set_value('Item', item_code, 'publish_in_hub', 0)
|
||||||
try:
|
else:
|
||||||
connection = get_hub_connection()
|
frappe.throw(_('Unable to update remote activity'))
|
||||||
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():
|
||||||
|
@ -58,10 +58,10 @@ export default {
|
|||||||
this.search_value = '';
|
this.search_value = '';
|
||||||
this.get_items();
|
this.get_items();
|
||||||
},
|
},
|
||||||
watch:{
|
mounted() {
|
||||||
$route (to, from){
|
frappe.route.on('change', () => {
|
||||||
this.get_items()
|
this.get_items();
|
||||||
}
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
get_items() {
|
get_items() {
|
||||||
|
@ -309,11 +309,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
unpublish_item() {
|
unpublish_item() {
|
||||||
let me = this;
|
frappe.confirm(__(`Unpublish ${this.item.item_name}?`), () => {
|
||||||
frappe.confirm(__(`Unpublish ${this.item.item_name}?`), function() {
|
|
||||||
frappe
|
frappe
|
||||||
.call('erpnext.hub_node.api.unpublish_item', {
|
.call('erpnext.hub_node.api.unpublish_item', {
|
||||||
item: me.item
|
item_code: this.item.item_code,
|
||||||
|
hub_item_name: this.hub_item_name
|
||||||
})
|
})
|
||||||
.then(r => {
|
.then(r => {
|
||||||
frappe.set_route(`marketplace/home`);
|
frappe.set_route(`marketplace/home`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user