Sponsor(task03)

This commit is contained in:
eman 2024-12-17 16:59:02 +02:00
parent 7f86abdb84
commit 5306cfd462
5 changed files with 342 additions and 199 deletions

View File

@ -43,6 +43,25 @@
<field eval="False" name="company_id"/>
<field name="padding">4</field>
</record>
<record id="sequence_point_of_sales_custom" model="ir.sequence">
<field name="name">Point Of Sale Sequence</field>
<field name="code">point.of.sale.sequence</field>
<field name="prefix">PO/</field>
<field eval="1" name="number_next"/>
<field eval="1" name="number_increment"/>
<field eval="True" name="use_date_range"/>
<field eval="False" name="company_id"/>
<field name="padding">4</field>
</record>
<record id="payment_details" model="ir.sequence">
<field name="name">Payment Details Sequence</field>
<field name="code">payment.details.sequence</field>
<field name="prefix">Payment/</field>
<field eval="1" name="number_next"/>
<field eval="1" name="number_increment"/>
<field eval="True" name="use_date_range"/>
<field eval="False" name="company_id"/>
<field name="padding">4</field>
</record>
</data>
</odoo>

View File

@ -4,9 +4,28 @@ from odoo import api, fields, models, _
class DonationsItems(models.Model):
_name = "donations.items"
_description = "DonationsItems"
_description = "Donation Items"
name = fields.Char(string="Donation Name")
donation_type = fields.Selection([('donation', 'Donation'),('waqf', 'Waqf'),('sponsorship', 'Sponsorship'),], string='Donation Type')
branch_custom_id = fields.Many2one('branch.settings', string="Branch")
show_donation_item = fields.Boolean(string='Show Donation Item')
show_donation_item = fields.Boolean(string='Show Donation Item')
fixed_value = fields.Boolean(string='Is Fixed Value?')
fixed_donation_amount = fields.Float(string='Donation Amount')
account_id = fields.Many2one('account.account', string="Account",domain="[('user_type_id.id','=',13)]")
class PointsOfSaleCustom(models.Model):
_name = "points.of.sale.custom"
_description = "Points Of Sale Custom"
name = fields.Char(string="Sequence/Point Name",readonly=True)
department_name = fields.Selection([('men', 'Men'),('women', 'Women')], string='Department Name')
branch_custom_id = fields.Many2one('branch.settings', string="Branch")
journal_id = fields.Many2one('account.journal', string="Journal",domain="[('type','=','bank')]")
@api.model
def create(self, vals):
res = super(PointsOfSaleCustom, self).create(vals)
if not res.name or res.name == _('New'):
res.name = self.env['ir.sequence'].sudo().next_by_code('point.of.sale.sequence') or _('New')
return res

View File

