Merge pull request #1340 from expsa/zen_fix_budget

fix button action budget
This commit is contained in:
mazenmuhamad 2024-09-30 12:31:28 +03:00 committed by GitHub
commit 04ab15a683
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -14,7 +14,7 @@ class BudgetConfirmationCustom(models.Model):
if self.expense_id and self.type == 'expense':
self.expense_id.write({'state': 'draft'})
self.expense_id.message_post(body=_(
"Rejected By : %s With Reject Reason : %s" % (str(self.env.user.name), str(self.reject_reason))))
"Rejected By : %s With Reject Reason : %s" % (str(self.env.user.name), str(self.reject_reason or self.env.context.get('reject_reason','')))))
def done(self):
super(BudgetConfirmationCustom, self).done()
@ -149,9 +149,11 @@ class AccountMove(models.Model):
else:
budget_line = budget_lines[0]
remain = abs(budget_line.remain)
amount = self.total_amount
tax_id = self.tax_ids[0].analytic if self.tax_ids else False
price_before_tax= self.unit_amount* self.quantity
tax_price = self.total_amount - price_before_tax
amount = price_before_tax + (tax_price if tax_id else 0)
new_remain = remain - amount
data = {
'name': _('Expense: %s') % self.employee_id.name,
'date': self.date,