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

« back to all changes in this revision

Viewing changes to mission_stock/test/data.yml

UF-359 [ADD] Account override module integration

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
-
2
 
  In order to test the behaviour of the mission stock report,
3
 
  we will create a mission stock report for an other instance
4
 
  and use the local instance.
5
 
-
6
 
    In order to test the mission stock module, we start by creating a new product category
7
 
-
8
 
  Create a new partner for coordination
9
 
-
10
 
  !record {model: res.partner, id: coord1}:
11
 
    name: Coordo
12
 
-
13
 
  !record {model: product.category, id: product_cat1}:
14
 
    name: Categ1
15
 
-
16
 
  To do this, we need a product
17
 
-
18
 
  !record {model: product.product, id: product1}:
19
 
    categ_id: product_cat1
20
 
    cost_method: standard
21
 
    mes_type: fixed
22
 
    name: P1
23
 
    price_margin: 2.0
24
 
    procure_method: make_to_stock
25
 
    property_stock_inventory: stock.location_inventory
26
 
    property_stock_procurement: stock.location_procurement
27
 
    property_stock_production: stock.location_production
28
 
    seller_delay: '1'
29
 
    standard_price: 100.0
30
 
    supply_method: buy
31
 
    type: product
32
 
    uom_id: product.product_uom_unit
33
 
    uom_po_id: product.product_uom_unit
34
 
    volume : 0.0
35
 
    warranty: 0.0
36
 
    weight: 0.0
37
 
    weight_net: 0.0
38
 
    reviewed_consumption: 45
39
 
    international_status: product_attributes.int_1
40
 
-
41
 
  We create also a new Unifield instance which is not a local instance
42
 
-
43
 
  !record {model: account.analytic.account, id: analytic_account_kenya2}:
44
 
    name: "Kenya2"
45
 
    currency_id: 1
46
 
    code: KEN2
47
 
    type: normal
48
 
    category: OC
49
 
    parent_id: analytic_distribution.analytic_account_project
50
 
    date: !eval "'%s-01-01' %(datetime.now().year + 2)"
51
 
-
52
 
  We create also a new comp. Cost Center
53
 
-
54
 
  !record {model: account.analytic.account, id: analytic_account_mal}:
55
 
    name: "MAL"
56
 
    currency_id: 1
57
 
    code: MAL
58
 
    type: normal
59
 
    category: OC
60
 
    parent_id: analytic_distribution.analytic_account_project
61
 
    date: !eval "'%s-01-01' %(datetime.now().year + 2)"
62
 
-
63
 
  !record {model: msf.instance, id: proj1}:
64
 
    level: project
65
 
    code: PROJ1
66
 
    mission: Mission Test
67
 
    instance: Proj. instance
68
 
    #parent_id: msf_instance.instance_section
69
 
    name: Project 1
70
 
    target_cost_center_ids:
71
 
      - cost_center_id: analytic_account_kenya2
72
 
        is_target: True
73
 
        is_top_cost_center: True
74
 
        is_po_fo_cost_center: True
75
 
    state: active
76
 
    move_prefix: TEST
77
 
    reconcile_prefix: T1
78
 
-
79
 
  Activate the local instance
80
 
-
81
 
  !python {model: msf.instance}: |
82
 
    user = self.pool.get('res.users').browse(cr, uid, uid)
83
 
    if user.company_id.instance_id:
84
 
        comp_instance = user.company_id.instance_id.id
85
 
    else:
86
 
        comp_instance = self.create(cr, uid, {'code': 'Comp Instance', 'name': 'Comp', 'level': 'section', 'move_prefix': 'COMP', 'reconcile_prefix': 'C1'})
87
 
        self.pool.get('account.target.costcenter').create(cr, uid, {'cost_center_id': ref('analytic_account_mal'), 'instance_id': comp_instance, 'is_target': True, 'is_top_cost_center': True, 'is_po_fo_cost_center': True})
88
 
        self.pool.get('res.company').write(cr, uid, [user.company_id.id], {'instance_id': comp_instance})
89
 
    self.write(cr, uid, ref('proj1'), {'parent_id': comp_instance})
