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 = [ 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,37 +260,49 @@ class DatenpolFunctions(object):
def setup_websites(self): def setup_websites(self):
"""Setup Websites""" """Setup Websites"""
# Create Theme
clarico_theme = self.odoo.env['website.theme'].create({
'name': 'Multiwebsite Clarico Theme',
'converted_theme_addon': 'theme_clarico'
})
vals = { if not self.odoo.env['ir.model.data'].search([('module', '=', 'website_multi_theme'), ('name', '=', 'clarico_multi')]):
'model': 'website.theme', # Create Theme
'module': 'website_multi_theme', clarico_theme = self.odoo.env['website.theme'].create({
'name': 'clarico_multi', 'name': 'Multiwebsite Clarico Theme',
'res_id': str(clarico_theme), 'converted_theme_addon': 'theme_clarico'
'noupdate': False, })
}
self.odoo.env['ir.model.data'].create(vals) vals = {
'model': 'website.theme',
'module': 'website_multi_theme',
'name': 'clarico_multi',
'res_id': str(clarico_theme),
'noupdate': False,
}
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
crm_team_vals = { cr_team_ir_heizpaneel = self.odoo.env['crm.team'].search([('name', '=', 'IR Heizpaneele')])
'name': 'IR Heizpaneele', if not cr_team_ir_heizpaneel:
'team_type': 'website', crm_team_vals = {
'company_id': self.odoo.env.ref('base.main_company').id, 'name': 'IR Heizpaneele',
} 'team_type': 'website',
cr_team_ir_heizpaneel = self.odoo.env['crm.team'].create(crm_team_vals) '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)
crm_team_vals = { cr_team_heizpaneel = self.odoo.env['crm.team'].search([('name', '=', 'Heizpaneele')])
'name': 'Heizpaneele', if not cr_team_heizpaneel:
'team_type': 'website', crm_team_vals = {
'company_id': self.odoo.env.ref('base.main_company').id, 'name': 'Heizpaneele',
} 'team_type': 'website',
cr_team_heizpaneel = self.odoo.env['crm.team'].create(crm_team_vals) '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 # Create and configure Websites
default_website = self.odoo.env.ref('website.default_website') default_website = self.odoo.env.ref('website.default_website')
@ -298,25 +310,31 @@ 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
})
vals = {
'model': 'website',
'module': 'dp_website',
'name': 'tz_heizpaneele',
'res_id': str(heizpaneele),
'noupdate': False,
} }
self.odoo.env['ir.model.data'].create(vals) 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',
'name': 'tz_heizpaneele',
'res_id': str(heizpaneele),
'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'] 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):