diff --git a/models/payment_batch.py b/models/payment_batch.py
index 6fc4846..6b25dd9 100644
--- a/models/payment_batch.py
+++ b/models/payment_batch.py
@@ -65,6 +65,8 @@ class opendons_payment_batch(models.Model):
'payment_batch_id',
string='donation',
track_visibility='onchange')
+
+
@api.model
def _default_currency(self):
@@ -82,7 +84,7 @@ class opendons_payment_batch(models.Model):
default=_default_currency
)
- payment_count=fields.Integer(string='payments count', readonly=True)
+ payment_count=fields.Integer(string='payments count', readonly=True,compute="_compute_total")
payment_input=fields.Char('Input field')
input_mode=fields.Selection([('manual','manual'),('loyalty','loyalty QRCODE'),('prospect','prospect QRCODE')])
assignment=fields.Selection([('single','single'),('multiple','multiple')])
@@ -99,6 +101,13 @@ class opendons_payment_batch(models.Model):
default=lambda self: self.env.company
)
+ amount_total = fields.Monetary(
+ 'Total amount',
+ currency_field='currency_id',compute="_compute_total"
+
+ )
+
+
@api.onchange('operation_id')
def _onchange_operation_id(self):
res = {}
@@ -212,7 +221,22 @@ class opendons_payment_batch(models.Model):
return True
+
+ def _compute_total(self):
+ total=0
+ i=0
+ for donation_id in self.donation_ids:
+
+ for line in donation_id.line_ids:
+ line_total = line.quantity * line.unit_price
+ total += line_total
+
+ i=i+1
+
+ self.amount_total= total
+ self.payment_count= i
+
class opendons_payment_batch_qrcode(models.Model):
_name = 'opendons.payment_batch_qrcode'
_description = 'store qrcode to avoid duplicate entries'
diff --git a/views/payment_batch.xml b/views/payment_batch.xml
index 186cd66..355ca12 100644
--- a/views/payment_batch.xml
+++ b/views/payment_batch.xml
@@ -51,6 +51,8 @@
+
+
@@ -62,7 +64,20 @@
-
+
+
+