90
 
    self.write(cr, uid, comp_instance, {'state': 'active'})
91
 
-
92
 
  Create a mission report for the project instance
93
 
-
94
 
  !record {model: stock.mission.report, id: report_proj}:
95
 
    name: Project report
96
 
    instance_id: proj1
97
 
    full_view: False
98
 
    report_line:
99
 
      - product_id: product1
100
 
        internal_qty: 100.00
101
 
        internal_val: 9000.00
102
 
        stock_qty: 55.00
103
 
        stock_val: 4950.00
104
 
        central_qty: 45.00
105
 
        central_val: 4050.00
106
 
        cross_qty: 0.00
107
 
        cross_val: 0.00
108
 
        secondary_qty: 0.00
109
 
        secondary_val: 0.00
110
 
        cu_qty: 0.00
111
 
        cu_val: 0.00
112
 
-
113
 
  Create some configurable locations
114
 
-
115
 
  !python {model: stock.location.configuration.wizard}: |
116
 
    eprep_id = self.create(cr, uid, {'location_name': 'EPREP',
117
 
                                     'location_usage': 'eprep',}, context={})
118
 
    is1_id = self.create(cr, uid, {'location_name': 'IS1',
119
 
                                   'location_usage': 'stock',}, context={})
120
 
    is2_id = self.create(cr, uid, {'location_name': 'IS2',
121
 
                                   'location_usage': 'stock',}, context={})
122
 
    cu1_id = self.create(cr, uid, {'location_name': 'CU1',
123
 
                                   'location_usage': 'consumption_unit',
124
 
                                   'location_type': 'internal'}, context={})
125
 
    cu2_id = self.create(cr, uid, {'location_name': 'CU2',
126
 
                                   'location_usage': 'consumption_unit',
127
 
                                   'location_type': 'internal'}, context={})
128
 
    cu3_id = self.create(cr, uid, {'location_name': 'CU3',
129
 
                                   'location_usage': 'consumption_unit',
130
 
                                   'location_type': 'customer'}, context={})
131
 
    for to_create in [eprep_id, is1_id, is2_id, cu1_id, cu2_id, cu3_id]:
132
 
        self.confirm_creation(cr, uid, to_create)
133
 
-
134
 
  Create an inventory for the local instance
135
 
-
136
 
  !record {model: stock.inventory, id: local_inv}:
137
 
    name: Local inventory
138
 
    date: !eval time.strftime('%Y-%m-%d')
139
 
    inventory_line_id:
140
 
      - location_id: msf_cross_docking.stock_location_input
141
 
        product_uom: product.product_uom_unit
142
 
        product_id: product1
143
 
        product_qty: 23
144
 
      - location_id: msf_cross_docking.stock_location_cross_docking
145
 
        product_uom: product.product_uom_unit
146
 
        product_id: product1
147
 
        product_qty: 12
148
 
      - location_id: stock.stock_location_output
149
 
        product_uom: product.product_uom_unit
150
 
        product_id: product1
151
 
        product_qty: 54
152
 
      - location_id: msf_outgoing.stock_location_packing
153
 
        product_uom: product.product_uom_unit
154
 
        product_id: product1
155
 
        product_qty: 23
156
 
      - location_id: msf_outgoing.stock_location_dispatch
157
 
        product_uom: product.product_uom_unit
158
 
        product_id: product1
159
 
        product_qty: 12
160
 
      - location_id: msf_outgoing.stock_location_distribution
161
 
        product_uom: product.product_uom_unit
162
 
        product_id: product1
163
 
        product_qty: 7
164
 
      - location_id: stock.stock_location_stock
165
 
        product_uom: product.product_uom_unit
166
 
        product_id: product1
167
 
        product_qty: 28
168
 
      - location_id: msf_config_locations.stock_location_medical
169
 
        product_uom: product.product_uom_unit
170
 
        product_id: product1
171
 
        product_qty: 56
172
 
      - location_id: msf_config_locations.stock_location_unalloc_medical
173
 
        product_uom: product.product_uom_unit
174
 
        product_id: product1
