~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to msf_budget/wizard/wizard_budget_import.py

  • Committer: Matthieu Dietrich
  • Date: 2012-07-10 14:12:40 UTC
  • mfrom: (913 unifield-wm)
  • mto: This revision was merged to the branch mainline in revision 935.
  • Revision ID: mdietrich@chloups211-20120710141240-celi3o016fqz7mj1
UF-881: [MERGE] merged with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
        if import_data[4][1] == "":
94
94
            raise osv.except_osv(_('Warning !'), _("The budget has no decision moment!"))
95
95
        else:
96
 
            result.update({'decision_moment': import_data[4][1]})
 
96
            moment_ids = self.pool.get('msf.budget.decision.moment').search(cr, uid, [('name', '=', import_data[4][1])], context=context)
 
97
            if len(moment_ids) == 0:
 
98
                raise osv.except_osv(_('Warning !'), _("The decision moment %s is not defined in the database!") % (import_data[4][1],))
 
99
            else:
 
100
                result.update({'decision_moment_id': moment_ids[0]})
97
101
        return result
98
102
    
99
103
    def fill_budget_line_data(self, cr, uid, import_data, context=None):
182
186
                                                                        AND name = %s \
183
187
                                                                        AND fiscalyear_id = %s \
184
188
                                                                        AND cost_center_id = %s \
 
189
                                                                        AND decision_moment_id = %s \
185
190
                                                                        ORDER BY version DESC LIMIT 1",
186
191
                                                                       (budget_vals['code'],
187
192
                                                                        budget_vals['name'],
188
193
                                                                        budget_vals['fiscalyear_id'],
189
 
                                                                        budget_vals['cost_center_id']))
 
194
                                                                        budget_vals['cost_center_id'],
 
195
                                                                        budget_vals['decision_moment_id']))
190
196
                    
191
197
                
192
198
                if not cr.rowcount: