This question has been flagged

I have a problem:

I changed purchase.order module by editing state list (field state):

my_purchases/models/models.py:

class PurchaseOrder(models.Model):
    _inherit = 'purchase.order'
    state = fields.Selection( ... my changes ....)

I run tests with: --test-enable -i "purchase,my_purchases"

One of tests from module 'purchase' has flags: post_install = True and at_install = False

A problem:

  1. odoo install purchase module and run purchase tests (with flag post_install=False) - OK
  2. odoo install my_purchases module and run my_purchases tests - OK
  3. After installation of all modules odoo run purchase test with flag post_install=True and this test fails because I changed model...

You have some advice?

Avatar
Discard
Author Best Answer

(odoo-env) vagrant@vagrant:~/odoo$ ./odoo-bin --test-enable -i "purchase,stxnext_purchases"

2018-03-29 08:02:00,759 8261 INFO ? odoo: Odoo version 11.0

.

.

2018-03-29 08:02:02,421 8261 INFO test3 odoo.modules.registry: module purchase: creating or updating database tables

.

.

2018-03-29 08:02:47,221 8261 INFO test3 odoo.modules.module: odoo.addons.purchase.tests.test_create_picking running tests.

2018-03-29 08:02:49,374 8261 INFO test3 odoo.addons.purchase.tests.test_create_picking: test_00_create_picking (odoo.addons.purchase.tests.test_create_picking.TestCreatePicking)

2018-03-29 08:02:51,300 8261 INFO test3 odoo.models.unlink: User #1 deleted stock.move records with IDs: [812]

2018-03-29 08:02:52,064 8261 INFO test3 odoo.addons.purchase.tests.test_create_picking: test_01_check_double_validation (odoo.addons.purchase.tests.test_create_picking.TestCreatePicking)

2018-03-29 08:02:54,020 8261 INFO test3 odoo.addons.purchase.tests.test_create_picking: test_02_check_mto_chain (odoo.addons.purchase.tests.test_create_picking.TestCreatePicking)

2018-03-29 08:02:54,021 8261 INFO test3 odoo.addons.purchase.tests.test_create_picking: ` Simulate a mto chain with a purchase order. Cancel the purchase order should also change the procure_method of the following move to MTS in order to be able to link it to a manually created purchase order.

2018-03-29 08:02:56,183 8261 INFO test3 odoo.addons.purchase.tests.test_create_picking: Ran 3 tests in 8.961s

2018-03-29 08:02:56,184 8261 INFO test3 odoo.addons.purchase.tests.test_create_picking: OK

2018-03-29 08:02:56,185 8261 INFO test3 odoo.modules.module: odoo.addons.purchase.tests.test_create_picking tested in 8.96s, 7528 queries

2018-03-29 08:02:56,185 8261 INFO test3 odoo.modules.module: odoo.addons.purchase.tests.test_onchange_product_id running tests.

2018-03-29 08:02:56,186 8261 INFO test3 odoo.addons.purchase.tests.test_onchange_product_id: test_onchange_product_id (odoo.addons.purchase.tests.test_onchange_product_id.TestOnchangeProductId)

2018-03-29 08:02:57,160 8261 INFO test3 odoo.addons.purchase.tests.test_onchange_product_id: Ran 1 test in 0.974s

2018-03-29 08:02:57,160 8261 INFO test3 odoo.addons.purchase.tests.test_onchange_product_id: OK

2018-03-29 08:02:57,161 8261 INFO test3 odoo.modules.module: odoo.addons.purchase.tests.test_purchase_lead_time running tests.

2018-03-29 08:03:00,062 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_lead_time: test_00_product_company_level_delays (odoo.addons.purchase.tests.test_purchase_lead_time.TestPurchaseLeadTime)

2018-03-29 08:03:00,062 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_lead_time: ` To check dates, set product's Delivery Lead Time and company's Purchase Lead Time.

2018-03-29 08:03:00,972 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_lead_time: test_01_product_level_delay (odoo.addons.purchase.tests.test_purchase_lead_time.TestPurchaseLeadTime)

2018-03-29 08:03:00,972 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_lead_time: ` To check schedule dates of multiple purchase order line of the same purchase order, we create two procurements for the two different product with same vendor and different Delivery Lead Time.

2018-03-29 08:03:01,746 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_lead_time: test_02_product_route_level_delays (odoo.addons.purchase.tests.test_purchase_lead_time.TestPurchaseLeadTime)

2018-03-29 08:03:01,747 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_lead_time: ` In order to check dates, set product's Delivery Lead Time and warehouse route's delay.

2018-03-29 08:03:03,186 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_lead_time: Ran 3 tests in 6.025s

