[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) <vfe@odoo.com>
This commit is contained in:
Valeriya(vchu)
2023-10-03 19:19:48 +00:00
committed by Victor Feyens
parent 854083f70a
commit 2114ad3a03
2 changed files with 6 additions and 2 deletions
@@ -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 });
@@ -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';
},