~unifield-team/unifield-wm/us-453

« back to all changes in this revision

Viewing changes to msf_instance/add_instance.py

  • Committer: jf
  • Date: 2015-07-27 07:23:15 UTC
  • mfrom: (2551.4.1 unifield-wm)
  • Revision ID: jfb@tempo-consulting.fr-20150727072315-wdml0nl9imiujc4s
US-421 [FIX] Account Move, third party journal: instance name added in journal name
lp:~unifield-team/unifield-wm/us_421

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
    _name = 'account.journal'
72
72
    _inherit = 'account.journal'
73
73
 
 
74
    def name_get(self, cr, uid, ids, context=None):
 
75
        if context is None:
 
76
            context = {}
 
77
        if context and context.get('journal_fake_name'):
 
78
            if not ids:
 
79
                return []
 
80
            ret = []
 
81
            for journal in self.read(cr, uid, ids, ['code', 'instance_id']):
 
82
                ret.append((journal['id'], '%s / %s'%(journal['instance_id'] and journal['instance_id'][1] or '', journal['code'])))
 
83
        else:
 
84
            ret = super(account_journal, self).name_get(cr, uid, ids, context=context)
 
85
        return ret
 
86
 
74
87
    def _get_current_instance(self, cr, uid, ids, name, args, context=None):
75
88
        """
76
89
        Get True if the journal was created by this instance.