175
 
        product_qty: 64
176
 
      - location_id: stock_override.stock_location_logistic
177
 
        product_uom: product.product_uom_unit
178
 
        product_id: product1
179
 
        product_qty: 11
180
 
      - location_id: msf_config_locations.stock_location_unalloc_logistic
181
 
        product_uom: product.product_uom_unit
182
 
        product_id: product1
183
 
        product_qty: 8
184
 
      - location_id: stock_override.stock_location_quarantine_scrap
185
 
        product_uom: product.product_uom_unit
186
 
        product_id: product1
187
 
        product_qty: 2
188
 
      - location_id: stock_override.stock_location_quarantine_analyze
189
 
        product_uom: product.product_uom_unit
190
 
        product_id: product1
191
 
        product_qty: 5
192
 
-
193
 
  Add some lines in the inventory for configurable locations
194
 
-
195
 
  !python {model: stock.location}: |
196
 
    eprep_id = self.search(cr, uid, [('name', '=', 'EPREP')])
197
 
    assert eprep_id, 'No EPREP location found'
198
 
    is1_id = self.search(cr, uid, [('name', '=', 'IS1')])
199
 
    assert is1_id, 'No IS1 location found'
200
 
    is2_id = self.search(cr, uid, [('name', '=', 'IS2')])
201
 
    assert is2_id, 'No IS2 location found'
202
 
    cu1_id = self.search(cr, uid, [('name', '=', 'CU1')])
203
 
    assert cu1_id, 'No CU1 location found'
204
 
    cu2_id = self.search(cr, uid, [('name', '=', 'CU2')])
205
 
    assert cu2_id, 'No CU2 location found'
206
 
    cu3_id = self.search(cr, uid, [('name', '=', 'CU3')])
207
 
    assert cu3_id, 'No CU3 location found'
208
 
    
209
 
    line_obj = self.pool.get('stock.inventory.line')
210
 
    line_obj.create(cr, uid, {'location_id': eprep_id[0],
211
 
                              'inventory_id': ref('local_inv'),
212
 
                              'product_uom': ref('product.product_uom_unit'),
213
 
                              'product_id': ref('product1'),
214
 
                              'reason_type_id': ref('reason_types_moves.reason_type_loss'),
215
 
                              'product_qty': 30})
216
 
    line_obj.create(cr, uid, {'location_id': is1_id[0],
217
 
                              'inventory_id': ref('local_inv'),
218
 
                              'product_uom': ref('product.product_uom_unit'),
219
 
                              'product_id': ref('product1'),
220
 
                              'reason_type_id': ref('reason_types_moves.reason_type_loss'),
221
 
                              'product_qty': 24})
222
 
    line_obj.create(cr, uid, {'location_id': is2_id[0],
223
 
                              'inventory_id': ref('local_inv'),
224
 
                              'product_uom': ref('product.product_uom_unit'),
225
 
                              'product_id': ref('product1'),
226
 
                              'reason_type_id': ref('reason_types_moves.reason_type_loss'),
227
 
                              'product_qty': 23})
228
 
    line_obj.create(cr, uid, {'location_id': cu1_id[0],
229
 
                              'inventory_id': ref('local_inv'),
230
 
                              'product_uom': ref('product.product_uom_unit'),
231
 
                              'product_id': ref('product1'),
232
 
                              'reason_type_id': ref('reason_types_moves.reason_type_loss'),
233
 
                              'product_qty': 52})
234
 
    line_obj.create(cr, uid, {'location_id': cu2_id[0],
235
 
                              'inventory_id': ref('local_inv'),
236
 
                              'product_uom': ref('product.product_uom_unit'),
237
 
                              'product_id': ref('product1'),
238
 
                              'reason_type_id': ref('reason_types_moves.reason_type_loss'),
239
 
                              'product_qty': 64})
240
 
-
241
 
  We confirm the inventory
242
 
-
243
 
  !python {model: stock.inventory}: |
244
 
    self.action_confirm(cr, uid, [ref('local_inv')], context=context)
245
 
    self.action_done(cr, uid, [ref('local_inv')], context=context)