[NEW] When shop is installed, disable all products
This commit is contained in:
@@ -23,3 +23,19 @@ def post_init_hook(env):
|
||||
'domain': False,
|
||||
'homepage_url': new_page.url
|
||||
})
|
||||
|
||||
module_ecommerce = env['ir.module.module'].search([('name','=','website_sale')])
|
||||
if module_ecommerce and module_ecommerce.state == 'installed':
|
||||
# disable payment options:
|
||||
for payment_method in env['payment.method'].search([]):
|
||||
payment_method.write({
|
||||
'active': False
|
||||
})
|
||||
_logger.error(f"________Disable payment method {payment_method.id}")
|
||||
# Disable products
|
||||
for product in env['product.template'].search([]):
|
||||
product.write({
|
||||
'website_published': False
|
||||
})
|
||||
_logger.error(f"________Disable product {product.id}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user