commit
2b63e1eacd
|
|
@ -96,14 +96,19 @@ class SchedulingLine(models.Model):
|
|||
scheduled_lines = self.search([
|
||||
('scheduled_date', '<=', today),
|
||||
('status', '=', 'unpaid'),
|
||||
('sponsorship_state', 'not in', ['canceled', 'closed']),
|
||||
])
|
||||
|
||||
_logger.info(f"Found {len(scheduled_lines)} scheduling lines scheduled for {today}")
|
||||
|
||||
|
||||
for line in scheduled_lines:
|
||||
donation_line = line.donation_detail_linked_id
|
||||
sponsorship = donation_line.sponsorship_id or donation_line.sponsorship_mechanism_id
|
||||
|
||||
# Additional safety check: skip if sponsorship is canceled or closed
|
||||
if not sponsorship or sponsorship.state in ['canceled', 'closed']:
|
||||
_logger.warning(f"Skipping scheduled payment for line {line.sequence_no}: sponsorship state is {sponsorship.state if sponsorship else 'None'}")
|
||||
continue
|
||||
|
||||
try:
|
||||
if line.donation_detail_linked_id.direct_debit:
|
||||
invoice_id = self.env['account.move'].sudo().search([
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<field name="name">esterdad.wizard.tree</field>
|
||||
<field name="model">esterdad.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Esterdad Wizard" create="0" edit="0">
|
||||
<tree string="Esterdad Wizard" create="0" edit="0">
|
||||
<field name="amount"/>
|
||||
<field name="cancel_date"/>
|
||||
<field name="pay_date"/>
|
||||
|
|
@ -20,63 +20,68 @@
|
|||
<field name="model">esterdad.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Esterdad Wizard" create="0" edit="0">
|
||||
<group>
|
||||
<field name="amount"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="cancel_date" readonly="1"/>
|
||||
<field name="pay_date" readonly="1"/>
|
||||
<field name="cancel_reason"/>
|
||||
<field name="another_reason"/>
|
||||
<field name="reason" attrs="{'invisible': [('another_reason', '=', False)]}"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="بيانات المتبرع">
|
||||
<group>
|
||||
<field name="sponsor_name"/>
|
||||
<field name="mobile"/>
|
||||
<field name="id_num"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Payment Details" groups="odex_takaful.group_refund_approval">
|
||||
<field name="payment_ids">
|
||||
<tree editable="1">
|
||||
<field name="date" readonly="1"/>
|
||||
<field name="name" readonly="1"/>
|
||||
<field name="journal_id" readonly="1"/>
|
||||
<field name="payment_method_line_id" readonly="1"/>
|
||||
<field name="amount" sum="Amount"
|
||||
readonly="1"/>
|
||||
<field name="state" readonly="1"/>
|
||||
<field name="currency_id" groups="base.group_multi_currency"/>
|
||||
<field name="confirm_payment_refund"
|
||||
attrs="{'readonly': [('payment_method_line_id_type', '=', 'cash')]}"/>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="amount"/>
|
||||
<field name="confirmed" invisible="1"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="cancel_date" readonly="1"/>
|
||||
<field name="pay_date" readonly="1"/>
|
||||
<field name="cancel_reason"/>
|
||||
<field name="another_reason"/>
|
||||
<field name="reason" attrs="{'invisible': [('another_reason', '=', False)]}"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="بيانات المتبرع">
|
||||
<group>
|
||||
<field name="sponsor_name"/>
|
||||
<field name="mobile"/>
|
||||
<field name="id_num"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Payment Details" groups="odex_takaful.group_refund_approval">
|
||||
<field name="payment_ids">
|
||||
<tree editable="1">
|
||||
<field name="date" readonly="1"/>
|
||||
|
||||
<field name="IBN_number"
|
||||
attrs="{'readonly': [('payment_method_line_id_type', '=', 'cash')]}"/>
|
||||
<field name="name" readonly="1"/>
|
||||
<field name="journal_id" readonly="1"/>
|
||||
<field name="payment_method_line_id" readonly="1"/>
|
||||
<field name="amount" sum="Amount"
|
||||
readonly="1"/>
|
||||
<field name="state" readonly="1"/>
|
||||
<field name="currency_id" groups="base.group_multi_currency"/>
|
||||
<field name="confirm_payment_refund"
|
||||
attrs="{'readonly': [('payment_method_line_id_type', '=', 'cash')]}"/>
|
||||
|
||||
<field name="confirm_payment_refund_image"
|
||||
attrs="{'readonly': [('payment_method_line_id_type', '=', 'cash')]}"/>
|
||||
<field name="payment_method_line_id_type"/>
|
||||
<field name="IBN_number"
|
||||
attrs="{'readonly': [('payment_method_line_id_type', '=', 'cash')]}"/>
|
||||
|
||||
<field name="confirm_payment_refund_image"
|
||||
attrs="{'readonly': [('payment_method_line_id_type', '=', 'cash')]}"/>
|
||||
<field name="payment_method_line_id_type"/>
|
||||
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
<footer>
|
||||
<button string="Cancel"
|
||||
class="btn-secondary"
|
||||
special="cancel"
|
||||
attrs="{'invisible': [('confirmed', '=', True)]}"
|
||||
/>
|
||||
|
||||
<button name="action_confirm_refund"
|
||||
string="Confirm"
|
||||
type="object"
|
||||
attrs="{'invisible': [('confirmed', '=', True)]}"
|
||||
class="btn-primary"/>
|
||||
</footer>
|
||||
</sheet>
|
||||
</form>
|
||||
<footer>
|
||||
<button string="Cancel"
|
||||
class="btn-secondary"
|
||||
special="cancel"
|
||||
attrs="{'invisible': [('confirmed', '=', True)]}"
|
||||
/>
|
||||
|
||||
<button name="action_confirm_refund"
|
||||
string="Confirm"
|
||||
type="object"
|
||||
attrs="{'invisible': [('confirmed', '=', True)]}"
|
||||
class="btn-primary"/>
|
||||
</footer>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue