From b95450ffa9dfb4793c82f12f46de8119d11d0480 Mon Sep 17 00:00:00 2001 From: ronozoro Date: Mon, 12 Aug 2024 18:30:56 +0300 Subject: [PATCH] fix payment and budget issues --- odex25_accounting/budget_extra/__manifest__.py | 2 +- odex25_accounting/budget_extra/i18n/ar_001.po | 12 ++++++++++-- odex25_accounting/budget_extra/views/view.xml | 11 +++++++++++ .../models/account_payment.py | 18 +++++++++++------- .../views/account_payment_views.xml | 13 ++++++++++++- 5 files changed, 45 insertions(+), 11 deletions(-) diff --git a/odex25_accounting/budget_extra/__manifest__.py b/odex25_accounting/budget_extra/__manifest__.py index 5aa2c6d62..05e99612d 100644 --- a/odex25_accounting/budget_extra/__manifest__.py +++ b/odex25_accounting/budget_extra/__manifest__.py @@ -11,7 +11,7 @@ 'website': "http://www.exp-sa.com", 'depends': ['account_budget_custom','hr'], 'data': [ -'security/ir.model.access.csv', + 'security/ir.model.access.csv', 'views/view.xml', ], 'installable': True, diff --git a/odex25_accounting/budget_extra/i18n/ar_001.po b/odex25_accounting/budget_extra/i18n/ar_001.po index fab1f95fb..1576bea2c 100644 --- a/odex25_accounting/budget_extra/i18n/ar_001.po +++ b/odex25_accounting/budget_extra/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-08-08 13:10+0000\n" -"PO-Revision-Date: 2024-08-08 13:10+0000\n" +"POT-Creation-Date: 2024-08-12 15:29+0000\n" +"PO-Revision-Date: 2024-08-12 15:29+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -21,6 +21,7 @@ msgstr "" #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget__account_program_id #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget_lines__account_program_id #: model:ir.ui.menu,name:budget_extra.menu_budget_account_program +#: model_terms:ir.ui.view,arch_db:budget_extra.view_crossovered_budget_line_search msgid "Account Program" msgstr "التصنيف حسب البرنامج" @@ -45,6 +46,7 @@ msgstr "بند الموازنة" #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget__classification_id #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget_lines__classification_id #: model:ir.ui.menu,name:budget_extra.menu_budget_classification +#: model_terms:ir.ui.view,arch_db:budget_extra.view_crossovered_budget_line_search msgid "Classification" msgstr "تصنيف" @@ -102,6 +104,7 @@ msgstr "الاسم" #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget__door_id #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget_lines__door_id #: model:ir.ui.menu,name:budget_extra.menu_budget_door +#: model_terms:ir.ui.view,arch_db:budget_extra.view_crossovered_budget_line_search msgid "Door" msgstr "الباب" @@ -111,6 +114,7 @@ msgstr "الباب" #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget__general_classification_id #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget_lines__general_classification_id #: model:ir.ui.menu,name:budget_extra.menu_budget_general_classification +#: model_terms:ir.ui.view,arch_db:budget_extra.view_crossovered_budget_line_search msgid "General Classification" msgstr "التصنيف العام" @@ -120,6 +124,7 @@ msgstr "التصنيف العام" #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget__higher_management_id #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget_lines__higher_management_id #: model:ir.ui.menu,name:budget_extra.menu_budget_higher_management +#: model_terms:ir.ui.view,arch_db:budget_extra.view_crossovered_budget_line_search msgid "Higher Management" msgstr "الإدارات العليا" @@ -177,6 +182,7 @@ msgstr "تم التعديل في" #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget__management_classification_id #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget_lines__management_classification_id #: model:ir.ui.menu,name:budget_extra.menu_budget_management_classification +#: model_terms:ir.ui.view,arch_db:budget_extra.view_crossovered_budget_line_search msgid "Management Classification" msgstr "التصنيف الاداري" @@ -198,6 +204,7 @@ msgstr "الاسم" #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget__program_id #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget_lines__program_id #: model:ir.ui.menu,name:budget_extra.menu_budget_program +#: model_terms:ir.ui.view,arch_db:budget_extra.view_crossovered_budget_line_search msgid "Program" msgstr "البرنامج" @@ -207,5 +214,6 @@ msgstr "البرنامج" #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget__sub_management_id #: model:ir.model.fields,field_description:budget_extra.field_crossovered_budget_lines__sub_management_id #: model:ir.ui.menu,name:budget_extra.menu_budget_sub_management +#: model_terms:ir.ui.view,arch_db:budget_extra.view_crossovered_budget_line_search msgid "Sub Management" msgstr "الإدارات الفرعية" diff --git a/odex25_accounting/budget_extra/views/view.xml b/odex25_accounting/budget_extra/views/view.xml index 785fde27f..27380e73a 100644 --- a/odex25_accounting/budget_extra/views/view.xml +++ b/odex25_accounting/budget_extra/views/view.xml @@ -305,6 +305,17 @@ + + + + + + + + + + + diff --git a/odex25_accounting/odex25_account_payment_fix/models/account_payment.py b/odex25_accounting/odex25_account_payment_fix/models/account_payment.py index 209537664..3842be0d9 100644 --- a/odex25_accounting/odex25_account_payment_fix/models/account_payment.py +++ b/odex25_accounting/odex25_account_payment_fix/models/account_payment.py @@ -16,7 +16,7 @@ class AccountPayment(models.Model): ], default='draft', string='Status', required=True, readonly=True, copy=False, tracking=True) state_history = fields.Char(string='State History', default='draft') - analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', copy=True) + analytic_account_id = fields.Many2one(comodel_name='account.analytic.account', string='Analytic Account', copy=True) @api.model def create(self, vals): @@ -33,7 +33,8 @@ class AccountPayment(models.Model): raise AccessError(_("You do not have the necessary permissions (%s) to perform this action.") % group_name) def action_post(self): - self._check_permission('odex25_account_payment_fix.group_posted') + if self.payment_type == 'outbound': + self._check_permission('odex25_account_payment_fix.group_posted') res = super(AccountPayment, self).action_post() for payment in self: payment.state = 'posted' @@ -47,12 +48,15 @@ class AccountPayment(models.Model): payment_state = self.state res = super(AccountPayment, self).action_cancel() for payment in self: - self._check_permission(f'odex25_account_payment_fix.group_{payment.state}') - if payment_state == 'draft': - payment.state = 'cancel' + if self.payment_type == 'outbound': + self._check_permission(f'odex25_account_payment_fix.group_{payment.state}') + if payment_state == 'draft': + payment.state = 'cancel' + else: + payment.state = self.state_history + payment.state_history = 'cancel' else: - payment.state = self.state_history - payment.state_history = 'cancel' + payment.state = 'cancel' if payment.analytic_account_id and payment.move_id: for line in payment.move_id.line_ids: line.analytic_account_id = payment.analytic_account_id.id diff --git a/odex25_accounting/odex25_account_payment_fix/views/account_payment_views.xml b/odex25_accounting/odex25_account_payment_fix/views/account_payment_views.xml index 9f2a9cc2f..0c31baaa9 100644 --- a/odex25_accounting/odex25_account_payment_fix/views/account_payment_views.xml +++ b/odex25_accounting/odex25_account_payment_fix/views/account_payment_views.xml @@ -18,7 +18,7 @@ -
+
+
+
+