1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
-
Standard flow of a Call for Bids in mode restricted
-
Create Call for Bids
-
!record {model: purchase.requisition, id: req1}:
date_end: '2013-08-30 00:00:00'
bid_tendering_mode: 'restricted'
schedule_date: '2013-09-30'
req_validity: '2013-09-10'
pricelist_id: purchase.list0
line_ids:
- product_id: product.product_product_15
product_qty: 15.0
- product_id: product.product_product_25
product_qty: 5.0
- product_id: product.product_product_27
product_qty: 40.0
-
Confirm Call
-
!python {model: purchase.requisition, id: req1}: |
self.signal_workflow('sent_suppliers')
-
Create RFQ1. I run the 'Request a quotation' wizard. I fill the supplier.
-
!record {model: purchase.requisition.partner, id: wizard_partner1}:
partner_id: base.res_partner_1
-
Create RFQ1. I confirm the wizard.
-
!python {model: purchase.requisition.partner}: |
self.create_order(cr, uid, [ref("wizard_partner1")],{
'active_model': 'purchase.requisition',
'active_id': ref("req1"),
'active_ids': [ref("req1")],
})
-
Create RFQ2. I run the 'Request a quotation' wizard. I fill the supplier.
-
!record {model: purchase.requisition.partner, id: wizard_partner2}:
partner_id: base.res_partner_3
-
Create RFQ2. I confirm the wizard.
-
!python {model: purchase.requisition.partner}: |
self.create_order(cr, uid, [ref("wizard_partner2")],{
'active_model': 'purchase.requisition',
'active_id': ref("req1"),
'active_ids': [ref("req1")],
})
-
Check the RFQs. Type must be 'rfq', state 'draft', all prices 0 and the total untaxed amount 0.
-
!python {model: purchase.requisition, id: req1}: |
from nose.tools import *
assert_equal(len(self.purchase_ids), 2)
for rfq in self.purchase_ids:
assert_equal(rfq.type, 'rfq')
assert_equal(rfq.state, 'draft')
assert_equal(rfq.amount_untaxed, 0.0)
for line in rfq.order_line:
assert_equal(line.price_subtotal, 0.0)
-
I send the RFQs. For this, I print the RFQ.
-
!python {model: purchase.requisition}: |
purchase_req = self.browse(cr, uid, ref("req1"))
for rfq in purchase_req.purchase_ids:
self.pool.get('purchase.order').print_quotation(cr, uid, [rfq.id])
-
I check the RFQs are in "RFQ sent" state.
-
!python {model: purchase.requisition, id: req1}: |
from nose.tools import *
assert_equal(len(self.purchase_ids), 2)
for rfq in self.purchase_ids:
assert_equal(rfq.type, 'rfq')
assert_equal(rfq.state, 'sent')
assert_equal(rfq.amount_untaxed, 0.0)
for line in rfq.order_line:
assert_equal(line.price_subtotal, 0.0)
-
I encode the bids. I set a price on the lines.
-
!python {model: purchase.requisition, id: req1}: |
from nose.tools import *
assert_equal(len(self.purchase_ids), 2)
price = 30.0
for rfq in self.purchase_ids:
for line in rfq.order_line:
line.price_unit = price
price += 5.0
-
I run the 'Bid encoded' wizard of bid1. I fill the date.
-
!record {model: purchase.action_modal.datetime, id: wizard_encodebid1}:
datetime: '2013-08-13 00:00:00'
-
I run the 'Bid encoded' wizard of bid1. I confirm the wizard.
-
!python {model: purchase.requisition}: |
purchase_req = self.browse(cr, uid, ref("req1"))
assert len(purchase_req.purchase_ids) == 2, "There must be 2 RFQs linked to this Call for bids"
for rfq in purchase_req.purchase_ids:
self.pool.get('purchase.order').bid_received_ok(cr, uid,
[rfq.id],
{'active_id': ref("wizard_encodebid1")
})
-
I run the 'Bid encoded' wizard of bid2. I fill the date.
-
!record {model: purchase.action_modal.datetime, id: wizard_encodebid2}:
datetime: '2013-08-13 00:10:00'
-
I run the 'Bid encoded' wizard of bid2. I confirm the wizard.
-
!python {model: purchase.requisition}: |
purchase_req = self.browse(cr, uid, ref("req1"))
assert len(purchase_req.purchase_ids) == 2, "There must be 2 RFQs linked to this Call for bids"
for rfq in purchase_req.purchase_ids:
self.pool.get('purchase.order').bid_received_ok(cr, uid,
[rfq.id],
{'active_id': ref("wizard_encodebid2")
})
-
I check the "Bid Encoded" status.
-
!python {model: purchase.requisition, id: req1}: |
from nose.tools import *
assert_equal(len(self.purchase_ids), 2)
for rfq in self.purchase_ids:
assert_equal(rfq.type, 'bid')
assert_equal(rfq.state, 'bid')
assert_not_equal(rfq.amount_untaxed, 0.0)
for line in rfq.order_line:
assert_not_equal(line.price_subtotal, 0.0)
-
I close the Call for bids and move to bids selection
-
!python {model: purchase.requisition, id: req1}: |
self.signal_workflow('open_bid')
-
In the bids selection, I confirm line 1 of bid 1 and line 2 of bid 2. For line 3, I select quantity 10 of bid 1 and confirm. I confirm line 3 of bid 2 for remaining quantity.
-
!python {model: purchase.requisition, id: req1}: |
from nose.tools import *
assert_equal(len(self.purchase_ids), 2)
self.purchase_ids[0].order_line[0].action_confirm()
self.purchase_ids[1].order_line[1].action_confirm()
QuantityWizard = self.env['bid.line.qty']
quantity_wizard = QuantityWizard.create({'qty': 5})
quantity_wizard.with_context({
'active_mode': 'purchase.order.line',
'active_id': self.purchase_ids[0].order_line[2].id,
'active_ids': [self.purchase_ids[0].order_line[2].id],
}).change_qty()
self.purchase_ids[1].order_line[2].action_confirm()
-
For each call for bid lines, I check that the confirmed selection match the
requested qty
-
!python {model: purchase.requisition, id: req1}: |
from nose.tools import *
for req_line in self.line_ids:
req_qty = req_line.product_qty
confirmed_qty = 0.0
for pol in req_line.purchase_line_ids:
if pol.state == 'confirmed':
confirmed_qty += pol.quantity_bid
assert_almost_equal(confirmed_qty, req_qty)
-
I mark the tender as selected
-
!python {model: purchase.requisition, id: req1}: |
self.signal_workflow('bid_selected')
-
I mark the tender as selection closed
-
!python {model: purchase.requisition, id: req1}: |
self.signal_workflow('close_bid')
-
I generate the POs
-
!python {model: purchase.requisition}: |
self.generate_po(cr, uid, [ref("req1")])
-
Then I should see 2 selected bids
-
!python {model: purchase.requisition, id: req1}: |
from nose.tools import *
assert_equal(2, len(self.purchase_ids))
for bid in self.purchase_ids:
assert_equal('bid_selected', bid.state)
assert_equal('bid', bid.type)
-
And I should see 2 generated purchase orders in draft that can be validated
manually.
-
!python {model: purchase.requisition, id: req1}: |
from nose.tools import *
assert_equal(2, len(self.generated_order_ids))
for po in self.generated_order_ids:
assert_equal('draftpo', po.state)
assert_equal('purchase', po.type)
assert_is(False, po.keep_in_draft)