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 CIM15
.IEC61968
.Common
.Document
import Document
23 class ErpInvoice(Document
):
24 """A roll up of invoice line items. The whole invoice has a due date and amount to be paid, with information such as customer, banks etc. being obtained through associations. The invoice roll up is based on individual line items that each contain amounts and descriptions for specific services or products.A roll up of invoice line items. The whole invoice has a due date and amount to be paid, with information such as customer, banks etc. being obtained through associations. The invoice roll up is based on individual line items that each contain amounts and descriptions for specific services or products.
27 def __init__(self
, mailedDate
='', transactionDateTime
='', amount
=0.0, dueDate
='', billMediaKind
="other", referenceNumber
='', kind
="sales", transferType
='', proForma
=False, ErpInvoiceLineItems
=None, CustomerAccount
=None, *args
, **kw_args
):
28 """Initialises a new 'ErpInvoice' instance.
30 @param mailedDate: Date on which the customer billing statement/invoice was printed/mailed.
31 @param transactionDateTime: Date and time when the invoice is issued.
32 @param amount: Total amount due on this invoice based on line items and applicable adjustments.
33 @param dueDate: Calculated date upon which the Invoice amount is due.
34 @param billMediaKind: Kind of media by which the CustomerBillingInfo was delivered. Values are: "other", "paper", "electronic"
35 @param referenceNumber: Number of an invoice to be reference by this invoice.
36 @param kind: Kind of invoice (default is 'sales'). Values are: "sales", "purchase"
37 @param transferType: Type of invoice transfer.
38 @param proForma: True if payment is to be paid by a Customer to accept a particular ErpQuote (with associated Design) and have work initiated, at which time an associated ErpInvoice should automatically be generated. EprPayment.subjectStatus satisfies terms specificed in the ErpQuote.
39 @param ErpInvoiceLineItems:
40 @param CustomerAccount:
42 #: Date on which the customer billing statement/invoice was printed/mailed.
43 self
.mailedDate
= mailedDate
45 #: Date and time when the invoice is issued.
46 self
.transactionDateTime
= transactionDateTime
48 #: Total amount due on this invoice based on line items and applicable adjustments.
51 #: Calculated date upon which the Invoice amount is due.
52 self
.dueDate
= dueDate
54 #: Kind of media by which the CustomerBillingInfo was delivered. Values are: "other", "paper", "electronic"
55 self
.billMediaKind
= billMediaKind
57 #: Number of an invoice to be reference by this invoice.
58 self
.referenceNumber
= referenceNumber
60 #: Kind of invoice (default is 'sales'). Values are: "sales", "purchase"
63 #: Type of invoice transfer.
64 self
.transferType
= transferType
66 #: True if payment is to be paid by a Customer to accept a particular ErpQuote (with associated Design) and have work initiated, at which time an associated ErpInvoice should automatically be generated. EprPayment.subjectStatus satisfies terms specificed in the ErpQuote.
67 self
.proForma
= proForma
69 self
._ErpInvoiceLineItems
= []
70 self
.ErpInvoiceLineItems
= [] if ErpInvoiceLineItems
is None else ErpInvoiceLineItems
72 self
._CustomerAccount
= None
73 self
.CustomerAccount
= CustomerAccount
75 super(ErpInvoice
, self
).__init
__(*args
, **kw_args
)
77 _attrs
= ["mailedDate", "transactionDateTime", "amount", "dueDate", "billMediaKind", "referenceNumber", "kind", "transferType", "proForma"]
78 _attr_types
= {"mailedDate": str, "transactionDateTime": str, "amount": float, "dueDate": str, "billMediaKind": str, "referenceNumber": str, "kind": str, "transferType": str, "proForma": bool}
79 _defaults
= {"mailedDate": '', "transactionDateTime": '', "amount": 0.0, "dueDate": '', "billMediaKind": "other", "referenceNumber": '', "kind": "sales", "transferType": '', "proForma": False}
80 _enums
= {"billMediaKind": "BillMediaKind", "kind": "ErpInvoiceKind"}
81 _refs
= ["ErpInvoiceLineItems", "CustomerAccount"]
82 _many_refs
= ["ErpInvoiceLineItems"]
84 def getErpInvoiceLineItems(self
):
86 return self
._ErpInvoiceLineItems
88 def setErpInvoiceLineItems(self
, value
):
89 for x
in self
._ErpInvoiceLineItems
:
93 self
._ErpInvoiceLineItems
= value
95 ErpInvoiceLineItems
= property(getErpInvoiceLineItems
, setErpInvoiceLineItems
)
97 def addErpInvoiceLineItems(self
, *ErpInvoiceLineItems
):
98 for obj
in ErpInvoiceLineItems
:
101 def removeErpInvoiceLineItems(self
, *ErpInvoiceLineItems
):
102 for obj
in ErpInvoiceLineItems
:
103 obj
.ErpInvoice
= None
105 def getCustomerAccount(self
):
107 return self
._CustomerAccount
109 def setCustomerAccount(self
, value
):
110 if self
._CustomerAccount
is not None:
111 filtered
= [x
for x
in self
.CustomerAccount
.ErpInvoicees
if x
!= self
]
112 self
._CustomerAccount
._ErpInvoicees
= filtered
114 self
._CustomerAccount
= value
115 if self
._CustomerAccount
is not None:
116 if self
not in self
._CustomerAccount
._ErpInvoicees
:
117 self
._CustomerAccount
._ErpInvoicees
.append(self
)
119 CustomerAccount
= property(getCustomerAccount
, setCustomerAccount
)