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

« back to all changes in this revision

Viewing changes to msf_accrual/wizard/wizard_accrual_validation.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:
74
74
                    move_id = move_obj.create(cr, uid, move_vals, context=context)
75
75
                    reversal_move_id = move_obj.create(cr, uid, reversal_move_vals, context=context)
76
76
                    
 
77
                    reversal_description = "REV - " + accrual_line.description
 
78
                    
77
79
                    # Create move lines
78
80
                    accrual_move_line_vals = {
 
81
                        'accrual': True,
79
82
                        'move_id': move_id,
80
83
                        'date': move_date,
 
84
                        'document_date': accrual_line.document_date,
81
85
                        'journal_id': accrual_line.journal_id.id,
82
86
                        'period_id': accrual_line.period_id.id,
83
87
                        'reference': accrual_line.reference,
89
93
                        'currency_id': accrual_line.currency_id.id,
90
94
                    }
91
95
                    expense_move_line_vals = {
 
96
                        'accrual': True,
92
97
                        'move_id': move_id,
93
98
                        'date': move_date,
 
99
                        'document_date': accrual_line.document_date,
94
100
                        'journal_id': accrual_line.journal_id.id,
95
101
                        'period_id': accrual_line.period_id.id,
96
102
                        'reference': accrual_line.reference,
103
109
                        'analytic_distribution_id': accrual_line.analytic_distribution_id.id,
104
110
                    }
105
111
                    
106
 
                    # and their reversal
 
112
                    # and their reversal (source_date to keep the old change rate)
107
113
                    reversal_accrual_move_line_vals = {
 
114
                        'accrual': True,
108
115
                        'move_id': reversal_move_id,
109
116
                        'date': reversal_move_date,
 
117
                        'document_date': accrual_line.document_date,
 
118
                        'source_date': move_date,
110
119
                        'journal_id': accrual_line.journal_id.id,
111
120
                        'period_id': reversal_period_id,
112
121
                        'reference': accrual_line.reference,
113
 
                        'name': accrual_line.description,
 
122
                        'name': reversal_description,
114
123
                        'account_id': accrual_line.accrual_account_id.id,
115
124
                        'partner_id': ((accrual_line.partner_id) and accrual_line.partner_id.id) or False,
116
125
                        'employee_id': ((accrual_line.employee_id) and accrual_line.employee_id.id) or False,
118
127
                        'currency_id': accrual_line.currency_id.id,
119
128
                    }
120
129
                    reversal_expense_move_line_vals = {
 
130
                        'accrual': True,
121
131
                        'move_id': reversal_move_id,
122
132
                        'date': reversal_move_date,
 
133
                        'document_date': accrual_line.document_date,
 
134
                        'source_date': move_date,
123
135
                        'journal_id': accrual_line.journal_id.id,
124
136
                        'period_id': reversal_period_id,
125
137
                        'reference': accrual_line.reference,
126
 
                        'name': accrual_line.description,
 
138
                        'name': reversal_description,
127
139
                        'account_id': accrual_line.expense_account_id.id,
128
140
                        'partner_id': ((accrual_line.partner_id) and accrual_line.partner_id.id) or False,
129
141
                        'employee_id': ((accrual_line.employee_id) and accrual_line.employee_id.id) or False,