'''
Find the partner for which the accounting entries will be created
'''
- # FIXME: after 7.0, to replace by function field partner.commercial_partner_id
-
- #if the chosen partner is not a company and has a parent company, use the parent for the journal entries
- #because you want to invoice 'Agrolait, accounting department' but the journal items are for 'Agrolait'
- while not partner.is_company and partner.parent_id:
- partner = partner.parent_id
- return partner
+ return partner.commercial_partner_id
- def copy(self, cr, uid, id, default=None, context=None):
+ def copy_data(self, cr, uid, id, default=None, context=None):
default = default or {}
default.update({'invoice_ids' : []})
- return super(res_partner, self).copy(cr, uid, id, default, context)
+ return super(res_partner, self).copy_data(cr, uid, id, default=default, context=context)
class mail_compose_message(osv.Model):