diff options
| author | jbw <jbw@odoo.com> | 2020-01-27 12:00:27 +0000 |
|---|---|---|
| committer | jbw <jbw@odoo.com> | 2020-02-03 15:35:08 +0000 |
| commit | 7b5664660f045dd88b7e9f34255cd85dfd67bc34 (patch) | |
| tree | d8f874fde3de33bce1cb555f501f2565c03c7433 /addons/hr_expense | |
| parent | 80c67aa26fa6c888c1ced2a6b445566fc439c112 (diff) | |
[IMP] hr_expense enable attachment preview in journal view
Adding preview of expenses attachment to journal view.
When creating an expense, files can be attached (e.g. scanned receipts).
Those attachment files where not displayed in "Accounting > Accounting > Journals > Purchases" move_line list.
They now appear in the document preview.
Task = 2176443
closes odoo/odoo#44161
Related: odoo/enterprise#8002
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Diffstat (limited to 'addons/hr_expense')
| -rw-r--r-- | addons/hr_expense/models/account_move_line.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/hr_expense/models/account_move_line.py b/addons/hr_expense/models/account_move_line.py index b920de82957..6ebc17ed523 100644 --- a/addons/hr_expense/models/account_move_line.py +++ b/addons/hr_expense/models/account_move_line.py @@ -10,6 +10,12 @@ class AccountMoveLine(models.Model): expense_id = fields.Many2one('hr.expense', string='Expense', copy=False, help="Expense where the move line come from") + def _get_attachment_domains(self): + attachment_domains = super(AccountMoveLine, self)._get_attachment_domains() + if self.expense_id: + attachment_domains.append([('res_model', '=', 'hr.expense'), ('res_id', '=', self.expense_id.id)]) + return attachment_domains + def reconcile(self, writeoff_acc_id=False, writeoff_journal_id=False): res = super(AccountMoveLine, self).reconcile(writeoff_acc_id=writeoff_acc_id, writeoff_journal_id=writeoff_journal_id) account_move_ids = [l.move_id.id for l in self if float_compare(l.move_id._get_cash_basis_matched_percentage(), 1, precision_digits=5) == 0] |
