fix payment and budget issues

This commit is contained in:
ronozoro 2024-08-12 18:30:56 +03:00
parent 2fe1b101fd
commit b95450ffa9
No known key found for this signature in database
GPG Key ID: 7C2BDED35C62C0F3
5 changed files with 45 additions and 11 deletions

View File

@ -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,

View File

@ -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 "الإدارات الفرعية"

View File

@ -305,6 +305,17 @@
<field name="account_program_id"/>
<field name="door_id"/>
</xpath>
<xpath expr="//group" position="inside">
<filter name="group_general_classification_id" string="General Classification" domain="[]" context="{'group_by':'general_classification_id'}"/>
<filter name="group_higher_management_id" string="Higher Management" domain="[]" context="{'group_by':'higher_management_id'}"/>
<filter name="group_management_classification_id" string="Management Classification" domain="[]" context="{'group_by':'management_classification_id'}"/>
<filter name="group_classification_id" string="Classification" domain="[]" context="{'group_by':'classification_id'}"/>
<filter name="group_sub_management_id" string="Sub Management" domain="[]" context="{'group_by':'sub_management_id'}"/>
<filter name="group_program_id" string="Program" domain="[]" context="{'group_by':'program_id'}"/>
<filter name="group_account_program_id" string="Account Program" domain="[]" context="{'group_by':'account_program_id'}"/>
<filter name="group_door_id" string="Door" domain="[]" context="{'group_by':'door_id'}"/>
</xpath>
</field>
</record>

View File

@ -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

View File

@ -18,7 +18,7 @@
<field name="priority" eval="120"/>
<field name="arch" type="xml">
<xpath expr="//header" position="replace">
<header>
<header attrs="{'invisible':[('payment_type','!=','outbound')]}">
<button name="action_draft" type="object" string="Set to Draft" states="cancel"
class="oe_highlight"/>
<button name="action_depart_manager" type="object" string="Department Manager" states="draft"
@ -37,6 +37,17 @@
<field name="state" widget="statusbar"
statusbar_visible="draft,depart_manager,accounting_manager,general_manager,posted"/>
</header>
<header attrs="{'invisible':[('payment_type','=','outbound')]}">
<button name="action_draft" type="object" string="Set to Draft" states="cancel"
class="oe_highlight"/>
<button name="action_post" type="object" string="Posted" states="draft" class="oe_highlight"/>
<button name="action_cancel" type="object" string="Cancel"
states="draft,posted"
class="oe_highlight"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,posted"/>
</header>
</xpath>
</field>
</record>