← Back to team overview

openerp-community team mailing list archive

Further Update

 

Dear Stuart,

hope you are doing well.

Please add the attached diff to our branch
https://code.launchpad.net/~vrt-openerp/openobject-addons/6.1-trunk-bug-923440
after reviewing it as I can not add it there.

The diff adds the address type 'private' and specifies default values
for new addresses context dependent.

Best Regards

Etienne

-- 
https://code.launchpad.net/~openerp-community/openobject-addons/trunk-bug-923440-base_contact_finalise6.1/+merge/95777
Your team OpenERP Community is subscribed to branch lp:~openerp-community/openobject-addons/trunk-bug-923440-base_contact_finalise6.1.
Index: /usr/share/pyshared/openerp/addons/base_contact/base_contact.py
===================================================================
--- /usr/share/pyshared/openerp/addons/base_contact/base_contact.py	(revision 13038)
+++ /usr/share/pyshared/openerp/addons/base_contact/base_contact.py	(revision 13054)
@@ -287,6 +287,10 @@
         'location_id' : fields.many2one('res.partner.location', 'Location'),
         'contact_id' : fields.many2one('res.partner.contact', 'Contact'),
         
+        #add private type
+        'type': fields.selection( [ ('default','Default'),('invoice','Invoice'), ('delivery','Delivery'), ('contact','Contact'), ('other','Other'), ('private', 'Private') ],'Address Type', help="Used to select automatically the right address according to the context in sales and purchases documents."),
+
+        
         #field for administer functions
         'sequence_contact': fields.integer('Contact Seq.',help='Order of\
                      importance of this address in the list of addresses of the linked contact'),
@@ -320,6 +324,7 @@
         'other': fields.char('Other Phone', size=64, help='Additional phone field'),
 
         # fields from contact
+        
         'mobile' : fields.related('contact_id', 'mobile', type='char', size=64, string='Mobile'),
                 #store = {'res.partner.contact': (_get_address_from_contact_ids, ['mobile'], 10),
                 #         'res.partner.address': (_get_own_addresses,['contact_id'], 20)}), @bug: query wants to store in crm_lead!!!!
Index: /usr/share/pyshared/openerp/addons/base_contact/base_contact_view.xml
===================================================================
--- /usr/share/pyshared/openerp/addons/base_contact/base_contact_view.xml	(revision 13038)
+++ /usr/share/pyshared/openerp/addons/base_contact/base_contact_view.xml	(revision 13054)
@@ -94,7 +94,8 @@
                                 <field name="photo" widget='image' nolabel="1"/>
                             </group>
                        </group>
-                       <field name="job_ids" colspan="4" nolabel="1" mode="tree,form" context="{'tree_view_ref' : 'base_contact.view_partner_address_tree_contact'}">
+                       <!-- default_type is not followed! -->
+                       <field name="job_ids" colspan="4" nolabel="1" mode="tree,form" context="{'tree_view_ref' : 'base_contact.view_partner_address_tree_contact', 'default_contact_id': active_id, 'default_type': 'contact'}">
                         </field>
                     </page>
                     <page string="Extra Information">
@@ -169,7 +170,7 @@
         <field name="type">form</field>
         <field name="arch" type="xml">
         	<field name="address" position="replace" >
-        	 	<field colspan="4" mode="tree,form" name="address" nolabel="1" select="1" height="260" context="{'tree_view_ref' : 'base_contact.view_partner_address_tree_partner'}">
+        	 	<field colspan="4" mode="tree,form" name="address" nolabel="1" select="1" height="260" context="{'tree_view_ref' : 'base_contact.view_partner_address_tree_partner', 'default_partner_id': active_id, 'default_type': 'contact'}">
         	    </field>
         	</field>
         
@@ -263,6 +264,11 @@
                 <field name="contact_id" on_change="onchange_contact_id(contact_id)" attrs="{'required':[('partner_id','=', False)]}"/>
                 <!-- <field name="name" string="use this field for initial name only" /> would require adaption of create-->
             </field>
+            
+            <field name="type" position="replace">
+            	<field name="type" required="1"/>
+            </field>
+            	
             <separator string="Postal Address" position="after">
                 <field name="location_id" required="1" on_change="onchange_location_id(location_id)" domain="[('partner_id', '=', partner_id)]"/>
             </separator>

References