diff --git a/odex25_accounting/budget_extra/i18n/ar_001.po b/odex25_accounting/budget_extra/i18n/ar_001.po index f5f5db244..fab1f95fb 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-05 13:17+0000\n" -"PO-Revision-Date: 2024-08-05 13:17+0000\n" +"POT-Creation-Date: 2024-08-08 13:10+0000\n" +"PO-Revision-Date: 2024-08-08 13:10+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -19,6 +19,7 @@ msgstr "" #: model:ir.actions.act_window,name:budget_extra.action_budget_account_program #: model:ir.model,name:budget_extra.model_budget_account_program #: 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 msgid "Account Program" msgstr "التصنيف حسب البرنامج" @@ -33,10 +34,16 @@ msgstr "الموازنة" msgid "Budget Classifcations" msgstr "تصنيف" +#. module: budget_extra +#: model:ir.model,name:budget_extra.model_crossovered_budget_lines +msgid "Budget Line" +msgstr "بند الموازنة" + #. module: budget_extra #: model:ir.actions.act_window,name:budget_extra.action_budget_classification #: model:ir.model,name:budget_extra.model_budget_classification #: 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 msgid "Classification" msgstr "تصنيف" @@ -93,6 +100,7 @@ msgstr "الاسم" #: model:ir.actions.act_window,name:budget_extra.action_budget_door #: model:ir.model,name:budget_extra.model_budget_door #: 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 msgid "Door" msgstr "الباب" @@ -101,6 +109,7 @@ msgstr "الباب" #: model:ir.actions.act_window,name:budget_extra.action_budget_general_classification #: model:ir.model,name:budget_extra.model_budget_general_classification #: 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 msgid "General Classification" msgstr "التصنيف العام" @@ -109,6 +118,7 @@ msgstr "التصنيف العام" #: model:ir.actions.act_window,name:budget_extra.action_budget_higher_management #: model:ir.model,name:budget_extra.model_budget_higher_management #: 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 msgid "Higher Management" msgstr "الإدارات العليا" @@ -165,6 +175,7 @@ msgstr "تم التعديل في" #: model:ir.actions.act_window,name:budget_extra.action_budget_management_classification #: model:ir.model,name:budget_extra.model_budget_management_classification #: 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 msgid "Management Classification" msgstr "التصنيف الاداري" @@ -185,6 +196,7 @@ msgstr "الاسم" #: model:ir.actions.act_window,name:budget_extra.action_budget_program #: model:ir.model,name:budget_extra.model_budget_program #: 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 msgid "Program" msgstr "البرنامج" @@ -193,6 +205,7 @@ msgstr "البرنامج" #: model:ir.actions.act_window,name:budget_extra.action_budget_sub_management #: model:ir.model,name:budget_extra.model_budget_sub_management #: 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 msgid "Sub Management" msgstr "الإدارات الفرعية" diff --git a/odex25_accounting/budget_extra/models/model.py b/odex25_accounting/budget_extra/models/model.py index fb9795878..e8186bdee 100644 --- a/odex25_accounting/budget_extra/models/model.py +++ b/odex25_accounting/budget_extra/models/model.py @@ -134,3 +134,25 @@ class AccountBudget(models.Model): program_id = fields.Many2one('budget.program', string='Program') account_program_id = fields.Many2one('budget.account.program', string='Account Program') door_id = fields.Many2one('budget.door', string='Door') + + +class AccountBudgetLine(models.Model): + _inherit = 'crossovered.budget.lines' + + general_classification_id = fields.Many2one('budget.general.classification', string='General Classification', + related='crossovered_budget_id.general_classification_id', store=True) + higher_management_id = fields.Many2one('budget.higher.management', string='Higher Management', + related='crossovered_budget_id.higher_management_id', store=True) + management_classification_id = fields.Many2one('budget.management.classification', + string='Management Classification', + related='crossovered_budget_id.management_classification_id', + store=True) + classification_id = fields.Many2one('budget.classification', string='Classification', + related='crossovered_budget_id.classification_id', store=True) + sub_management_id = fields.Many2one('budget.sub.management', string='Sub Management', + related='crossovered_budget_id.sub_management_id', store=True) + program_id = fields.Many2one('budget.program', string='Program', related='crossovered_budget_id.program_id', + store=True) + account_program_id = fields.Many2one('budget.account.program', string='Account Program', + related='crossovered_budget_id.account_program_id', store=True) + door_id = fields.Many2one('budget.door', string='Door', related='crossovered_budget_id.door_id', store=True) diff --git a/odex25_accounting/budget_extra/views/view.xml b/odex25_accounting/budget_extra/views/view.xml index 4c18c1b10..785fde27f 100644 --- a/odex25_accounting/budget_extra/views/view.xml +++ b/odex25_accounting/budget_extra/views/view.xml @@ -290,4 +290,23 @@ + + crossovered.budget.view.lines.inherit.form + crossovered.budget.lines + + + + + + + + + + + + + + + + diff --git a/odex25_accounting/odex25_account_payment_fix/__manifest__.py b/odex25_accounting/odex25_account_payment_fix/__manifest__.py index 3072946a0..13885e3d5 100644 --- a/odex25_accounting/odex25_account_payment_fix/__manifest__.py +++ b/odex25_accounting/odex25_account_payment_fix/__manifest__.py @@ -11,6 +11,7 @@ 'website': "http://www.exp-sa.com", 'depends': ['account', 'odex25_account_accountant'], 'data': [ + 'security/security.xml', 'views/account_payment_views.xml', ], 'installable': True, diff --git a/odex25_accounting/odex25_account_payment_fix/i18n/ar.po b/odex25_accounting/odex25_account_payment_fix/i18n/ar.po index 28760e3b7..49aa914cc 100644 --- a/odex25_accounting/odex25_account_payment_fix/i18n/ar.po +++ b/odex25_accounting/odex25_account_payment_fix/i18n/ar.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-05 12:51+0000\n" -"PO-Revision-Date: 2024-08-05 12:51+0000\n" +"POT-Creation-Date: 2024-08-08 13:53+0000\n" +"PO-Revision-Date: 2024-08-08 13:53+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,12 +15,90 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__accounting_manager +#: model:res.groups,name:odex25_account_payment_fix.group_accounting_manager +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "Accounting Manager" +msgstr "المدير المالي" + +#. module: odex25_account_payment_fix +#: model:ir.module.category,description:odex25_account_payment_fix.module_category_payment_access +msgid "After-sales services" +msgstr "" + #. module: odex25_account_payment_fix #: model:ir.model.fields,field_description:odex25_account_payment_fix.field_account_payment__analytic_account_id msgid "Analytic Account" msgstr "الحساب التحليلي" +#. module: odex25_account_payment_fix +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "Cancel" +msgstr "إلغاء" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__cancel +msgid "Cancelled" +msgstr "ملغي" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__depart_manager +#: model:res.groups,name:odex25_account_payment_fix.group_depart_manager +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "Department Manager" +msgstr "رئيس القسم" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__draft +msgid "Draft" +msgstr "مسودة" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__general_manager +#: model:res.groups,name:odex25_account_payment_fix.group_general_manager +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "General Manager" +msgstr "المدير العام" + +#. module: odex25_account_payment_fix +#: model:ir.module.category,name:odex25_account_payment_fix.module_category_payment_access +msgid "Payment Access" +msgstr "" + #. module: odex25_account_payment_fix #: model:ir.model,name:odex25_account_payment_fix.model_account_payment msgid "Payments" msgstr "الدفعات" + +#. module: odex25_account_payment_fix +#: model:res.groups,name:odex25_account_payment_fix.group_posted +msgid "Post Payment" +msgstr "تأكيد" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__posted +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "Posted" +msgstr "مؤكد" + +#. module: odex25_account_payment_fix +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "Set to Draft" +msgstr "تحويل إلى مسودة" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields,field_description:odex25_account_payment_fix.field_account_payment__state_history +msgid "State History" +msgstr "الحالة السابقة" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields,field_description:odex25_account_payment_fix.field_account_payment__state +msgid "Status" +msgstr "الحالة" + +#. module: odex25_account_payment_fix +#: code:addons/odex25_account_payment_fix/models/account_payment.py:0 +#, python-format +msgid "You do not have the necessary permissions (%s) to perform this action." +msgstr "ليس لديك الصلاحيات اللازمة (%s) لأداء هذا الإجراء." diff --git a/odex25_accounting/odex25_account_payment_fix/i18n/ar_001.po b/odex25_accounting/odex25_account_payment_fix/i18n/ar_001.po index 28760e3b7..49aa914cc 100644 --- a/odex25_accounting/odex25_account_payment_fix/i18n/ar_001.po +++ b/odex25_accounting/odex25_account_payment_fix/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-05 12:51+0000\n" -"PO-Revision-Date: 2024-08-05 12:51+0000\n" +"POT-Creation-Date: 2024-08-08 13:53+0000\n" +"PO-Revision-Date: 2024-08-08 13:53+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,12 +15,90 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__accounting_manager +#: model:res.groups,name:odex25_account_payment_fix.group_accounting_manager +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "Accounting Manager" +msgstr "المدير المالي" + +#. module: odex25_account_payment_fix +#: model:ir.module.category,description:odex25_account_payment_fix.module_category_payment_access +msgid "After-sales services" +msgstr "" + #. module: odex25_account_payment_fix #: model:ir.model.fields,field_description:odex25_account_payment_fix.field_account_payment__analytic_account_id msgid "Analytic Account" msgstr "الحساب التحليلي" +#. module: odex25_account_payment_fix +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "Cancel" +msgstr "إلغاء" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__cancel +msgid "Cancelled" +msgstr "ملغي" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__depart_manager +#: model:res.groups,name:odex25_account_payment_fix.group_depart_manager +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "Department Manager" +msgstr "رئيس القسم" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__draft +msgid "Draft" +msgstr "مسودة" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__general_manager +#: model:res.groups,name:odex25_account_payment_fix.group_general_manager +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "General Manager" +msgstr "المدير العام" + +#. module: odex25_account_payment_fix +#: model:ir.module.category,name:odex25_account_payment_fix.module_category_payment_access +msgid "Payment Access" +msgstr "" + #. module: odex25_account_payment_fix #: model:ir.model,name:odex25_account_payment_fix.model_account_payment msgid "Payments" msgstr "الدفعات" + +#. module: odex25_account_payment_fix +#: model:res.groups,name:odex25_account_payment_fix.group_posted +msgid "Post Payment" +msgstr "تأكيد" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__posted +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "Posted" +msgstr "مؤكد" + +#. module: odex25_account_payment_fix +#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant +msgid "Set to Draft" +msgstr "تحويل إلى مسودة" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields,field_description:odex25_account_payment_fix.field_account_payment__state_history +msgid "State History" +msgstr "الحالة السابقة" + +#. module: odex25_account_payment_fix +#: model:ir.model.fields,field_description:odex25_account_payment_fix.field_account_payment__state +msgid "Status" +msgstr "الحالة" + +#. module: odex25_account_payment_fix +#: code:addons/odex25_account_payment_fix/models/account_payment.py:0 +#, python-format +msgid "You do not have the necessary permissions (%s) to perform this action." +msgstr "ليس لديك الصلاحيات اللازمة (%s) لأداء هذا الإجراء." 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 a2aa57462..209537664 100644 --- a/odex25_accounting/odex25_account_payment_fix/models/account_payment.py +++ b/odex25_accounting/odex25_account_payment_fix/models/account_payment.py @@ -1,43 +1,84 @@ # -*- coding: utf-8 -*- -from odoo import models, fields,api, _ +from odoo import models, fields, api, _ +from odoo.exceptions import AccessError class AccountPayment(models.Model): _inherit = "account.payment" + state = fields.Selection(selection=[ + ('draft', 'Draft'), + ('depart_manager', 'Department Manager'), + ('accounting_manager', 'Accounting Manager'), + ('general_manager', 'General Manager'), + ('posted', 'Posted'), + ('cancel', 'Cancelled'), + ], 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) - def action_post(self): - res = super(AccountPayment, self).action_post() - for payment in self: - payment.state= 'posted' - 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 - return res - - def action_cancel(self): - res = super(AccountPayment, self).action_cancel() - for payment in self: - 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 - return res - - def action_draft(self): - res = super(AccountPayment, self).action_draft() - for payment in self: - payment.state= 'draft' - 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 - return res - @api.model def create(self, vals): + vals['state_history'] = 'draft' res = super(AccountPayment, self).create(vals) if res.analytic_account_id and res.move_id: for line in res.move_id.line_ids: line.analytic_account_id = res.analytic_account_id.id return res + + def _check_permission(self, group_xml_id): + if not self.env.user.has_group(group_xml_id): + group_name = self.env.ref(group_xml_id).name + 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') + res = super(AccountPayment, self).action_post() + for payment in self: + payment.state = 'posted' + 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 + + return res + + def action_cancel(self): + 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' + else: + payment.state = self.state_history + payment.state_history = '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 + return res + + def action_draft(self): + res = super(AccountPayment, self).action_draft() + for payment in self: + payment.state = 'draft' + 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 + payment.state_history = 'cancel' + return res + + def action_depart_manager(self): + self._check_permission('odex25_account_payment_fix.group_depart_manager') + self.state_history = self.state + self.state = 'depart_manager' + + def action_accounting_manager(self): + self._check_permission('odex25_account_payment_fix.group_accounting_manager') + self.state_history = self.state + self.state = 'accounting_manager' + + def action_general_manager(self): + self._check_permission('odex25_account_payment_fix.group_general_manager') + self.state_history = self.state + self.state = 'general_manager' diff --git a/odex25_accounting/odex25_account_payment_fix/security/security.xml b/odex25_accounting/odex25_account_payment_fix/security/security.xml new file mode 100644 index 000000000..08cc494f5 --- /dev/null +++ b/odex25_accounting/odex25_account_payment_fix/security/security.xml @@ -0,0 +1,24 @@ + + + Payment Access + After-sales services + 14 + + + + Department Manager + + + + Accounting Manager + + + + General Manager + + + + Post Payment + + + 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 217d32fb8..9f2a9cc2f 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 @@ -10,4 +10,35 @@ + + + account.payment.form.inherit.odex25_account_accountant + account.payment + + + + +
+
+
+
+
+