Skip to content

Commit f529e7c

Browse files
author
Pierrick Brun
committed
FIX tests
1 parent c201e5f commit f529e7c

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

quick_purchase/models/product_product.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _complete_purchase_line_vals(self, line, vals):
6161

6262
def _inverse_set_purchase_qty(self):
6363
purchase = self.env['purchase.order'].browse(
64-
self.env.context.get('purchase_id'))
64+
self._context.get('purchase_id'))
6565
for product in self:
6666
purchase_line = self._get_purchase_line(purchase)
6767
if purchase_line:

quick_purchase/tests/test_quick_purchase.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,10 @@ def test_quick_purchase(self):
2323
self.product_id_2 = self.env.ref('product.product_product_11')
2424
po_vals = {
2525
'partner_id': self.partner_id.id,
26-
'location_id': self.env.ref('stock.stock_location_locations').id,
2726
}
28-
self.po = self.PurchaseOrder.new(po_vals)
29-
onchange_vals = self.po.onchange_partner_id(
30-
self.po.partner_id.id)
31-
po_vals.update(onchange_vals['value'])
3227
self.po = self.PurchaseOrder.create(po_vals)
28+
self.po.play_onchanges(
29+
{'partner_id': self.partner_id.id}, ['partner_id'])
3330
# test add purchase order line
3431
self.product_id_1.with_context(
3532
{'purchase_id': self.po.id}).qty_to_purchase = 5.0
@@ -67,7 +64,7 @@ def test_quick_purchase(self):
6764

6865
# test that add_product open the right action
6966
product_act_origin = self.env.ref(
70-
'quick_purchase.product_product_action')
67+
'purchase.product_product_action')
7168
product_act_from_po = self.po.add_product()
7269
self.assertEqual(
7370
product_act_from_po['type'], 'ir.actions.act_window')

0 commit comments

Comments
 (0)