2018-03-29 08:03:03,187 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_lead_time: OK

2018-03-29 08:03:03,187 8261 INFO test3 odoo.modules.module: odoo.addons.purchase.tests.test_purchase_lead_time tested in 6.03s, 5413 queries

2018-03-29 08:03:03,189 8261 INFO test3 odoo.modules.module: odoo.addons.purchase.tests.test_stockvaluation running tests.

2018-03-29 08:03:03,189 8261 INFO test3 odoo.addons.purchase.tests.test_stockvaluation: test_change_currency_rate_average_1 (odoo.addons.purchase.tests.test_stockvaluation.TestStockValuation)

2018-03-29 08:03:03,190 8261 INFO test3 odoo.addons.purchase.tests.test_stockvaluation: ` Confirm a purchase order in another currency and create the associated receipt, change the currency rate, validate the receipt and then check that the value of the received goods is set according to the last currency rate.

2018-03-29 08:03:04,365 8261 INFO test3 odoo.addons.purchase.tests.test_stockvaluation: test_change_unit_cost_average_1 (odoo.addons.purchase.tests.test_stockvaluation.TestStockValuation)

2018-03-29 08:03:04,365 8261 INFO test3 odoo.addons.purchase.tests.test_stockvaluation: ` Confirm a purchase order and create the associated receipt, change the unit cost of the purchase order before validating the receipt, the value of the received goods should be set according to the last unit cost.

2018-03-29 08:03:05,482 8261 INFO test3 odoo.addons.purchase.tests.test_stockvaluation: test_standard_price_change_1 (odoo.addons.purchase.tests.test_stockvaluation.TestStockValuation)

2018-03-29 08:03:05,482 8261 INFO test3 odoo.addons.purchase.tests.test_stockvaluation: ` Confirm a purchase order and create the associated receipt, change the unit cost of the purchase order and the standard price of the product before validating the receipt, the value of the received goods should be set according to the last standard price.

2018-03-29 08:03:06,635 8261 INFO test3 odoo.addons.purchase.tests.test_stockvaluation: Ran 3 tests in 3.445s

2018-03-29 08:03:06,635 8261 INFO test3 odoo.addons.purchase.tests.test_stockvaluation: OK

.

.

2018-03-29 08:03:06,823 8261 INFO test3 odoo.modules.registry: module stxnext_purchases: creating or updating database tables

.

.

2018-03-29 08:03:08,230 8261 INFO test3 odoo.modules.module: odoo.addons.stxnext_purchases.tests.test_stxnext_purchases running tests.

2018-03-29 08:03:08,231 8261 INFO test3 odoo.addons.stxnext_purchases.tests.test_stxnext_purchases: test_purchase_order_flow (odoo.addons.stxnext_purchases.tests.test_stxnext_purchases.TestStxnextPurchases)

2018-03-29 08:03:08,282 8261 INFO test3 odoo.models.unlink: User #1 deleted ir.model.data records with IDs: [5531]

2018-03-29 08:03:08,293 8261 INFO test3 odoo.models.unlink: User #1 deleted product.supplierinfo records with IDs: [9]

2018-03-29 08:03:08,454 8261 INFO test3 odoo.addons.stxnext_purchases.tests.test_stxnext_purchases: Ran 1 test in 0.223s

2018-03-29 08:03:08,454 8261 INFO test3 odoo.addons.stxnext_purchases.tests.test_stxnext_purchases: OK

.

.

2018-03-29 08:03:08,961 8261 INFO test3 odoo.modules.module: odoo.addons.purchase.tests.test_purchase_order running tests.

2018-03-29 08:03:08,961 8261 INFO test3 odoo.addons.base.ir.ir_http: Generating routing map

2018-03-29 08:03:08,962 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_order: test_00_purchase_order_flow (odoo.addons.purchase.tests.test_purchase_order.TestPurchaseOrder)

2018-03-29 08:03:09,247 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ERROR

2018-03-29 08:03:09,247 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_order: test_02_po_return (odoo.addons.purchase.tests.test_purchase_order.TestPurchaseOrder)

2018-03-29 08:03:09,248 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_order: ` Test a PO with a product on Incoming shipment. Validate the PO, then do a return of the picking with Refund.

2018-03-29 08:03:09,437 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: FAIL

2018-03-29 08:03:09,437 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_order: ======================================================================

2018-03-29 08:03:09,437 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ERROR: test_00_purchase_order_flow (odoo.addons.purchase.tests.test_purchase_order.TestPurchaseOrder)

2018-03-29 08:03:09,438 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: Traceback (most recent call last):

2018-03-29 08:03:09,438 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/odoo/fields.py", line 947, in __get__

