~unifield-team/unifield-wm/us-671-homere

« back to all changes in this revision

Viewing changes to unifield_setup/installer/project_addresses.py

  • Committer: chloups208
  • Date: 2012-11-21 11:15:15 UTC
  • mto: This revision was merged to the branch mainline in revision 1340.
  • Revision ID: chloups208@chloups208-laptop-20121121111515-myqv282h6xmgh053
utp-171 modification of fields po, po line, product, so, so line

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
        if not context:
107
107
            context = {}
108
108
 
109
 
        res = super(project_addresses, self).execute(cr, 1, ids, context=context)
 
109
        res = super(project_addresses, self).execute(cr, uid, ids, context=context)
110
110
        
111
111
        assert len(ids) == 1, "We should only get one object from the form"
112
112
        payload = self.browse(cr, uid, ids[0], context=context)
173
173
                address_obj.unlink(cr, uid, bill_address[0], context=context)
174
174
        
175
175
        if company.instance_id:
176
 
            self.pool.get('res.company').write(cr, 1, [company.id], {'name': company.instance_id.instance}, context=context)
 
176
            self.pool.get('res.company').write(cr, uid, [company.id], {'name': company.instance_id.instance}, context=context)
177
177
 
178
178
            c = context.copy()
179
179
            c.update({'from_config': True})
180
180
            self.pool.get('res.partner').write(cr, uid, [company.partner_id.id], {'name': company.instance_id.instance,
181
181
                                                                                  'partner_type': 'internal'}, context=c)
182
182
 
183
 
        data_obj = self.pool.get('ir.model.data')
184
 
        warehouse_obj = self.pool.get('stock.warehouse')
185
 
        user_obj = self.pool.get('res.users')
186
 
 
187
 
        instance_name = user_obj.browse(cr, uid, uid, context=context).company_id.partner_id.name
188
 
 
189
 
        # Rename the warehouse with the name of the company
190
 
        warehouse_id = data_obj.get_object_reference(cr, uid, 'stock', 'warehouse0')[1]
191
 
        warehouse_obj.write(cr, uid, [warehouse_id], {'name': 'MSF %s' % instance_name}, context=context)
192
 
 
193
183
        return res
194
184
    
195
185
project_addresses()