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
.IEC61968
.Common
.Document
import Document
19 class CustomerAccount(Document
):
20 """Assignment of a group of products and services purchased by the Customer through a CustomerAgreement, used as a mechanism for customer billing and payment. It contains common information from the various types of CustomerAgreements to create billings (invoices) for a Customer and receive payment.
23 def __init__(self
, PaymentTransactions
=None, CustomerAgreements
=None, *args
, **kw_args
):
24 """Initialises a new 'CustomerAccount' instance.
26 @param PaymentTransactions: All payment transactions for this customer account.
27 @param CustomerAgreements: All agreements for this customer account.
29 self
._PaymentTransactions
= []
30 self
.PaymentTransactions
= [] if PaymentTransactions
is None else PaymentTransactions
32 self
._CustomerAgreements
= []
33 self
.CustomerAgreements
= [] if CustomerAgreements
is None else CustomerAgreements
35 super(CustomerAccount
, self
).__init
__(*args
, **kw_args
)
41 _refs
= ["PaymentTransactions", "CustomerAgreements"]
42 _many_refs
= ["PaymentTransactions", "CustomerAgreements"]
44 def getPaymentTransactions(self
):
45 """All payment transactions for this customer account.
47 return self
._PaymentTransactions
49 def setPaymentTransactions(self
, value
):
50 for x
in self
._PaymentTransactions
:
51 x
._CustomerAccount
= None
53 y
._CustomerAccount
= self
54 self
._PaymentTransactions
= value
56 PaymentTransactions
= property(getPaymentTransactions
, setPaymentTransactions
)
58 def addPaymentTransactions(self
, *PaymentTransactions
):
59 for obj
in PaymentTransactions
:
60 obj
._CustomerAccount
= self
61 self
._PaymentTransactions
.append(obj
)
63 def removePaymentTransactions(self
, *PaymentTransactions
):
64 for obj
in PaymentTransactions
:
65 obj
._CustomerAccount
= None
66 self
._PaymentTransactions
.remove(obj
)
68 def getCustomerAgreements(self
):
69 """All agreements for this customer account.
71 return self
._CustomerAgreements
73 def setCustomerAgreements(self
, value
):
74 for x
in self
._CustomerAgreements
:
75 x
._CustomerAccount
= None
77 y
._CustomerAccount
= self
78 self
._CustomerAgreements
= value
80 CustomerAgreements
= property(getCustomerAgreements
, setCustomerAgreements
)
82 def addCustomerAgreements(self
, *CustomerAgreements
):
83 for obj
in CustomerAgreements
:
84 obj
._CustomerAccount
= self
85 self
._CustomerAgreements
.append(obj
)
87 def removeCustomerAgreements(self
, *CustomerAgreements
):
88 for obj
in CustomerAgreements
:
89 obj
._CustomerAccount
= None
90 self
._CustomerAgreements
.remove(obj
)