diff --git a/inventory.py b/inventory.py index 80d02bf754..6d119695d5 100644 --- a/inventory.py +++ b/inventory.py @@ -91,7 +91,6 @@ class Inventory(ModelWorkflow, ModelSQL, ModelView): }) def wkf_done(self, inventory): - date_obj = Pool().get('ir.date') line_obj = Pool().get('stock.inventory.line') for line in inventory.lines: @@ -140,7 +139,6 @@ class Inventory(ModelWorkflow, ModelSQL, ModelView): pool = Pool() line_obj = pool.get('stock.inventory.line') product_obj = pool.get('product.product') - uom_obj = pool.get('product.uom') if isinstance(ids, (int, long)): ids = [ids] @@ -227,7 +225,6 @@ class InventoryLine(ModelSQL, ModelView): def on_change_product(self, vals): product_obj = Pool().get('product.product') - uom_obj = Pool().get('product.uom') res = {} res['unit_digits'] = 2 if vals.get('product'): diff --git a/move.py b/move.py index 0352926a06..74b9cf38cb 100644 --- a/move.py +++ b/move.py @@ -259,7 +259,6 @@ class Move(ModelSQL, ModelView): def default_currency(self): company_obj = Pool().get('company.company') - currency_obj = Pool().get('currency.currency') company = Transaction().context.get('company') if company: company = company_obj.browse(company) @@ -725,7 +724,7 @@ class Move(ModelSQL, ModelView): self.write(move.id, values) first = False else: - move_id = self.copy(move.id, default=values) + self.copy(move.id, default=values) qty_default_uom = uom_obj.compute_qty(move.uom, qty, move.product.default_uom, round=False) diff --git a/product.py b/product.py index ca79200982..0e553dfe25 100644 --- a/product.py +++ b/product.py @@ -169,8 +169,6 @@ class Product(ModelSQL, ModelView): and quantity as value """ pool = Pool() - uom_obj = pool.get("product.uom") - product_obj = pool.get("product.product") rule_obj = pool.get('ir.rule') location_obj = pool.get('stock.location') date_obj = pool.get('ir.date') diff --git a/shipment.py b/shipment.py index 8f322e4778..58a9ce4817 100644 --- a/shipment.py +++ b/shipment.py @@ -1048,7 +1048,6 @@ class ShipmentOut(ModelWorkflow, ModelSQL, ModelView): that are in the outgoing moves. """ move_obj = Pool().get('stock.move') - uom_obj = Pool().get('product.uom') self.write(shipment.id, { 'state': 'waiting', }) @@ -1311,7 +1310,6 @@ class ShipmentOutReturn(ModelWorkflow, ModelSQL, ModelView): return {'delivery_address': False} party_obj = Pool().get("party.party") address_id = party_obj.address_get(values['customer'], type='delivery') - party = party_obj.browse(values['customer']) return { 'delivery_address': address_id, } @@ -2109,9 +2107,6 @@ class PickingList(CompanyReport): _name = 'stock.shipment.out.picking_list' def parse(self, report, objects, datas, localcontext): - move_obj = Pool().get('stock.move') - shipment_out_obj = Pool().get('stock.shipment.out') - compare_context = self.get_compare_context(report, objects, datas) sorted_moves = {} @@ -2156,9 +2151,6 @@ class SupplierRestockingList(CompanyReport): _name = 'stock.shipment.in.restocking_list' def parse(self, report, objects, datas, localcontext): - move_obj = Pool().get('stock.move') - shipment_in_obj = Pool().get('stock.shipment.in') - compare_context = self.get_compare_context(report, objects, datas) sorted_moves = {} @@ -2203,9 +2195,6 @@ class CustomerReturnRestockingList(CompanyReport): _name = 'stock.shipment.out.return.restocking_list' def parse(self, report, objects, datas, localcontext): - move_obj = Pool().get('stock.move') - shipment_in_obj = Pool().get('stock.shipment.out.return') - compare_context = self.get_compare_context(report, objects, datas) sorted_moves = {} @@ -2250,9 +2239,6 @@ class InteralShipmentReport(CompanyReport): _name = 'stock.shipment.internal.report' def parse(self, report, objects, datas, localcontext=None): - move_obj = Pool().get('stock.move') - shipment_in_obj = Pool().get('stock.shipment.internal') - compare_context = self.get_compare_context(report, objects, datas) sorted_moves = {} diff --git a/tests/test_stock.py b/tests/test_stock.py index dbef2fed24..e303908d76 100644 --- a/tests/test_stock.py +++ b/tests/test_stock.py @@ -52,7 +52,7 @@ class StockTestCase(unittest.TestCase): ''' Test Move.internal_quantity. ''' - with Transaction().start(DB_NAME, USER, CONTEXT) as transaction: + with Transaction().start(DB_NAME, USER, CONTEXT): category_id = self.category.create({ 'name': 'Test Move.internal_quantity', }) @@ -301,7 +301,7 @@ class StockTestCase(unittest.TestCase): ''' Test period. ''' - with Transaction().start(DB_NAME, USER, CONTEXT) as transaction: + with Transaction().start(DB_NAME, USER, CONTEXT): category_id = self.category.create({ 'name': 'Test period', })