Merge pull request #5466 from expsa/replace_between_replace_wating
Replace between replace wating
This commit is contained in:
commit
8d9a557357
|
|
@ -102,11 +102,42 @@ class DonationsDetailsLines(models.Model):
|
|||
waiting_date = fields.Date(
|
||||
string="تاريخ الانتظار",
|
||||
)
|
||||
|
||||
actual_end_date = fields.Date(string="مدة الانتظار", compute='_compute_actual_end_date', store=True)
|
||||
period_display = fields.Char(
|
||||
string="Period",
|
||||
compute="_compute_period_display" )
|
||||
|
||||
age_category = fields.Selection([
|
||||
('18', '+18'),
|
||||
('16', '+16'),
|
||||
('all', 'جميع الأعمار'),
|
||||
], string="الفئة العمرية", compute="_compute_age_category")
|
||||
|
||||
@api.depends('sponsorship_duration', 'payment_month_count', 'direct_debit')
|
||||
def _compute_age_category(self):
|
||||
for rec in self:
|
||||
print( rec.sponsorship_duration , ' ' ,rec.direct_debit , ' ' , rec.payment_month_count)
|
||||
if rec.sponsorship_duration == 'permanent':
|
||||
rec.age_category = 'all'
|
||||
elif rec.sponsorship_duration != 'permanent' :
|
||||
if rec.direct_debit:
|
||||
rec.age_category = '16'
|
||||
elif rec.sponsorship_duration != 'permanent' and rec.payment_month_count >= 6:
|
||||
rec.age_category = 'all'
|
||||
elif rec.sponsorship_duration != 'permanent' and rec.payment_month_count < 6:
|
||||
rec.age_category = '18'
|
||||
else:
|
||||
rec.age_category = 'all'
|
||||
|
||||
@api.depends('benefit_ids.end_date')
|
||||
def _compute_actual_end_date(self):
|
||||
for rec in self:
|
||||
if rec.benefit_ids:
|
||||
# take the first benefit record
|
||||
first_benefit = rec.benefit_ids[0]
|
||||
rec.actual_end_date = first_benefit.end_date
|
||||
else:
|
||||
rec.actual_end_date = False
|
||||
@api.depends('end_date', 'waiting_date')
|
||||
def _compute_period_display(self):
|
||||
today = date.today()
|
||||
|
|
@ -879,7 +910,7 @@ class DonationsDetailsLines(models.Model):
|
|||
record = super(DonationsDetailsLines, self).create(vals)
|
||||
if record.benefit_ids == 1:
|
||||
record.benefit_id = record.benefit_ids[0].id
|
||||
|
||||
print('Vals >>> ' , vals)
|
||||
return record
|
||||
|
||||
def write(self, vals):
|
||||
|
|
|
|||
|
|
@ -810,7 +810,7 @@ class TakafulSponsorship(models.Model):
|
|||
sponsor_donor_type = vals.get('sponsor_donor_type')
|
||||
sponsor_id = vals.get('sponsor_id')
|
||||
state = vals.get('state', 'draft')
|
||||
|
||||
print('Vals >>> ' , vals)
|
||||
# Only validate when state is draft and saving (not during onchange)
|
||||
if state == 'draft':
|
||||
# Check for donation with new_sponsor
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
<field name="branch_custom_id" optional="hide" />
|
||||
<field name="benefit_family_code" optional="hide" />
|
||||
<field name="benefit_id" optional="hide" />
|
||||
<field name="sponsorship_creation_date" />
|
||||
<!-- <field name="sponsorship_creation_date" />-->
|
||||
<field name="create_date" optional="hide"/>
|
||||
<field name="waiting_date" widget="date" optional="hide"/>
|
||||
<field name="state" widget="badge"
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
decoration-success="state in ['active', 'paid','confirmed']"
|
||||
decoration-danger="state == 'closed'"
|
||||
decoration-info="state == 'extended'" />
|
||||
|
||||
<field name="age_category" widget="state" />
|
||||
<button name="action_view_scheduling_lines"
|
||||
string="View Scheduling Lines"
|
||||
type="object"
|
||||
|
|
@ -231,6 +231,7 @@
|
|||
<field name="donation_type"
|
||||
attrs="{'invisible': [('record_type', '!=', 'sponsorship')], 'readonly': ['|', ('record_type', '=', 'sponsorship'), ('parent_state', '!=', 'draft')]}"
|
||||
force_save="1" />
|
||||
<field name="age_category" widget="state" />
|
||||
<field name="direct_debit" invisible="1" />
|
||||
<field name="donation_types"
|
||||
attrs="{
|
||||
|
|
@ -379,16 +380,19 @@
|
|||
<field name="branch_custom_id" optional="hide" />
|
||||
<field name="benefit_family_code" optional="hide" />
|
||||
<field name="benefit_id" optional="hide" />
|
||||
<field name="sponsorship_creation_date" />
|
||||
<!-- <field name="sponsorship_creation_date" />-->
|
||||
<field name="create_date" optional="hide"/>
|
||||
<field name="waiting_date" widget="date" />
|
||||
<field name="period_display" />
|
||||
<field name="waiting_date" />
|
||||
<field name="waiting_date" string='مدة الانتظار' widget="remaining_days" />
|
||||
<!-- <field name="period_display" />-->
|
||||
<field name="state" widget="badge"
|
||||
decoration-muted="state == 'draft'"
|
||||
decoration-warning="state == 'waiting'"
|
||||
decoration-success="state in ['active', 'paid','confirmed']"
|
||||
decoration-danger="state == 'closed'"
|
||||
decoration-info="state == 'extended'" />
|
||||
<field name="age_category" widget="state" />
|
||||
|
||||
|
||||
<button name="action_view_scheduling_lines"
|
||||
string="View Scheduling Lines"
|
||||
|
|
@ -425,17 +429,17 @@
|
|||
<field name="branch_custom_id" optional="hide" />
|
||||
<field name="benefit_family_code" optional="hide" />
|
||||
<field name="benefit_id" optional="hide" />
|
||||
<field name="sponsorship_creation_date" />
|
||||
<!-- <field name="sponsorship_creation_date" />-->
|
||||
<field name="create_date" optional="hide"/>
|
||||
<field name="end_date" widget="date" />
|
||||
<field name="period_display" />
|
||||
<field name="actual_end_date" widget="date" string="تاريخ خروج المستفيد" />
|
||||
<field name="actual_end_date" widget="remaining_days" string="فترة الخروج" />
|
||||
<field name="state" widget="badge"
|
||||
decoration-muted="state == 'draft'"
|
||||
decoration-warning="state == 'waiting'"
|
||||
decoration-success="state in ['active', 'paid','confirmed']"
|
||||
decoration-danger="state == 'closed'"
|
||||
decoration-info="state == 'extended'" />
|
||||
|
||||
<field name="age_category" widget="state" />
|
||||
<button name="action_view_scheduling_lines"
|
||||
string="View Scheduling Lines"
|
||||
type="object"
|
||||
|
|
|
|||
Loading…
Reference in New Issue