[UPD] odex_benefit
This commit is contained in:
parent
3bd8c8fcc7
commit
527d85249e
|
|
@ -1336,6 +1336,11 @@ msgstr "المناطق والمحافظات"
|
|||
msgid "Age"
|
||||
msgstr "العمر"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_relation_settings__age_difference
|
||||
msgid "Age Difference"
|
||||
msgstr "فرق العمر"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_generate_reports__age_from
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_rooms_categories__age_from
|
||||
|
|
@ -11327,6 +11332,22 @@ msgstr "رقم الجوال {} موجود بالفعل في أسرة بكود {}
|
|||
msgid "The phone {} already exists in family with code {}."
|
||||
msgstr "رقم الجوال {} موجود بالفعل في أسرة بكود {}"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: code:addons/odex_benefit/models/family_members.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The son/daughter's age is supposed to be less than the father's age by %s"
|
||||
msgstr ""
|
||||
"عمر الابن/الابنة مفترض أن يكون أقل من عمر الأب بـ %s"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: code:addons/odex_benefit/models/family_members.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The son/daughter's age is supposed to be less than the mother's age by %s"
|
||||
msgstr ""
|
||||
"عمر الابن/الابنة مفترض أن يكون أقل من عمر الأم بـ %s"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields,help:odex_benefit.field_benefits_representative__membership_amount
|
||||
#: model:ir.model.fields,help:odex_benefit.field_external_benefits__membership_amount
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ class GrantBenefitProfile(models.Model):
|
|||
)
|
||||
zip = fields.Char('Zip', change_default=True, readonly=False, store=True)
|
||||
# res_city_id = fields.Many2one('res.city', domain="[('country_city_id', '=', city_id)]")
|
||||
housing_city = fields.Char()
|
||||
# housing_city = fields.Char()
|
||||
url = fields.Char()
|
||||
url_html = fields.Html(
|
||||
sanitize=False,
|
||||
|
|
@ -2006,15 +2006,16 @@ class GrantBenefitProfile(models.Model):
|
|||
'target': 'current',
|
||||
}
|
||||
|
||||
@api.depends('birth_date')
|
||||
@api.depends('father_birth_date')
|
||||
def _compute_get_father_age(self):
|
||||
for rec in self:
|
||||
if rec.birth_date:
|
||||
if rec.father_birth_date:
|
||||
today = date.today()
|
||||
day = datetime.strptime(str(rec.birth_date), DEFAULT_SERVER_DATE_FORMAT)
|
||||
day = datetime.strptime(str(rec.father_birth_date), DEFAULT_SERVER_DATE_FORMAT)
|
||||
age = rd(today, day)
|
||||
rec.father_age = age.years
|
||||
rec.father_age = 0
|
||||
else:
|
||||
rec.father_age = 0
|
||||
|
||||
@api.depends('mother_birth_date')
|
||||
def _compute_get_mother_age(self):
|
||||
|
|
|
|||
|
|
@ -734,6 +734,7 @@ class RelationSettings(models.Model):
|
|||
name = fields.Char(string='name')
|
||||
relation_type = fields.Selection(
|
||||
[('son', _('Son')), ('daughter', _('Daughter')),('mother', _('Mother')),('replacement_mother', _('Replacement Mother')),('other relation', _('Other Relation'))])
|
||||
age_difference = fields.Integer()
|
||||
|
||||
class LocationSettings(models.Model):
|
||||
_name = 'location.settings'
|
||||
|
|
|
|||
|
|
@ -262,6 +262,19 @@ class FamilyMemberProfile(models.Model):
|
|||
# _("You should at least insert one current/previous education status!")
|
||||
# )
|
||||
# return super(FamilyMemberProfile, self).write(vals)
|
||||
|
||||
@api.onchange('age')
|
||||
def _check_son_daughter_age(self):
|
||||
for rec in self:
|
||||
if rec.relationn.relation_type in ['son', 'daughter'] and rec.relationn.age_difference > 0:
|
||||
if rec.benefit_id.father_age and rec.benefit_id.father_age - rec.age < rec.relationn.age_difference:
|
||||
raise ValidationError(
|
||||
_("The son/daughter's age is supposed to be less than the father's age by %s" % rec.relationn.age_difference)
|
||||
)
|
||||
if rec.benefit_id.mother_age and rec.benefit_id.mother_age - rec.age < rec.relationn.age_difference:
|
||||
raise ValidationError(
|
||||
_("The son/daughter's age is supposed to be less than the mother's age by %s" % rec.relationn.age_difference)
|
||||
)
|
||||
|
||||
@api.depends('age_status', 'is_dead','benefit_id.member_ids.age_status','benefit_id.member_ids.is_dead')
|
||||
def _compute_minor_siblings(self):
|
||||
|
|
|
|||
|
|
@ -1002,6 +1002,7 @@
|
|||
<group>
|
||||
<field name="name"/>
|
||||
<field name="relation_type"/>
|
||||
<field name="age_difference" attrs="{'invisible': [('relation_type', 'not in', ['son', 'daughter'])]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
|
|
|
|||
|
|
@ -1001,20 +1001,21 @@
|
|||
widget="many2many_attachment_preview"/>
|
||||
</group>
|
||||
<group string="National address">
|
||||
<field name="country_id"
|
||||
<!-- <field name="country_id"
|
||||
attrs="{'required':[('state','not in',['draft','new'])]}"
|
||||
readonly="1"/>
|
||||
<field name="state_id"
|
||||
readonly="1"/> -->
|
||||
<!-- <field name="state_id"
|
||||
attrs="{'required':[('state','not in',['draft','new'])]}"
|
||||
readonly="1" string="Region"/>
|
||||
readonly="1" string="Region"/> -->
|
||||
<field name="city_id" readonly="1" string="City" force_save="1"
|
||||
options="{'no_create': True, 'no_create_edit': True}"
|
||||
groups="odex_benefit.group_benefit_manager"/>
|
||||
<!-- <field name="res_city_id" string="Res City"
|
||||
options="{'no_create': True, 'no_create_edit': True}"/> -->
|
||||
<field name="housing_city"/>
|
||||
<!-- <field name="housing_city"/> -->
|
||||
<field name="district_id" readonly="1" force_save="1"
|
||||
options="{'no_create': True, 'no_create_edit': True}"
|
||||
attrs="{'readonly':[('state', 'not in', ['draft', 'new', 'complete_info'])]}"
|
||||
groups="odex_benefit.group_benefit_manager"/>
|
||||
<field name="zip"
|
||||
attrs="{'required':[('state','not in',['draft','new'])],'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields
|
||||
from odoo import models, fields, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class SuspendReasonWizard(models.TransientModel):
|
||||
|
|
@ -21,11 +22,31 @@ class SuspendReasonWizard(models.TransientModel):
|
|||
|
||||
entity_id = fields.Many2one("grant.benefit", string="Entity", default=_default_entity)
|
||||
member_id = fields.Many2one("family.member", string="Member", default=_default_member)
|
||||
suspend_reason = fields.Many2one('suspend.reason',string='Suspend Reason')
|
||||
suspend_description = fields.Text(string='Suspend Description')
|
||||
suspend_attachment = fields.Binary(string='Suspend Attachment',attachment = True)
|
||||
suspend_type = fields.Selection(selection=[('temporarily_suspend', 'Temporarily Suspended'), ('suspend', 'Suspend')], string="Suspend Type")
|
||||
suspend_reason = fields.Many2one('suspend.reason',string='Suspend Reason', required=True)
|
||||
suspend_description = fields.Text(string='Suspend Description', required=True)
|
||||
suspend_attachment = fields.Binary(string='Suspend Attachment', attachment=True, required=True)
|
||||
suspend_type = fields.Selection(selection=[('temporarily_suspend', 'Temporarily Suspended'), ('suspend', 'Suspend')], string="Suspend Type", required=True)
|
||||
|
||||
|
||||
def _create_attachment_record_from_binary(self):
|
||||
self.ensure_one()
|
||||
|
||||
linked_record = self.entity_id or self.member_id
|
||||
if not linked_record:
|
||||
UserError(
|
||||
_('There is no record to link the binary to it!')
|
||||
)
|
||||
binary_file = self.suspend_attachment
|
||||
attachment_vals = {
|
||||
'name': 'suspend_attachment_%s' % (linked_record.id or 'tmp'),
|
||||
'datas': binary_file,
|
||||
'res_model': 'grant.benefit',
|
||||
'res_id': linked_record.id,
|
||||
'type': 'binary',
|
||||
}
|
||||
|
||||
return self.env['ir.attachment'].create(attachment_vals)
|
||||
|
||||
def action_submit(self):
|
||||
for rec in self:
|
||||
rec.entity_id.state = 'waiting_approve'
|
||||
|
|
@ -33,7 +54,7 @@ class SuspendReasonWizard(models.TransientModel):
|
|||
rec.entity_id.suspend_reason = rec.suspend_reason
|
||||
rec.entity_id.suspend_description = rec.suspend_description
|
||||
rec.entity_id.suspend_type = rec.suspend_type
|
||||
rec.entity_id.suspend_attachment = rec.suspend_attachment
|
||||
rec.entity_id.suspend_attachment = self._create_attachment_record_from_binary()
|
||||
rec.entity_id.suspend_method = 'manual'
|
||||
|
||||
def action_member_submit(self):
|
||||
|
|
@ -43,5 +64,5 @@ class SuspendReasonWizard(models.TransientModel):
|
|||
rec.member_id.suspend_reason = rec.suspend_reason
|
||||
rec.member_id.suspend_description = rec.suspend_description
|
||||
rec.member_id.suspend_type = rec.suspend_type
|
||||
rec.member_id.suspend_attachment = rec.suspend_attachment
|
||||
rec.member_id.suspend_attachment = self._create_attachment_record_from_binary()
|
||||
rec.member_id.suspend_method = 'manual'
|
||||
|
|
|
|||
Loading…
Reference in New Issue