[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#101307 X-original-commit: f95eb814166646ec3113d35b910a677b21737cd1 Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user