Hello, i'm new in odoo and i try trought many exercise to train.
For this exercise i must :
-filter the lines of commssions for one employee for wich paid is wrong
-And return the sum oh this lines in my fiels "commission impayées"
I use more function and try more research in addons but i don't understand all,can you help me please ?
classCommissionDues(models.Model): | |
_inherit = "hr.employee" | |
commissions_impayees = fields.Float(string='Commissions dues', compute='_compute_commissions', store=False) | |
def _compute_commissions(self): | |
for record in self: | |
obj = self.env.ref(res.partner.commission) | |
employee_id = employee_obj.search([('record.id')]) | |
filtre_commissions = filtered(lambda line: line.paid == False) | |
record.commissions_impayees = sum(line.paid == False) | |
class ResPartnerCommission(models.Model): | |
_name = "res.partner.commission" | |
_description = "Commercial" | |
name = fields.Char(string='Name', required=True) | |
description = fields.Text(string='description') | |
employee_id = fields.Many2one('hr.employee', required=True, ondelete='cascade') | |
account_id = fields.Many2one(string='account_id') | |
date = fields.Date(string='date') | |
amount = fields.Integer(string='amount') | |
paid = fields.Boolean(string='paid') |