mirror of
https://github.com/NaN-tic/trytond-stock_number_of_packages.git
synced 2023-12-14 07:52:52 +01:00
pending python3 adapations
This commit is contained in:
parent
01537ede41
commit
529b412ab9
|
@ -89,7 +89,7 @@ class Inventory(metaclass=PoolMeta):
|
|||
Line.write(*to_write)
|
||||
|
||||
# Create lines if needed
|
||||
for key, number_of_packages in pbl.iteritems():
|
||||
for key, number_of_packages in pbl.items():
|
||||
product_id = key[grouping.index('product') + 1]
|
||||
if not number_of_packages:
|
||||
continue
|
||||
|
|
|
@ -20,7 +20,7 @@ class Location(metaclass=PoolMeta):
|
|||
quantity_fname = name.replace('number_of_packages', 'quantity')
|
||||
with Transaction().set_context(number_of_packages=True):
|
||||
quantities = cls.get_quantity(locations, quantity_fname)
|
||||
for key, quantity in quantities.iteritems():
|
||||
for key, quantity in quantities.items():
|
||||
if quantity != None:
|
||||
quantities[key] = int(quantity)
|
||||
return quantities
|
||||
|
|
|
@ -23,7 +23,7 @@ class NumberOfPackagesCacheMixin(object):
|
|||
|
||||
vlist = []
|
||||
for period_id, vlist_by_location in \
|
||||
vlist_by_period_location.iteritems():
|
||||
vlist_by_period_location.items():
|
||||
period = Period(period_id)
|
||||
with Transaction().set_context(
|
||||
stock_date_end=period.date,
|
||||
|
@ -35,7 +35,7 @@ class NumberOfPackagesCacheMixin(object):
|
|||
):
|
||||
pbl = Product.products_by_location(
|
||||
vlist_by_location.keys(), grouping=grouping)
|
||||
for location_id, location_vlist in vlist_by_location.iteritems():
|
||||
for location_id, location_vlist in vlist_by_location.items():
|
||||
for values in location_vlist:
|
||||
key = tuple([location_id] + [values[x] for x in grouping])
|
||||
values['number_of_packages'] = int(pbl.get(key, 0.0))
|
||||
|
|
|
@ -70,7 +70,7 @@ class Product(StockMixin, metaclass=PoolMeta):
|
|||
grouping_filter=grouping_filter, position=position)
|
||||
|
||||
if name.endswith('number_of_packages'):
|
||||
for key, quantity in quantities.iteritems():
|
||||
for key, quantity in quantities.items():
|
||||
quantities[key] = 0
|
||||
if quantity is not None:
|
||||
quantities[key] = int(quantity)
|
||||
|
@ -81,7 +81,7 @@ class Product(StockMixin, metaclass=PoolMeta):
|
|||
if name.endswith('number_of_packages'):
|
||||
with Transaction().set_context(number_of_packages=True):
|
||||
location_ids = Transaction().context.get('locations')
|
||||
product_ids = map(int, products)
|
||||
product_ids = [x.id for x in products]
|
||||
return cls._get_quantity(
|
||||
products, name, location_ids,
|
||||
grouping_filter=(product_ids,))
|
||||
|
|
|
@ -9,9 +9,8 @@ __all__ = ['ShipmentIn', 'ShipmentOut', 'ShipmentOutReturn']
|
|||
class ShipmentIn(metaclass=PoolMeta):
|
||||
__name__ = 'stock.shipment.in'
|
||||
|
||||
@classmethod
|
||||
def _get_inventory_moves(cls, incoming_move):
|
||||
move = super(ShipmentIn, cls)._get_inventory_moves(incoming_move)
|
||||
def _get_inventory_move(self, incoming_move):
|
||||
move = super(ShipmentIn, self)._get_inventory_move(incoming_move)
|
||||
if not move:
|
||||
return
|
||||
move.package = incoming_move.package
|
||||
|
|
|
@ -296,8 +296,7 @@ Validate Shipments one month ago::
|
|||
4.7
|
||||
>>> lot_w_package.save()
|
||||
>>> incoming_move.lot = lot_w_package
|
||||
>>> incoming_move.package == product_lot_w_package.template.packagings[1]
|
||||
True
|
||||
>>> incoming_move.package = product_lot_w_package.template.packagings[1]
|
||||
>>> incoming_move.number_of_packages = 17
|
||||
>>> incoming_move.quantity
|
||||
79.9
|
||||
|
|
Loading…
Reference in a new issue