Impacted versions:

10.0

Steps to reproduce:

See  https://youtu.be/I3Qb3m1GmJ4

Current behavior:

Currency mixing in expense sheet view and report

Expected behavior:

Have no currency mixing :smile: 

Video/Screenshot link (optional):

See https://youtu.be/I3Qb3m1GmJ4

Credit : @alexis-via - Barcelona OCA code sprint


addons/hr_expense/models/hr_expense.py
self.total_amount = sum(self.expense_line_ids.mapped('total_amount'))
    
    
    
    
    
    @api.model
    def _add_missing_default_values(self, values):
        values = super(HrExpenseSheet, self)._add_missing_default_values(values)
        if self.env.context.get('default_expense_line_ids', False):
            lines_to_add = []
            for line in values.get('expense_line_ids', []):
                if line[0] == 1:
                    lines_to_add.append([4, line[1], False])
            values['expense_line_ids'] = lines_to_add + values['expense_line_ids']
        return values
    @api.one
    def _compute_attachment_number(self):
        self.attachment_number = sum(self.expense_line_ids.mapped('attachment_number'))
    @api.multi
    def refuse_expenses(self, reason):
        self.write({'state': 'cancel'})
        for sheet in self:
            body = (_("Your Expense %s has been refused.<br/><ul class=o_timeline_tracking_value_list><li>Reason<span> : </span><span class=o_timeline_tracking_value>%s</span></li></ul>") % (sheet.name, reason))
            sheet.message_post(body=body)
    @api.multi
    def approve_expense_sheets(self):