openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #04409
lp:~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_validation-uco into lp:~openerp-dev/openobject-addons/trunk-contact-google-sync
Ujjvala Collins (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_validation-uco into lp:~openerp-dev/openobject-addons/trunk-contact-google-sync.
Requested reviews:
OpenERP R&D Team (openerp-dev)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_validation-uco/+merge/54163
Backlog Validation 1 :
-----------------------------------
01 : rename the menu (too long for web client layout) rename into : Import Contact
02 : in the wizard :
Title : Import contacts from a google account
the label of the firts field must be : "Google Username"
the label of the firts field must be : "Google Password"
04 : if create partner is selected -> choose if supplier / customer ...
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_validation-uco/+merge/54163
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-dev/openobject-addons/trunk-contact-google-sync-backlog_validation-uco into lp:~openerp-dev/openobject-addons/trunk-contact-google-sync.
=== modified file 'google_base_account/wizard/google_login.py'
--- google_base_account/wizard/google_login.py 2011-03-07 13:33:54 +0000
+++ google_base_account/wizard/google_login.py 2011-03-21 08:41:31 +0000
@@ -30,8 +30,8 @@
_description ='Google Contact'
_name = 'google.login'
_columns = {
- 'user': fields.char('Username', size=64, required=True),
- 'password': fields.char('Password', size=64),
+ 'user': fields.char('Google Username', size=64, required=True),
+ 'password': fields.char('Google Password', size=64),
}
def google_login(self, user, password, type='group', context=None):
@@ -42,7 +42,7 @@
gd_client = gdata.contacts.service.ContactsService()
try:
gd_client.ClientLogin(user, password,gd_client.source)
- except Exception, e:
+ except Exception:
return False
return gd_client
=== modified file 'sync_google_contact/wizard/google_contact_import.py'
--- sync_google_contact/wizard/google_contact_import.py 2011-03-07 13:33:54 +0000
+++ sync_google_contact/wizard/google_contact_import.py 2011-03-21 08:41:31 +0000
@@ -77,6 +77,8 @@
_columns = {
'create_partner': fields.selection([('create_all','Create partner for each contact'),('create_address','Import only address')],'Options'),
+ 'customer': fields.boolean('Customer'),
+ 'supplier': fields.boolean('Supplier'),
'group_name': fields.selection(_get_group, "Group Name", size=32,help="Choose which group to import, By default it takes all."),
}
@@ -87,9 +89,13 @@
def create_partner(self, cr, uid, data={}, context=None):
partner_obj = self.pool.get('res.partner')
- name = data.get('name','')
- partner_id = partner_obj.create(cr, uid, {'name': name, 'address' : [(6, 0, [data['address_id']])]}, context=context)
- return partner_id, data
+ partner_id = partner_obj.create(cr, uid, {
+ 'name': data.get('name',''),
+ 'address' : [(6, 0, [data['address_id']])],
+ 'customer': data.get('customer', False),
+ 'supplier': data.get('supplier', False)
+ }, context=context)
+ return partner_id
def import_contact(self, cr, uid, ids, context=None):
obj = self.browse(cr, uid, ids, context=context)[0]
@@ -112,7 +118,7 @@
else:
contact = gd_client.GetContactsFeed()
- ids = self.create_contact(cr, uid, gd_client, contact, option=obj.create_partner,context=context)
+ ids = self.create_contact(cr, uid, ids, gd_client, contact, option=obj.create_partner,context=context)
if not ids:
return {'type': 'ir.actions.act_window_close'}
@@ -127,7 +133,7 @@
'type': 'ir.actions.act_window',
}
- def create_contact(self, cr, uid, gd_client, contact, option,context=None):
+ def create_contact(self, cr, uid, ids, gd_client, contact, option,context=None):
model_obj = self.pool.get('ir.model.data')
addresss_obj = self.pool.get('res.partner.address')
addresses = []
@@ -141,6 +147,7 @@
'name': google_id,
'model': 'res.partner.address',
'module': 'sync_google_contact',
+ 'noupdate': True
}
data_ids = model_obj.search(cr, uid, [('model','=','res.partner.address'), ('name','=', google_id)])
@@ -158,7 +165,10 @@
res_id = addresss_obj.create(cr, uid, data, context=context)
data['address_id'] = res_id
if option == 'create_all':
- partner_id, data = self.create_partner(cr, uid, data, context=context)
+ obj = self.browse(cr, uid, ids, context=context)[0]
+ data['customer'] = obj.customer
+ data['supplier'] = obj.supplier
+ partner_id = self.create_partner(cr, uid, data, context=context)
partner_ids.append(partner_id)
addresses.append(res_id)
=== modified file 'sync_google_contact/wizard/google_contact_import_view.xml'
--- sync_google_contact/wizard/google_contact_import_view.xml 2011-02-28 12:38:47 +0000
+++ sync_google_contact/wizard/google_contact_import_view.xml 2011-03-21 08:41:31 +0000
@@ -6,11 +6,16 @@
<field name="model">synchronize.base</field>
<field name="type">form</field>
<field name="arch" type="xml">
- <form string="Import Google Contacts">
+ <form string="Import contacts from a google account">
<group colspan="4" col="4">
<field name="group_name" />
<separator string="Import Options" colspan="4"/>
<field name="create_partner"/>
+ <newline/>
+ <group attrs="{'invisible': [('create_partner','!=','create_all')]}" colspan="2" col="4">
+ <field name="customer"/>
+ <field name="supplier"/>
+ </group>
</group>
<separator string="" colspan="4"/>
<group colspan="4" col="4">
@@ -29,7 +34,7 @@
Login Action
-->
<record model="ir.actions.act_window" id="act_google_login_form">
- <field name="name">Import contacts from your google account</field>
+ <field name="name">Import Contacts</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">google.login.contact</field>
<field name="view_type">form</field>
Follow ups