Bumping version for release.
[PyCIM.git] / CIM14 / IEC61968 / PaymentMetering / PointOfSale.py
bloba20119979f7a715f8635e15238af0ca06cda9a3b
1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14.IEC61970.Core.IdentifiedObject import IdentifiedObject
19 class PointOfSale(IdentifiedObject):
20 """Logical point where transactions take place with operational interaction between Cashier and the payment system; in certain cases PointOfSale interacts directly with the end customer, in which case Cashier might not be a real person: for example a self-service kiosk or over the internet.
21 """
23 def __init__(self, location='', Vendor=None, CashierShifts=None, *args, **kw_args):
24 """Initialises a new 'PointOfSale' instance.
26 @param location: Local description for where this point of sale is physically located.
27 @param Vendor: Vendor that controls this PointOfSale.
28 @param CashierShifts: All shifts this point of sale operated in.
29 """
30 #: Local description for where this point of sale is physically located.
31 self.location = location
33 self._Vendor = None
34 self.Vendor = Vendor
36 self._CashierShifts = []
37 self.CashierShifts = [] if CashierShifts is None else CashierShifts
39 super(PointOfSale, self).__init__(*args, **kw_args)
41 _attrs = ["location"]
42 _attr_types = {"location": str}
43 _defaults = {"location": ''}
44 _enums = {}
45 _refs = ["Vendor", "CashierShifts"]
46 _many_refs = ["CashierShifts"]
48 def getVendor(self):
49 """Vendor that controls this PointOfSale.
50 """
51 return self._Vendor
53 def setVendor(self, value):
54 if self._Vendor is not None:
55 filtered = [x for x in self.Vendor.PointOfSales if x != self]
56 self._Vendor._PointOfSales = filtered
58 self._Vendor = value
59 if self._Vendor is not None:
60 if self not in self._Vendor._PointOfSales:
61 self._Vendor._PointOfSales.append(self)
63 Vendor = property(getVendor, setVendor)
65 def getCashierShifts(self):
66 """All shifts this point of sale operated in.
67 """
68 return self._CashierShifts
70 def setCashierShifts(self, value):
71 for x in self._CashierShifts:
72 x.PointOfSale = None
73 for y in value:
74 y._PointOfSale = self
75 self._CashierShifts = value
77 CashierShifts = property(getCashierShifts, setCashierShifts)
79 def addCashierShifts(self, *CashierShifts):
80 for obj in CashierShifts:
81 obj.PointOfSale = self
83 def removeCashierShifts(self, *CashierShifts):
84 for obj in CashierShifts:
85 obj.PointOfSale = None