@@ -134,6 +134,91 @@ def test_purchase_order_line_sequence(self):
134
134
"The Sequence is not copied properly" ,
135
135
)
136
136
137
+ def test_purchase_order_line_sequence_with_section_note (self ):
138
+ """
139
+ Verify that the sequence is correctly assigned to the move associated
140
+ with the purchase order line it references.
141
+ """
142
+ po = self ._create_purchase_order ()
143
+ self .PurchaseOrderLine .create (
144
+ {
145
+ "name" : "Section 1" ,
146
+ "display_type" : "line_section" ,
147
+ "order_id" : po .id ,
148
+ "product_qty" : 0 ,
149
+ }
150
+ )
151
+ self .PurchaseOrderLine .create (
152
+ {
153
+ "name" : self .product_id_1 .name ,
154
+ "product_id" : self .product_id_1 .id ,
155
+ "product_qty" : 15.0 ,
156
+ "product_uom" : self .product_id_1 .uom_po_id .id ,
157
+ "price_unit" : 150.0 ,
158
+ "date_planned" : datetime .today ().strftime (
159
+ DEFAULT_SERVER_DATETIME_FORMAT
160
+ ),
161
+ "order_id" : po .id ,
162
+ }
163
+ )
164
+ self .PurchaseOrderLine .create (
165
+ {
166
+ "name" : "Note 1" ,
167
+ "display_type" : "line_note" ,
168
+ "order_id" : po .id ,
169
+ "product_qty" : 0 ,
170
+ }
171
+ )
172
+ self .PurchaseOrderLine .create (
173
+ {
174
+ "name" : self .product_id_2 .name ,
175
+ "product_id" : self .product_id_2 .id ,
176
+ "product_qty" : 1.0 ,
177
+ "product_uom" : self .product_id_2 .uom_po_id .id ,
178
+ "price_unit" : 50.0 ,
179
+ "date_planned" : datetime .today ().strftime (
180
+ DEFAULT_SERVER_DATETIME_FORMAT
181
+ ),
182
+ "order_id" : po .id ,
183
+ }
184
+ )
185
+ po .button_confirm ()
186
+
187
+ moves = po .picking_ids [0 ].move_ids_without_package
188
+ self .assertNotEquals (len (po .order_line ), len (moves ))
189
+
190
+ for move in moves :
191
+ self .assertEqual (move .sequence , move .purchase_line_id .sequence )
192
+
193
+ def test_write_purchase_order_line (self ):
194
+ po = self ._create_purchase_order ()
195
+ po .button_confirm ()
196
+
197
+ po .write (
198
+ {
199
+ "order_line" : [
200
+ (
201
+ 0 ,
202
+ 0 ,
203
+ {
204
+ "name" : self .product_id_2 .name ,
205
+ "product_id" : self .product_id_2 .id ,
206
+ "product_qty" : 2 ,
207
+ "product_uom" : self .product_id_2 .uom_id .id ,
208
+ "price_unit" : 30 ,
209
+ "date_planned" : datetime .today ().strftime (
210
+ DEFAULT_SERVER_DATETIME_FORMAT
211
+ ),
212
+ },
213
+ )
214
+ ]
215
+ }
216
+ )
217
+
218
+ moves = po .picking_ids [0 ].move_ids_without_package
219
+ for move in moves :
220
+ self .assertEqual (move .sequence , move .purchase_line_id .sequence )
221
+
137
222
def test_invoice_sequence (self ):
138
223
139
224
po = self ._create_purchase_order ()
0 commit comments