Merge pull request #4716 from expsa/samir-aladawi-updates-on-benefit
[UPD] odex_benefit
This commit is contained in:
commit
4716fd34e3
|
|
@ -3308,6 +3308,11 @@ msgstr ""
|
||||||
msgid "Create A Club"
|
msgid "Create A Club"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.visits_form
|
||||||
|
msgid "Create New Visit"
|
||||||
|
msgstr "إنشاء زيارة جديدة"
|
||||||
|
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form
|
||||||
msgid "Create Periodic visit"
|
msgid "Create Periodic visit"
|
||||||
|
|
@ -9337,6 +9342,17 @@ msgstr "عدد أوامر نقطة البيع"
|
||||||
msgid "Positive"
|
msgid "Positive"
|
||||||
msgstr ""
|
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
|
#. module: odex_benefit
|
||||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form
|
||||||
msgid "Preview Attachment"
|
msgid "Preview Attachment"
|
||||||
|
|
@ -9770,10 +9786,14 @@ msgstr "سبب الرفض"
|
||||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.service_request_search
|
#: 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_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_entity_refused_reason_wizard_form
|
||||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_visit_location_refusal_reason_wizard_form
|
|
||||||
msgid "Refused"
|
msgid "Refused"
|
||||||
msgstr "مرفوض"
|
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
|
#. module: odex_benefit
|
||||||
#: model:ir.model,name:odex_benefit.model_entity_refused_reason_wizard
|
#: model:ir.model,name:odex_benefit.model_entity_refused_reason_wizard
|
||||||
msgid "Refused Reason Wizard"
|
msgid "Refused Reason Wizard"
|
||||||
|
|
@ -10092,6 +10112,11 @@ msgstr "ملفات مطلوبة"
|
||||||
msgid "Rerearcher Wizard"
|
msgid "Rerearcher Wizard"
|
||||||
msgstr " توجيه الملف للاخصائي"
|
msgstr " توجيه الملف للاخصائي"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.visits_form
|
||||||
|
msgid "Reschedule"
|
||||||
|
msgstr "إعادة جدولة"
|
||||||
|
|
||||||
#. module: odex_benefit
|
#. 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_changes_requests__researcher_ids
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__researcher_id
|
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__researcher_id
|
||||||
|
|
@ -10379,7 +10404,7 @@ msgstr "جاري الزيارة"
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: model:ir.model.fields.selection,name:odex_benefit.selection__visit_location__state__pending
|
#: model:ir.model.fields.selection,name:odex_benefit.selection__visit_location__state__pending
|
||||||
msgid "Pending"
|
msgid "Pending"
|
||||||
msgstr "معلق"
|
msgstr "معلقة"
|
||||||
|
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_program_plane_line__score
|
#: model:ir.model.fields,field_description:odex_benefit.field_program_plane_line__score
|
||||||
|
|
@ -15418,7 +15443,7 @@ msgstr "سبب رفض الزيارة"
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_visit_location_refusal_reason_wizard__suspend_reason_id
|
#: model:ir.model.fields,field_description:odex_benefit.field_visit_location_refusal_reason_wizard__suspend_reason_id
|
||||||
msgid "Refusal Reason"
|
msgid "Refusal Reason"
|
||||||
msgstr "سبب الرفض"
|
msgstr "السبب"
|
||||||
|
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: code:addons/odex_benefit/wizards/visit_location_refused_wizard.py:0
|
#: code:addons/odex_benefit/wizards/visit_location_refused_wizard.py:0
|
||||||
|
|
|
||||||
|
|
@ -659,7 +659,7 @@ class ResDistricts(models.Model):
|
||||||
class VisitsSettings(models.Model):
|
class VisitsSettings(models.Model):
|
||||||
_name = 'visits.types'
|
_name = 'visits.types'
|
||||||
|
|
||||||
name = fields.Char(string="Name",required=True)
|
name = fields.Char(string="Name", required=True)
|
||||||
creation_method = fields.Selection(
|
creation_method = fields.Selection(
|
||||||
[('manual', 'Manual'),('automatic', 'Automatic')],
|
[('manual', 'Manual'),('automatic', 'Automatic')],
|
||||||
string="Creation Method",
|
string="Creation Method",
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,9 @@ class Visit(models.Model):
|
||||||
visit_types = fields.Many2one(
|
visit_types = fields.Many2one(
|
||||||
'visits.types',
|
'visits.types',
|
||||||
string='Visits Types',
|
string='Visits Types',
|
||||||
ondelete="restrict"
|
ondelete='restrict'
|
||||||
|
|
||||||
)
|
)
|
||||||
|
visit_types_creation_method = fields.Selection(related='visit_types.creation_method')
|
||||||
evaluation = fields.Selection(
|
evaluation = fields.Selection(
|
||||||
[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6')],
|
[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6')],
|
||||||
string='Evaluation')
|
string='Evaluation')
|
||||||
|
|
@ -64,41 +64,42 @@ class Visit(models.Model):
|
||||||
survey_url = fields.Char(string="Survey URL")
|
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_create_new_visit(self):
|
||||||
|
for rec in self:
|
||||||
# def action_postpone(self):
|
new_visit = self.create({
|
||||||
# """Open wizard to postpone"""
|
'creation_type': rec.creation_type,
|
||||||
# return {
|
'visit_types': rec.visit_types.id,
|
||||||
# 'name': _('Postpone Visit'),
|
'benefit_id': rec.benefit_id.id,
|
||||||
# 'type': 'ir.actions.act_window',
|
'researcher_ids': [(6, 0, rec.researcher_ids.ids)],
|
||||||
# 'res_model': 'visit.postpone.wizard',
|
'visit_date': fields.Datetime.now(),
|
||||||
# 'view_mode': 'form',
|
'state': 'draft',
|
||||||
# 'target': 'new',
|
})
|
||||||
# 'context': {'default_visit_id': self.id},
|
return {
|
||||||
# }
|
'type': 'ir.actions.act_window',
|
||||||
#
|
'res_model': 'visit.location',
|
||||||
# def action_reschedule(self):
|
'view_mode': 'form',
|
||||||
# for rec in self:
|
'res_id': new_visit.id,
|
||||||
# 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
|
|
||||||
|
|
||||||
@api.depends('response_id')
|
@api.depends('response_id')
|
||||||
def _compute_response_count(self):
|
def _compute_response_count(self):
|
||||||
|
|
@ -121,7 +122,7 @@ class Visit(models.Model):
|
||||||
|
|
||||||
def unlink(self):
|
def unlink(self):
|
||||||
for order in 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'))
|
raise UserError(_('You cannot delete this record'))
|
||||||
return super(Visit, self).unlink()
|
return super(Visit, self).unlink()
|
||||||
|
|
||||||
|
|
@ -338,14 +339,14 @@ class Visit(models.Model):
|
||||||
# author_id=self.env.ref('base.partner_root').id
|
# author_id=self.env.ref('base.partner_root').id
|
||||||
# )
|
# )
|
||||||
|
|
||||||
def action_close(self):
|
# def action_close(self):
|
||||||
self.ensure_one()
|
# self.ensure_one()
|
||||||
if self.visit_types.survey_id:
|
# if self.visit_types.survey_id:
|
||||||
if not self.response_id:
|
# if not self.response_id:
|
||||||
raise UserError(_("You must send the evaluation form before closing the visit."))
|
# raise UserError(_("You must send the evaluation form before closing the visit."))
|
||||||
if self.response_id.state != 'done':
|
# if self.response_id.state != 'done':
|
||||||
raise UserError(_("The visit cannot be closed before the family completes the evaluation form."))
|
# raise UserError(_("The visit cannot be closed before the family completes the evaluation form."))
|
||||||
self.state = 'close'
|
# self.state = 'close'
|
||||||
|
|
||||||
@api.depends("researcher_team")
|
@api.depends("researcher_team")
|
||||||
def get_researcher_ids(self):
|
def get_researcher_ids(self):
|
||||||
|
|
@ -393,24 +394,3 @@ class MemberEducationStatus(models.Model):
|
||||||
_name = 'member.education.status'
|
_name = 'member.education.status'
|
||||||
|
|
||||||
name = fields.Char()
|
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'
|
_inherit = 'survey.user_input'
|
||||||
|
|
||||||
visit_id = fields.Many2one('visit.location', string="Visit")
|
visit_id = fields.Many2one('visit.location', string="Visit")
|
||||||
|
|
||||||
|
|
||||||
|
def _mark_done(self):
|
||||||
|
super(SurveyUserInput, self)._mark_done()
|
||||||
|
self.visit_id.write({
|
||||||
|
'state': 'close'
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -84,36 +84,42 @@
|
||||||
states="draft"/>
|
states="draft"/>
|
||||||
<button name="action_schedule_a_visit" string="Schedule a visit" type="object"
|
<button name="action_schedule_a_visit" string="Schedule a visit" type="object"
|
||||||
class="oe_highlight" states="contact"/>
|
class="oe_highlight" states="contact"/>
|
||||||
|
<button name="action_create_new_visit"
|
||||||
|
string="Create New Visit"
|
||||||
<!-- added by eslam-->
|
type="object"
|
||||||
<!-- <button name="action_incomplete"-->
|
states="close"/>
|
||||||
<!-- string="عدم الاكتمال"-->
|
<button name="action_postpone"
|
||||||
<!-- type="object"-->
|
string="Postponement"
|
||||||
<!-- class="btn btn-danger"-->
|
type="object"
|
||||||
<!-- attrs="{'invisible': [('state', 'not in', ['contact','schedule_a_visit'])]}"/>-->
|
class="btn-warning"
|
||||||
|
states="contact,schedule_a_visit"/>
|
||||||
<!-- <button name="action_postpone"-->
|
<button name="action_reschedule"
|
||||||
<!-- string="تأجيل"-->
|
string="Reschedule"
|
||||||
<!-- type="object"-->
|
type="object"
|
||||||
<!-- class="btn btn-warning"-->
|
states="pending"/>
|
||||||
<!-- attrs="{'invisible': [('state', 'not in', ['contact','schedule_a_visit'])]}"/>-->
|
|
||||||
<!-- added by eslam-->
|
|
||||||
|
|
||||||
<button name="action_done" string="Done" type="object" class="oe_highlight"
|
<button name="action_done" string="Done" type="object" class="oe_highlight"
|
||||||
states="schedule_a_visit"/>
|
states="schedule_a_visit"/>
|
||||||
<button name="action_skip_otp"
|
<button name="action_skip_otp"
|
||||||
string="Skip OTP Verification" states="schedule_a_visit"
|
string="Skip OTP Verification"
|
||||||
type="object" class="btn btn-danger"
|
states="schedule_a_visit"
|
||||||
|
type="object"
|
||||||
|
class="btn-danger"
|
||||||
groups="odex_benefit.group_otp_manager"/>
|
groups="odex_benefit.group_otp_manager"/>
|
||||||
<button name="action_cancel" string="Visit Cancel" type="object"
|
<button name="action_cancel"
|
||||||
states="contact,schedule_a_visit"/>
|
string="Visit Cancel"
|
||||||
<button name="action_close" string="Close" type="object" states="done"/>
|
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"
|
<button name="action_send_survey"
|
||||||
attrs="{'invisible':[('state', '!=', 'done')]}"
|
attrs="{'invisible':[('state', '!=', 'done')]}"
|
||||||
type="object" string="Resend Survey Link" class="oe_highlight"/>
|
type="object" string="Resend Survey Link" class="oe_highlight"/>
|
||||||
<button name="geo_localize" string="Map" type="object" class="oe_highlight"
|
<button name="geo_localize"
|
||||||
attrs="{'invisible':['|',('benefit_id', '=', False),('state', '=', 'done')]}"/>
|
string="Map"
|
||||||
|
type="object"
|
||||||
|
class="oe_highlight"
|
||||||
|
icon="fa-map"
|
||||||
|
attrs="{'invisible':['|',('benefit_id', '=', False),('state', '=', 'done')]}"/>
|
||||||
<field name="state" widget="statusbar"
|
<field name="state" widget="statusbar"
|
||||||
statusbar_visible="draft,contact,schedule_a_visit,cancel,done,close"/>
|
statusbar_visible="draft,contact,schedule_a_visit,cancel,done,close"/>
|
||||||
</header>
|
</header>
|
||||||
|
|
@ -134,10 +140,24 @@
|
||||||
</div>
|
</div>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="visit_types" domain="[('creation_method','=','manual')]"
|
<field name="visit_types_creation_method" invisible="1" />
|
||||||
attrs="{'readonly':[('state', 'in', ['close','cancel'])]}" required="1"/>
|
<field name="visit_types"
|
||||||
<field name="benefit_id" attrs="{'readonly':[('state', 'in', ['close','cancel'])]}"
|
domain="[('creation_method','=','manual')]"
|
||||||
required="1"/>
|
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="sms_phone"/>
|
||||||
<field name="researcher_team" required="1"/>
|
<field name="researcher_team" required="1"/>
|
||||||
<field name="researcher_ids" invisible="1" widget="many2many_tags"
|
<field name="researcher_ids" invisible="1" widget="many2many_tags"
|
||||||
|
|
@ -226,37 +246,5 @@
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</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>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
<field name="refusal_notes" no_label="1"/>
|
<field name="refusal_notes" no_label="1"/>
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<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
|
or
|
||||||
<button special="cancel" string="Cancel"/>
|
<button special="cancel" string="Cancel"/>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue