read total + payment-data
This commit is contained in:
parent
dbd4948e67
commit
2af92a9a6d
2 changed files with 50 additions and 0 deletions
39
document.py
39
document.py
|
@ -543,6 +543,45 @@ class Incoming(metaclass=PoolMeta):
|
|||
if taxes:
|
||||
self.parsed_data['payment']['taxes'] = taxes
|
||||
|
||||
xpath_payterms = xpath_payment + ['ram:SpecifiedTradePaymentTerms']
|
||||
xpath_discount = ['ram:ApplicableTradePaymentDiscountTerms']
|
||||
pay_terms = self._readxml_read_listdata(xmltree, xpath_payterms, [], [
|
||||
('ram:Description', 'description'),
|
||||
(['ram:DueDateDateTime', 'udt:DateTimeString'],
|
||||
'duedate', date),
|
||||
('ram:DirectDebitMandateID', 'mandat_id'),
|
||||
('ram:PartialPaymentAmount', 'amount', Decimal),
|
||||
(xpath_discount + ['ram:BasisDateTime', 'udt:DateTimeString'],
|
||||
'discount_date', date),
|
||||
(xpath_discount + ['ram:BasisPeriodMeasure'],
|
||||
'discount_measure', Decimal),
|
||||
(xpath_discount + ['ram:BasisAmount'],
|
||||
'discount_base', Decimal),
|
||||
(xpath_discount + ['ram:CalculationPercent'],
|
||||
'discount_perc', Decimal),
|
||||
(xpath_discount + ['ram:ActualDiscountAmount'],
|
||||
'discount_amount', Decimal)
|
||||
])
|
||||
if pay_terms:
|
||||
self.parsed_data['payment']['terms'] = pay_terms
|
||||
|
||||
# total
|
||||
xpath_total = xpath_payment + [
|
||||
'ram:SpecifiedTradeSettlementHeaderMonetarySummation']
|
||||
total = self._readxml_read_listdata(xmltree, xpath_total, [], [
|
||||
('ram:LineTotalAmount', 'amount', Decimal),
|
||||
('ram:ChargeTotalAmount', 'charge', Decimal),
|
||||
('ram:AllowanceTotalAmount', 'allowance', Decimal),
|
||||
('ram:TaxBasisTotalAmount', 'taxbase', Decimal),
|
||||
('ram:TaxTotalAmount', 'taxtotal', Decimal),
|
||||
('ram:RoundingAmount', 'rounding', Decimal),
|
||||
('ram:GrandTotalAmount', 'grand', Decimal),
|
||||
('ram:TotalPrepaidAmount', 'prepaid', Decimal),
|
||||
('ram:DuePayableAmount', 'duepayable', Decimal),
|
||||
])
|
||||
if total:
|
||||
self.parsed_data['total'] = total[0]
|
||||
|
||||
def _readxml_getinvoiceline(self, invoice, line_data):
|
||||
""" create invoice line in memory
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue