[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>
This commit is contained in:
@@ -4154,6 +4154,14 @@ class AccountMoveLine(models.Model):
|
||||
'context': self.env.context,
|
||||
}
|
||||
|
||||
def _get_attachment_domains(self):
|
||||
self.ensure_one()
|
||||
domains = [[('res_model', '=', 'account.move'), ('res_id', '=', self.move_id.id)]]
|
||||
if self.statement_id:
|
||||
domains.append([('res_model', '=', 'account.bank.statement'), ('res_id', '=', self.statement_id.id)])
|
||||
if self.payment_id:
|
||||
domains.append([('res_model', '=', 'account.payment'), ('res_id', '=', self.payment_id.id)])
|
||||
return domains
|
||||
|
||||
class AccountPartialReconcile(models.Model):
|
||||
_name = "account.partial.reconcile"
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user