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

« back to all changes in this revision

Viewing changes to account_mcdb/account_period_state.py

  • Committer: jf
  • Date: 2016-02-08 16:40:08 UTC
  • mfrom: (2753.1.7 unifield-wm)
  • Revision ID: jfb@tempo-consulting.fr-20160208164008-426e001so4e9xoip
US-871 [FIX] Mass Realloc: add COR prefix in AJI, use entry_sequence as ref. in COR and REV AJIs
US-871 [FIX] Single AJI manually corrected, COR AJI can't be mass rallocated
lp:~jfb-tempo-consulting/unifield-wm/us-871

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
        user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
81
81
        model_data = self.pool.get('ir.model.data')
 
82
        period_state = self.pool.get('account.period.state')
82
83
        parent = user.company_id.instance_id.id
83
84
        ids_to_write = []
84
85
        for period_id in period_ids:
97
98
                    }
98
99
                    self.write(cr, uid, ids, vals, context=context)
99
100
                    for period_state_id in ids:
100
 
                        period_state_xml_id = self.get_sd_ref(cr, uid, period_state_id)
 
101
                        period_state_xml_id = period_state.get_sd_ref(cr, uid, period_state_id)
101
102
                        ids_to_write.append(model_data._get_id(cr, uid, 'sd',
102
103
                            period_state_xml_id))
103
104
 
106
107
                        'period_id': period['id'],
107
108
                        'instance_id': parent,
108
109
                        'state': period['state']}
109
 
                    new_period_state_id = self.create(cr, uid, vals, context=context)
110
 
                    new_period_state_xml_id = self.get_sd_ref(cr, uid,
111
 
                                                                    new_period_state_id)
112
 
                    ids_to_write.append(model_data._get_id(cr, uid, 'sd',
113
 
                                                           new_period_state_xml_id))
 
110
                    self.create(cr, uid, vals, context=context)
114
111
 
115
112
        # US-649 : in context of synchro last_modification date must be updated
116
113
        # on account.period.state because they are created with synchro and
117
114
        # they need to be sync down to other instances
118
115
        if ids_to_write:
119
 
            model_data.write(cr, uid, ids_to_write,
120
 
                {'last_modification': fields.datetime.now(), 'touched': "['state']"})
 
116
            model_data.write(cr, uid, ids_to_write, {'last_modification':fields.datetime.now()})
 
117
 
121
118
        return True
122
119
 
123
120
account_period_state()
204
201
                        'instance_id': parent,
205
202
                        'state': fy['state']
206
203
                    }
207
 
                    new_id = self.create(cr, uid, vals, context=context)
208
 
                    state_to_update.append(new_id)
 
204
                    nid = self.create(cr, uid, vals, context=context)
 
205
                    state_to_update = [nid]
209
206
 
210
207
        for fy_state_id in state_to_update:
211
208
            fy_state_xml_id = fy_state_obj.get_sd_ref(cr, uid, fy_state_id)