From 878ef9e1be9c1106290839407476bc65ed3b232d Mon Sep 17 00:00:00 2001 From: ronozoro Date: Sat, 16 Nov 2024 19:28:28 -0800 Subject: [PATCH] fix issues in accounting expense --- .../exp_budget_check/__manifest__.py | 2 +- .../exp_budget_check/i18n/ar_001.po | 27 ++++++++++++++----- .../exp_budget_check/models/hr_expense.py | 13 +++++++-- .../exp_budget_check/security/security.xml | 8 ++++++ .../views/hr_expense_view.xml | 18 +++++++++++-- .../petty_invoice/i18n/ar_001.po | 12 +++++++-- .../petty_invoice/models/account_move.py | 1 + .../petty_invoice/views/account_move_view.xml | 3 +++ 8 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 odex25_accounting/exp_budget_check/security/security.xml diff --git a/odex25_accounting/exp_budget_check/__manifest__.py b/odex25_accounting/exp_budget_check/__manifest__.py index 52d5bf0e5..225d5b1b7 100644 --- a/odex25_accounting/exp_budget_check/__manifest__.py +++ b/odex25_accounting/exp_budget_check/__manifest__.py @@ -26,7 +26,7 @@ # always loaded 'data': [ - # 'security/ir.model.access.csv', + 'security/security.xml', 'views/account_invoice_view.xml', 'views/hr_expense_view.xml', ], diff --git a/odex25_accounting/exp_budget_check/i18n/ar_001.po b/odex25_accounting/exp_budget_check/i18n/ar_001.po index 5bd88fc0c..49eed6b95 100644 --- a/odex25_accounting/exp_budget_check/i18n/ar_001.po +++ b/odex25_accounting/exp_budget_check/i18n/ar_001.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-13 23:59+0000\n" -"PO-Revision-Date: 2024-10-13 23:59+0000\n" +"POT-Creation-Date: 2024-11-17 03:25+0000\n" +"PO-Revision-Date: 2024-11-17 03:25+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -49,6 +49,11 @@ msgstr "تعميد الموازنة" msgid "Budget Line" msgstr "بند الموازنة" +#. module: exp_budget_check +#: model:res.groups,name:exp_budget_check.odex25_accounting_group_exp_budget_override +msgid "Budget Override in Expense" +msgstr "تجاوز الموازنة في المصروفات" + #. module: exp_budget_check #: model:ir.model.fields.selection,name:exp_budget_check.selection__account_move__state__cancel msgid "Cancelled" @@ -81,6 +86,11 @@ msgstr "المبلغ التعميد" msgid "Confirm Bill" msgstr "تأكيد الفاتورة" +#. module: exp_budget_check +#: model_terms:ir.ui.view,arch_db:exp_budget_check.hr_expense_view_form_inherit +msgid "Create Report" +msgstr "إنشاء تقرير" + #. module: exp_budget_check #: model:ir.model.fields.selection,name:exp_budget_check.selection__account_move__state__draft msgid "Draft" @@ -117,7 +127,7 @@ msgstr "" #: model:ir.model.fields,field_description:exp_budget_check.field_account_payment__invoice_rec_id #: model:ir.model.fields,field_description:exp_budget_check.field_budget_confirmation__invoice_id msgid "Invoice" -msgstr "" +msgstr "فاتورة" #. module: exp_budget_check #: model:ir.model.fields,field_description:exp_budget_check.field_account_bank_statement_line__is_approve @@ -162,7 +172,7 @@ msgstr "عنصر اليومية" #: code:addons/exp_budget_check/models/hr_expense.py:0 #, python-format msgid "New Expense Report" -msgstr "" +msgstr "تقرير مصروف جديد" #. module: exp_budget_check #: model:ir.model.fields,help:exp_budget_check.field_hr_expense__address_id @@ -180,7 +190,7 @@ msgstr "الدفعات" #: code:addons/exp_budget_check/models/hr_expense.py:0 #, python-format msgid "Please Check Budget First" -msgstr "" +msgstr "برجاء التحقق من الموازنة أولا" #. module: exp_budget_check #: code:addons/exp_budget_check/models/account_invoice.py:0 @@ -222,6 +232,11 @@ msgstr "الشريك" msgid "Reserve Amount" msgstr "المبلغ المحجوز" +#. module: exp_budget_check +#: model_terms:ir.ui.view,arch_db:exp_budget_check.hr_expense_view_form_inherit +msgid "Skip Budget" +msgstr "تخطي الموازنة" + #. module: exp_budget_check #: model:ir.model.fields,field_description:exp_budget_check.field_account_bank_statement_line__state_a #: model:ir.model.fields,field_description:exp_budget_check.field_account_bank_statement_line__state_b @@ -251,7 +266,7 @@ msgstr "ضريبة" #: code:addons/exp_budget_check/models/hr_expense.py:0 #, python-format msgid "The Budget Confirmation Doesn't Approve yet" -msgstr "" +msgstr "لم يتم تأكيد الموازنة بعد" #. module: exp_budget_check #: code:addons/exp_budget_check/models/account_invoice.py:0 diff --git a/odex25_accounting/exp_budget_check/models/hr_expense.py b/odex25_accounting/exp_budget_check/models/hr_expense.py index f2e5af442..183a7348b 100644 --- a/odex25_accounting/exp_budget_check/models/hr_expense.py +++ b/odex25_accounting/exp_budget_check/models/hr_expense.py @@ -60,8 +60,10 @@ class AccountMove(models.Model): if record.analytic_account_id.is_analytic_budget: if record.state == 'draft': record.write({'state': 'confirm'}) - elif record.state == 'confirm': + elif record.state == 'confirm' and not record.is_approve: raise UserError(_('Please Check Budget First')) + elif record.state == 'confirm' and record.is_approve: + break elif record.state == 'wait_budget': raise UserError(_("The Budget Confirmation Doesn't Approve yet")) elif record.state == 'budget_approve': @@ -103,7 +105,7 @@ class AccountMove(models.Model): } else: return super(AccountMove, record).action_submit_expenses() - + return super(AccountMove, self).action_submit_expenses() def button_cancel(self): res = super(AccountMove, self).button_cancel() if self.is_check: @@ -189,3 +191,10 @@ class AccountMove(models.Model): 'is_check': True, 'state': 'wait_budget' }) + + def action_budget_skip(self): + self.write({ + 'is_approve': True, + 'state': 'confirm' + }) + return True diff --git a/odex25_accounting/exp_budget_check/security/security.xml b/odex25_accounting/exp_budget_check/security/security.xml new file mode 100644 index 000000000..1d1a514eb --- /dev/null +++ b/odex25_accounting/exp_budget_check/security/security.xml @@ -0,0 +1,8 @@ + + + + + Budget Override in Expense + + + \ No newline at end of file diff --git a/odex25_accounting/exp_budget_check/views/hr_expense_view.xml b/odex25_accounting/exp_budget_check/views/hr_expense_view.xml index 9892be1dd..ac1381157 100644 --- a/odex25_accounting/exp_budget_check/views/hr_expense_view.xml +++ b/odex25_accounting/exp_budget_check/views/hr_expense_view.xml @@ -7,11 +7,25 @@ hr.expense -