new payment updates and enhances

This commit is contained in:
ronozoro 2024-08-08 16:55:45 +03:00
parent fc41a3477d
commit 283c3ad175
No known key found for this signature in database
GPG Key ID: 7C2BDED35C62C0F3
9 changed files with 341 additions and 34 deletions

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

View File

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

View File

@ -290,4 +290,23 @@
</field>
</record>
<record model="ir.ui.view" id="view_crossovered_budget_line_search">
<field name="name">crossovered.budget.view.lines.inherit.form</field>
<field name="model">crossovered.budget.lines</field>
<field name="inherit_id" ref="odex25_account_budget.view_crossovered_budget_line_search"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='analytic_account_id']" position="after">
<field name="general_classification_id"/>
<field name="higher_management_id"/>
<field name="management_classification_id"/>
<field name="classification_id"/>
<field name="sub_management_id"/>
<field name="program_id"/>
<field name="account_program_id"/>
<field name="door_id"/>
</xpath>
</field>
</record>
</odoo>

View File

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

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-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) لأداء هذا الإجراء."

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-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) لأداء هذا الإجراء."

View File

@ -1,25 +1,58 @@
# -*- coding: utf-8 -*-
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)
@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
@ -32,12 +65,20 @@ class AccountPayment(models.Model):
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
@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
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'

View File

@ -0,0 +1,24 @@
<odoo>
<record model="ir.module.category" id="module_category_payment_access">
<field name="name">Payment Access</field>
<field name="description">After-sales services</field>
<field name="sequence">14</field>
</record>
<record id="group_depart_manager" model="res.groups">
<field name="name">Department Manager</field>
<field name="category_id" ref="odex25_account_payment_fix.module_category_payment_access"/>
</record>
<record id="group_accounting_manager" model="res.groups">
<field name="name">Accounting Manager</field>
<field name="category_id" ref="odex25_account_payment_fix.module_category_payment_access"/>
</record>
<record id="group_general_manager" model="res.groups">
<field name="name">General Manager</field>
<field name="category_id" ref="odex25_account_payment_fix.module_category_payment_access"/>
</record>
<record id="group_posted" model="res.groups">
<field name="name">Post Payment</field>
<field name="category_id" ref="odex25_account_payment_fix.module_category_payment_access"/>
</record>
</odoo>

View File

@ -10,4 +10,35 @@
</xpath>
</field>
</record>
<record id="view_account_payment_form_inherit_odex25_account_accountant" model="ir.ui.view">
<field name="name">account.payment.form.inherit.odex25_account_accountant</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_form"/>
<field name="priority" eval="120"/>
<field name="arch" type="xml">
<xpath expr="//header" position="replace">
<header>
<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"
groups="odex25_account_payment_fix.group_depart_manager" class="oe_highlight"/>
<button name="action_accounting_manager" type="object" string="Accounting Manager"
states="depart_manager" groups="odex25_account_payment_fix.group_accounting_manager"
class="oe_highlight"/>
<button name="action_general_manager" type="object" string="General Manager"
states="accounting_manager" groups="odex25_account_payment_fix.group_general_manager"
class="oe_highlight"/>
<button name="action_post" type="object" string="Posted" states="general_manager"
groups="odex25_account_payment_fix.group_posted" class="oe_highlight"/>
<button name="action_cancel" type="object" string="Cancel"
states="draft,depart_manager,accounting_manager,general_manager,posted"
class="oe_highlight"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,depart_manager,accounting_manager,general_manager,posted"/>
</header>
</xpath>
</field>
</record>
</odoo>