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

« back to all changes in this revision

Viewing changes to msf_audittrail/audittrail_invoice_data.yml

  • Committer: Olivier DOSSMANN
  • Date: 2013-05-31 14:22:09 UTC
  • mto: This revision was merged to the branch mainline in revision 1687.
  • Revision ID: od@tempo-consulting.fr-20130531142209-sbcwvzuema11guzz
UF-1991 [FIX] Problem with wizard on "msg" field. Change it to "name".

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-
 
2
  I will create a rule for Invoice object
 
3
-
 
4
  !python {model: audittrail.rule}: |
 
5
    name = 'Invoice'
 
6
    object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'account.invoice')], context=context)
 
7
    rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context)
 
8
    if object_ids and not rule_id:
 
9
      # Create the rule
 
10
      fields = ['date_invoice', 'state', 'account_id', 'address_invoice_id', 'amount_to_pay', 'analytic_distribution_id', 
 
11
                'check_total', 'comment', 'currency_id', 'fiscal_position', 'name', 'origin', 'partner_id', 
 
12
                'payment_ids', 'period_id', 'reference', 'reference_type', 'tax_line']
 
13
 
 
14
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'account.invoice'), ('name', 'in', fields)], context=context)
 
15
        
 
16
      rule_id = self.create(cr, uid, {'name': name,
 
17
                                      'object_id': object_ids[0],
 
18
                                      'log_write': True,
 
19
                                      'log_unlink': True,
 
20
                                      'log_create': True,
 
21
                                      'field_ids': [(6, 0, fields_ids)],
 
22
                                     }, context=context)
 
23
                                    
 
24
      # Subscribe to the rule
 
25
      self.subscribe(cr, uid, rule_id)
 
26
-
 
27
  I will create a rule for Invoice lines
 
28
-
 
29
  !python {model: audittrail.rule}: |
 
30
    name = 'Invoice Line'
 
31
    object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'account.invoice.line')], context=context)
 
32
    rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context)
 
33
    if object_ids and not rule_id:
 
34
      # Create the rule
 
35
      fields = ['account_id', 'analytic_distribution_id', 'invoice_id', 'invoice_line_tax_id', 'name', 'origin', 'partner_id', 'price_unit', 
 
36
                'product_id', 'quantity', 'uos_id']
 
37
 
 
38
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'account.invoice.line'), ('name', 'in', fields)], context=context)
 
39
      field_name = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'account.invoice.line'), ('name', '=', 'line_number')], context=context)
 
40
      field_parent = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'account.invoice.line'), ('name', '=', 'invoice_id')], context=context)
 
41
      
 
42
      name_id = False
 
43
      parent_id = False
 
44
      
 
45
      if field_parent:
 
46
        parent_id = field_parent[0]
 
47
        if field_name:
 
48
          name_id = field_name[0]
 
49
        
 
50
      rule_id = self.create(cr, uid, {'name': name,
 
51
                                      'object_id': object_ids[0],
 
52
                                      'log_write': True,
 
53
                                      'log_unlink': True,
 
54
                                      'log_create': True,
 
55
                                      'field_ids': [(6, 0, fields_ids)],
 
56
                                      'parent_field_id': parent_id,
 
57
                                      'name_get_field_id': name_id,
 
58
                                     }, context=context)
 
59
                                    
 
60
      # Subscribe to the rule
 
61
      self.subscribe(cr, uid, rule_id)
 
62
-
 
63
  I will create a rule for Register object
 
64
-
 
65
  !python {model: audittrail.rule}: |
 
66
    name = 'Register'
 
67
    object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'account.bank.statement')], context=context)
 
68
    rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context)
 
69
    if object_ids and not rule_id:
 
70
      # Create the rule
 
71
      fields = ['state', 'balance_end_real', 'closing_balance_frozen', 'closing_date', 'notes', 'ending_details_ids', 'name', 
 
72
                'open_advance_amount', 'user_id']
 
73
 
 
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 Budget object
 
88
-
 
89
  !python {model: audittrail.rule}: |
 
90
    name = 'Budget'
 
91
    object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'msf.budget')], 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 = ['state', 'code', 'cost_center_id', 'name']
 
96
 
 
97
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'msf.budget'), ('name', 'in', fields)], context=context)
 
98
        
 
99
      rule_id = self.create(cr, uid, {'name': name,
 
100
                                      'object_id': object_ids[0],
 
101
                                      'log_write': False,
 
102
                                      'log_unlink': False,
 
103
                                      'log_create': True,
 
104
                                      'field_ids': [(6, 0, fields_ids)],
 
105
                                     }, context=context)
 
106
                                    
 
107
      # Subscribe to the rule
 
108
      self.subscribe(cr, uid, rule_id)
 
109
-
 
110
  I will create a rule for Financing Contracts object
 
111
-
 
112
  !python {model: audittrail.rule}: |
 
113
    name = 'Financing Contract'
 
114
    object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'financing.contract.contract')], context=context)
 
115
    rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context)
 
116
    if object_ids and not rule_id:
 
117
      # Create the rule
 
118
      fields = ['state', 'code', 'currency_table_id', 'donor_id', 'grant_amount', 'hard_closed_date', 'hq_grant_reference', 
 
119
                'name', 'open_date', 'reporting_currency', 'soft_closed_date']
 
120
 
 
121
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'financing.contract.contract'), ('name', 'in', fields)], context=context)
 
122
        
 
123
      rule_id = self.create(cr, uid, {'name': name,
 
124
                                      'object_id': object_ids[0],
 
125
                                      'log_write': True,
 
126
                                      'log_unlink': True,
 
127
                                      'log_create': True,
 
128
                                      'field_ids': [(6, 0, fields_ids)],
 
129
                                     }, context=context)
 
130
                                    
 
131
      # Subscribe to the rule
 
132
      self.subscribe(cr, uid, rule_id)
 
133
-
 
134
  I will create a rule for Analytic account object
 
135
-
 
136
  !python {model: audittrail.rule}: |
 
137
    name = 'Analytic Account'
 
138
    object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'account.analytic.account')], context=context)
 
139
    rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context)
 
140
    if object_ids and not rule_id:
 
141
      # Create the rule
 
142
      fields = ['state', 'category', 'code', 'complete_name', 'cost_center_ids', 'date', 'date_start', 'name', 'parent_id']
 
143
 
 
144
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'account.analytic.account'), ('name', 'in', fields)], context=context)
 
145
        
 
146
      rule_id = self.create(cr, uid, {'name': name,
 
147
                                      'object_id': object_ids[0],
 
148
                                      'log_write': False,
 
149
                                      'log_unlink': False,
 
150
                                      'log_create': True,
 
151
                                      'field_ids': [(6, 0, fields_ids)],
 
152
                                     }, context=context)
 
153
                                    
 
154
      # Subscribe to the rule
 
155
      self.subscribe(cr, uid, rule_id)
 
156
-
 
157
  I will create a rule for Period object
 
158
-
 
159
  !python {model: audittrail.rule}: |
 
160
    name = 'Period'
 
161
    object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'account.period')], context=context)
 
162
    rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context)
 
163
    if object_ids and not rule_id:
 
164
      # Create the rule
 
165
      fields = ['state']
 
166
 
 
167
      fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=' ,'account.period'), ('name', 'in', fields)], context=context)
 
168
        
 
169
      rule_id = self.create(cr, uid, {'name': name,
 
170
                                      'object_id': object_ids[0],
 
171
                                      'log_write': True,
 
172
                                      'log_unlink': True,
 
173
                                      'log_create': True,
 
174
                                      'field_ids': [(6, 0, fields_ids)],
 
175
                                     }, context=context)
 
176
                                    
 
177
      # Subscribe to the rule
 
178
      self.subscribe(cr, uid, rule_id)