[MOD] Configuration wizard : small changes

bzr revid: vir@tinyerp.com-20100727093648-fneruqalpbvoxxum
This commit is contained in:
AMP(Open ERP) 2010-07-27 15:06:48 +05:30 committed by Vir (Open ERP)
parent 5f3a32a17b
commit 406c37c2f8
10 changed files with 46 additions and 39 deletions

View File

@ -25,41 +25,44 @@ from osv import fields, osv
class base_contact_installer(osv.osv_memory):
_name = 'base.contact.installer'
_inherit = 'res.config.installer'
_columns = {
'name': fields.char('Name', size=64),
'migrate': fields.boolean('Migrate', help="If you select this, all addresses will be migrated."),
'name': fields.char('Name', size=64),
'migrate': fields.boolean('Migrate', help="If you select this, all addresses will be migrated."),
'nomigrate': fields.boolean('NoMigrate', help="If you select this, all addresses will be not migrated."),
}
def execute(self, cr, uid, ids, context=None):
"""
This function is used to create contact and address from existing partner address
This function is used to create contact and address from existing partner address
"""
cr.execute("""DROP TRIGGER IF EXISTS contactjob on res_partner_contact;
DROP LANGUAGE IF EXISTS plpgsql CASCADE;
CREATE LANGUAGE plpgsql ;
CREATE OR REPLACE FUNCTION add_to_job() RETURNS TRIGGER AS $contactjob$
DECLARE
new_name varchar;
new_phonenum varchar;
BEGIN
IF(TG_OP='INSERT') THEN
INSERT INTO res_partner_job(contact_id, address_id, function, state) VALUES(NEW.id, NEW.website::integer,NEW.first_name, 'current');
UPDATE res_partner_contact set first_name=Null, website=Null, active=True where id=NEW.id;
END IF;
RETURN NEW;
END;
$contactjob$ LANGUAGE plpgsql;
CREATE TRIGGER contactjob AFTER INSERT ON res_partner_contact FOR EACH ROW EXECUTE PROCEDURE add_to_job();""")
cr.commit()
obj = self.pool.get("base.contact.installer").browse(cr, uid, uid)
if obj.migrate:
cr.execute("""DROP TRIGGER IF EXISTS contactjob on res_partner_contact;
DROP LANGUAGE IF EXISTS plpgsql CASCADE;
CREATE LANGUAGE plpgsql ;
CREATE OR REPLACE FUNCTION add_to_job() RETURNS TRIGGER AS $contactjob$
DECLARE
new_name varchar;
new_phonenum varchar;
BEGIN
IF(TG_OP='INSERT') THEN
INSERT INTO res_partner_job(contact_id, address_id, function, state) VALUES(NEW.id, NEW.website::integer,NEW.first_name, 'current');
UPDATE res_partner_contact set first_name=Null, website=Null, active=True where id=NEW.id;
END IF;
RETURN NEW;
END;
$contactjob$ LANGUAGE plpgsql;
CREATE TRIGGER contactjob AFTER INSERT ON res_partner_contact FOR EACH ROW EXECUTE PROCEDURE add_to_job();""")
cr.commit()
cr.execute("INSERT into res_partner_contact (name, title, email, first_name, website) (SELECT coalesce(name, 'Noname'), title, email, function , to_char(id, '99999999') from res_partner_address)")
cr.commit()
cr.execute("INSERT into res_partner_contact (name, title, email, first_name, website) (SELECT coalesce(name, 'Noname'), title, email, function , to_char(id, '99999999') from res_partner_address)")
cr.commit()
cr.execute("DROP TRIGGER IF EXISTS contactjob on res_partner_contact")
cr.execute("DROP LANGUAGE IF EXISTS plpgsql CASCADE;")
cr.execute("DROP FUNCTION IF EXISTS add_to_job()")
cr.commit()
cr.execute("DROP TRIGGER IF EXISTS contactjob on res_partner_contact")
cr.execute("DROP LANGUAGE IF EXISTS plpgsql CASCADE;")
cr.execute("DROP FUNCTION IF EXISTS add_to_job()")
cr.commit()
base_contact_installer()

View File

