From 2114ad3a033f56b644c7ec4f9f23bec23853e7b8 Mon Sep 17 00:00:00 2001 From: "Valeriya(vchu)" Date: Thu, 6 Apr 2023 10:14:29 +0200 Subject: [PATCH] [IMP] website_sale: auto publish products users who create products from the website are intended to make it visible immediately for customers task-3234684 closes odoo/odoo#117884 Signed-off-by: Victor Feyens (vfe) --- addons/website/static/src/systray_items/new_content.js | 3 ++- .../website_sale/static/src/js/systray_items/new_content.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/website/static/src/systray_items/new_content.js b/addons/website/static/src/systray_items/new_content.js index 97bd56b144f..018b21ab319 100644 --- a/addons/website/static/src/systray_items/new_content.js +++ b/addons/website/static/src/systray_items/new_content.js @@ -244,8 +244,9 @@ export class NewContentModal extends Component { * perform the 'ir.act_window_close' action, which will be used when * the dialog is closed to go to the correct website page. */ - async onAddContent(action, edition = false) { + async onAddContent(action, edition = false, context = null) { this.action.doAction(action, { + additionalContext: (context) ? context: {}, onClose: (infos) => { if (infos) { this.website.goToWebsite({ path: infos.path, edition: edition }); diff --git a/addons/website_sale/static/src/js/systray_items/new_content.js b/addons/website_sale/static/src/js/systray_items/new_content.js index c2cc920b22b..0d5ec7eaed1 100644 --- a/addons/website_sale/static/src/js/systray_items/new_content.js +++ b/addons/website_sale/static/src/js/systray_items/new_content.js @@ -8,7 +8,10 @@ patch(NewContentModal.prototype, { super.setup(); const newProductElement = this.state.newContentElements.find(element => element.moduleXmlId === 'base.module_website_sale'); - newProductElement.createNewContent = () => this.onAddContent('website_sale.product_product_action_add', true); + newProductElement.createNewContent = () => this.onAddContent( + 'website_sale.product_product_action_add', + true, + {default_is_published: true}); newProductElement.status = MODULE_STATUS.INSTALLED; newProductElement.model = 'product.product'; },