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.whitelist()
|
||||
def unpublish_item(item):
|
||||
def unpublish_item(item_code, hub_item_name):
|
||||
''' Remove item listing from the marketplace '''
|
||||
item = json.loads(item)
|
||||
|
||||
item_code = item.get('item_code')
|
||||
response = call_hub_method('unpublish_item', {
|
||||
'hub_item_name': hub_item_name
|
||||
})
|
||||
|
||||
if response:
|
||||
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')
|
||||
else:
|
||||
frappe.throw(_('Unable to update remote activity'))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_unregistered_users():
|
||||
|
@ -58,10 +58,10 @@ export default {
|
||||
this.search_value = '';
|
||||
this.get_items();
|
||||
},
|
||||
watch:{
|
||||
$route (to, from){
|
||||
this.get_items()
|
||||
}
|
||||
mounted() {
|
||||
frappe.route.on('change', () => {
|
||||
this.get_items();
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
get_items() {
|
||||
|
@ -309,11 +309,11 @@ export default {
|
||||
},
|
||||
|
||||
unpublish_item() {
|
||||
let me = this;
|
||||
frappe.confirm(__(`Unpublish ${this.item.item_name}?`), function() {
|
||||
frappe.confirm(__(`Unpublish ${this.item.item_name}?`), () => {
|
||||
frappe
|
||||
.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 => {
|
||||
frappe.set_route(`marketplace/home`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user