diff --git a/odex25_accounting/budget_extra/__init__.py b/odex25_accounting/budget_extra/__init__.py new file mode 100644 index 000000000..f5ba686bc --- /dev/null +++ b/odex25_accounting/budget_extra/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models \ No newline at end of file diff --git a/odex25_accounting/budget_extra/__manifest__.py b/odex25_accounting/budget_extra/__manifest__.py new file mode 100644 index 000000000..5aa2c6d62 --- /dev/null +++ b/odex25_accounting/budget_extra/__manifest__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +{ + 'name': 'Budget Extra Fields', + 'version': '1.1', + 'category': 'Odex25-Accounting/Odex25-Accounting', + 'sequence': 30, + 'summary': 'Manage Budget Classifications and Programs', + 'description': """ Fix issues with payment +""", + 'author': "Expert Co. Ltd.", + 'website': "http://www.exp-sa.com", + 'depends': ['account_budget_custom','hr'], + 'data': [ +'security/ir.model.access.csv', + 'views/view.xml', + ], + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/odex25_accounting/budget_extra/i18n/ar_001.po b/odex25_accounting/budget_extra/i18n/ar_001.po new file mode 100644 index 000000000..f5f5db244 --- /dev/null +++ b/odex25_accounting/budget_extra/i18n/ar_001.po @@ -0,0 +1,198 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * budget_extra +# +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" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: budget_extra +#: 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.ui.menu,name:budget_extra.menu_budget_account_program +msgid "Account Program" +msgstr "التصنيف حسب البرنامج" + +#. module: budget_extra +#: model:ir.model,name:budget_extra.model_crossovered_budget +msgid "Budget" +msgstr "الموازنة" + +#. module: budget_extra +#: model:ir.ui.menu,name:budget_extra.menu_budget_classifications +msgid "Budget Classifcations" +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.ui.menu,name:budget_extra.menu_budget_classification +msgid "Classification" +msgstr "تصنيف" + +#. module: budget_extra +#: model:ir.model.fields,field_description:budget_extra.field_budget_account_program__code +#: model:ir.model.fields,field_description:budget_extra.field_budget_classification__code +#: model:ir.model.fields,field_description:budget_extra.field_budget_door__code +#: model:ir.model.fields,field_description:budget_extra.field_budget_general_classification__code +#: model:ir.model.fields,field_description:budget_extra.field_budget_higher_management__code +#: model:ir.model.fields,field_description:budget_extra.field_budget_management_classification__code +#: model:ir.model.fields,field_description:budget_extra.field_budget_program__code +#: model:ir.model.fields,field_description:budget_extra.field_budget_sub_management__code +msgid "Code" +msgstr "كود" + +#. module: budget_extra +#: model:ir.model.fields,field_description:budget_extra.field_budget_account_program__create_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_classification__create_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_door__create_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_general_classification__create_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_higher_management__create_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_management_classification__create_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_program__create_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_sub_management__create_uid +msgid "Created by" +msgstr "" + +#. module: budget_extra +#: model:ir.model.fields,field_description:budget_extra.field_budget_account_program__create_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_classification__create_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_door__create_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_general_classification__create_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_higher_management__create_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_management_classification__create_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_program__create_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_sub_management__create_date +msgid "Created on" +msgstr "انشئ في" + +#. module: budget_extra +#: model:ir.model.fields,field_description:budget_extra.field_budget_account_program__display_name +#: model:ir.model.fields,field_description:budget_extra.field_budget_classification__display_name +#: model:ir.model.fields,field_description:budget_extra.field_budget_door__display_name +#: model:ir.model.fields,field_description:budget_extra.field_budget_general_classification__display_name +#: model:ir.model.fields,field_description:budget_extra.field_budget_higher_management__display_name +#: model:ir.model.fields,field_description:budget_extra.field_budget_management_classification__display_name +#: model:ir.model.fields,field_description:budget_extra.field_budget_program__display_name +#: model:ir.model.fields,field_description:budget_extra.field_budget_sub_management__display_name +msgid "Display Name" +msgstr "الاسم" + +#. module: budget_extra +#: 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.ui.menu,name:budget_extra.menu_budget_door +msgid "Door" +msgstr "الباب" + +#. module: budget_extra +#: 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.ui.menu,name:budget_extra.menu_budget_general_classification +msgid "General Classification" +msgstr "التصنيف العام" + +#. module: budget_extra +#: 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.ui.menu,name:budget_extra.menu_budget_higher_management +msgid "Higher Management" +msgstr "الإدارات العليا" + +#. module: budget_extra +#: model:ir.model.fields,field_description:budget_extra.field_budget_account_program__id +#: model:ir.model.fields,field_description:budget_extra.field_budget_classification__id +#: model:ir.model.fields,field_description:budget_extra.field_budget_door__id +#: model:ir.model.fields,field_description:budget_extra.field_budget_general_classification__id +#: model:ir.model.fields,field_description:budget_extra.field_budget_higher_management__id +#: model:ir.model.fields,field_description:budget_extra.field_budget_management_classification__id +#: model:ir.model.fields,field_description:budget_extra.field_budget_program__id +#: model:ir.model.fields,field_description:budget_extra.field_budget_sub_management__id +msgid "ID" +msgstr "رقم" + +#. module: budget_extra +#: model:ir.model.fields,field_description:budget_extra.field_budget_account_program____last_update +#: model:ir.model.fields,field_description:budget_extra.field_budget_classification____last_update +#: model:ir.model.fields,field_description:budget_extra.field_budget_door____last_update +#: model:ir.model.fields,field_description:budget_extra.field_budget_general_classification____last_update +#: model:ir.model.fields,field_description:budget_extra.field_budget_higher_management____last_update +#: model:ir.model.fields,field_description:budget_extra.field_budget_management_classification____last_update +#: model:ir.model.fields,field_description:budget_extra.field_budget_program____last_update +#: model:ir.model.fields,field_description:budget_extra.field_budget_sub_management____last_update +msgid "Last Modified on" +msgstr "تم التعديل في" + +#. module: budget_extra +#: model:ir.model.fields,field_description:budget_extra.field_budget_account_program__write_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_classification__write_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_door__write_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_general_classification__write_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_higher_management__write_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_management_classification__write_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_program__write_uid +#: model:ir.model.fields,field_description:budget_extra.field_budget_sub_management__write_uid +msgid "Last Updated by" +msgstr "تم التعديل بواسطة" + +#. module: budget_extra +#: model:ir.model.fields,field_description:budget_extra.field_budget_account_program__write_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_classification__write_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_door__write_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_general_classification__write_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_higher_management__write_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_management_classification__write_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_program__write_date +#: model:ir.model.fields,field_description:budget_extra.field_budget_sub_management__write_date +msgid "Last Updated on" +msgstr "تم التعديل في" + +#. module: budget_extra +#: 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.ui.menu,name:budget_extra.menu_budget_management_classification +msgid "Management Classification" +msgstr "التصنيف الاداري" + +#. module: budget_extra +#: model:ir.model.fields,field_description:budget_extra.field_budget_account_program__name +#: model:ir.model.fields,field_description:budget_extra.field_budget_classification__name +#: model:ir.model.fields,field_description:budget_extra.field_budget_door__name +#: model:ir.model.fields,field_description:budget_extra.field_budget_general_classification__name +#: model:ir.model.fields,field_description:budget_extra.field_budget_higher_management__name +#: model:ir.model.fields,field_description:budget_extra.field_budget_management_classification__name +#: model:ir.model.fields,field_description:budget_extra.field_budget_program__name +#: model:ir.model.fields,field_description:budget_extra.field_budget_sub_management__name +msgid "Name" +msgstr "الاسم" + +#. module: budget_extra +#: 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.ui.menu,name:budget_extra.menu_budget_program +msgid "Program" +msgstr "البرنامج" + +#. module: budget_extra +#: 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.ui.menu,name:budget_extra.menu_budget_sub_management +msgid "Sub Management" +msgstr "الإدارات الفرعية" diff --git a/odex25_accounting/budget_extra/models/__init__.py b/odex25_accounting/budget_extra/models/__init__.py new file mode 100644 index 000000000..bad9dcddc --- /dev/null +++ b/odex25_accounting/budget_extra/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import model diff --git a/odex25_accounting/budget_extra/models/model.py b/odex25_accounting/budget_extra/models/model.py new file mode 100644 index 000000000..fb9795878 --- /dev/null +++ b/odex25_accounting/budget_extra/models/model.py @@ -0,0 +1,136 @@ +from odoo import models, fields, api +from odoo.exceptions import ValidationError + + +class BudgetGeneralClassification(models.Model): + _name = 'budget.general.classification' + _description = 'General Classification' + _rec_name = 'name' + + name = fields.Char(required=True) + code = fields.Char(required=True) + + @api.constrains('code') + def _check_code_unique(self): + for record in self: + if self.search([('code', '=', record.code), ('id', '!=', record.id)]): + raise ValidationError('The code must be unique.') + + +class BudgetHigherManagement(models.Model): + _name = 'budget.higher.management' + _description = 'Higher Management' + _rec_name = 'name' + + name = fields.Char(required=True) + code = fields.Char(required=True) + + @api.constrains('code') + def _check_code_unique(self): + for record in self: + if self.search([('code', '=', record.code), ('id', '!=', record.id)]): + raise ValidationError('The code must be unique.') + + +class BudgetManagementClassification(models.Model): + _name = 'budget.management.classification' + _description = 'Management Classification' + _rec_name = 'name' + + name = fields.Char(required=True) + code = fields.Char(required=True) + + @api.constrains('code') + def _check_code_unique(self): + for record in self: + if self.search([('code', '=', record.code), ('id', '!=', record.id)]): + raise ValidationError('The code must be unique.') + + +class BudgetClassification(models.Model): + _name = 'budget.classification' + _description = 'Classification' + _rec_name = 'name' + + name = fields.Char(required=True) + code = fields.Char(required=True) + + @api.constrains('code') + def _check_code_unique(self): + for record in self: + if self.search([('code', '=', record.code), ('id', '!=', record.id)]): + raise ValidationError('The code must be unique.') + + +class BudgetSubManagement(models.Model): + _name = 'budget.sub.management' + _description = 'Sub Management' + _rec_name = 'name' + + name = fields.Char(required=True) + code = fields.Char(required=True) + + @api.constrains('code') + def _check_code_unique(self): + for record in self: + if self.search([('code', '=', record.code), ('id', '!=', record.id)]): + raise ValidationError('The code must be unique.') + + +class BudgetProgram(models.Model): + _name = 'budget.program' + _description = 'Program' + _rec_name = 'name' + + name = fields.Char(required=True) + code = fields.Char(required=True) + + @api.constrains('code') + def _check_code_unique(self): + for record in self: + if self.search([('code', '=', record.code), ('id', '!=', record.id)]): + raise ValidationError('The code must be unique.') + + +class BudgetAccountProgram(models.Model): + _name = 'budget.account.program' + _description = 'Account Program' + _rec_name = 'name' + + name = fields.Char(required=True) + code = fields.Char(required=True) + + @api.constrains('code') + def _check_code_unique(self): + for record in self: + if self.search([('code', '=', record.code), ('id', '!=', record.id)]): + raise ValidationError('The code must be unique.') + + +class BudgetDoor(models.Model): + _name = 'budget.door' + _description = 'Door' + _rec_name = 'name' + + name = fields.Char(required=True) + code = fields.Char(required=True) + + @api.constrains('code') + def _check_code_unique(self): + for record in self: + if self.search([('code', '=', record.code), ('id', '!=', record.id)]): + raise ValidationError('The code must be unique.') + + +class AccountBudget(models.Model): + _inherit = 'crossovered.budget' + + general_classification_id = fields.Many2one('budget.general.classification', string='General Classification') + higher_management_id = fields.Many2one('budget.higher.management', string='Higher Management') + management_classification_id = fields.Many2one('budget.management.classification', + string='Management Classification') + classification_id = fields.Many2one('budget.classification', string='Classification') + sub_management_id = fields.Many2one('budget.sub.management', string='Sub Management') + 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') diff --git a/odex25_accounting/budget_extra/security/ir.model.access.csv b/odex25_accounting/budget_extra/security/ir.model.access.csv new file mode 100644 index 000000000..6b1e00e8c --- /dev/null +++ b/odex25_accounting/budget_extra/security/ir.model.access.csv @@ -0,0 +1,9 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_budget_general_classification,budget.general.classification,model_budget_general_classification,base.group_user,1,1,1,1 +access_budget_higher_management,budget.higher.management,model_budget_higher_management,base.group_user,1,1,1,1 +access_budget_management_classification,budget.management.classification,model_budget_management_classification,base.group_user,1,1,1,1 +access_budget_classification,budget.classification,model_budget_classification,base.group_user,1,1,1,1 +access_budget_sub_management,budget.sub.management,model_budget_sub_management,base.group_user,1,1,1,1 +access_budget_program,budget.program,model_budget_program,base.group_user,1,1,1,1 +access_budget_account_program,budget.account.program,model_budget_account_program,base.group_user,1,1,1,1 +access_budget_door,budget.door,model_budget_door,base.group_user,1,1,1,1 diff --git a/odex25_accounting/budget_extra/views/view.xml b/odex25_accounting/budget_extra/views/view.xml new file mode 100644 index 000000000..4c18c1b10 --- /dev/null +++ b/odex25_accounting/budget_extra/views/view.xml @@ -0,0 +1,293 @@ + + + + budget.general.classification.tree + budget.general.classification + + + + + + + + + + budget.general.classification.form + budget.general.classification + +
+ + + + +
+
+
+ + + General Classification + budget.general.classification + tree,form + + + + + + + + budget.higher.management.tree + budget.higher.management + + + + + + + + + + budget.higher.management.form + budget.higher.management + +
+ + + + +
+
+
+ + + Higher Management + budget.higher.management + tree,form + + + + + + + budget.management.classification.tree + budget.management.classification + + + + + + + + + + budget.management.classification.form + budget.management.classification + +
+ + + + +
+
+
+ + + Management Classification + budget.management.classification + tree,form + + + + + + + budget.classification.tree + budget.classification + + + + + + + + + + budget.classification.form + budget.classification + +
+ + + + +
+
+
+ + + Classification + budget.classification + tree,form + + + + + + + budget.sub.management.tree + budget.sub.management + + + + + + + + + + budget.sub.management.form + budget.sub.management + +
+ + + + +
+
+
+ + + Sub Management + budget.sub.management + tree,form + + + + + + + budget.program.tree + budget.program + + + + + + + + + + budget.program.form + budget.program + +
+ + + + +
+
+
+ + + Program + budget.program + tree,form + + + + + + + budget.account.program.tree + budget.account.program + + + + + + + + + + budget.account.program.form + budget.account.program + +
+ + + + +
+
+
+ + + Account Program + budget.account.program + tree,form + + + + + + + budget.door.tree + budget.door + + + + + + + + + + budget.door.form + budget.door + +
+ + + + +
+
+
+ + + Door + budget.door + tree,form + + + + + + crossovered.budget.view.inherit.form + crossovered.budget + + + + + + + + + + + + + + + +
diff --git a/odex25_accounting/odex25_account_accountant/models/account_payment.py b/odex25_accounting/odex25_account_accountant/models/account_payment.py index d4e26a913..1822c1345 100644 --- a/odex25_accounting/odex25_account_accountant/models/account_payment.py +++ b/odex25_accounting/odex25_account_accountant/models/account_payment.py @@ -6,6 +6,8 @@ from odoo.exceptions import UserError class AccountPayment(models.Model): _inherit = "account.payment" + analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', copy=False) + def action_open_manual_reconciliation_widget(self): ''' Open the manual reconciliation widget for the current payment. :return: A dictionary representing an action. @@ -31,3 +33,30 @@ class AccountPayment(models.Model): 'tag': 'manual_reconciliation_view', 'context': action_context, } + + 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 \ No newline at end of file diff --git a/odex25_accounting/odex25_account_accountant/views/account_payment_views.xml b/odex25_accounting/odex25_account_accountant/views/account_payment_views.xml index a55ca2d53..fb23a37d5 100644 --- a/odex25_accounting/odex25_account_accountant/views/account_payment_views.xml +++ b/odex25_accounting/odex25_account_accountant/views/account_payment_views.xml @@ -8,6 +8,9 @@ account.group_account_manager + + + diff --git a/odex25_accounting/odex25_account_payment_fix/__init__.py b/odex25_accounting/odex25_account_payment_fix/__init__.py new file mode 100644 index 000000000..1ad0afc91 --- /dev/null +++ b/odex25_accounting/odex25_account_payment_fix/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + + +from . import models \ No newline at end of file diff --git a/odex25_accounting/odex25_account_payment_fix/__manifest__.py b/odex25_accounting/odex25_account_payment_fix/__manifest__.py new file mode 100644 index 000000000..3072946a0 --- /dev/null +++ b/odex25_accounting/odex25_account_payment_fix/__manifest__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +{ + 'name': 'Odex25 Payment Fix', + 'version': '1.1', + 'category': 'Odex25-Accounting/Odex25-Accounting', + 'sequence': 30, + 'summary': 'Manage financial and analytic accounting', + 'description': """ Fix issues with payment +""", + 'author': "Expert Co. Ltd.", + 'website': "http://www.exp-sa.com", + 'depends': ['account', 'odex25_account_accountant'], + 'data': [ + 'views/account_payment_views.xml', + ], + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/odex25_accounting/odex25_account_payment_fix/i18n/ar.po b/odex25_accounting/odex25_account_payment_fix/i18n/ar.po new file mode 100644 index 000000000..28760e3b7 --- /dev/null +++ b/odex25_accounting/odex25_account_payment_fix/i18n/ar.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * odex25_account_payment_fix +# +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" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. 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:ir.model,name:odex25_account_payment_fix.model_account_payment +msgid "Payments" +msgstr "الدفعات" diff --git a/odex25_accounting/odex25_account_payment_fix/i18n/ar_001.po b/odex25_accounting/odex25_account_payment_fix/i18n/ar_001.po new file mode 100644 index 000000000..28760e3b7 --- /dev/null +++ b/odex25_accounting/odex25_account_payment_fix/i18n/ar_001.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * odex25_account_payment_fix +# +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" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. 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:ir.model,name:odex25_account_payment_fix.model_account_payment +msgid "Payments" +msgstr "الدفعات" diff --git a/odex25_accounting/odex25_account_payment_fix/models/__init__.py b/odex25_accounting/odex25_account_payment_fix/models/__init__.py new file mode 100644 index 000000000..d564ba5da --- /dev/null +++ b/odex25_accounting/odex25_account_payment_fix/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import account_payment diff --git a/odex25_accounting/odex25_account_payment_fix/models/account_payment.py b/odex25_accounting/odex25_account_payment_fix/models/account_payment.py new file mode 100644 index 000000000..8220665c2 --- /dev/null +++ b/odex25_accounting/odex25_account_payment_fix/models/account_payment.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from odoo import models, fields,api, _ + + +class AccountPayment(models.Model): + _inherit = "account.payment" + + 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): + 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 \ No newline at end of file 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 new file mode 100644 index 000000000..217d32fb8 --- /dev/null +++ b/odex25_accounting/odex25_account_payment_fix/views/account_payment_views.xml @@ -0,0 +1,13 @@ + + + + account.payment.form.inherit.odex25_account_accountant + account.payment + + + + + + + +