~unifield-team/unifield-wm/us-671-homere

« back to all changes in this revision

Viewing changes to msf_audittrail/audittrail_invoice_data.yml

  • Committer: chloups208
  • Date: 2012-11-21 11:15:15 UTC
  • mto: This revision was merged to the branch mainline in revision 1340.
  • Revision ID: chloups208@chloups208-laptop-20121121111515-myqv282h6xmgh053
utp-171 modification of fields po, po line, product, so, so line

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
                'payment_ids', 'period_id', 'reference', 'reference_type', 'tax_line']
13
13
 
14
14
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'account.invoice'), ('name', 'in', fields)], context=context)
15
 
 
 
15
        
16
16
      rule_id = self.create(cr, uid, {'name': name,
17
17
                                      'object_id': object_ids[0],
18
18
                                      'log_write': True,
20
20
                                      'log_create': True,
21
21
                                      'field_ids': [(6, 0, fields_ids)],
22
22
                                     }, context=context)
23
 
 
 
23
                                    
24
24
      # Subscribe to the rule
25
25
      self.subscribe(cr, uid, rule_id)
26
26
-
38
38
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'account.invoice.line'), ('name', 'in', fields)], context=context)
39
39
      field_name = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'account.invoice.line'), ('name', '=', 'line_number')], context=context)
40
40
      field_parent = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'account.invoice.line'), ('name', '=', 'invoice_id')], context=context)
41
 
 
 
41
      
42
42
      name_id = False
43
43
      parent_id = False
44
 
 
 
44
      
45
45
      if field_parent:
46
46
        parent_id = field_parent[0]
47
47
        if field_name:
48
48
          name_id = field_name[0]
49
 
 
 
49
        
50
50
      rule_id = self.create(cr, uid, {'name': name,
51
51
                                      'object_id': object_ids[0],
52
52
                                      'log_write': True,
56
56
                                      'parent_field_id': parent_id,
57
57
                                      'name_get_field_id': name_id,
58
58
                                     }, context=context)
59
 
 
 
59
                                    
60
60
      # Subscribe to the rule
61
61
      self.subscribe(cr, uid, rule_id)
62
62
-
68
68
    rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context)
69
69
    if object_ids and not rule_id:
70
70
      # Create the rule
71
 
      fields = ['state', 'balance_end_real', 'closing_balance_frozen', 'closing_date', 'notes',  'name',
72
 
                'open_advance_amount', 'user_id', 'closing_date', 'unrecorded_expenses_amount']
 
71
      fields = ['state', 'balance_end_real', 'closing_balance_frozen', 'closing_date', 'notes', 'ending_details_ids', 'name', 
 
72
                'open_advance_amount', 'user_id']
73
73
 
74
74
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'account.bank.statement'), ('name', 'in', fields)], context=context)
75
 
 
76
 
      rule_id = self.create(cr, uid, {'name': name,
77
 
                                      'object_id': object_ids[0],
78
 
                                      'log_write': True,
79
 
                                      'log_unlink': True,
80
 
                                      'log_create': True,
81
 
                                      'field_ids': [(6, 0, fields_ids)],
82
 
                                     }, context=context)
83
 
 
84
 
      # Subscribe to the rule
85
 
      self.subscribe(cr, uid, rule_id)
86
 
-
87
 
  I will create a rule for Register Line object
88
 
-
89
 
  !python {model: audittrail.rule}: |
90
 
    name = 'Register Line'
91
 
    object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'account.bank.statement.line')], context=context)
92
 
    rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context)
93
 
    if object_ids and not rule_id:
94
 
      # Create the rule
95
 
      fields = [
96
 
        'name', 'document_date', 'date', 'sequence_for_reference',
97
 
        'account_id', 'partner_type2',
98
 
        'amount_in', 'amount_out', 
99
 
        'reconciled', 'state',
100
 
      ]
101
 
 
102
 
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'account.bank.statement.line'), ('name', 'in', fields)], context=context)
103
 
      field_name = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'account.bank.statement.line'), ('name', '=', 'name')], context=context)
104
 
      field_parent = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'account.bank.statement.line'), ('name', '=', 'statement_id')], context=context)
105
 
 
106
 
      name_id = False
107
 
      parent_id = False
108
 
 
109
 
      if field_parent:
110
 
        parent_id = field_parent[0]
111
 
        if field_name:
112
 
          name_id = field_name[0]
113
 
 
114
 
      rule_id = self.create(cr, uid, {'name': name,
115
 
                                      'object_id': object_ids[0],
116
 
                                      'log_write': True,
117
 
                                      'log_unlink': True,
118
 
                                      'log_create': True,
119
 
                                      'field_ids': [(6, 0, fields_ids)],
120
 
                                      'parent_field_id': parent_id,
121
 
                                      'name_get_field_id': name_id,
122
 
                                     }, context=context)