@ -9,11 +9,6 @@ from datetime import timedelta
from dateutil.relativedelta import relativedelta
from dateutil.parser import parse
import logging
_logger = logging.getLogger(__name__)
def trunc_datetime(someDate):
# Compare two dates based on Month and Year only
return someDate.replace(day=1, hour=0, minute=0, second=0, microsecond=0)
@ -46,12 +41,7 @@ class TakafulSponsorship(models.Model):
sponsor_id = fields.Many2one('takaful.sponsor',string='Sponsor Name',domain="[('branch_custom_id', '=', branch_custom_id),('branch_custom_id','!=',False)]")
member_id = fields.Many2one('res.partner',string='Member Name',domain="[('is_member', '=', True)]")
is_gift = fields.Selection([
('no', 'No'),
('yes', 'Yes')],
string='Is Gift To Person',
)
is_gift = fields.Selection([('no', 'No'),('yes', 'Yes')],string='Is Gift To Person')
gifter_id = fields.Many2one(
'takaful.sponsor',
string='The Gifter To'
@ -61,10 +51,7 @@ class TakafulSponsorship(models.Model):
gifter_message = fields.Text(string='Message To Gifter')
sponsorship_type = fields.Selection([('person', 'Individual'),('group', 'Group')],string='Sponsorship Type',tracking=True)
code = fields.Char(string="Code",
copy=False,
readonly=True)
code = fields.Char(string="Code",copy=False,readonly=True)
benefit_type = fields.Selection([('orphan', 'Orphans'),('widow', 'Widows')],string='Sponsorship Beneficiary Type',tracking=True)
branch_custom_id = fields.Many2one('branch.settings', string="Branch")
sponsorship_creation_date = fields.Datetime(string="Sponsorship Creation Date", default=fields.Datetime.now)
@ -79,14 +66,11 @@ class TakafulSponsorship(models.Model):
members_domain_ids = fields.Many2many(comodel_name='family.member', compute='_compute_domain_ids')
# This is if for one person, and not a group.
benefit_id = fields.Many2one('family.member',string='Beneficiary Name',ondelete='set null',domain = "[('id', 'in',members_domain_ids)]")
family_id = fields.Many2one(
'grant.benefit',
string='Family',
ondelete='set null',related="benefit_id.benefit_id"
)
family_id = fields.Many2one('grant.benefit',string='Family',ondelete='set null',related="benefit_id.benefit_id")
education_status = fields.Selection(string='Education Status',selection=[('educated', 'educated'), ('illiterate', 'illiterate'),('under_study_age','Under Study Age')])
education_level = fields.Many2one("education.level", string='Education Levels')
sponsorship_duration = fields.Selection([('temporary', 'Temporary'),('permanent', 'Permanent')],string='Sponsorship Duration',required=True,default='permanent',tracking=True)
sponsorship_duration = fields.Selection([('temporary', 'Temporary'),('permanent', 'Permanent')],string='Sponsorship Duration',default='permanent',tracking=True)
total_sponsorship_amount = fields.Float(string='Total Sponsorship Amount',compute='_get_total_sponsorship_amount')
supporter_status = fields.Selection([
('no', 'Not Exist'),
('yes', 'Exist')],
@ -97,6 +81,28 @@ class TakafulSponsorship(models.Model):
has_needs = fields.Boolean(store=True)
donations_details_lines = fields.One2many('donations.details.lines','sponsorship_id')
payment_details_lines = fields.One2many('payment.details.lines','sponsorship_id')
@api.constrains('payment_details_lines')
def check_payment_amount(self):
total_amount = 0
for rec in self.payment_details_lines:
total_amount += rec.donation_amount
if total_amount != self.total_sponsorship_amount:
raise ValidationError(
_('Total Payment Amount Should be Total Sponsorship Amount'))
@api.constrains('donations_details_lines')
def check_donation_types(self):
# Search for an existing record
record_exist = self.env["donations.details.lines"].search(
[('donation_type', '=', 'sponsorship'),
('sponsorship_id', '=', self.id)],
)
# Raise error if record already exists
if record_exist and len(record_exist) > 1:
raise ValidationError(_("You cannot Add more than one sponsorship"))
@api.constrains('end_date')
def check_end_date(self):
@ -122,6 +128,16 @@ class TakafulSponsorship(models.Model):
rec.supporter_status = 'no'
else:
rec.supporter_status = ''
@api.depends('donations_details_lines')
def _get_total_sponsorship_amount(self):
for rec in self:
rec.total_sponsorship_amount = sum(line.donation_amount for line in rec.donations_details_lines)
@api.onchange('donations_details_lines')
def onchange_donations_details_lines(self):
for rec in self:
rec.benefit_ids = rec.donations_details_lines.benefit_ids.ids
@api.depends('gender','education_status','education_level','sponsorship_type','benefit_type','age_category_id')
def _compute_domain_ids(self):
# Create a domain
@ -212,7 +228,7 @@ class TakafulSponsorship(models.Model):
city_id = fields.Many2one(
'res.country.city',string='District')
benefit_count = fields.Integer(string='Sponsorship Beneficiaries Number')
benefit_count = fields.Integer(string='Sponsorship Beneficiaries Number',compute="_get_benefits_count")
start_date = fields.Date(string="Sponsorship Start Date", copy=False)
end_date = fields.Date(string="Sponsorship End Date")
@ -226,10 +242,7 @@ class TakafulSponsorship(models.Model):
string='Sponsorship Beneficiaries Classification',
tracking=True
)
benefit_ids = fields.Many2many(
'family.member',
string='Beneficiaries Names',
)
benefit_ids = fields.Many2many('family.member',string='Beneficiaries Names')
with_orphan_ids = fields.Many2many(
'grant.benefit',relation='takaful_sponsor_grant_benefit_rel',
@ -268,9 +281,7 @@ class TakafulSponsorship(models.Model):
due_days = fields.Integer(string='Overdue in Days',
compute='_check_if_has_delay', store=True)
contribution_value = fields.Float(string="Contribution Value")
load_amount = fields.Float(string="Load Amount Per Person",
compute='_compute_load_amount')
load_amount = fields.Float(string="Load Amount Per Person")
total_contribution = fields.Float(string="Contributions Total",
compute='calculate_total_paid')
@ -297,15 +308,19 @@ class TakafulSponsorship(models.Model):
voucher_ids = fields.One2many('account.move','sponsorship_id',string='Vouchers', copy=False)
# payment_ids = fields.One2many('account.payment','sponsorship_id',string='Payments', copy=False)
@api.depends('contribution_value', 'benefit_ids', 'sponsorship_type')
def _compute_load_amount(self):
""" Calculate load amount of sponsorship for a person """
# @api.depends('contribution_value', 'benefit_ids', 'sponsorship_type')
# def _compute_load_amount(self):
# """ Calculate load amount of sponsorship for a person """
# for rec in self:
# if rec.benefit_ids and rec.contribution_value > 0 and rec.sponsorship_type == 'group':
# rec.load_amount = float(
# rec.contribution_value / len(rec.benefit_ids))
# else:
# rec.load_amount = rec.contribution_value
@api.depends('benefit_ids')
def _get_benefits_count(self):
for rec in self:
if rec.benefit_ids and rec.contribution_value > 0 and rec.sponsorship_type == 'group':
rec.load_amount = float(
rec.contribution_value / len(rec.benefit_ids))
else:
rec.load_amount = rec.contribution_value
rec.benefit_count = len(rec.benefit_ids)
def voucher_total_paid(self):
self.total_voucher = len(self.voucher_ids)
@ -542,19 +557,19 @@ class TakafulSponsorship(models.Model):
rec.due_days = 0
# On Change
@api.onchange('sponsorship_class', 'sponsorship_type', 'benefit_id', 'benefit_ids')
def sponsorship_fully_value(self):
if self.sponsorship_class == 'fully' and self.benefit_ids and self.sponsorship_type == 'group':
self.update({'contribution_value': sum(
self.benefit_ids.mapped('benefit_needs_value'))})
elif self.sponsorship_class == 'fully' and self.benefit_id and self.sponsorship_type == 'person':
self.update(
{'contribution_value': self.benefit_id.benefit_needs_value})
else:
self.update({'contribution_value': 0})
# @api.onchange('sponsorship_class', 'sponsorship_type', 'benefit_id', 'benefit_ids')
# def sponsorship_fully_value(self):
# if self.sponsorship_class == 'fully' and self.benefit_ids and self.sponsorship_type == 'group':
# self.update({'contribution_value': sum(
# self.benefit_ids.mapped('benefit_needs_value'))})
# elif self.sponsorship_class == 'fully' and self.benefit_id and self.sponsorship_type == 'person':
# self.update(
# {'contribution_value': self.benefit_id.benefit_needs_value})
# else:
# self.update({'contribution_value': 0})
@api.constrains('contribution_value')
def check_contribution_value(self):
# @api.constrains('contribution_value')
# def check_contribution_value(self):
# if not self.sponsor_id:
# raise ValidationError(
# _(u'Please Select The Sponsor'))
@ -578,28 +593,28 @@ class TakafulSponsorship(models.Model):
# if not self.benefit_id and self.sponsorship_type == 'person':
# raise ValidationError(
# _(u'Please Select a Beneficiary For Sponsorship Person'))
if len(self.benefit_ids) < 2 and self.sponsorship_type == 'group':
raise ValidationError(
_(u'Please Select At least Two Beneficiaries For Sponsorship Group'))
if self.sponsorship_class == 'partial':
default_sponsorship = int(
self.env['ir.config_parameter'].sudo().get_param('odex_takaful_base.min_kafala', 0))
if self.benefit_ids and self.sponsorship_type == 'group':
benefit_count = len(self.benefit_ids)
else:
benefit_count = 1
if default_sponsorship <= 0:
raise ValidationError(
_(u'Min kafala value should be defined by administration'))
total_sponsorship = default_sponsorship * benefit_count
if self.contribution_value < total_sponsorship:
raise ValidationError(
_(u'Kafala value should be equal or greater than') + ' ' + str(total_sponsorship))
#
# if len(self.benefit_ids) < 2 and self.sponsorship_type == 'group':
# raise ValidationError(
# _(u'Please Select At least Two Beneficiaries For Sponsorship Group'))
#
# if self.sponsorship_class == 'partial':
# default_sponsorship = int(
# self.env['ir.config_parameter'].sudo().get_param('odex_takaful_base.min_kafala', 0))
#
# if self.benefit_ids and self.sponsorship_type == 'group':
# benefit_count = len(self.benefit_ids)
# else:
# benefit_count = 1
#
# if default_sponsorship <= 0:
# raise ValidationError(
# _(u'Min kafala value should be defined by administration'))
#
# total_sponsorship = default_sponsorship * benefit_count
# if self.contribution_value < total_sponsorship:
# raise ValidationError(
# _(u'Kafala value should be equal or greater than') + ' ' + str(total_sponsorship))
# Model Operations
@api.model
@ -1048,83 +1063,144 @@ class DonationsDetailsLines(models.Model):
sponsorship_id = fields.Many2one('takaful.sponsorship', string="Sponsorship")
donation_amount = fields.Float(string='Donation Amount')
donation_mechanism = fields.Selection([('with_conditions', 'With Conditions'),('without_conditions', 'Without Conditions')],string='Donation Mechanism')
benefit_type = fields.Selection([('orphan', 'Orphans'),('widow', 'Widows'),('both', 'Both')],required=True,string='Sponsorship Beneficiary Type',tracking=True)
benefit_type = fields.Selection([('orphan', 'Orphans'),('widow', 'Widows'),('both', 'Both')],string='Sponsorship Beneficiary Type',tracking=True)
sponsorship_type = fields.Selection([('person', 'Individual'),('group', 'Group')],string='Sponsorship Type',tracking=True)
gender = fields.Selection(selection=[('male', 'Male'), ('female', 'Female')], string="Gender")
age_category_id = fields.Many2one('age.category', string='Age Category')
education_status = fields.Selection(string='Education Status',selection=[('educated', 'educated'), ('illiterate', 'illiterate'),('under_study_age', 'Under Study Age')])
education_level = fields.Many2one("education.level", string='Education Levels')
benefit_id = fields.Many2one('family.member',string='Beneficiary Name',ondelete='set null',domain = "[('id', 'in',members_domain_ids)]")
family_id = fields.Many2one('grant.benefit',string='Family',ondelete='set null',related="benefit_id.benefit_id")
members_domain_ids = fields.Many2many(comodel_name='family.member', compute='_compute_domain_ids')
benefit_ids = fields.Many2many('family.member',string='Beneficiaries Names')
sponsorship_duration = fields.Selection([('temporary', 'Temporary'),('permanent', 'Permanent')],string='Sponsorship Duration',default='permanent',tracking=True)
start_date = fields.Date(string="Sponsorship Start Date", copy=False)
end_date = fields.Date(string="Sponsorship End Date")
payment_option = fields.Selection([('month', 'Monthly'),('once', 'For Once')], string='Payment Option', default='month')
fixed_value = fields.Boolean(string='Is Fixed Value?',related='donation_name.fixed_value')
@api.depends('gender', 'education_status', 'education_level', 'sponsorship_type', 'benefit_type', 'age_category_id')
def _compute_domain_ids(self):
# Create a domain
self.members_domain_ids = [(6, 0, [])]
if self.benefit_type == 'orphan' and self.sponsorship_type:
base_domain = \
[
('state', 'in', ['second_approve', 'temporarily_suspended', 'suspended_first_approve']),
('member_status', '=', 'benefit'),
'|',
('relationn.relation_type', '=', 'daughter'),
('relationn.relation_type', '=', 'son')
]
if self.gender:
if self.gender == 'female':
base_domain = [
('state', 'in', ('second_approve', 'temporarily_suspended', 'suspended_first_approve')),
('member_status', '=', 'benefit'), ('relationn.relation_type', '=', 'daughter')]
if self.gender == 'male':
base_domain = [
('state', 'in', ('second_approve', 'temporarily_suspended', 'suspended_first_approve')),
('member_status', '=', 'benefit'), ('relationn.relation_type', '=', 'son')]
if self.education_status:
base_domain.append(('education_status', '=', self.education_status))
if self.education_level:
base_domain.append(('education_levels', '=', self.education_level.id))
if self.age_category_id:
base_domain.append(('age', '<=', self.age_category_id.max_age))
base_domain.append(('age', '>=', self.age_category_id.min_age))
self.members_domain_ids = self.env['family.member'].sudo().search(base_domain)
domain = {'benefit_id': [('id', 'in', self.members_domain_ids.ids)]}
return {'domain': domain}
if self.benefit_type == 'widow' and self.sponsorship_type:
base_domain = [('state', 'in', ['second_approve', 'temporarily_suspended', 'suspended_first_approve']),
('member_status', '=', 'benefit'), '|', ('relationn.relation_type', '=', 'mother'),
('relationn.relation_type', '=', 'replacement_mother')]
if self.education_status:
base_domain.append(('education_status', '=', self.education_status))
if self.education_level:
base_domain.append(('education_levels', '=', self.education_level.id))
if self.age_category_id:
base_domain.append(('age', '<=', self.age_category_id.max_age))
base_domain.append(('age', '>=', self.age_category_id.min_age))
self.members_domain_ids = self.env['family.member'].sudo().search(base_domain)
domain = {'benefit_id': [('id', 'in', self.members_domain_ids.ids)]}
return {'domain': domain}
if self.benefit_type == 'both' and self.sponsorship_type:
base_domain = [('state', 'in', ['second_approve', 'temporarily_suspended', 'suspended_first_approve']),
('member_status', '=', 'benefit')]
if self.education_status:
base_domain.append(('education_status', '=', self.education_status))
if self.education_level:
base_domain.append(('education_levels', '=', self.education_level.id))
if self.age_category_id:
base_domain.append(('age', '<=', self.age_category_id.max_age))
base_domain.append(('age', '>=', self.age_category_id.min_age))
self.members_domain_ids = self.env['family.member'].sudo().search(base_domain)
domain = {'benefit_id': [('id', 'in', self.members_domain_ids.ids)]}
return {'domain': domain}
for rec in self:
# Create a domain
rec.members_domain_ids = [(6, 0, [])]
if rec.benefit_type == 'orphan' and rec.sponsorship_type:
base_domain = \
[
('state', 'in', ['second_approve', 'temporarily_suspended', 'suspended_first_approve']),
('member_status', '=', 'benefit'),
'|',
('relationn.relation_type', '=', 'daughter'),
('relationn.relation_type', '=', 'son')
]
if rec.gender:
if rec.gender == 'female':
base_domain = [
('state', 'in', ('second_approve', 'temporarily_suspended', 'suspended_first_approve')),
('member_status', '=', 'benefit'), ('relationn.relation_type', '=', 'daughter')]
if rec.gender == 'male':
base_domain = [
('state', 'in', ('second_approve', 'temporarily_suspended', 'suspended_first_approve')),
('member_status', '=', 'benefit'), ('relationn.relation_type', '=', 'son')]
if rec.education_status:
base_domain.append(('education_status', '=', rec.education_status))
if rec.education_level:
base_domain.append(('education_levels', '=', rec.education_level.id))
if rec.age_category_id:
base_domain.append(('age', '<=', rec.age_category_id.max_age))
base_domain.append(('age', '>=', rec.age_category_id.min_age))
rec.members_domain_ids = self.env['family.member'].sudo().search(base_domain)
domain = {'benefit_id': [('id', 'in', rec.members_domain_ids.ids)]}
return {'domain': domain}
if rec.benefit_type == 'widow' and rec.sponsorship_type:
base_domain = [('state', 'in', ['second_approve', 'temporarily_suspended', 'suspended_first_approve']),
('member_status', '=', 'benefit'), '|', ('relationn.relation_type', '=', 'mother'),
('relationn.relation_type', '=', 'replacement_mother')]
if rec.education_status:
base_domain.append(('education_status', '=', rec.education_status))
if rec.education_level:
base_domain.append(('education_levels', '=', rec.education_level.id))
if rec.age_category_id:
base_domain.append(('age', '<=', rec.age_category_id.max_age))
base_domain.append(('age', '>=', rec.age_category_id.min_age))
rec.members_domain_ids = self.env['family.member'].sudo().search(base_domain)
domain = {'benefit_id': [('id', 'in', rec.members_domain_ids.ids)]}
return {'domain': domain}
if rec.benefit_type == 'both' and rec.sponsorship_type:
base_domain = [('state', 'in', ['second_approve', 'temporarily_suspended', 'suspended_first_approve']),
('member_status', '=', 'benefit')]
if rec.education_status:
base_domain.append(('education_status', '=', rec.education_status))
if rec.education_level:
base_domain.append(('education_levels', '=', rec.education_level.id))
if rec.age_category_id:
base_domain.append(('age', '<=', rec.age_category_id.max_age))
base_domain.append(('age', '>=', rec.age_category_id.min_age))
rec.members_domain_ids = self.env['family.member'].sudo().search(base_domain)
domain = {'benefit_id': [('id', 'in', rec.members_domain_ids.ids)]}
return {'domain': domain}
@api.onchange('donation_name')
def onchange_donation_name(self):
for rec in self:
if rec.donation_name.fixed_value:
rec.donation_amount = rec.donation_name.fixed_donation_amount
@api.onchange('donation_type')
def onchange_donation_type(self):
for rec in self:
if rec.donation_type == 'sponsorship':
rec.donation_mechanism = 'with_conditions'
# if not rec.sponsorship_id:
# raise ValidationError(_("Sponsorship ID must be set for sponsorship donations."))
#
# # Search for an existing record
# record_exist = self.env["donations.details.lines"].search(
# [('donation_type', '=', 'sponsorship'),
# ('sponsorship_id', '=', rec.sponsorship_id.id)],
# limit=1
# )
#
# # Raise error if record already exists
# if record_exist:
# raise ValidationError(_("A donation with the same sponsorship ID already exists."))
class PaymentDetailsLines(models.Model):
_name = "payment.details.lines"
payment_method = fields.Selection(selection=[("cash", "Cash"),("card", "Card"),("check", "Check"),("credit_card", "Credit Card")])
donation_amount = fields.Float(string='Donation Amount')
donation_date = fields.Date(string='Donation Date',default=lambda self: fields.Date.today())
note = fields.Char(string='Note')
journal_id = fields.Many2one('account.journal', string="Journal")
points_of_sale = fields.Many2one('points.of.sale.custom', string="Point OF sale")
sponsorship_id = fields.Many2one('takaful.sponsorship')
bank_id = fields.Many2one('res.partner.bank',string="Sponsorship Bank")
charity_journal_id = fields.Many2one('account.journal', string="charity Bank",related = 'points_of_sale.journal_id')
name = fields.Char(string="Ref.",readonly=True)
check_number = fields.Char(string='Check Number')
account_payment_method = fields.Many2one('account.payment.method.line',domain="[('payment_type','=','inbound')]",string='Account Payment Method')
@api.model
def create(self, vals):
res = super(PaymentDetailsLines, self).create(vals)
if not res.name or res.name == _('New'):
res.name = self.env['ir.sequence'].sudo().next_by_code('payment.details.sequence') or _('New')
return res
@api.onchange('journal_id')
def onchange_journal_id(self):
for rec in self:
# Build the dynamic domain
domain = []
if rec.payment_method == 'cash':
domain = [
('type','=','cash')
]
if rec.payment_method == 'check':
domain = [
'|',('type', '=', 'cash'),('type', '=', 'bank')
]
return {'domain': {'journal_id': domain}}

View File

@ -22,3 +22,5 @@ access_sponsorship_reason_stop,Full access on sponsorship.reason.stop,model_spon
access_donate_for_another_person,access_donate_for_another_person,model_donate_for_another_person,odex_takaful.group_kufula_viewer,1,1,1,1
access_donations_items,access_donations_items,model_donations_items,odex_takaful.group_kufula_viewer,1,1,1,1
access_donations_details_lines,access_donations_details_lines,model_donations_details_lines,odex_takaful.group_kufula_viewer,1,1,1,1
access_points_of_sale_custom,access_points_of_sale_custom,model_points_of_sale_custom,odex_takaful.group_kufula_viewer,1,1,1,1
access_payment_details_lines,access_payment_details_lines,model_payment_details_lines,odex_takaful.group_kufula_viewer,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
22 access_donate_for_another_person access_donate_for_another_person model_donate_for_another_person odex_takaful.group_kufula_viewer 1 1 1 1
23 access_donations_items access_donations_items model_donations_items odex_takaful.group_kufula_viewer 1 1 1 1
24 access_donations_details_lines access_donations_details_lines model_donations_details_lines odex_takaful.group_kufula_viewer 1 1 1 1
25 access_points_of_sale_custom access_points_of_sale_custom model_points_of_sale_custom odex_takaful.group_kufula_viewer 1 1 1 1
26 access_payment_details_lines access_payment_details_lines model_payment_details_lines odex_takaful.group_kufula_viewer 1 1 1 1

View File

@ -71,19 +71,20 @@
<field name="sponsor_phone" attrs="{'invisible': [('sponsor_or_donor_type','!=','not_registered'),('sponsor_or_donor_type','!=','unknown')]}"/>
<field name="sponsor_id" attrs="{'invisible': ['|',('sponsor_or_donor_type','!=','new_sponsor'),('sponsor_or_donor_type','!=','registered'),('registered_type','=','member')],'required':[('state','!=','draft')],'readonly':[('sponsor_or_donor_type','=','new_sponsor')]}" force_save="1"/>
<field name="member_id" attrs="{'invisible': [('registered_type','!=','member')]}"/>
<field name="sponsorship_type"/>
<field name="benefit_type"/>
<field name="sponsorship_class"/>
<!-- <field name="sponsorship_type"/>-->
<!-- <field name="benefit_type"/>-->
<!-- <field name="sponsorship_class"/>-->
<field name="is_widow_orphan" invisible="1"/>
<field name="gender"/>
<field name="age_category_id"/>
<field name="education_status"/>
<field name="education_level"/>
<field name="payment_option"/>
<field name="payment_journal_id" required="1" />
<field name="payment_method"/>
<!-- <field name="gender"/>-->
<!-- <field name="age_category_id"/>-->
<!-- <field name="education_status"/>-->
<!-- <field name="education_level"/>-->
<!-- <field name="payment_option"/>-->
<!-- <field name="payment_journal_id" required="1" />-->
<!-- <field name="payment_method"/>-->
<field name="total_sponsorship_amount"/>
<field name="has_delay" invisible="1"/>
<field name="members_domain_ids" invisible="1"/>
</group>
@ -91,63 +92,63 @@
<group name="group_right">
<field name="sponsorship_creation_date" />
<field name="sponsor_note" />
<div attrs="{'invisible': [('sponsorship_type', '!=', 'person')]}">
<!-- <div attrs="{'invisible': [('sponsorship_type', '!=', 'person')]}">-->
<label for="benefit_id" string="The Orphan" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'person'), ('benefit_type', '!=', 'orphan')]}" style="font-weight: bold;"/>
<!-- <label for="benefit_id" string="The Orphan" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'person'), ('benefit_type', '!=', 'orphan')]}" style="font-weight: bold;"/>-->
<label for="benefit_id" string="The Widow" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'person'), ('benefit_type', '!=', 'widow')]}" style="font-weight: bold;"/>
<!-- <label for="benefit_id" string="The Widow" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'person'), ('benefit_type', '!=', 'widow')]}" style="font-weight: bold;"/>-->
</div>
<!-- </div>-->
<field style="width: 290px; margin-right: 10px;" name="benefit_id" nolabel="1" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'person'), ('benefit_type', '=', False)]}"/>
<!-- <field style="width: 290px; margin-right: 10px;" name="benefit_id" nolabel="1" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'person'), ('benefit_type', '=', False)]}"/>-->
<div attrs="{'invisible': [('sponsorship_type', '!=', 'group')]}">
<!-- <div attrs="{'invisible': [('sponsorship_type', '!=', 'group')]}">-->
<label for="benefit_count" string="Number Of Sponsorship Orphans" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'group'), ('benefit_type', '!=', 'orphan')]}" style="font-weight: bold;"/>
<label for="benefit_count" string="Number Of Sponsorship Orphans and Widows" style="font-weight: bold;"/>
<label for="benefit_count" string="Number Of Sponsorship Widows" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'group'), ('benefit_type', '!=', 'widow')]}" style="font-weight: bold;"/>
<!-- <label for="benefit_count" string="Number Of Sponsorship Widows" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'group'), ('benefit_type', '!=', 'widow')]}" style="font-weight: bold;"/>-->
</div>
<!-- </div>-->
<field style="width: 290px; margin-right: 10px;" name="benefit_count" nolabel="1" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'group'), ('benefit_type', '=', False)]}"/>
<field style="width: 290px; margin-right: 10px;" name="benefit_count" nolabel="1"/>
<label for="min_needs_percent" string="Needs Percentage From" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'group'), ('benefit_type', '=', False)]}"/>
<!-- <label for="min_needs_percent" string="Needs Percentage From" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'group'), ('benefit_type', '=', False)]}"/>-->
<div class="oe_inline">
<!-- <div class="oe_inline">-->
<field name="min_needs_percent" placeholder="Min Value" nolabel="1" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'group'), ('benefit_type', '=', False)]}"/>
<!-- <field name="min_needs_percent" placeholder="Min Value" nolabel="1" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'group'), ('benefit_type', '=', False)]}"/>-->
<field name="max_needs_percent" placeholder="Max Value" nolabel="1" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'group'), ('benefit_type', '=', False)]}"/>
<!-- <field name="max_needs_percent" placeholder="Max Value" nolabel="1" attrs="{'invisible': ['|',('sponsorship_type', '!=', 'group'), ('benefit_type', '=', False)]}"/>-->
</div>
<field name="family_id"/>
<field name="city_id" attrs="{'invisible': [('sponsorship_type', '!=', 'person')]}"/>
<field name="sponsorship_duration" />
<field name="start_date" />
<field name="end_date" />
<field name="supporter_status" attrs="{'invisible': [('sponsorship_type', '!=', 'person')]}"/>
<!-- </div>-->
<!-- <field name="family_id"/>-->
<field name="city_id"/>
<!-- <field name="sponsorship_duration" />-->
<!-- <field name="start_date" />-->
<!-- <field name="end_date" />-->
<!-- <field name="supporter_status" attrs="{'invisible': [('sponsorship_type', '!=', 'person')]}"/>-->
</group>
</group>
<group>
<label for="contribution_value" />
<div>
<field name="contribution_value" class="oe_inline" style="margin-right:50px;" attrs="{'readonly': [('sponsorship_class', '=', 'fully')]}" force_save="1"/>
<span class="oe_inline text-muted"> Riyal</span>
</div>
<!-- <label for="contribution_value" />-->
<!-- <div>-->
<!-- <field name="contribution_value" class="oe_inline" style="margin-right:50px;" attrs="{'readonly': [('sponsorship_class', '=', 'fully')]}" force_save="1"/>-->
<!-- <span class="oe_inline text-muted"> Riyal</span>-->
<!-- </div>-->
<field name="is_gift" invisible="1"/>
</group>
<group attrs="{'invisible': [('sponsorship_type', '!=', 'group')]}">
<label for="load_amount" />
<div>
<field name="load_amount" class="oe_inline" style="margin-right:50px;" readonly="1" force_save="1"/>
<span class="oe_inline text-muted"> Riyal</span>
</div>
</group>
<!-- <group>-->
<!-- <label for="load_amount" />-->
<!-- <div>-->
<!-- <field name="load_amount" class="oe_inline" style="margin-right:50px;" readonly="1" force_save="1"/>-->
<!-- <span class="oe_inline text-muted"> Riyal</span>-->
<!-- </div>-->
<!-- </group>-->
<group>
<field name="donate_for_another_person"/>
</group>
@ -164,21 +165,12 @@
<field name="reason" readonly="1" attrs="{'invisible': [('state', '!=', 'canceled')]}" style="color: red;"/>
</group>
<group string="Orphans List" attrs="{'invisible': ['|', ('sponsorship_type', '!=', 'group'), ('benefit_type', '!=', 'orphan')]}">
<field name="benefit_ids" nolabel="1" domain="[('id', 'in', members_domain_ids)]"/>
</group>
<group string="Widows List" attrs="{'invisible': ['|', ('sponsorship_type', '!=', 'group'), ('benefit_type', '!=', 'widow')]}">
<field name="benefit_ids" nolabel="1" domain="[('id', 'in', members_domain_ids)]"/>
</group>
<group string="Sponsored Orphans Names" attrs="{'invisible': [('is_widow_orphan', '=', False)]}" >
<field name="with_orphan_ids" readonly="1" widget="many2many" nolabel="1" attrs="{'invisible': [('is_widow_orphan', '=', False)]}"/>
<group string="Orphans and Widow List">
<field name="benefit_ids" nolabel="1" domain="[('id', 'in', members_domain_ids)]" readonly="1" force_save="1"/>
</group>
<!-- <group string="Sponsored Orphans Names" attrs="{'invisible': [('is_widow_orphan', '=', False)]}" >-->
<!-- <field name="with_orphan_ids" readonly="1" widget="many2many" nolabel="1" attrs="{'invisible': [('is_widow_orphan', '=', False)]}"/>-->
<!-- </group>-->
<group>
<notebook>
<page string="Another Sponsors" attrs="{'invisible':[('donate_for_another_person','=',False)]}">
@ -197,30 +189,32 @@
<group>
<field name="donation_type"/>
<field name="sponsorship_duration" attrs="{'invisible': [('donation_type','!=','sponsorship')]}"/>
<field name="start_date" attrs="{'invisible': [('sponsorship_duration','=','permanent')]}"/>
<field name="end_date" attrs="{'invisible': [('sponsorship_duration','=','permanent')]}"/>
<field name="start_date" attrs="{'invisible': ['|',('sponsorship_duration','!=','temporary'),('donation_type','!=','sponsorship')]}"/>
<field name="end_date" attrs="{'invisible': ['|',('sponsorship_duration','!=','temporary'),('donation_type','!=','sponsorship')]}"/>
</group>
<group>
<field name="donation_name"/>
<field name="donation_mechanism" attrs="{'invisible':[('donation_type','=','waqf')],'readonly': [('donation_type','=','sponsorship')]}" force_save="1"/>
<field name="payment_option" attrs="{'invisible': [('donation_type','!=','sponsorship')]}"/>
<field name="donation_amount"/>
<field name="fixed_value" invisible="1"/>
<field name="donation_amount" attrs="{'readonly':[('fixed_value','=',True)]}" force_save="1"/>
</group>
</group>
<group>
<group attrs="{'invisible': ['|',('donation_mechanism','!=','with_conditions'),('donation_type','=','waqf')]}">
<group>
<h3> Benefit Details</h3>
<field name="members_domain_ids" invisible="1"/>
<field name="benefit_type"/>
<field name="sponsorship_type"/>
<field name="gender"/>
<field name="age_category_id"/>
<field name="education_status"/>
<field name="education_level"/>
<field name="benefit_type" attrs="{'invisible': [('donation_mechanism','!=','with_conditions')]}"/>
<field name="sponsorship_type" attrs="{'invisible': [('donation_mechanism','!=','with_conditions')]}"/>
<field name="gender" attrs="{'invisible': [('donation_mechanism','!=','with_conditions')]}"/>
<field name="age_category_id" attrs="{'invisible': [('donation_mechanism','!=','with_conditions')]}"/>
<field name="education_status" attrs="{'invisible': [('donation_mechanism','!=','with_conditions')]}"/>
<field name="education_level" attrs="{'invisible': [('donation_mechanism','!=','with_conditions')]}"/>
</group>
<group>
<br/>
<field name="benefit_id" attrs="{'invisible': [('sponsorship_type','!=','person')]}"/>
<field name="family_id" attrs="{'invisible': [('sponsorship_type','!=','person')]}"/>
</group>
</group>
<group string="Orphans List" attrs="{'invisible': ['|', ('sponsorship_type', '!=', 'group'), ('benefit_type', '!=', 'orphan')]}">
@ -237,10 +231,43 @@
<field name="donation_type"/>
<field name="donation_name"/>
<field name="donation_amount"/>
<field name="sponsorship_type" attrs="{'invisible': [('donation_mechanism','!=','with_conditions')]}"/>
<field name="benefit_id"/>
<field name="donation_mechanism" attrs="{'invisible': ['|',('donation_type','=','sponsorship'),('donation_type','=','waqf')]}"/>
</tree>
</field>
</page>
<page string="Payment Details">
<field name="payment_details_lines">
<form string="Donation Details">
<group>
<group>
<field name="payment_method"/>
<field name="name" attrs="{'invisible': ['|','|',('payment_method','=','cash'),('payment_method','=','check'),('payment_method','=',False)]}"/>
<field name="check_number" attrs="{'invisible': [('payment_method','!=','check')]}"/>
<field name="bank_id" attrs="{'invisible': ['|',('payment_method','=','cash'),('payment_method','=',False)]}"/>
<field name="journal_id" attrs="{'invisible': ['|','|',('payment_method','=','card'),('payment_method','=','credit_card'),('payment_method','=',False)]}"/>
<field name="points_of_sale" attrs="{'invisible': ['|','|',('payment_method','=','cash'),('payment_method','=','check'),('payment_method','=',False)]}"/>
</group>
<group>
<field name="donation_date"/>
<field name="charity_journal_id" attrs="{'invisible': ['|','|',('payment_method','=','cash'),('payment_method','=','check'),('payment_method','=',False)]}"/>
<field name="donation_amount"/>
<field name="account_payment_method" attrs="{'invisible': ['|','|',('payment_method','=','cash'),('payment_method','=','check'),('payment_method','=',False)]}"/>
<field name="note"/>
</group>
</group>
</form>
<tree>
<field name="payment_method"/>
<field name="donation_amount"/>
<field name="donation_date"/>
<field name="note"/>
<!-- <field name="journal_id"/>-->
<!-- <field name="points_of_sale"/>-->
</tree>
</field>
</page>
</notebook>
</group>