2018-03-29 08:03:09,442 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` value = record.env.cache.get(record, self)

2018-03-29 08:03:09,442 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/odoo/api.py", line 960, in get

2018-03-29 08:03:09,442 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` value = self._data[field][record.id][key]

2018-03-29 08:03:09,443 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` KeyError: (<odoo.sql_db.Cursor object at 0x7f33150579b0>, 1)

2018-03-29 08:03:09,443 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: `

2018-03-29 08:03:09,443 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` During handling of the above exception, another exception occurred:

2018-03-29 08:03:09,443 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: `

2018-03-29 08:03:09,444 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` Traceback (most recent call last):

2018-03-29 08:03:09,444 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/addons/purchase/tests/test_purchase_order.py", line 23, in setUp

2018-03-29 08:03:09,445 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` (self.product_id_1 | self.product_id_2).write({'purchase_method': 'purchase'})

2018-03-29 08:03:09,445 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/addons/stock/models/product.py", line 367, in write

2018-03-29 08:03:09,445 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` res = super(Product, self).write(values)

2018-03-29 08:03:09,445 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/addons/product/models/product.py", line 309, in write

2018-03-29 08:03:09,446 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` res = super(ProductProduct, self).write(values)

2018-03-29 08:03:09,446 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/addons/mail/models/mail_thread.py", line 265, in write

2018-03-29 08:03:09,447 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` track_self = self.with_context(lang=self.env.user.lang)

2018-03-29 08:03:09,447 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/odoo/fields.py", line 951, in __get__

2018-03-29 08:03:09,448 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` self.determine_value(record)

2018-03-29 08:03:09,448 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/odoo/fields.py", line 1062, in determine_value

2018-03-29 08:03:09,449 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` self.compute_value(recs)

2018-03-29 08:03:09,450 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/odoo/fields.py", line 1018, in compute_value

2018-03-29 08:03:09,450 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` self._compute_value(records)

2018-03-29 08:03:09,450 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/odoo/fields.py", line 1011, in _compute_value

2018-03-29 08:03:09,451 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` self.compute(records)

2018-03-29 08:03:09,451 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/odoo/fields.py", line 599, in _compute_related

2018-03-29 08:03:09,451 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` record[self.name] = value[self.related_field.name]

2018-03-29 08:03:09,452 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/odoo/models.py", line 4668, in __setitem__

2018-03-29 08:03:09,452 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` return self._fields[key].__set__(self, value)

2018-03-29 08:03:09,453 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/odoo/fields.py", line 969, in __set__

2018-03-29 08:03:09,453 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` value = self.convert_to_cache(value, record)

2018-03-29 08:03:09,454 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/odoo/fields.py", line 1805, in convert_to_cache

2018-03-29 08:03:09,454 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` if value in self.get_values(record.env):

2018-03-29 08:03:09,454 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/odoo/fields.py", line 1800, in get_values

2018-03-29 08:03:09,455 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` return [value for value, _ in selection]

2018-03-29 08:03:09,455 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` TypeError: 'NoneType' object is not iterable

2018-03-29 08:03:09,455 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_order: ======================================================================

2018-03-29 08:03:09,456 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: FAIL: test_02_po_return (odoo.addons.purchase.tests.test_purchase_order.TestPurchaseOrder)

2018-03-29 08:03:09,456 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` Test a PO with a product on Incoming shipment. Validate the PO, then do a return of the picking with Refund.

2018-03-29 08:03:09,457 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: Traceback (most recent call last):

2018-03-29 08:03:09,457 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` File "/home/vagrant/odoo/addons/purchase/tests/test_purchase_order.py", line 103, in test_02_po_return

2018-03-29 08:03:09,457 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` self.assertEqual(self.po.state, 'purchase', 'Purchase: PO state should be "Purchase"')

2018-03-29 08:03:09,458 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` AssertionError: 'draft' != 'purchase'

2018-03-29 08:03:09,458 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` - draft

2018-03-29 08:03:09,459 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` + purchase

2018-03-29 08:03:09,459 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: ` : Purchase: PO state should be "Purchase"

2018-03-29 08:03:09,459 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_order: Ran 2 tests in 0.476s

2018-03-29 08:03:09,460 8261 ERROR test3 odoo.addons.purchase.tests.test_purchase_order: FAILED

2018-03-29 08:03:09,460 8261 INFO test3 odoo.addons.purchase.tests.test_purchase_order: (failures=1, errors=1)

2018-03-29 08:03:09,461 8261 ERROR test3 odoo.modules.module: Module purchase: 1 failures, 1 errors

Avatar
Discard
Best Answer

hello, 

can you copy / paste test error to be able to help you ?

Avatar
Discard