1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 from CIM14
.IEC61970
.Core
.IdentifiedObject
import IdentifiedObject
23 class PointOfSale(IdentifiedObject
):
24 """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.
27 def __init__(self
, location
='', Vendor
=None, CashierShifts
=None, *args
, **kw_args
):
28 """Initialises a new 'PointOfSale' instance.
30 @param location: Local description for where this point of sale is physically located.
31 @param Vendor: Vendor that controls this PointOfSale.
32 @param CashierShifts: All shifts this point of sale operated in.
34 #: Local description for where this point of sale is physically located.
35 self
.location
= location
40 self
._CashierShifts
= []
41 self
.CashierShifts
= [] if CashierShifts
is None else CashierShifts
43 super(PointOfSale
, self
).__init
__(*args
, **kw_args
)
46 _attr_types
= {"location": str}
47 _defaults
= {"location": ''}
49 _refs
= ["Vendor", "CashierShifts"]
50 _many_refs
= ["CashierShifts"]
53 """Vendor that controls this PointOfSale.
57 def setVendor(self
, value
):
58 if self
._Vendor
is not None:
59 filtered
= [x
for x
in self
.Vendor
.PointOfSales
if x
!= self
]
60 self
._Vendor
._PointOfSales
= filtered
63 if self
._Vendor
is not None:
64 if self
not in self
._Vendor
._PointOfSales
:
65 self
._Vendor
._PointOfSales
.append(self
)
67 Vendor
= property(getVendor
, setVendor
)
69 def getCashierShifts(self
):
70 """All shifts this point of sale operated in.
72 return self
._CashierShifts
74 def setCashierShifts(self
, value
):
75 for x
in self
._CashierShifts
:
79 self
._CashierShifts
= value
81 CashierShifts
= property(getCashierShifts
, setCashierShifts
)
83 def addCashierShifts(self
, *CashierShifts
):
84 for obj
in CashierShifts
:
85 obj
.PointOfSale
= self
87 def removeCashierShifts(self
, *CashierShifts
):
88 for obj
in CashierShifts
:
89 obj
.PointOfSale
= None