Commit ac7e2847 authored by Romain Courteaud's avatar Romain Courteaud

Initial import.

Move from Business Template erp5_apparel_depend.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3234 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5660665e
##############################################################################
#
# Copyright (c) 2002 Coramy SAS and Contributors. All Rights Reserved.
# Thierry_Faucher <Thierry_Faucher@coramy.com>
# Copyright (c) 2004 Nexedi SARL and Contributors. All Rights Reserved.
# Courteaud_Romain <romain@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Globals import InitializeClass, PersistentMapping
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5Type.XMLMatrix import XMLMatrix
from Products.ERP5.Document.Domain import Domain
from Products.ERP5.Variated import Variated
from zLOG import LOG
class Consumption(XMLObject, XMLMatrix, Variated):
"""
A matrix which provides default quantities
for a given quantity
"""
meta_type = 'ERP5 Consumption'
portal_type = 'Consumption'
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.View)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.VariationRange
# , PropertySheet.Consumption
)
security.declareProtected(Permissions.ModifyPortalContent, '_setMatrixCellRange')
def _setMatrixCellRange(self):
"""
Set consumption matrix set range
"""
lines, columns, tab = self.Consumption_asCellRange()
#self.setCellRange(lines, columns, base_id='quantity')
self.setCellRange(lines, base_id='quantity')
security.declareProtected(Permissions.ModifyPortalContent, '_setVariationCategoryList')
def _setVariationCategoryList(self,value):
"""
Set consumption variation category list.
Set matrix cell range.
"""
self._setCategoryMembership(self.getVariationRangeBaseCategoryList(),value,base=1)
# XXX Must use in futur this method, but it failed today
#Variated._setVariationCategoryList(self, value)
self._setMatrixCellRange()
security.declareProtected(Permissions.ModifyPortalContent, 'setVariationCategoryList')
def setVariationCategoryList(self,value):
"""
Set consumption variation category list.
Reindex Object.
"""
self._setVariationCategoryList(value)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, 'getVariationRangeBaseCategoryList')
def getVariationRangeBaseCategoryList(self):
"""
Return range of base variation
"""
return self.getPortalVariationBaseCategoryList()
security.declareProtected(Permissions.ModifyPortalContent, 'getVariationRangeBaseCategoryItemList')
def getVariationRangeBaseCategoryItemList(self):
"""
Return range of base variation item
Left display
"""
# XXX get TitleOrId
return map( lambda x: (x,x) , self.getVariationRangeBaseCategoryList() )
security.declareProtected(Permissions.ModifyPortalContent, 'getVariationRangeCategoryList')
def getVariationRangeCategoryList(self):
"""
Return range of variation
"""
result = self.portal_categories.getCategoryChildList(self.getVariationBaseCategoryList(), base=0)
return result
security.declareProtected(Permissions.ModifyPortalContent, 'getVariationRangeCategoryItemList')
def getVariationRangeCategoryItemList(self):
"""
Return range of variation item
"""
# We need a left display for ListField, and self.portal_categories.getCategoryChildTitleItemList return a right display
# So, invert all tuples
result = map( lambda x: (x[1],x[0]), self.portal_categories.getCategoryChildTitleItemList(self.getVariationBaseCategoryList(), base=1) )
return result
security.declareProtected(Permissions.ModifyPortalContent, 'getQuantityRatio')
def getQuantityRatio(self, variation_category_line, variation_category_column):
"""
Return quantity ratio for a virtual cell.
Return None if not result can be return.
"""
cell_quantity_ratio_list = []
for variation_category in (variation_category_line, variation_category_column):
cell = self.getCell(variation_category, base_id='quantity')
if cell is None:
return None
else:
cell_quantity_ratio = cell.getProperty('quantity')
if cell_quantity_ratio in [None, 0, '']:
return None
else:
cell_quantity_ratio_list.append( cell_quantity_ratio )
return cell_quantity_ratio_list[1] / cell_quantity_ratio_list[0]
##############################################################################
#
# Copyright (c) 2002-2004 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
# Courteaud_Romain <romain@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Variation import Variation
from Products.ERP5.Document.Image import Image
class VariationImage(Image, Variation):
"""
A Variation combinated with a image
"""
meta_type = 'ERP5 Variation Image'
portal_type = 'Variation Image'
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.View)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Price
, PropertySheet.Variation
, PropertySheet.VariationRange
)
##############################################################################
#
# Copyright (c) 2002 Coramy SAS and Contributors. All Rights Reserved.
# Copyright (c) 2004 Nexedi SARL and Contributors. All Rights Reserved.
# Romain Courteaud <romain@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
class IndustrialDescription:
"""
Help for the creation
"""
_properties = (
{ 'id' : 'bill_of_material_description', #XXX
'description' : 'A description text of the components and their consumptions in the product',
'type' : 'text',
'mode' : 'w' },
{ 'id' : 'industrial_process_description', #XXXX
'description' : 'A description text of operations required to build the product',
'type' : 'text',
'mode' : 'w' },
)
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