Merge pull request #5758 from expsa/hhkk
[IMP] odex_benefit: IMP benefit
This commit is contained in:
commit
d296329a48
|
|
@ -66,10 +66,10 @@ class GrantBenefitProfile(models.Model):
|
||||||
phone2 = fields.Char(string="Phone2")
|
phone2 = fields.Char(string="Phone2")
|
||||||
relative_phone = fields.Char(string="Relative Phone")
|
relative_phone = fields.Char(string="Relative Phone")
|
||||||
relative_relation = fields.Char(string="Relative Relation")
|
relative_relation = fields.Char(string="Relative Relation")
|
||||||
sms_phone = fields.Char(string="Contact Phone")
|
sms_phone = fields.Char(string="Contact Phone",tracking=True)
|
||||||
name_in_bank = fields.Char()
|
name_in_bank = fields.Char()
|
||||||
family_bank = fields.Many2one('res.partner.bank')
|
family_bank = fields.Many2one('res.partner.bank')
|
||||||
acc_number = fields.Char('Account Number',copy=False)
|
acc_number = fields.Char('Account Number',copy=False,tracking=True)
|
||||||
acc_holder_name = fields.Char('Account Holder Name')
|
acc_holder_name = fields.Char('Account Holder Name')
|
||||||
acc_holder_id_number = fields.Char(string="Account Holder ID Number")
|
acc_holder_id_number = fields.Char(string="Account Holder ID Number")
|
||||||
bank_id = fields.Many2one("res.bank",string='Bank')
|
bank_id = fields.Many2one("res.bank",string='Bank')
|
||||||
|
|
@ -104,7 +104,7 @@ class GrantBenefitProfile(models.Model):
|
||||||
user_id = fields.Many2one('res.users', string="User")
|
user_id = fields.Many2one('res.users', string="User")
|
||||||
password = fields.Char('Password')
|
password = fields.Char('Password')
|
||||||
# Category And Family
|
# Category And Family
|
||||||
benefit_category_id = fields.Many2one('benefit.category', string='Benefit Category', compute="get_benefit_category",store=True)
|
benefit_category_id = fields.Many2one('benefit.category', string='Benefit Category', compute="get_benefit_category",store=True,tracking=True)
|
||||||
benefit_category_old = fields.Many2one('benefit.category', string='Family category in the old system')
|
benefit_category_old = fields.Many2one('benefit.category', string='Family category in the old system')
|
||||||
family_id = fields.Many2one('benefit.family', string='Benefit Family')
|
family_id = fields.Many2one('benefit.family', string='Benefit Family')
|
||||||
# address
|
# address
|
||||||
|
|
@ -123,7 +123,7 @@ class GrantBenefitProfile(models.Model):
|
||||||
('villa', 'villa'),
|
('villa', 'villa'),
|
||||||
('popular_house', 'popular house'),
|
('popular_house', 'popular house'),
|
||||||
('tent', 'tent'),
|
('tent', 'tent'),
|
||||||
('Appendix', 'Appendix'), ], default='apartment')
|
('Appendix', 'Appendix'), ], default='apartment',tracking=True)
|
||||||
property_instrument_number = fields.Char(string='Property Instrument number')
|
property_instrument_number = fields.Char(string='Property Instrument number')
|
||||||
property_instrument_attach = fields.Many2many('ir.attachment','rel_property_instrument_attach_attachment','benefit_id','attachment_id',string='Property Instrument Attach')
|
property_instrument_attach = fields.Many2many('ir.attachment','rel_property_instrument_attach_attachment','benefit_id','attachment_id',string='Property Instrument Attach')
|
||||||
electricity_attach = fields.Many2many('ir.attachment','rel_electricity_attach_attachment','benefit_id','attachment_id',string='Electricity Attach')
|
electricity_attach = fields.Many2many('ir.attachment','rel_electricity_attach_attachment','benefit_id','attachment_id',string='Electricity Attach')
|
||||||
|
|
@ -387,7 +387,7 @@ class GrantBenefitProfile(models.Model):
|
||||||
total_income = fields.Float('Total Income', compute="get_total_income", store=True)
|
total_income = fields.Float('Total Income', compute="get_total_income", store=True)
|
||||||
benefit_member_count = fields.Integer(string="Members count", compute="get_members_count")
|
benefit_member_count = fields.Integer(string="Members count", compute="get_members_count")
|
||||||
non_member_count = fields.Integer(string="Non Benefit Members count", compute="get_non_members_count")
|
non_member_count = fields.Integer(string="Non Benefit Members count", compute="get_non_members_count")
|
||||||
member_income = fields.Integer(string="Member Income Average", compute="get_member_income",store=True)
|
member_income = fields.Integer(string="Member Income Average", compute="get_member_income",store=True,tracking=True)
|
||||||
request_activity_id = fields.Many2one('mail.activity')
|
request_activity_id = fields.Many2one('mail.activity')
|
||||||
state = fields.Selection([
|
state = fields.Selection([
|
||||||
('draft', 'Draft'),
|
('draft', 'Draft'),
|
||||||
|
|
@ -404,15 +404,15 @@ class GrantBenefitProfile(models.Model):
|
||||||
('exception_second_approve', 'Waiting for General Manager'),
|
('exception_second_approve', 'Waiting for General Manager'),
|
||||||
('black_list', 'Black List'),
|
('black_list', 'Black List'),
|
||||||
], string='state', default="draft", tracking=True, group_expand='_expand_states')
|
], string='state', default="draft", tracking=True, group_expand='_expand_states')
|
||||||
branch_custom_id = fields.Many2one('branch.settings', string="Branch")
|
branch_custom_id = fields.Many2one('branch.settings', string="Branch",tracking=True)
|
||||||
branch_family_id = fields.Many2one('branch.settings', string="Family Branch")
|
branch_family_id = fields.Many2one('branch.settings', string="Family Branch",tracking=True)
|
||||||
branch_has_employees = fields.Boolean('Has Employees In branch',related="branch_custom_id.has_employees")
|
branch_has_employees = fields.Boolean('Has Employees In branch',related="branch_custom_id.has_employees")
|
||||||
district_id = fields.Many2one('res.districts', string="District", domain="[('branch_custom_id','=',branch_custom_id)]")
|
district_id = fields.Many2one('res.districts', string="District", domain="[('branch_custom_id','=',branch_custom_id)]",tracking=True)
|
||||||
meal_card = fields.Boolean(string="Meal Card",related="district_id.meal_card", store=True,related_sudo=True)
|
meal_card = fields.Boolean(string="Meal Card",related="district_id.meal_card", store=True,related_sudo=True)
|
||||||
attachment_ids = fields.One2many('ir.attachment', 'benefit_id')
|
attachment_ids = fields.One2many('ir.attachment', 'benefit_id')
|
||||||
family_debits_ids = fields.One2many('family.debits', 'benefit_id')
|
family_debits_ids = fields.One2many('family.debits', 'benefit_id')
|
||||||
researcher_id = fields.Many2one("committees.line", string="Researcher")
|
researcher_id = fields.Many2one("committees.line", string="Researcher",tracking=True)
|
||||||
assigned_researcher_id = fields.Many2one('committees.line',string='Assigned Researcher')
|
assigned_researcher_id = fields.Many2one('committees.line',string='Assigned Researcher',tracking=True)
|
||||||
auto_accept_for_member = fields.Boolean(string="Auto Accept For members", default=True)
|
auto_accept_for_member = fields.Boolean(string="Auto Accept For members", default=True)
|
||||||
last_visit_date = fields.Datetime(string='Last Visit Date')
|
last_visit_date = fields.Datetime(string='Last Visit Date')
|
||||||
# Benefit Housing Information
|
# Benefit Housing Information
|
||||||
|
|
@ -714,6 +714,14 @@ class GrantBenefitProfile(models.Model):
|
||||||
"Numbers and special characters are not allowed.") % field_label
|
"Numbers and special characters are not allowed.") % field_label
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@api.constrains('active', 'state')
|
||||||
|
def _prevent_archive_unless_allowed(self):
|
||||||
|
for rec in self:
|
||||||
|
if not rec.active and rec.state not in ['refused', 'suspended_second_approve', 'black_list']:
|
||||||
|
raise ValidationError(
|
||||||
|
"You can only archive the family if its status is: Refused, Final Suspension, or Blacklisted."
|
||||||
|
)
|
||||||
|
|
||||||
@api.depends('rent_amount','property_type','benefit_member_count', 'branch_custom_id.branch_type')
|
@api.depends('rent_amount','property_type','benefit_member_count', 'branch_custom_id.branch_type')
|
||||||
def _compute_estimated_rent_amount(self):
|
def _compute_estimated_rent_amount(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
|
|
@ -1340,6 +1348,9 @@ class GrantBenefitProfile(models.Model):
|
||||||
record.partner_id.get_partner_name() # Force recomputation of name
|
record.partner_id.get_partner_name() # Force recomputation of name
|
||||||
if record.user_id:
|
if record.user_id:
|
||||||
record.sudo().user_id.write({"name": record.partner_id.name})
|
record.sudo().user_id.write({"name": record.partner_id.name})
|
||||||
|
if 'active' in vals:
|
||||||
|
for rec in self:
|
||||||
|
rec.member_ids.write({'active': vals['active']})
|
||||||
#if not self.env.context.get('force_website', False) and not self.env.context.get('bypass_attachments_requirement', False):
|
#if not self.env.context.get('force_website', False) and not self.env.context.get('bypass_attachments_requirement', False):
|
||||||
# self._validate_required_attachments()
|
# self._validate_required_attachments()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -666,7 +666,7 @@ class ResDistricts(models.Model):
|
||||||
name = fields.Char(string="Name")
|
name = fields.Char(string="Name")
|
||||||
meal_card = fields.Boolean(string='Meal Card')
|
meal_card = fields.Boolean(string='Meal Card')
|
||||||
city_id = fields.Many2one('res.country.city')
|
city_id = fields.Many2one('res.country.city')
|
||||||
branch_custom_id = fields.Many2one("branch.settings", string="Branch", domain="[('city_id', '=', city_id)]")
|
branch_custom_id = fields.Many2one("branch.settings", string="Branch")
|
||||||
|
|
||||||
class VisitsSettings(models.Model):
|
class VisitsSettings(models.Model):
|
||||||
_name = 'visits.types'
|
_name = 'visits.types'
|
||||||
|
|
|
||||||
|
|
@ -275,6 +275,7 @@ class FamilyMemberProfile(models.Model):
|
||||||
total_member_service_requests = fields.Integer(compute='_get_total_member_service_requests')
|
total_member_service_requests = fields.Integer(compute='_get_total_member_service_requests')
|
||||||
non_benefit_reason = fields.Text(string="Non Benefit Reason", tracking=True)
|
non_benefit_reason = fields.Text(string="Non Benefit Reason", tracking=True)
|
||||||
final_suspend_date = fields.Date(string="Final Suspend Date")
|
final_suspend_date = fields.Date(string="Final Suspend Date")
|
||||||
|
active = fields.Boolean(string='Active', default=True)
|
||||||
|
|
||||||
# def create(self, vals):
|
# def create(self, vals):
|
||||||
# for line_vals in vals:
|
# for line_vals in vals:
|
||||||
|
|
|
||||||
|
|
@ -823,6 +823,28 @@ class ServiceRequest(models.Model):
|
||||||
('state', '!=', 'refused')
|
('state', '!=', 'refused')
|
||||||
], order='date desc', limit=1)
|
], order='date desc', limit=1)
|
||||||
|
|
||||||
|
if service_type == 'buy_home':
|
||||||
|
complete_building_requests = Service.search([
|
||||||
|
('family_id', '=', family_id),
|
||||||
|
('service_cat.service_type', '=', 'complete_building_house'),
|
||||||
|
('id', '!=', rec._origin.id),
|
||||||
|
('state', '!=', 'refused')
|
||||||
|
], order='date desc', limit=1)
|
||||||
|
if complete_building_requests and complete_building_requests.date:
|
||||||
|
raise UserError(_(
|
||||||
|
"You cannot request 'buy_home' service because there is an existing 'complete_building_house' service request."
|
||||||
|
))
|
||||||
|
if service_type == 'complete_building_house':
|
||||||
|
buy_home_requests = Service.search([
|
||||||
|
('family_id', '=', family_id),
|
||||||
|
('service_cat.service_type', '=', 'buy_home'),
|
||||||
|
('id', '!=', rec._origin.id),
|
||||||
|
('state', '!=', 'refused')
|
||||||
|
], order='date desc', limit=1)
|
||||||
|
if buy_home_requests and buy_home_requests.date:
|
||||||
|
raise UserError(_(
|
||||||
|
"You cannot request 'complete_building_house' service because there is an existing 'buy_home' service request."
|
||||||
|
))
|
||||||
if existing_request_restoration and existing_request_restoration.date:
|
if existing_request_restoration and existing_request_restoration.date:
|
||||||
if service_type == 'buy_home':
|
if service_type == 'buy_home':
|
||||||
raise ValidationError(_(
|
raise ValidationError(_(
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@
|
||||||
<field name="education_status"/>
|
<field name="education_status"/>
|
||||||
<field name="benefit_id" attrs="{'readonly': [('state','!=','draft')]}" force_save="1"
|
<field name="benefit_id" attrs="{'readonly': [('state','!=','draft')]}" force_save="1"
|
||||||
required="1"/>
|
required="1"/>
|
||||||
<field name="partner_id"/>
|
<field name="partner_id" invisible="1"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="is_work"
|
<field name="is_work"
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
<field name="assignment_type" required="1"/>
|
<field name="assignment_type" required="1"/>
|
||||||
<field name="researcher_team" required="1"
|
<field name="researcher_team" required="1"
|
||||||
domain="[('branch_custom_id', '=',branch_custom_id)]"
|
domain="[('branch_custom_id', '=',branch_custom_id)]"
|
||||||
attrs="{'required': [('assignment_type', '!=', 'end_assignment')]}"
|
attrs="{'required': [('assignment_type', '!=', 'end_assignment')],'invisible': [('assignment_type', '=', 'end_assignment')]}"
|
||||||
options="{'no_create': True, 'no_create_edit': True,'no_quick_create': True, 'no_open': True}"/>
|
options="{'no_create': True, 'no_create_edit': True,'no_quick_create': True, 'no_open': True}"/>
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ class ProjectProjectInherit(models.Model):
|
||||||
is_family_need_evacuate = fields.Boolean(string='Is family need evacuate?')
|
is_family_need_evacuate = fields.Boolean(string='Is family need evacuate?')
|
||||||
service_type = fields.Selection(
|
service_type = fields.Selection(
|
||||||
[('rent', 'Rent'), ('home_restoration', 'Home Restoration'), ('alternative_housing', 'Alternative Housing'),
|
[('rent', 'Rent'), ('home_restoration', 'Home Restoration'), ('alternative_housing', 'Alternative Housing'),
|
||||||
('home_maintenance', 'Home Maintenance')
|
('home_maintenance', 'Home Maintenance'),('buy_home', 'Buy Home')
|
||||||
, ('complete_building_house', 'Complete Building House')], string='Service Type')
|
, ('complete_building_house', 'Complete Building House')], string='Service Type')
|
||||||
service_requests_count = fields.Integer(
|
service_requests_count = fields.Integer(
|
||||||
string="Service Requests",
|
string="Service Requests",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue