fix issues in accounting expense

This commit is contained in:
ronozoro 2024-11-16 19:28:28 -08:00
parent 3864ae9b89
commit 878ef9e1be
No known key found for this signature in database
GPG Key ID: 7C2BDED35C62C0F3
8 changed files with 71 additions and 13 deletions

View File

@ -26,7 +26,7 @@
# always loaded
'data': [
# 'security/ir.model.access.csv',
'security/security.xml',
'views/account_invoice_view.xml',
'views/hr_expense_view.xml',
],

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-10-13 23:59+0000\n"
"PO-Revision-Date: 2024-10-13 23:59+0000\n"
"POT-Creation-Date: 2024-11-17 03:25+0000\n"
"PO-Revision-Date: 2024-11-17 03:25+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -49,6 +49,11 @@ msgstr "تعميد الموازنة"
msgid "Budget Line"
msgstr "بند الموازنة"
#. module: exp_budget_check
#: model:res.groups,name:exp_budget_check.odex25_accounting_group_exp_budget_override
msgid "Budget Override in Expense"
msgstr "تجاوز الموازنة في المصروفات"
#. module: exp_budget_check
#: model:ir.model.fields.selection,name:exp_budget_check.selection__account_move__state__cancel
msgid "Cancelled"
@ -81,6 +86,11 @@ msgstr "المبلغ التعميد"
msgid "Confirm Bill"
msgstr "تأكيد الفاتورة"
#. module: exp_budget_check
#: model_terms:ir.ui.view,arch_db:exp_budget_check.hr_expense_view_form_inherit
msgid "Create Report"
msgstr "إنشاء تقرير"
#. module: exp_budget_check
#: model:ir.model.fields.selection,name:exp_budget_check.selection__account_move__state__draft
msgid "Draft"
@ -117,7 +127,7 @@ msgstr ""
#: model:ir.model.fields,field_description:exp_budget_check.field_account_payment__invoice_rec_id
#: model:ir.model.fields,field_description:exp_budget_check.field_budget_confirmation__invoice_id
msgid "Invoice"
msgstr ""
msgstr "فاتورة"
#. module: exp_budget_check
#: model:ir.model.fields,field_description:exp_budget_check.field_account_bank_statement_line__is_approve
@ -162,7 +172,7 @@ msgstr "عنصر اليومية"
#: code:addons/exp_budget_check/models/hr_expense.py:0
#, python-format
msgid "New Expense Report"
msgstr ""
msgstr "تقرير مصروف جديد"
#. module: exp_budget_check
#: model:ir.model.fields,help:exp_budget_check.field_hr_expense__address_id
@ -180,7 +190,7 @@ msgstr "الدفعات"
#: code:addons/exp_budget_check/models/hr_expense.py:0
#, python-format
msgid "Please Check Budget First"
msgstr ""
msgstr "برجاء التحقق من الموازنة أولا"
#. module: exp_budget_check
#: code:addons/exp_budget_check/models/account_invoice.py:0
@ -222,6 +232,11 @@ msgstr "الشريك"
msgid "Reserve Amount"
msgstr "المبلغ المحجوز"
#. module: exp_budget_check
#: model_terms:ir.ui.view,arch_db:exp_budget_check.hr_expense_view_form_inherit
msgid "Skip Budget"
msgstr "تخطي الموازنة"
#. module: exp_budget_check
#: model:ir.model.fields,field_description:exp_budget_check.field_account_bank_statement_line__state_a
#: model:ir.model.fields,field_description:exp_budget_check.field_account_bank_statement_line__state_b
@ -251,7 +266,7 @@ msgstr "ضريبة"
#: code:addons/exp_budget_check/models/hr_expense.py:0
#, python-format
msgid "The Budget Confirmation Doesn't Approve yet"
msgstr ""
msgstr "لم يتم تأكيد الموازنة بعد"
#. module: exp_budget_check
#: code:addons/exp_budget_check/models/account_invoice.py:0

View File

@ -60,8 +60,10 @@ class AccountMove(models.Model):
if record.analytic_account_id.is_analytic_budget:
if record.state == 'draft':
record.write({'state': 'confirm'})
elif record.state == 'confirm':
elif record.state == 'confirm' and not record.is_approve:
raise UserError(_('Please Check Budget First'))
elif record.state == 'confirm' and record.is_approve:
break
elif record.state == 'wait_budget':
raise UserError(_("The Budget Confirmation Doesn't Approve yet"))
elif record.state == 'budget_approve':
@ -103,7 +105,7 @@ class AccountMove(models.Model):
}
else:
return super(AccountMove, record).action_submit_expenses()
return super(AccountMove, self).action_submit_expenses()
def button_cancel(self):
res = super(AccountMove, self).button_cancel()
if self.is_check:
@ -189,3 +191,10 @@ class AccountMove(models.Model):
'is_check': True,
'state': 'wait_budget'
})
def action_budget_skip(self):
self.write({
'is_approve': True,
'state': 'confirm'
})
return True

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="odex25_accounting_group_exp_budget_override" model="res.groups">
<field name="name">Budget Override in Expense</field>
</record>
</data>
</odoo>

View File

@ -7,11 +7,25 @@
<field name="model">hr.expense</field>
<field name="inherit_id" ref="hr_expense.hr_expense_view_form"/>
<field name="arch" type="xml">
<xpath expr="//header" position="inside">
<button name="action_budget" type="object" string="Check Budget" class="oe_highlight"
attrs="{'invisible': [('state', '!=', 'confirm')]}"/>
attrs="{'invisible': [('state', '!=', 'draft')]}"/>
<button name="action_budget_skip" type="object" string="Skip Budget" class="oe_highlight"
attrs="{'invisible': [('state', '!=', 'draft')]}" groups="exp_budget_check.odex25_accounting_group_exp_budget_override"/>
</xpath>
<xpath expr="//button[@name='action_submit_expenses'][1]" position="replace">
<button name="action_submit_expenses" string="Create Report" type="object"
class="oe_highlight o_expense_submit"
attrs="{'invisible': ['|','|', ('attachment_number', '&lt;=', 0), ('sheet_id', '!=', False),('state', '=', 'draft')]}"/>
</xpath>
<xpath expr="//button[@name='action_submit_expenses'][2]" position="replace">
<button name="action_submit_expenses" string="Create Report" type="object" class="o_expense_submit"
attrs="{'invisible': ['|','|', ('attachment_number', '&gt;=', 1), ('sheet_id', '!=', False),('state', '=', 'draft')]}"/>
</xpath>
</field>
</record>
<record id="view_budget_confirmation_form" model="ir.ui.view">

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-10-27 03:55+0000\n"
"PO-Revision-Date: 2024-10-27 03:55+0000\n"
"POT-Creation-Date: 2024-11-17 03:27+0000\n"
"PO-Revision-Date: 2024-11-17 03:27+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -32,3 +32,11 @@ msgstr "قيد اليومية"
#: model_terms:ir.ui.view,arch_db:petty_invoice.view_account_invoice_filter
msgid "Paid by Petty Cash"
msgstr "منصرفه من العهد"
#. module: petty_invoice
#: model:ir.model.fields,field_description:petty_invoice.field_account_bank_statement_line__petty_employee_id
#: model:ir.model.fields,field_description:petty_invoice.field_account_move__petty_employee_id
#: model:ir.model.fields,field_description:petty_invoice.field_account_payment__petty_employee_id
#: model_terms:ir.ui.view,arch_db:petty_invoice.view_account_invoice_filter
msgid "Petty Cashier"
msgstr "موظف العهد"

View File

@ -7,3 +7,4 @@ class AccountMove(models.Model):
_inherit = 'account.move'
is_petty_paid = fields.Boolean(string='Paid by Petty Cash', default=False)
petty_employee_id = fields.Many2one('hr.employee', string='Petty Cashier', copy=False)

View File

@ -6,6 +6,7 @@
<field name="inherit_id" ref="account.view_account_invoice_filter"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='date']" position="after">
<field name="petty_employee_id"/>
<field name="is_petty_paid"/>
<filter name="is_petty_paid" string="Paid by Petty Cash"
domain="[('is_petty_paid', '=',True)]"/>
@ -13,6 +14,7 @@
</xpath>
<xpath expr="//group" position="inside">
<filter name="group_by_created_by" string="Created By" context="{'group_by':'create_uid'}"/>
<filter name="group_by_petty_employee_id" string="Petty Cashier" context="{'group_by':'petty_employee_id'}"/>
</xpath>
</field>
@ -26,6 +28,7 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_date']" position="after">
<field name="is_petty_paid" readonly="1"/>
<field name="petty_employee_id" readonly="1"/>
</xpath>
</field>
</record>