Commit d2c17920 authored by Jérome Perrin's avatar Jérome Perrin

remove not used InventoryBrain

parent 5ee20444
......@@ -38,7 +38,7 @@ at_date</string> </value>
</item>
<item>
<key> <string>class_name_</string> </key>
<value> <string>InventoryBrain</string> </value>
<value> <string>MovementHistoryListBrain</string> </value>
</item>
<item>
<key> <string>connection_hook</string> </key>
......@@ -85,6 +85,7 @@ XXX now that grouping_date exists, this script will become useless.\n
mirror_section.relative_url as mirror_section_relative_url,\n
mirror_section.title as mirror_section_title,\n
stock.date as date,\n
stock.node_uid as node_uid,\n
IFNULL(stock.total_price, 0) as total_price,\n
IFNULL(stock.quantity, 0) as total_quantity\n
\n
......@@ -115,6 +116,7 @@ XXX now that grouping_date exists, this script will become useless.\n
mirror_section.relative_url as mirror_section_relative_url,\n
mirror_section.title as mirror_section_title,\n
stock.date as date,\n
stock.node_uid as node_uid,\n
IFNULL(stock.total_price, 0) as total_price,\n
IFNULL(stock.quantity, 0) as total_quantity\n
\n
......
......@@ -47,62 +47,6 @@ class ComputedAttributeGetItemCompatibleMixin(ZSQLBrain):
return item.__of__(self)
return item
class InventoryBrain(ZSQLBrain):
"""
Global analysis (all variations and categories)
"""
# Stock management
def getInventory(self, at_date=None, ignore_variation=0,
simulation_state=None, **kw):
if isinstance(simulation_state, str):
simulation_state = [simulation_state]
result = self.Resource_zGetInventory(
resource_uid=[self.resource_uid],
to_date=at_date, omit_simulation=0,
section_category=self.getPortalDefaultSectionCategory(),
simulation_state=simulation_state)
inventory = None
if len(result) > 0:
inventory = result[0].inventory
if inventory is None:
return 0.0
else:
return inventory
def getCurrentInventory(self):
return self.getInventory(
simulation_state=self.getPortalCurrentInventoryStateList(),
ignore_variation=1)
def getFutureInventory(self):
return self.getInventory(
ignore_variation=1,
simulation_state= \
list(self.getPortalFutureInventoryStateList())+ \
list(self.getPortalReservedInventoryStateList())+ \
list(self.getPortalCurrentInventoryStateList()))
def getAvailableInventory(self):
current = self.getCurrentInventory()
result = self.Resource_zGetInventory(
resource_uid=[self.resource_uid], ignore_variation=1,
omit_simulation=1, omit_input=1,
section_category=self.getPortalDefaultSectionCategory(),
simulation_state= \
self.getPortalReservedInventoryStateList())
reserved_inventory = None
if len(result) > 0:
reserved_inventory = result[0].inventory
if reserved_inventory is None:
reserved_inventory = 0.0
return current + reserved_inventory
def getQuantityUnit(self, **kw):
resource = self.portal_catalog.getObject(self.resource_uid)
if resource is not None:
return resource.getQuantityUnit()
class InventoryListBrain(ComputedAttributeGetItemCompatibleMixin):
"""
Lists each variation
......
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