update setup_website script

develop
Ahmed Aly 2018-06-27 16:49:08 +02:00
parent 9af5fb4e71
commit 6ad634aa64
2 changed files with 73 additions and 41 deletions

View File

@ -157,12 +157,12 @@ class Config(object):
self.multi_website_modules = [ self.multi_website_modules = [
'website_multi_company_sale', 'website_multi_company_sale',
'dp_website',
'clarico_cart', 'clarico_cart',
'clarico_contact', 'clarico_contact',
'theme_clarico', 'theme_clarico',
'payment_paypal', 'payment_paypal',
'payment_stripe' 'payment_stripe',
'dp_website'
] ]
# Setze das Feld "Attachment" im Report (wenn gesetzt wird das PDF in den Anhängen gespeichert) # Setze das Feld "Attachment" im Report (wenn gesetzt wird das PDF in den Anhängen gespeichert)

View File

@ -260,6 +260,8 @@ class DatenpolFunctions(object):
def setup_websites(self): def setup_websites(self):
"""Setup Websites""" """Setup Websites"""
if not self.odoo.env['ir.model.data'].search([('module', '=', 'website_multi_theme'), ('name', '=', 'clarico_multi')]):
# Create Theme # Create Theme
clarico_theme = self.odoo.env['website.theme'].create({ clarico_theme = self.odoo.env['website.theme'].create({
'name': 'Multiwebsite Clarico Theme', 'name': 'Multiwebsite Clarico Theme',
@ -275,22 +277,32 @@ class DatenpolFunctions(object):
} }
self.odoo.env['ir.model.data'].create(vals) self.odoo.env['ir.model.data'].create(vals)
clarico_theme = self.odoo.env.ref('website_multi_theme.clarico_multi')
self.odoo.env.ref('website.default_website').multi_theme_reload() self.odoo.env.ref('website.default_website').multi_theme_reload()
# create Salesteam for all websites # create Salesteam for all websites
cr_team_ir_heizpaneel = self.odoo.env['crm.team'].search([('name', '=', 'IR Heizpaneele')])
if not cr_team_ir_heizpaneel:
crm_team_vals = { crm_team_vals = {
'name': 'IR Heizpaneele', 'name': 'IR Heizpaneele',
'team_type': 'website', 'team_type': 'website',
'company_id': self.odoo.env.ref('base.main_company').id, 'company_id': self.odoo.env.ref('base.main_company').id,
} }
cr_team_ir_heizpaneel = self.odoo.env['crm.team'].create(crm_team_vals) cr_team_ir_heizpaneel = self.odoo.env['crm.team'].create(crm_team_vals)
else:
cr_team_ir_heizpaneel = self.odoo.env['crm.team'].browse(cr_team_ir_heizpaneel)
cr_team_heizpaneel = self.odoo.env['crm.team'].search([('name', '=', 'Heizpaneele')])
if not cr_team_heizpaneel:
crm_team_vals = { crm_team_vals = {
'name': 'Heizpaneele', 'name': 'Heizpaneele',
'team_type': 'website', 'team_type': 'website',
'company_id': self.odoo.env.ref('base.main_company').id, 'company_id': self.odoo.env.ref('base.main_company').id,
} }
cr_team_heizpaneel = self.odoo.env['crm.team'].create(crm_team_vals) cr_team_heizpaneel = self.odoo.env['crm.team'].create(crm_team_vals)
else:
cr_team_heizpaneel = self.odoo.env['crm.team'].browse(cr_team_heizpaneel)
# Create and configure Websites # Create and configure Websites
default_website = self.odoo.env.ref('website.default_website') default_website = self.odoo.env.ref('website.default_website')
@ -298,17 +310,20 @@ class DatenpolFunctions(object):
'name': 'IR Heizpaneele', 'name': 'IR Heizpaneele',
'domain': 'www.irheizpaneele.at', 'domain': 'www.irheizpaneele.at',
'company_id': self.odoo.env.ref('base.main_company').id, 'company_id': self.odoo.env.ref('base.main_company').id,
'salesteam_id': cr_team_ir_heizpaneel, 'salesteam_id': cr_team_ir_heizpaneel.id,
'multi_theme_id': clarico_theme 'multi_theme_id': clarico_theme.id
}) })
heizpaneele = self.odoo.env['website'].create({
heizpaneele_vals = {
'name': 'Heizpaneele', 'name': 'Heizpaneele',
'domain': 'www.heizpaneele.at', 'domain': 'www.heizpaneele.at',
'company_id': self.odoo.env.ref('base.main_company').id, 'company_id': self.odoo.env.ref('base.main_company').id,
'salesteam_id': cr_team_heizpaneel, 'salesteam_id': cr_team_heizpaneel.id,
'multi_theme_id': clarico_theme 'multi_theme_id': clarico_theme.id
}) }
if not self.odoo.env['ir.model.data'].search([('module', '=', 'dp_website'), ('name', '=', 'tz_heizpaneele')]):
heizpaneele = self.odoo.env['website'].create(heizpaneele_vals)
vals = { vals = {
'model': 'website', 'model': 'website',
'module': 'dp_website', 'module': 'dp_website',
@ -317,6 +332,9 @@ class DatenpolFunctions(object):
'noupdate': False, 'noupdate': False,
} }
self.odoo.env['ir.model.data'].create(vals) self.odoo.env['ir.model.data'].create(vals)
else:
heizpaneele = self.odoo.env.ref('dp_website.tz_heizpaneele')
heizpaneele.write(heizpaneele_vals)
res_settings = self.odoo.env['res.config.settings'] res_settings = self.odoo.env['res.config.settings']
vals = res_settings.default_get([]) vals = res_settings.default_get([])
@ -328,6 +346,20 @@ class DatenpolFunctions(object):
wizard_id = res_settings.create(vals) wizard_id = res_settings.create(vals)
res_settings.execute(wizard_id) res_settings.execute(wizard_id)
#
self.odoo.env['product.pricelist'].browse(self.odoo.env['product.pricelist'].search([])).write({
'selectable': False
})
# create Cart Menu
if not self.odoo.env['website.menu'].search([('name', '=', 'Cart')]):
self.odoo.env['website.menu'].create({
'website_id': False,
'name': 'Cart',
'url': '/shop/cart',
'parent_id': self.odoo.env.ref('website.main_menu').id,
})
return True return True
def configure_payment_providers(self): def configure_payment_providers(self):