@ -23,14 +23,18 @@
<attribute name='string'></attribute>
</xpath>
<xpath expr="//button[@string='Install Modules']" position="attributes">
<attribute name="string">Migrate</attribute>
<attribute name="string">Configure</attribute>
</xpath>
<group colspan="8">
<group colspan="2" col="2">
<label string="Due to changes in Address and Partner's relation, some of the details from address are needed to migrated into contact information." colspan="4"/>
<label string="Otherwise these details will not be visible from address/contact." colspan="4"/>
<label string="Do you want to migrate your Address data in Contact Data?" colspan="4" />
<field name="migrate" string="Yes/No" />
<group colspan="6">
<label string="Migrate:" colspan="1"/>
<field name="migrate" string="Yes" colspan="1"/>
<field name="nomigrate" string="No" colspan="1"/>
</group>
</group>
</group>
</data>

View File

@ -11,7 +11,7 @@
<attribute name="string">Main Company Setup</attribute>
</form>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">Information of your company will be used to custiomise your documents like Invoices, Sale Orders and many more.</attribute>
<attribute name="string">Information of your company will be used to customize your documents like Invoices, Sale Orders and many more.</attribute>
</xpath>
<xpath expr='//separator[@string="title"]' position='attributes'>
<attribute name='string'>Configure Your Company</attribute>

View File

@ -8,7 +8,7 @@
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">CRM Modules Installation</attribute>
<attribute name="string">CRM Modules Configuration</attribute>
</form>
<separator string="title" position="attributes">

View File

@ -10,7 +10,7 @@
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Select Human Resources Modules To Install</attribute>
<attribute name="string">Human Resources Modules Configuration</attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string">Select Human Resources Modules To Install</attribute>

View File

@ -8,7 +8,7 @@
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Knowledge Modules Installation</attribute>
<attribute name="string">Knowledge Modules Configuration</attribute>
</form>
<separator string="title" position="attributes">

View File

@ -13,7 +13,7 @@
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Marketing Modules Installation</attribute>
<attribute name="string">Marketing Modules Configuration</attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string">Select Marketing Modules to Install</attribute>

View File

@ -8,7 +8,7 @@
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Tools Modules Installation</attribute>
<attribute name="string">Tools Modules Configuration</attribute>
</form>
<xpath expr='//separator[@string="vsep"]' position='attributes'>
<attribute name='string'></attribute>

View File

@ -9,7 +9,7 @@
<field name="arch" type="xml">
<data>
<form position="attributes">
<attribute name="string">Project Modules Installation</attribute>
<attribute name="string">Project Modules Configuration</attribute>
</form>
<separator string="title" position="attributes">
<attribute name="string">Project Management</attribute>

View File

@ -33,7 +33,7 @@ class thunderbird_installer(osv.osv_memory):
data = super(thunderbird_installer, self).default_get(cr, uid, fields, context)
pdf_file = open(config['addons_path'] + "/thunderbird/doc/Installation Guide to OpenERP Thunderbid Plug-in.pdf", 'r')
data['pdf_file'] = base64.encodestring(pdf_file.read())
file = open(config['addons_path'] + "/thunderbird/plugin/tiny_plugin-2.0.xpi", 'r')
file = open(config['addons_path'] + "/thunderbird/plugin/OpenERP_plugin-2.0.xpi", 'r')
data['plugin_file'] = base64.encodestring(file.read())
return data
@ -48,9 +48,9 @@ class thunderbird_installer(osv.osv_memory):
_defaults = {
'thunderbird' : True,
'name' : 'tiny_plugin-2.0.xpi',
'name' : 'OpenERP_plugin-2.0.xpi',
'pdf_name' : 'Installation Guide to OpenERP Thunderbid Plug-in.pdf',
'description' : """ * Save the Thunderbird plug­in. \n * Follows the step to install Thunderbird plug­in. \n -> 1.From Menu Bar of Thunderbird, open Tools ­> Add ons. \n -> 2. Click on install button and a browser window appears. \n -> 3. Select the plug-in(.xpi file) and click Ok. \n -> 4. Software installation window appears and within a short time “Install Now” button will be enabled \n -> 5. Click "Install Now". \n -> 6. Restart Thunderbird."""
'description' : """ * Save the Thunderbird plug­in. \n * Follow the Steps to configure OpenERP in Thunderbird. \n -> 1. Go to Tools > OpenERP Synchronization. \n -> 2. check data (configured by default). \n -> 3. Click Test Connection. \n -> 4. A message appears with state of your connection. \n -> 5. If your connection failed, check if your database is open, and check your data. \n -> 6. If you have a good connection, click Ok and start to archive mail in OpenERP.
}
thunderbird_installer()