IMP benefit

This commit is contained in:
younes 2025-09-22 14:05:11 +01:00
parent af3293c7a8
commit bca4c2a031
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_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_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')
total_service_requests = fields.Integer(compute='_get_total_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):
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):
for rec in self:
rec.with_context(bypass_attachments_requirement=True).write({
'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):

View File

@ -235,7 +235,7 @@
<div class="o_field_widget o_stat_info">
<div class="oe_inline">
<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'}"/>
</span>
</div>