123
 
 
124
 
      # Subscribe to the rule
125
 
      self.subscribe(cr, uid, rule_id)
126
 
-
127
 
  I will create a rule for Cash Box Lines of a Register
128
 
-
129
 
  !python {model: audittrail.rule}: |
130
 
    name = 'CashBox Line'
131
 
    object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'account.cashbox.line')], context=context)
132
 
    rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context)
133
 
    if object_ids and not rule_id:
134
 
      # Create the rule
135
 
      fields = ['pieces', 'number', 'subtotal']
136
 
 
137
 
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'account.cashbox.line'), ('name', 'in', fields)], context=context)
138
 
      field_name = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'account.cashbox.line'), ('name', '=', 'pieces')], context=context)
139
 
      field_parent = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'account.cashbox.line'), ('name', '=', 'ending_id')], context=context)
140
 
 
141
 
      name_id = False
142
 
      parent_id = False
143
 
 
144
 
      if field_parent:
145
 
        parent_id = field_parent[0]
146
 
        if field_name:
147
 
          name_id = field_name[0]
148
 
 
149
 
      rule_id = self.create(cr, uid, {'name': name,
150
 
                                      'object_id': object_ids[0],
151
 
                                      'log_write': True,
152
 
                                      'log_unlink': True,
153
 
                                      'log_create': True,
154
 
                                      'field_ids': [(6, 0, fields_ids)],
155
 
                                      'parent_field_id': parent_id,
156
 
                                      'name_get_field_id': name_id,
157
 
                                      'domain_filter': "[('ending_id', '!=',  False)]",
158
 
                                     }, context=context)
159
 
 
 
75
        
 
76
      rule_id = self.create(cr, uid, {'name': name,
 
77
                                      'object_id': object_ids[0],
 
78
                                      'log_write': True,
 
79
                                      'log_unlink': True,
 
80
                                      'log_create': True,
 
81
                                      'field_ids': [(6, 0, fields_ids)],
 
82
                                     }, context=context)
 
83
                                    
160
84
      # Subscribe to the rule
161
85
      self.subscribe(cr, uid, rule_id)
162
86
-
171
95
      fields = ['state', 'code', 'cost_center_id', 'name']
172
96
 
173
97
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'msf.budget'), ('name', 'in', fields)], context=context)
174
 
 
 
98
        
175
99
      rule_id = self.create(cr, uid, {'name': name,
176
100
                                      'object_id': object_ids[0],
177
101
                                      'log_write': False,
179
103
                                      'log_create': True,
180
104
                                      'field_ids': [(6, 0, fields_ids)],
181
105
                                     }, context=context)
182
 
 
 
106
                                    
183
107
      # Subscribe to the rule
184
108
      self.subscribe(cr, uid, rule_id)
185
109
-
195
119
                'name', 'open_date', 'reporting_currency', 'soft_closed_date']
196
120
 
197
121
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'financing.contract.contract'), ('name', 'in', fields)], context=context)
198
 
 
 
122
        
199
123
      rule_id = self.create(cr, uid, {'name': name,
200
124
                                      'object_id': object_ids[0],
201
125
                                      'log_write': True,
203
127
                                      'log_create': True,
204
128
                                      'field_ids': [(6, 0, fields_ids)],
205
129
                                     }, context=context)
206
 
 
 
130
                                    
207
131
      # Subscribe to the rule
208
132
      self.subscribe(cr, uid, rule_id)
209
133
-
218
142
      fields = ['state', 'category', 'code', 'complete_name', 'cost_center_ids', 'date', 'date_start', 'name', 'parent_id']
219
143
 
220
144
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'account.analytic.account'), ('name', 'in', fields)], context=context)
221
 
 
 
145
        
222
146
      rule_id = self.create(cr, uid, {'name': name,
223
147
                                      'object_id': object_ids[0],
224
148
                                      'log_write': False,
226
150
                                      'log_create': True,
227
151
                                      'field_ids': [(6, 0, fields_ids)],
228
152
                                     }, context=context)
229
 
 
 
153
                                    
230
154
      # Subscribe to the rule
231
155
      self.subscribe(cr, uid, rule_id)
232
156
-
241
165
      fields = ['state']
242
166
 
243
167
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'account.period'), ('name', 'in', fields)], context=context)
244
 
 
 
168
        
245
169
      rule_id = self.create(cr, uid, {'name': name,
246
170
                                      'object_id': object_ids[0],
247
171
                                      'log_write': True,
249
173
                                      'log_create': True,
250
174
                                      'field_ids': [(6, 0, fields_ids)],
251
175
                                     }, context=context)
252
 
 
 
176
                                    
253
177
      # Subscribe to the rule
254
178
      self.subscribe(cr, uid, rule_id)