update setup_website script

develop
Ahmed Aly 2018-06-27 16:49:08 +02:00 committed by Andreas Wabro
parent 2d3f4526fd
commit 17ee7c8126
2 changed files with 73 additions and 41 deletions

View File

@ -157,12 +157,12 @@ class Config(object):
self.multi_website_modules = [
'website_multi_company_sale',
'dp_website',
'clarico_cart',
'clarico_contact',
'theme_clarico',
'payment_paypal',
'payment_stripe'
'payment_stripe',
'dp_website'
]
# 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):
"""Setup Websites"""
if not self.odoo.env['ir.model.data'].search([('module', '=', 'website_multi_theme'), ('name', '=', 'clarico_multi')]):
# Create Theme
clarico_theme = self.odoo.env['website.theme'].create({
'name': 'Multiwebsite Clarico Theme',
@ -275,22 +277,32 @@ class DatenpolFunctions(object):
}
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()
#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 = {
'name': 'IR Heizpaneele',
'team_type': 'website',
'company_id': self.odoo.env.ref('base.main_company').id,
}
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 = {
'name': 'Heizpaneele',
'team_type': 'website',
'company_id': self.odoo.env.ref('base.main_company').id,
}
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
default_website = self.odoo.env.ref('website.default_website')
@ -298,17 +310,20 @@ class DatenpolFunctions(object):
'name': 'IR Heizpaneele',
'domain': 'www.irheizpaneele.at',
'company_id': self.odoo.env.ref('base.main_company').id,
'salesteam_id': cr_team_ir_heizpaneel,
'multi_theme_id': clarico_theme
'salesteam_id': cr_team_ir_heizpaneel.id,
'multi_theme_id': clarico_theme.id
})
heizpaneele = self.odoo.env['website'].create({
heizpaneele_vals = {
'name': 'Heizpaneele',
'domain': 'www.heizpaneele.at',
'company_id': self.odoo.env.ref('base.main_company').id,
'salesteam_id': cr_team_heizpaneel,
'multi_theme_id': clarico_theme
})
'salesteam_id': cr_team_heizpaneel.id,
'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 = {
'model': 'website',
'module': 'dp_website',
@ -317,6 +332,9 @@ class DatenpolFunctions(object):
'noupdate': False,
}
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']
vals = res_settings.default_get([])
@ -328,6 +346,20 @@ class DatenpolFunctions(object):
wizard_id = res_settings.create(vals)
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
def configure_payment_providers(self):