Skip to content
Snippets Groups Projects
Commit f95eb814 authored by Cédric Snauwaert's avatar Cédric Snauwaert
Browse files

[FIX] hr_expense: fix company expense could not be posted


When creating an expense paid by the company, we want the expense
to be on a bank journal. This is currently incompatible with the
current constraint we have that force expense of type 'in_receip'
to be on a purchase journal. Since expense only behave like type
'in_receipt' we can ignore that constraint.

closes odoo/odoo#100957

Signed-off-by: default avatarWilliam André (wan) <wan@odoo.com>
parent 592b8016
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,10 @@ class AccountMove(models.Model):
def is_purchase_document(self, include_receipts=False):
return bool(self.expense_sheet_id and include_receipts) or super().is_purchase_document(include_receipts)
# Expenses can be written on journal other than purchase, hence don't include them in the constraint check
def _check_journal_move_type(self):
return super(AccountMove, self.filtered(lambda x: not x.expense_sheet_id))._check_journal_move_type()
def _creation_message(self):
if self.line_ids.expense_id:
return _("Expense entry Created")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment