Commit c10fb67e authored by Kevin Deldycke's avatar Kevin Deldycke

silent updates


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3183 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e844f335
############################################################################## ##############################################################################
# #
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2002-2005 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com> # Jean-Paul Smets-Solanes <jp@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
...@@ -36,10 +36,11 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface ...@@ -36,10 +36,11 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.DeliveryCell import DeliveryCell from Products.ERP5.Document.DeliveryCell import DeliveryCell
from Products.ERP5.Document.Movement import Movement from Products.ERP5.Document.Movement import Movement
class InventoryCell(DeliveryCell): class InventoryCell(DeliveryCell):
""" """
A DeliveryCell allows to define specific quantities An InventoryCell allows to define specific inventory
for each variation of a resource in a delivery line. for each variation of a resource in an inventory line.
""" """
meta_type = 'ERP5 Inventory Cell' meta_type = 'ERP5 Inventory Cell'
...@@ -74,8 +75,7 @@ class InventoryCell(DeliveryCell): ...@@ -74,8 +75,7 @@ class InventoryCell(DeliveryCell):
factory_type_information = \ factory_type_information = \
{ 'id' : portal_type { 'id' : portal_type
, 'meta_type' : meta_type , 'meta_type' : meta_type
, 'description' : """\ , 'description' : """An Inventory Cell."""
Une ligne tarifaire."""
, 'icon' : 'order_line_icon.gif' , 'icon' : 'order_line_icon.gif'
, 'product' : 'ERP5' , 'product' : 'ERP5'
, 'factory' : 'addInventoryCell' , 'factory' : 'addInventoryCell'
...@@ -237,18 +237,13 @@ Une ligne tarifaire.""" ...@@ -237,18 +237,13 @@ Une ligne tarifaire."""
elif (self.getResource() == object.getResource()) and (self.getVariationCategoryList() == object.getVariationCategoryList()) : elif (self.getResource() == object.getResource()) and (self.getVariationCategoryList() == object.getVariationCategoryList()) :
# we can add this item to the list of aggregated items # we can add this item to the list of aggregated items
item_object_list.append(object) item_object_list.append(object)
# update item_id_list and build relation # update item_id_list and build relation
self.setAggregateValueList(item_object_list) self.setAggregateValueList(item_object_list)
# update inventory if needed # update inventory if needed
if len(item_object_list)>0 : if len(item_object_list)>0 :
quantity = 0 quantity = 0
for object_item in item_object_list : for object_item in item_object_list :
quantity += object_item.getRemainingQuantity() quantity += object_item.getRemainingQuantity()
self.setInventory(quantity) self.setInventory(quantity)
# Required for indexing # Required for indexing
...@@ -259,7 +254,6 @@ Une ligne tarifaire.""" ...@@ -259,7 +254,6 @@ Une ligne tarifaire."""
""" """
return Movement.getInventoriatedQuantity(self) return Movement.getInventoriatedQuantity(self)
security.declareProtected(Permissions.AccessContentsInformation, 'getStartDate') security.declareProtected(Permissions.AccessContentsInformation, 'getStartDate')
def getStartDate(self): def getStartDate(self):
""" """
...@@ -291,7 +285,6 @@ Une ligne tarifaire.""" ...@@ -291,7 +285,6 @@ Une ligne tarifaire."""
object = None object = None
else : else :
object = None object = None
if object is not None : if object is not None :
# if item was in previous_item_list keep it # if item was in previous_item_list keep it
if object in previous_item_list : if object in previous_item_list :
...@@ -304,18 +297,13 @@ Une ligne tarifaire.""" ...@@ -304,18 +297,13 @@ Une ligne tarifaire."""
if self.getDestinationTitle() != last_location_title or last_location_title == '' : if self.getDestinationTitle() != last_location_title or last_location_title == '' :
# we can add this item to the list of aggregated items # we can add this item to the list of aggregated items
item_object_list.append(object) item_object_list.append(object)
# update item_id_list and build relation # update item_id_list and build relation
self.setAggregateValueList(item_object_list) self.setAggregateValueList(item_object_list)
# update inventory if needed # update inventory if needed
if len(item_object_list)>0 : if len(item_object_list)>0 :
quantity = 0 quantity = 0
for object_item in item_object_list : for object_item in item_object_list :
quantity += object_item.getQuantity() quantity += object_item.getQuantity()
self.setProductionQuantity(quantity) self.setProductionQuantity(quantity)
def _setConsumedItemIdList(self, value): def _setConsumedItemIdList(self, value):
...@@ -335,7 +323,6 @@ Une ligne tarifaire.""" ...@@ -335,7 +323,6 @@ Une ligne tarifaire."""
object = None object = None
else : else :
object = None object = None
if object is not None : if object is not None :
# if item was in previous_item_list keep it # if item was in previous_item_list keep it
if object in previous_item_list : if object in previous_item_list :
...@@ -348,20 +335,15 @@ Une ligne tarifaire.""" ...@@ -348,20 +335,15 @@ Une ligne tarifaire."""
if self.getDestinationTitle() == last_location_title or last_location_title == '' : if self.getDestinationTitle() == last_location_title or last_location_title == '' :
# we can add this item to the list of aggregated items # we can add this item to the list of aggregated items
item_object_list.append(object) item_object_list.append(object)
# update item_id_list and build relation # update item_id_list and build relation
self.setAggregateValueList(item_object_list) self.setAggregateValueList(item_object_list)
# update inventory if needed # update inventory if needed
if len(item_object_list)>0 : if len(item_object_list)>0 :
quantity = 0 quantity = 0
for object_item in item_object_list : for object_item in item_object_list :
quantity += object_item.getRemainingQuantity() quantity += object_item.getRemainingQuantity()
# we reset the location of the item # we reset the location of the item
object_item.setLocation('') object_item.setLocation('')
self.setConsumptionQuantity(quantity) self.setConsumptionQuantity(quantity)
def getProducedItemIdList(self): def getProducedItemIdList(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment