Merge pull request #4733 from expsa/kch_dev_odex25_ensan

IMP benefit
This commit is contained in:
kchyounes19 2025-09-22 14:06:29 +01:00 committed by GitHub
commit 69aae702bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -496,7 +496,7 @@ class GrantBenefitProfile(models.Model):
family_monthly_meals = fields.Float(string="Family Monthly Meals", compute='_get_family_monthly_values') family_monthly_meals = fields.Float(string="Family Monthly Meals", compute='_get_family_monthly_values')
family_monthly_clotting = fields.Float(string="Family Monthly Clotting", compute='_get_family_monthly_values') family_monthly_clotting = fields.Float(string="Family Monthly Clotting", compute='_get_family_monthly_values')
total_family_expenses = fields.Float(string="Total Family Expenses", compute='_get_family_monthly_values') total_family_expenses = fields.Float(string="Total Family Expenses", compute='_get_family_monthly_values')
total_move_lines = fields.Integer(string="Total Move Lines", compute='_get_total_move_lines') total_move_lines = fields.Float(string="Total Move Lines", compute='_get_total_move_lines')
visit_location_count = fields.Integer(string="Visit Location Count", compute='_compute_visit_location_count') visit_location_count = fields.Integer(string="Visit Location Count", compute='_compute_visit_location_count')
total_service_requests = fields.Integer(compute='_get_total_service_requests') total_service_requests = fields.Integer(compute='_get_total_service_requests')
total_seasonal_service_requests = fields.Integer(compute='_get_total_seasonal_service_requests') total_seasonal_service_requests = fields.Integer(compute='_get_total_seasonal_service_requests')
@ -835,13 +835,13 @@ class GrantBenefitProfile(models.Model):
def _get_total_move_lines(self): def _get_total_move_lines(self):
for rec in self: for rec in self:
rec.total_move_lines = self.env['account.move.line'].search_count([('benefit_family_id', '=', rec.id)]) move_lines = self.env['account.move.line'].search([('benefit_family_id', '=', rec.id)])
rec.total_move_lines = sum(move_lines.mapped('debit')) - sum(move_lines.mapped('credit'))
def _compute_visit_location_count(self): def _compute_visit_location_count(self):
for rec in self: for rec in self:
rec.with_context(bypass_attachments_requirement=True).write({ rec.with_context(bypass_attachments_requirement=True).write({
'visit_location_count': self.env['visit.location'].search_count([('benefit_id', '=', rec.id)]), 'visit_location_count': self.env['visit.location'].search_count([('benefit_id', '=', rec.id)]),
'total_move_lines': self.env['account.move.line'].search_count([('benefit_family_id', '=', rec.id)])
}) })
def action_view_benefit_members(self): def action_view_benefit_members(self):

View File

@ -235,7 +235,7 @@
<div class="o_field_widget o_stat_info"> <div class="o_field_widget o_stat_info">
<div class="oe_inline"> <div class="oe_inline">
<span class="o_stat_value"> <span class="o_stat_value">
<field name="total_expenses" nolabel="1" widget="monetary" <field name="total_move_lines" nolabel="1" widget="monetary"
options="{'currency_field': 'currency_id'}"/> options="{'currency_field': 'currency_id'}"/>
</span> </span>
</div> </div>