IMP benefit
This commit is contained in:
commit
5293871416
|
|
@ -15,6 +15,7 @@
|
|||
'data/scheduled_actions.xml',
|
||||
'data/server_actions.xml',
|
||||
'data/email_temps.xml',
|
||||
'data/visits_types_data.xml',
|
||||
|
||||
'views/benefit_view.xml',
|
||||
'views/users_inherit.xml',
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
<data noupdate="0">
|
||||
<!-- Scheduler for Managing Sponsorship Workflow Every Day -->
|
||||
<record id="scheduler_visit_workflow_action" forcecreate='True' model="ir.cron">
|
||||
<field name="name">Yearly Visit Workflow Scheduler</field>
|
||||
<field name="name">Recurrence Visit Workflow Scheduler</field>
|
||||
<field name="user_id" ref="base.user_root" />
|
||||
<field name="interval_number">12</field>
|
||||
<field name="nextcall" eval="(DateTime.now() + relativedelta(years=1)).strftime('%Y-%m-%d 04:00:00')" />
|
||||
<field name="interval_number">1</field>
|
||||
<field name="nextcall" eval="(DateTime.now() + relativedelta(days=1)).strftime('%Y-%m-%d 00:00:00')" />
|
||||
<!-- <field name="nextcall" eval="(datetime.now() + timedelta(minutes=7)).strftime('%Y-%m-%d %H:%M:%S')"/>-->
|
||||
<field name="interval_type">months</field>
|
||||
<field name="interval_type">days</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field name="doall" eval="False"/>
|
||||
<field name="model_id" ref="model_grant_benefit"/>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="initial_visit" model="visits.types">
|
||||
<field name="name">أولية</field>
|
||||
<field name="creation_method">automatic</field>
|
||||
<field name="recurrence_interval">0</field>
|
||||
<field name="otp_verification">True</field>
|
||||
<field name="otp_validity_minutes">1</field>
|
||||
</record>
|
||||
|
||||
<record id="recurrence_visit" model="visits.types">
|
||||
<field name="name">دورية</field>
|
||||
<field name="creation_method">automatic</field>
|
||||
<field name="recurrence_interval">30</field>
|
||||
<field name="otp_verification">True</field>
|
||||
<field name="otp_validity_minutes">1</field>
|
||||
</record>
|
||||
|
||||
<record id="guidance_visit" model="visits.types">
|
||||
<field name="name">الارشادية</field>
|
||||
<field name="creation_method">manual</field>
|
||||
<field name="otp_verification">True</field>
|
||||
<field name="otp_validity_minutes">5</field>
|
||||
</record>
|
||||
|
||||
<record id="goal_visit" model="visits.types">
|
||||
<field name="name">ذات هدف معين</field>
|
||||
<field name="creation_method">manual</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -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
|
||||
|
|
@ -3305,6 +3310,11 @@ msgstr ""
|
|||
msgid "Create A Club"
|
||||
msgstr ""
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.visits_form
|
||||
msgid "Create New Visit"
|
||||
msgstr "إنشاء زيارة جديدة"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form
|
||||
msgid "Create Periodic visit"
|
||||
|
|
@ -9335,6 +9345,17 @@ msgstr "عدد أوامر نقطة البيع"
|
|||
msgid "Positive"
|
||||
msgstr ""
|
||||
|
||||
#. module: odex_benefit
|
||||
#: code:addons/odex_benefit/models/visit.py:0
|
||||
#, python-format
|
||||
msgid "Postpone Visit"
|
||||
msgstr "تأجيل الزيارة"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.visits_form
|
||||
msgid "Postponement"
|
||||
msgstr "تأجيل"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form
|
||||
msgid "Preview Attachment"
|
||||
|
|
@ -9768,10 +9789,14 @@ msgstr "سبب الرفض"
|
|||
#: model_terms:ir.ui.view,arch_db:odex_benefit.service_request_search
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_entity_final_refused_reason_wizard_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_entity_refused_reason_wizard_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_visit_location_refusal_reason_wizard_form
|
||||
msgid "Refused"
|
||||
msgstr "مرفوض"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_visit_location_refusal_reason_wizard_form
|
||||
msgid "Confirm"
|
||||
msgstr "تأكيد"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model,name:odex_benefit.model_entity_refused_reason_wizard
|
||||
msgid "Refused Reason Wizard"
|
||||
|
|
@ -10090,6 +10115,11 @@ msgstr "ملفات مطلوبة"
|
|||
msgid "Rerearcher Wizard"
|
||||
msgstr " توجيه الملف للاخصائي"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.visits_form
|
||||
msgid "Reschedule"
|
||||
msgstr "إعادة جدولة"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_changes_requests__researcher_ids
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__researcher_id
|
||||
|
|
@ -10377,7 +10407,7 @@ msgstr "جاري الزيارة"
|
|||
#. module: odex_benefit
|
||||
#: model:ir.model.fields.selection,name:odex_benefit.selection__visit_location__state__pending
|
||||
msgid "Pending"
|
||||
msgstr "معلق"
|
||||
msgstr "معلقة"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_program_plane_line__score
|
||||
|
|
@ -11330,6 +11360,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
|
||||
|
|
@ -12310,7 +12356,7 @@ msgstr "سنوي"
|
|||
#: model:ir.actions.server,name:odex_benefit.scheduler_visit_workflow_action_ir_actions_server
|
||||
#: model:ir.cron,cron_name:odex_benefit.scheduler_visit_workflow_action
|
||||
#: model:ir.cron,name:odex_benefit.scheduler_visit_workflow_action
|
||||
msgid "Yearly Visit Workflow Scheduler"
|
||||
msgid "Recurrence Visit Workflow Scheduler"
|
||||
msgstr ""
|
||||
|
||||
#. module: odex_benefit
|
||||
|
|
@ -15402,7 +15448,7 @@ msgstr "سبب رفض الزيارة"
|
|||
#. module: odex_benefit
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_visit_location_refusal_reason_wizard__suspend_reason_id
|
||||
msgid "Refusal Reason"
|
||||
msgstr "سبب الرفض"
|
||||
msgstr "السبب"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: code:addons/odex_benefit/wizards/visit_location_refused_wizard.py:0
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
@ -2283,11 +2284,15 @@ class GrantBenefitProfile(models.Model):
|
|||
|
||||
def create_scheduled_visit(self):
|
||||
records = self.env["grant.benefit"].search([('state', '=', 'second_approve')])
|
||||
for rec in records:
|
||||
recurrence_visit_id = self.env.ref('odex_benefit.recurrence_visit')
|
||||
period_unit = {
|
||||
recurrence_visit_id.recurrence_period: recurrence_visit_id.recurrence_interval
|
||||
}
|
||||
for rec in records.filtered(lambda r: r.last_visit_date and (r.last_visit_date + rd(**period_unit)).date() <= fields.Date.context_today(self)):
|
||||
self.env['visit.location'].create({
|
||||
'benefit_id': rec.id,
|
||||
'visit_date': date.today(),
|
||||
'visit_types': 2,
|
||||
'visit_types': recurrence_visit_id.id,
|
||||
'selector': 'researcher',
|
||||
'researcher_id': rec.researcher_id.id,
|
||||
# 'researcher_team': rec.researcher_team.id,
|
||||
|
|
|
|||
|
|
@ -659,7 +659,7 @@ class ResDistricts(models.Model):
|
|||
class VisitsSettings(models.Model):
|
||||
_name = 'visits.types'
|
||||
|
||||
name = fields.Char(string="Name",required=True)
|
||||
name = fields.Char(string="Name", required=True)
|
||||
creation_method = fields.Selection(
|
||||
[('manual', 'Manual'),('automatic', 'Automatic')],
|
||||
string="Creation Method",
|
||||
|
|
@ -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,12 +262,27 @@ class FamilyMemberProfile(models.Model):
|
|||
# )
|
||||
# return super(FamilyMemberProfile, self).write(vals)
|
||||
|
||||
<<<<<<< HEAD
|
||||
@api.onchange('relationn_type')
|
||||
def _onchange_relationn_type(self):
|
||||
if self.relationn_type in ['mother', 'replacement_mother']:
|
||||
return {'domain': {'member_location_conf': [('location_type', '=', 'mother_location')]}}
|
||||
else:
|
||||
return {'domain': {'member_location_conf': [('location_type', '=', 'member')]}}
|
||||
=======
|
||||
@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)
|
||||
)
|
||||
>>>>>>> e7950687880663fd59cd99be55cab71ca3bd4bd9
|
||||
|
||||
@api.depends('age_status', 'is_dead','benefit_id.member_ids.age_status','benefit_id.member_ids.is_dead')
|
||||
def _compute_minor_siblings(self):
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ class Visit(models.Model):
|
|||
visit_types = fields.Many2one(
|
||||
'visits.types',
|
||||
string='Visits Types',
|
||||
ondelete="restrict"
|
||||
|
||||
ondelete='restrict'
|
||||
)
|
||||
visit_types_creation_method = fields.Selection(related='visit_types.creation_method')
|
||||
evaluation = fields.Selection(
|
||||
[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6')],
|
||||
string='Evaluation')
|
||||
|
|
@ -64,41 +64,42 @@ class Visit(models.Model):
|
|||
survey_url = fields.Char(string="Survey URL")
|
||||
|
||||
|
||||
def action_postpone(self):
|
||||
"""Open wizard to postpone"""
|
||||
context = dict(self.env.context or {})
|
||||
context['target_state'] = "pending"
|
||||
context['active_id'] = self.id
|
||||
return {
|
||||
'name': _('Postpone Visit'),
|
||||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'visit.location.refusal.reason.wizard',
|
||||
'view_id': self.env.ref('odex_benefit.view_visit_location_refusal_reason_wizard_form').id,
|
||||
'target': 'new',
|
||||
'context': context,
|
||||
}
|
||||
|
||||
def action_reschedule(self):
|
||||
for rec in self:
|
||||
rec.state = "contact"
|
||||
|
||||
# added by eslam
|
||||
|
||||
# def action_postpone(self):
|
||||
# """Open wizard to postpone"""
|
||||
# return {
|
||||
# 'name': _('Postpone Visit'),
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# 'res_model': 'visit.postpone.wizard',
|
||||
# 'view_mode': 'form',
|
||||
# 'target': 'new',
|
||||
# 'context': {'default_visit_id': self.id},
|
||||
# }
|
||||
#
|
||||
# def action_reschedule(self):
|
||||
# for rec in self:
|
||||
# rec.state = "contact"
|
||||
#
|
||||
# def action_create_new_visit(self):
|
||||
# for rec in self:
|
||||
# new_visit = self.create({
|
||||
# 'creation_type': rec.creation_type,
|
||||
# 'visit_types': rec.visit_types.id,
|
||||
# 'benefit_id': rec.benefit_id.id,
|
||||
# 'researcher_ids': [(6, 0, rec.researcher_ids.ids)],
|
||||
# 'visit_date': fields.Datetime.now(),
|
||||
# 'state': 'draft',
|
||||
# })
|
||||
# return {
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# 'res_model': 'visit.location',
|
||||
# 'view_mode': 'form',
|
||||
# 'res_id': new_visit.id,
|
||||
# }
|
||||
# added by eslam
|
||||
def action_create_new_visit(self):
|
||||
for rec in self:
|
||||
new_visit = self.create({
|
||||
'creation_type': rec.creation_type,
|
||||
'visit_types': rec.visit_types.id,
|
||||
'benefit_id': rec.benefit_id.id,
|
||||
'researcher_ids': [(6, 0, rec.researcher_ids.ids)],
|
||||
'visit_date': fields.Datetime.now(),
|
||||
'state': 'draft',
|
||||
})
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'visit.location',
|
||||
'view_mode': 'form',
|
||||
'res_id': new_visit.id,
|
||||
}
|
||||
|
||||
@api.depends('response_id')
|
||||
def _compute_response_count(self):
|
||||
|
|
@ -121,7 +122,7 @@ class Visit(models.Model):
|
|||
|
||||
def unlink(self):
|
||||
for order in self:
|
||||
if order.state not in ['draft']:
|
||||
if order.state not in ['draft'] or order.visit_types.creation_method == 'automatic':
|
||||
raise UserError(_('You cannot delete this record'))
|
||||
return super(Visit, self).unlink()
|
||||
|
||||
|
|
@ -338,14 +339,14 @@ class Visit(models.Model):
|
|||
# author_id=self.env.ref('base.partner_root').id
|
||||
# )
|
||||
|
||||
def action_close(self):
|
||||
self.ensure_one()
|
||||
if self.visit_types.survey_id:
|
||||
if not self.response_id:
|
||||
raise UserError(_("You must send the evaluation form before closing the visit."))
|
||||
if self.response_id.state != 'done':
|
||||
raise UserError(_("The visit cannot be closed before the family completes the evaluation form."))
|
||||
self.state = 'close'
|
||||
# def action_close(self):
|
||||
# self.ensure_one()
|
||||
# if self.visit_types.survey_id:
|
||||
# if not self.response_id:
|
||||
# raise UserError(_("You must send the evaluation form before closing the visit."))
|
||||
# if self.response_id.state != 'done':
|
||||
# raise UserError(_("The visit cannot be closed before the family completes the evaluation form."))
|
||||
# self.state = 'close'
|
||||
|
||||
@api.depends("researcher_team")
|
||||
def get_researcher_ids(self):
|
||||
|
|
@ -393,24 +394,3 @@ class MemberEducationStatus(models.Model):
|
|||
_name = 'member.education.status'
|
||||
|
||||
name = fields.Char()
|
||||
|
||||
class VisitPostponeWizard(models.TransientModel):
|
||||
_name = "visit.postpone.wizard"
|
||||
_description = "Postpone Visit Wizard"
|
||||
|
||||
visit_id = fields.Many2one("visit.location", string="Visit", required=True, readonly=True)
|
||||
reason = fields.Text(string="Reason", required=True)
|
||||
notes = fields.Text(string="Notes")
|
||||
|
||||
def action_confirm_postpone(self):
|
||||
"""Confirm postpone and set state to pending"""
|
||||
for wizard in self:
|
||||
if not wizard.reason:
|
||||
raise ValidationError(_("You must provide a reason to postpone."))
|
||||
visit = wizard.visit_id
|
||||
visit.write({
|
||||
"state": "pending",
|
||||
"reason": wizard.reason,
|
||||
"message": wizard.notes,
|
||||
})
|
||||
return {"type": "ir.actions.act_window_close"}
|
||||
|
|
|
|||
|
|
@ -4,3 +4,10 @@ class SurveyUserInput(models.Model):
|
|||
_inherit = 'survey.user_input'
|
||||
|
||||
visit_id = fields.Many2one('visit.location', string="Visit")
|
||||
|
||||
|
||||
def _mark_done(self):
|
||||
super(SurveyUserInput, self)._mark_done()
|
||||
self.sudo().visit_id.write({
|
||||
'state': 'close'
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -199,10 +199,10 @@
|
|||
states="second_approve"
|
||||
confirm="Are you sure you want to open info edition !"
|
||||
/>
|
||||
<button name="create_manual_visit" type="object"
|
||||
<!-- <button name="create_manual_visit" type="object"
|
||||
string="Create Periodic visit" class="oe_highlight"
|
||||
states="second_approve"
|
||||
/>
|
||||
/> -->
|
||||
<button name="action_set_to_draft" type="object"
|
||||
string="Set to Draft" class="btn btn-warning"
|
||||
groups="odex_benefit.group_benefit_back_to_draft"
|
||||
|
|
@ -1010,20 +1010,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'])]}"/>
|
||||
|
|
|
|||
|
|
@ -84,36 +84,42 @@
|
|||
states="draft"/>
|
||||
<button name="action_schedule_a_visit" string="Schedule a visit" type="object"
|
||||
class="oe_highlight" states="contact"/>
|
||||
|
||||
|
||||
<!-- added by eslam-->
|
||||
<!-- <button name="action_incomplete"-->
|
||||
<!-- string="عدم الاكتمال"-->
|
||||
<!-- type="object"-->
|
||||
<!-- class="btn btn-danger"-->
|
||||
<!-- attrs="{'invisible': [('state', 'not in', ['contact','schedule_a_visit'])]}"/>-->
|
||||
|
||||
<!-- <button name="action_postpone"-->
|
||||
<!-- string="تأجيل"-->
|
||||
<!-- type="object"-->
|
||||
<!-- class="btn btn-warning"-->
|
||||
<!-- attrs="{'invisible': [('state', 'not in', ['contact','schedule_a_visit'])]}"/>-->
|
||||
<!-- added by eslam-->
|
||||
|
||||
<button name="action_create_new_visit"
|
||||
string="Create New Visit"
|
||||
type="object"
|
||||
states="close"/>
|
||||
<button name="action_postpone"
|
||||
string="Postponement"
|
||||
type="object"
|
||||
class="btn-warning"
|
||||
states="contact,schedule_a_visit"/>
|
||||
<button name="action_reschedule"
|
||||
string="Reschedule"
|
||||
type="object"
|
||||
states="pending"/>
|
||||
<button name="action_done" string="Done" type="object" class="oe_highlight"
|
||||
states="schedule_a_visit"/>
|
||||
<button name="action_skip_otp"
|
||||
string="Skip OTP Verification" states="schedule_a_visit"
|
||||
type="object" class="btn btn-danger"
|
||||
string="Skip OTP Verification"
|
||||
states="schedule_a_visit"
|
||||
type="object"
|
||||
class="btn-danger"
|
||||
groups="odex_benefit.group_otp_manager"/>
|
||||
<button name="action_cancel" string="Visit Cancel" type="object"
|
||||
states="contact,schedule_a_visit"/>
|
||||
<button name="action_close" string="Close" type="object" states="done"/>
|
||||
<button name="action_cancel"
|
||||
string="Visit Cancel"
|
||||
type="object"
|
||||
class="btn-danger"
|
||||
states="contact,schedule_a_visit"/>
|
||||
<!-- <button name="action_close" string="Close" type="object" states="done"/> -->
|
||||
<button name="action_send_survey"
|
||||
attrs="{'invisible':[('state', '!=', 'done')]}"
|
||||
type="object" string="Resend Survey Link" class="oe_highlight"/>
|
||||
<button name="geo_localize" string="Map" type="object" class="oe_highlight"
|
||||
attrs="{'invisible':['|',('benefit_id', '=', False),('state', '=', 'done')]}"/>
|
||||
<button name="geo_localize"
|
||||
string="Map"
|
||||
type="object"
|
||||
class="oe_highlight"
|
||||
icon="fa-map"
|
||||
attrs="{'invisible':['|',('benefit_id', '=', False),('state', '=', 'done')]}"/>
|
||||
<field name="state" widget="statusbar"
|
||||
statusbar_visible="draft,contact,schedule_a_visit,cancel,done,close"/>
|
||||
</header>
|
||||
|
|
@ -134,10 +140,24 @@
|
|||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="visit_types" domain="[('creation_method','=','manual')]"
|
||||
attrs="{'readonly':[('state', 'in', ['close','cancel'])]}" required="1"/>
|
||||
<field name="benefit_id" attrs="{'readonly':[('state', 'in', ['close','cancel'])]}"
|
||||
required="1"/>
|
||||
<field name="visit_types_creation_method" invisible="1" />
|
||||
<field name="visit_types"
|
||||
domain="[('creation_method','=','manual')]"
|
||||
attrs="{'readonly':[
|
||||
'|',
|
||||
('state', 'in', ['close', 'cancel']),
|
||||
('visit_types_creation_method', '=', 'automatic')
|
||||
]
|
||||
}"
|
||||
required="1"/>
|
||||
<field name="benefit_id"
|
||||
attrs="{'readonly':[
|
||||
'|',
|
||||
('state', 'in', ['close', 'cancel']),
|
||||
('visit_types_creation_method', '=', 'automatic')
|
||||
]
|
||||
}"
|
||||
required="1"/>
|
||||
<field name="sms_phone"/>
|
||||
<field name="researcher_team" required="1"/>
|
||||
<field name="researcher_ids" invisible="1" widget="many2many_tags"
|
||||
|
|
@ -226,37 +246,5 @@
|
|||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- added by eslam-->
|
||||
<!-- <record id="view_visit_postpone_wizard" model="ir.ui.view">-->
|
||||
<!-- <field name="name">visit.postpone.wizard.form</field>-->
|
||||
<!-- <field name="model">visit.postpone.wizard</field>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <form string="Postpone Visit">-->
|
||||
<!-- <group>-->
|
||||
<!-- <field name="visit_id" readonly="1"/>-->
|
||||
<!-- <field name="reason"/>-->
|
||||
<!-- <field name="notes"/>-->
|
||||
<!-- </group>-->
|
||||
<!-- <footer>-->
|
||||
<!-- <button name="action_confirm_postpone"-->
|
||||
<!-- string="Confirm"-->
|
||||
<!-- type="object"-->
|
||||
<!-- class="btn btn-primary"/>-->
|
||||
<!-- <button string="Cancel" class="btn btn-secondary" special="cancel"/>-->
|
||||
<!-- </footer>-->
|
||||
<!-- </form>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
<!-- <record id="action_visit_postpone_wizard" model="ir.actions.act_window">-->
|
||||
<!-- <field name="name">Postpone Visit</field>-->
|
||||
<!-- <field name="res_model">visit.postpone.wizard</field>-->
|
||||
<!-- <field name="view_mode">form</field>-->
|
||||
<!-- <field name="target">new</field>-->
|
||||
<!-- </record>-->
|
||||
<!-- added by eslam-->
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<field name="refusal_notes" no_label="1"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="action_confirm_return" type="object" string="Refused" class="oe_highlight"/>
|
||||
<button name="action_confirm_return" type="object" string="Confirm" class="oe_highlight"/>
|
||||
or
|
||||
<button special="cancel" string="Cancel"/>
|
||||
</footer>
|
||||
|
|
|
|||
Loading…
Reference in New Issue