|
@ -65,6 +65,8 @@ class opendons_payment_batch(models.Model): |
|
|
'payment_batch_id', |
|
|
'payment_batch_id', |
|
|
string='donation', |
|
|
string='donation', |
|
|
track_visibility='onchange') |
|
|
track_visibility='onchange') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@api.model |
|
|
@api.model |
|
|
def _default_currency(self): |
|
|
def _default_currency(self): |
|
@ -82,7 +84,7 @@ class opendons_payment_batch(models.Model): |
|
|
default=_default_currency |
|
|
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') |
|
|
payment_input=fields.Char('Input field') |
|
|
input_mode=fields.Selection([('manual','manual'),('loyalty','loyalty QRCODE'),('prospect','prospect QRCODE')]) |
|
|
input_mode=fields.Selection([('manual','manual'),('loyalty','loyalty QRCODE'),('prospect','prospect QRCODE')]) |
|
|
assignment=fields.Selection([('single','single'),('multiple','multiple')]) |
|
|
assignment=fields.Selection([('single','single'),('multiple','multiple')]) |
|
@ -99,6 +101,13 @@ class opendons_payment_batch(models.Model): |
|
|
default=lambda self: self.env.company |
|
|
default=lambda self: self.env.company |
|
|
|
|
|
|
|
|
) |
|
|
) |
|
|
|
|
|
amount_total = fields.Monetary( |
|
|
|
|
|
'Total amount', |
|
|
|
|
|
currency_field='currency_id',compute="_compute_total" |
|
|
|
|
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@api.onchange('operation_id') |
|
|
@api.onchange('operation_id') |
|
|
def _onchange_operation_id(self): |
|
|
def _onchange_operation_id(self): |
|
|
res = {} |
|
|
res = {} |
|
@ -212,7 +221,22 @@ class opendons_payment_batch(models.Model): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return True |
|
|
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): |
|
|
class opendons_payment_batch_qrcode(models.Model): |
|
|
_name = 'opendons.payment_batch_qrcode' |
|
|
_name = 'opendons.payment_batch_qrcode' |
|
|
_description = 'store qrcode to avoid duplicate entries' |
|
|
_description = 'store qrcode to avoid duplicate entries' |
|
|