Merge remote-tracking branch 'origin/dev_odex25_accounting' into dev_odex25_accounting
This commit is contained in:
commit
3751c3d155
|
|
@ -1,7 +1,7 @@
|
|||
name: App Server - Pull Code
|
||||
|
||||
# This Server contain many services:
|
||||
# - Cyber project (dev - preprod - prod)
|
||||
# - Cyber project (dev - preprod)
|
||||
# - Ensan project (dev - preprod)
|
||||
# - Odex25-General Project (dev - preprod)
|
||||
# - ODEX25_STANDARD Project (dev - preprod - prod)
|
||||
|
|
@ -54,23 +54,22 @@ on:
|
|||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy_master_server:
|
||||
name: Deploy to Master
|
||||
runs-on: app-sever-project-runner
|
||||
if: github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/master_odex-event' || github.ref == 'refs/heads/master_odex25_accounting' || github.ref == 'refs/heads/master_odex25_base' || github.ref == 'refs/heads/master_odex25_dms' || github.ref == 'refs/heads/master_odex25_fleet' || github.ref == 'refs/heads/master_odex25_ENSAN' || github.ref == 'refs/heads/master_odex25_hr' || github.ref == 'refs/heads/master_odex25_inventory' || github.ref == 'refs/heads/master_odex25_maintenance' || github.ref == 'refs/heads/master_odex25_mobile' || github.ref == 'refs/heads/master_odex25_pos' || github.ref == 'refs/heads/master_odex25_project' || github.ref == 'refs/heads/master_odex25_purchase' || github.ref == 'refs/heads/master_odex25_realstate' || github.ref == 'refs/heads/master_odex25_sales' || github.ref == 'refs/heads/master_odex25_survey' || github.ref == 'refs/heads/master_odex25_transactions' || github.ref == 'refs/heads/master_odex25_website' || github.ref == 'refs/heads/master_openeducat_erp-14.0.1.0' || github.ref == 'refs/heads/master_odex25_ensan')
|
||||
steps:
|
||||
- name: Checkout And Restart Project
|
||||
run: |
|
||||
echo "** [INFO] Running on branch --> ${GITHUB_REF#refs/heads/}"
|
||||
# deploy_master_server:
|
||||
# name: Deploy to Master
|
||||
# runs-on: app-sever-project-runner
|
||||
# if: github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/master_odex-event' || github.ref == 'refs/heads/master_odex25_accounting' || github.ref == 'refs/heads/master_odex25_base' || github.ref == 'refs/heads/master_odex25_dms' || github.ref == 'refs/heads/master_odex25_fleet' || github.ref == 'refs/heads/master_odex25_ENSAN' || github.ref == 'refs/heads/master_odex25_hr' || github.ref == 'refs/heads/master_odex25_inventory' || github.ref == 'refs/heads/master_odex25_maintenance' || github.ref == 'refs/heads/master_odex25_mobile' || github.ref == 'refs/heads/master_odex25_pos' || github.ref == 'refs/heads/master_odex25_project' || github.ref == 'refs/heads/master_odex25_purchase' || github.ref == 'refs/heads/master_odex25_realstate' || github.ref == 'refs/heads/master_odex25_sales' || github.ref == 'refs/heads/master_odex25_survey' || github.ref == 'refs/heads/master_odex25_transactions' || github.ref == 'refs/heads/master_odex25_website' || github.ref == 'refs/heads/master_openeducat_erp-14.0.1.0' || github.ref == 'refs/heads/master_odex25_ensan')
|
||||
# steps:
|
||||
# - name: Checkout And Restart Project
|
||||
# run: |
|
||||
# echo "** [INFO] Running on branch --> ${GITHUB_REF#refs/heads/}"
|
||||
|
||||
sudo chmod +x ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh
|
||||
sudo ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.APP_SERVER_USER14 }} ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }} ${{ secrets.CYBER_APP_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/}
|
||||
sudo systemctl restart ${{ secrets.ODEX25_STANDARD_MASTER_SERVICE }}
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "** [INFO] "MASTER" services have been restarted."
|
||||
else
|
||||
echo "** [ERROR] Failed to restart "MASTER" services."
|
||||
fi
|
||||
# sudo chmod +x ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh
|
||||
# sudo ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.APP_SERVER_USER14 }} ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }} ${{ secrets.CYBER_APP_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/}
|
||||
# if [ $? -eq 0 ]; then
|
||||
# echo "** [INFO] "MASTER" services have been restarted."
|
||||
# else
|
||||
# echo "** [ERROR] Failed to restart "MASTER" services."
|
||||
# fi
|
||||
|
||||
deploy_preprod_server:
|
||||
name: Deploy to Preprod
|
||||
|
|
@ -83,7 +82,7 @@ jobs:
|
|||
|
||||
sudo chmod +x ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh
|
||||
sudo ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.APP_SERVER_USER14 }} ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }} ${{ secrets.CYBER_APP_PREPROD_SERVICE }} preprod ${GITHUB_REF#refs/heads/preprod_} ${GITHUB_REF#refs/heads/}
|
||||
sudo systemctl restart ${{ secrets.ENSAN_APP_PREPROD_SERVICE }} ${{ secrets.ODEX25_GENERAL_PREPROD_SERVICE }} ${{ secrets.ODEX25_STANDARD_PREPROD_SERVICE }} ${{ secrets.TWAHOD_APP_PREPROD_SERVICE }} ${{ secrets.ODEX25_DEMO_PREPROD_SERVICE }} ${{ secrets.HELPDESK_PREPROD_SERVICE }}
|
||||
sudo systemctl restart ${{ secrets.ENSAN_APP_PREPROD_SERVICE }} ${{ secrets.ODEX25_GENERAL_PREPROD_SERVICE }} ${{ secrets.ODEX25_STANDARD_PREPROD_SERVICE }} ${{ secrets.TWAHOD_APP_PREPROD_SERVICE }} ${{ secrets.ODEX25_DEMO_PREPROD_SERVICE }} ${{ secrets.HELPDESK_PREPROD_SERVICE }} ${{ secrets.TRAHUM_PREPROD_SERVICE }}
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "** [INFO] "PREPROD" services have been restarted."
|
||||
else
|
||||
|
|
@ -100,7 +99,7 @@ jobs:
|
|||
echo "** [INFO] Running on branch --> ${GITHUB_REF#refs/heads/}"
|
||||
sudo chmod +x ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh
|
||||
sudo ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.APP_SERVER_USER14 }} ${{ secrets.APP_SERVER_STANDARD_FOLDER_PATH }} ${{ secrets.CYBER_APP_TEST_SERVICE }} test ${GITHUB_REF#refs/heads/dev_} ${GITHUB_REF#refs/heads/}
|
||||
sudo systemctl restart ${{ secrets.ENSAN_APP_TEST_SERVICE }} ${{ secrets.ODEX25_GENERAL_TEST_SERVICE }} ${{ secrets.ODEX25_STANDARD_TEST_SERVICE }} ${{ secrets.TWAHOD_APP_TEST_SERVICE }} ${{ secrets.HELPDESK_TEST_SERVICE }} ${{ secrets.KAZ_LIBRARY_TEST_SERVICE }}
|
||||
sudo systemctl restart ${{ secrets.ENSAN_APP_TEST_SERVICE }} ${{ secrets.ODEX25_GENERAL_TEST_SERVICE }} ${{ secrets.ODEX25_STANDARD_TEST_SERVICE }} ${{ secrets.TWAHOD_APP_TEST_SERVICE }} ${{ secrets.HELPDESK_TEST_SERVICE }} ${{ secrets.KAZ_LIBRARY_TEST_SERVICE }} ${{ secrets.TRAHUM_TEST_SERVICE }}
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "** [INFO] "DEV" services have been restarted."
|
||||
else
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
name: Cyber Project - Pull Code
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy_master_server:
|
||||
name: Deploy to Master
|
||||
runs-on: cyber-client-project-runner
|
||||
if: github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/master_odex-event' || github.ref == 'refs/heads/master_odex25_accounting' || github.ref == 'refs/heads/master_odex25_base' || github.ref == 'refs/heads/master_odex25_dms' || github.ref == 'refs/heads/master_odex25_fleet' || github.ref == 'refs/heads/master_odex25_ENSAN' || github.ref == 'refs/heads/master_odex25_hr' || github.ref == 'refs/heads/master_odex25_inventory' || github.ref == 'refs/heads/master_odex25_maintenance' || github.ref == 'refs/heads/master_odex25_mobile' || github.ref == 'refs/heads/master_odex25_pos' || github.ref == 'refs/heads/master_odex25_project' || github.ref == 'refs/heads/master_odex25_purchase' || github.ref == 'refs/heads/master_odex25_realstate' || github.ref == 'refs/heads/master_odex25_sales' || github.ref == 'refs/heads/master_odex25_survey' || github.ref == 'refs/heads/master_odex25_transactions' || github.ref == 'refs/heads/master_odex25_website' || github.ref == 'refs/heads/master_openeducat_erp-14.0.1.0' || github.ref == 'refs/heads/master_odex25_ensan')
|
||||
steps:
|
||||
- name: Checkout And Restart Project
|
||||
run: |
|
||||
echo "** [INFO] Running on branch --> ${GITHUB_REF#refs/heads/}"
|
||||
|
||||
sudo chmod +x ${{ secrets.CYBER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh
|
||||
sudo ${{ secrets.CYBER_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.CYBER_PROJECT_USER }} ${{ secrets.CYBER_STANDARD_FOLDER_PATH }} ${{ secrets.CYBER_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/}
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
name: KAZ-Library Project - Pull Code
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy_master_server:
|
||||
name: Deploy to Master
|
||||
runs-on: kaz-library-project-runner
|
||||
if: github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/master_odex-event' || github.ref == 'refs/heads/master_odex25_accounting' || github.ref == 'refs/heads/master_odex25_base' || github.ref == 'refs/heads/master_odex25_dms' || github.ref == 'refs/heads/master_odex25_fleet' || github.ref == 'refs/heads/master_odex25_ENSAN' || github.ref == 'refs/heads/master_odex25_hr' || github.ref == 'refs/heads/master_odex25_inventory' || github.ref == 'refs/heads/master_odex25_maintenance' || github.ref == 'refs/heads/master_odex25_mobile' || github.ref == 'refs/heads/master_odex25_pos' || github.ref == 'refs/heads/master_odex25_project' || github.ref == 'refs/heads/master_odex25_purchase' || github.ref == 'refs/heads/master_odex25_realstate' || github.ref == 'refs/heads/master_odex25_sales' || github.ref == 'refs/heads/master_odex25_survey' || github.ref == 'refs/heads/master_odex25_transactions' || github.ref == 'refs/heads/master_odex25_website' || github.ref == 'refs/heads/master_openeducat_erp-14.0.1.0' || github.ref == 'refs/heads/master_odex25_ensan')
|
||||
steps:
|
||||
- name: Checkout And Restart Project
|
||||
run: |
|
||||
echo "** [INFO] Running on branch --> ${GITHUB_REF#refs/heads/}"
|
||||
|
||||
sudo chmod +x ${{ secrets.KAZ_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh
|
||||
sudo ${{ secrets.KAZ_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.KAZ_PROJECT_USER }} ${{ secrets.KAZ_STANDARD_FOLDER_PATH }} ${{ secrets.KAZ_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/}
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
name: Twahod Project - Pull Code
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy_master_server:
|
||||
name: Deploy to Master
|
||||
runs-on: twahod-client-project-runner
|
||||
if: github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/master_odex-event' || github.ref == 'refs/heads/master_odex25_accounting' || github.ref == 'refs/heads/master_odex25_base' || github.ref == 'refs/heads/master_odex25_dms' || github.ref == 'refs/heads/master_odex25_fleet' || github.ref == 'refs/heads/master_odex25_ENSAN' || github.ref == 'refs/heads/master_odex25_hr' || github.ref == 'refs/heads/master_odex25_inventory' || github.ref == 'refs/heads/master_odex25_maintenance' || github.ref == 'refs/heads/master_odex25_mobile' || github.ref == 'refs/heads/master_odex25_pos' || github.ref == 'refs/heads/master_odex25_project' || github.ref == 'refs/heads/master_odex25_purchase' || github.ref == 'refs/heads/master_odex25_realstate' || github.ref == 'refs/heads/master_odex25_sales' || github.ref == 'refs/heads/master_odex25_survey' || github.ref == 'refs/heads/master_odex25_transactions' || github.ref == 'refs/heads/master_odex25_website' || github.ref == 'refs/heads/master_openeducat_erp-14.0.1.0' || github.ref == 'refs/heads/master_odex25_ensan')
|
||||
steps:
|
||||
- name: Checkout And Restart Project
|
||||
run: |
|
||||
echo "** [INFO] Running on branch --> ${GITHUB_REF#refs/heads/}"
|
||||
|
||||
sudo chmod +x ${{ secrets.TWAHOD_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh
|
||||
sudo ${{ secrets.TWAHOD_STANDARD_FOLDER_PATH }}/scripts/pull_code.sh ${{ secrets.TWAHOD_PROJECT_USER }} ${{ secrets.TWAHOD_STANDARD_FOLDER_PATH }} ${{ secrets.TWAHOD_MASTER_SERVICE }} master ${GITHUB_REF#refs/heads/master_} ${GITHUB_REF#refs/heads/}
|
||||
|
|
@ -10,41 +10,103 @@ class AccountMove(models.Model):
|
|||
res_model = fields.Char()
|
||||
|
||||
def get_attachments(self):
|
||||
# Check if multiple records are passed, and handle them in a loop
|
||||
if len(self) > 1:
|
||||
action = self.env['ir.actions.act_window']._for_xml_id('base.action_attachment')
|
||||
action['domain'] = [
|
||||
('res_model', '=', 'account.move'),
|
||||
('res_id', 'in', self.ids),
|
||||
]
|
||||
|
||||
# Update attachment count for all records (if necessary)
|
||||
for record in self:
|
||||
related_ids = record.ids
|
||||
related_models = 'account.move'
|
||||
|
||||
if record.res_id and record.res_model:
|
||||
related_ids = record.ids + [record.res_id]
|
||||
related_models = ['account.move', record.res_model]
|
||||
action['domain'] = [
|
||||
('res_model', 'in', related_models),
|
||||
('res_id', 'in', related_ids),
|
||||
]
|
||||
|
||||
# Context for creating new attachments for each record
|
||||
action['context'] = "{'default_res_model': '%s','default_res_id': %d}" % (record._name, record.id)
|
||||
|
||||
# Update attachment count for each record
|
||||
record.attach_no = self.env['ir.attachment'].search_count([
|
||||
('res_model', 'in', related_models),
|
||||
('res_id', 'in', related_ids)
|
||||
])
|
||||
|
||||
return action
|
||||
|
||||
# If only one record is passed, use the original logic
|
||||
self.ensure_one()
|
||||
|
||||
|
||||
action = self.env['ir.actions.act_window']._for_xml_id('base.action_attachment')
|
||||
action['domain'] = [
|
||||
('res_model', '=', 'account.move'),
|
||||
('res_id', 'in',self.ids), ]
|
||||
('res_id', 'in', self.ids),
|
||||
]
|
||||
domain = [
|
||||
('res_model', '=', 'account.move'),
|
||||
('res_id', 'in', self.ids), ]
|
||||
('res_id', 'in', self.ids),
|
||||
]
|
||||
related_ids = self.ids
|
||||
related_models = 'account.move'
|
||||
|
||||
|
||||
if self.res_id and self.res_model:
|
||||
related_ids = self.ids + [self.res_id]
|
||||
related_models = ['account.move', self.res_model]
|
||||
action['domain'] = [
|
||||
('res_model', 'in', related_models),
|
||||
('res_id', 'in', related_ids), ]
|
||||
('res_id', 'in', related_ids),
|
||||
]
|
||||
domain = [
|
||||
('res_model', 'in', related_models),
|
||||
('res_id', 'in', related_ids), ]
|
||||
|
||||
('res_id', 'in', related_ids),
|
||||
]
|
||||
|
||||
# Context for creating new attachments
|
||||
action['context'] = "{'default_res_model': '%s','default_res_id': %d}" % (self._name, self.id)
|
||||
|
||||
# Update attachment count for smart button
|
||||
|
||||
|
||||
self.attach_no = self.env['ir.attachment'].search_count(domain)
|
||||
|
||||
|
||||
return action
|
||||
|
||||
|
||||
# def get_attachments(self):
|
||||
# self.ensure_one()
|
||||
|
||||
# action = self.env['ir.actions.act_window']._for_xml_id('base.action_attachment')
|
||||
# action['domain'] = str([('res_model', '=', 'account.move'), ('res_id', 'in', self.ids)])
|
||||
# action['domain'] = [
|
||||
# ('res_model', '=', 'account.move'),
|
||||
# ('res_id', 'in',self.ids), ]
|
||||
# domain = [
|
||||
# ('res_model', '=', 'account.move'),
|
||||
# ('res_id', 'in', self.ids), ]
|
||||
# related_ids = self.ids
|
||||
# related_models = 'account.move'
|
||||
|
||||
# if self.res_id and self.res_model:
|
||||
# related_ids = self.ids + [self.res_id]
|
||||
# related_models = ['account.move', self.res_model]
|
||||
# action['domain'] = [
|
||||
# ('res_model', 'in', related_models),
|
||||
# ('res_id', 'in', related_ids), ]
|
||||
# domain = [
|
||||
# ('res_model', 'in', related_models),
|
||||
# ('res_id', 'in', related_ids), ]
|
||||
|
||||
# # Context for creating new attachments
|
||||
# action['context'] = "{'default_res_model': '%s','default_res_id': %d}" % (self._name, self.id)
|
||||
# domain = [('res_model', '=', 'account.move'), ('res_id', '=', self.id)]
|
||||
# # Update attachment count for smart button
|
||||
|
||||
|
||||
# self.attach_no = self.env['ir.attachment'].search_count(domain)
|
||||
|
||||
# return action
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-06-26 18:41+0000\n"
|
||||
"PO-Revision-Date: 2024-06-26 18:41+0000\n"
|
||||
"POT-Creation-Date: 2024-09-30 00:33+0000\n"
|
||||
"PO-Revision-Date: 2024-09-30 00:33+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
|
@ -72,7 +72,6 @@ msgstr "مبلغ"
|
|||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/models/account_budget.py:0
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__above_remain
|
||||
#, python-format
|
||||
msgid "Amount of money that has been exceeded"
|
||||
msgstr ""
|
||||
|
|
@ -81,24 +80,25 @@ msgstr ""
|
|||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/models/account_budget.py:0
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__provide
|
||||
#, python-format
|
||||
msgid "Amount of money that has been provided"
|
||||
msgstr "تعزيز او تحويل من هو عبارة عن تعزيزات الموازنة او تحويلات من موزانات أخرى"
|
||||
msgstr ""
|
||||
"تعزيز او تحويل من هو عبارة عن تعزيزات الموازنة او تحويلات من موزانات أخرى"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/models/account_budget.py:0
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__pull_out
|
||||
#, python-format
|
||||
msgid "Amount of money that has been pulled out"
|
||||
msgstr "تخفيض او تحويل الى هو عبارة عن تخفيضات للموازنة او تحويلات الى موزانات أخرى"
|
||||
msgstr ""
|
||||
"تخفيض او تحويل الى هو عبارة عن تخفيضات للموازنة او تحويلات الى موزانات أخرى"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/models/account_budget.py:0
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__remain
|
||||
#, python-format
|
||||
msgid "Amount of money that has been remained"
|
||||
msgstr " ( مبلغ متاح - المبلغ المحجوز - مبلغ تعميد - المبلغ الفعلى - المحجوز المبدئي ) يكون صفر عند قابل الاشارة"
|
||||
msgstr ""
|
||||
" ( مبلغ متاح - المبلغ المحجوز - مبلغ تعميد - المبلغ الفعلى - المحجوز المبدئي"
|
||||
" ) يكون صفر عند قابل الاشارة"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model_terms:ir.ui.view,arch_db:account_budget_custom.view_budget_confirmation_form
|
||||
|
|
@ -242,11 +242,6 @@ msgstr "لا يمكن تراكب خطوط الميزانية مع بعضها ا
|
|||
msgid "Budgets"
|
||||
msgstr "الموازنات"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation__bybass_budget_check
|
||||
msgid "ByPass Budget Line Check"
|
||||
msgstr "تخطي ربط الموازنه بالحساب"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields.selection,name:account_budget_custom.selection__budget_confirmation__state__cancel
|
||||
msgid "Cancel"
|
||||
|
|
@ -278,16 +273,16 @@ msgstr ""
|
|||
msgid "Confirm"
|
||||
msgstr "تأكيد"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_crossovered_budget_lines__confirm
|
||||
msgid "Confirm Amount"
|
||||
msgstr "المبلغ التعميد"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields.selection,name:account_budget_custom.selection__budget_operations__state__confirmed
|
||||
msgid "Confirmed"
|
||||
msgstr "مؤكد"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model,name:account_budget_custom.model_res_partner
|
||||
msgid "Contact"
|
||||
msgstr "جهة الاتصال"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation__analytic_account_id
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation_line__analytic_account_id
|
||||
|
|
@ -359,12 +354,9 @@ msgstr "تفاصيل المطابقة"
|
|||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation__display_name
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation_line__display_name
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_operations__display_name
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_crossovered_budget__display_name
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_crossovered_budget_lines__display_name
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_reject_wizard__display_name
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_report_account_budget_custom_budget_report__display_name
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_report_account_budget_custom_budget_xslx_report__display_name
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_res_partner__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "الاسم المعروض"
|
||||
|
||||
|
|
@ -397,10 +389,11 @@ msgstr "المبلغ النهائي"
|
|||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/models/account_budget.py:0
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__final_amount
|
||||
#, python-format
|
||||
msgid "Final amount of money that has been provided"
|
||||
msgstr "هو مبلغ الموازنة المتاح للارتباط ويشمل مبلغ المخطط + تعزيز او تحويل من - تخفيض او تحويل الى"
|
||||
msgstr ""
|
||||
"هو مبلغ الموازنة المتاح للارتباط ويشمل مبلغ المخطط + تعزيز او تحويل من - "
|
||||
"تخفيض او تحويل الى"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation__message_follower_ids
|
||||
|
|
@ -449,12 +442,9 @@ msgstr "من العملية"
|
|||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation__id
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation_line__id
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_operations__id
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_crossovered_budget__id
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_crossovered_budget_lines__id
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_reject_wizard__id
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_report_account_budget_custom_budget_report__id
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_report_account_budget_custom_budget_xslx_report__id
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_res_partner__id
|
||||
msgid "ID"
|
||||
msgstr "المُعرف"
|
||||
|
||||
|
|
@ -499,12 +489,9 @@ msgstr "متابع"
|
|||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation____last_update
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation_line____last_update
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_operations____last_update
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_crossovered_budget____last_update
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_crossovered_budget_lines____last_update
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_reject_wizard____last_update
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_report_account_budget_custom_budget_report____last_update
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_report_account_budget_custom_budget_xslx_report____last_update
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_res_partner____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "آخر تعديل في"
|
||||
|
||||
|
|
@ -645,7 +632,6 @@ msgstr "تعزيز/تحويل من"
|
|||
|
||||
#. module: account_budget_custom
|
||||
#: model_terms:ir.ui.view,arch_db:account_budget_custom.crossovered_budget_view_form
|
||||
#: model_terms:ir.ui.view,arch_db:account_budget_custom.view_crossovered_budget_line_tree
|
||||
msgid "Provided Amount"
|
||||
msgstr "مبلغ الدعم"
|
||||
|
||||
|
|
@ -656,7 +642,6 @@ msgstr "تخفيض/تحويل إلي"
|
|||
|
||||
#. module: account_budget_custom
|
||||
#: model_terms:ir.ui.view,arch_db:account_budget_custom.crossovered_budget_view_form
|
||||
#: model_terms:ir.ui.view,arch_db:account_budget_custom.view_crossovered_budget_line_tree
|
||||
msgid "Pull Out Amount"
|
||||
msgstr "مبلغ السحب"
|
||||
|
||||
|
|
@ -673,13 +658,19 @@ msgstr "المبلغ"
|
|||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields.selection,name:account_budget_custom.selection__budget_confirmation__type__purchase_request
|
||||
msgid "Purchase Request"
|
||||
msgstr ""
|
||||
msgstr "طلب شراء"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields.selection,name:account_budget_custom.selection__budget_confirmation__type__purchase_order
|
||||
msgid "Purchase Requisition"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation__reason
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_operations__reason
|
||||
msgid "Reason/Justification"
|
||||
msgstr "السببظ المبرر"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_confirmation__ref
|
||||
msgid "Reference"
|
||||
|
|
@ -713,7 +704,6 @@ msgstr "المبلغ المتاح"
|
|||
|
||||
#. module: account_budget_custom
|
||||
#: model_terms:ir.ui.view,arch_db:account_budget_custom.crossovered_budget_view_form
|
||||
#: model_terms:ir.ui.view,arch_db:account_budget_custom.view_crossovered_budget_line_tree
|
||||
msgid "Remain Amount"
|
||||
msgstr "المبلغ المتاح"
|
||||
|
||||
|
|
@ -727,6 +717,11 @@ msgstr "المبلغ قبل الخصم لهذه الخدمات على هذه ا
|
|||
msgid "Remain of Christening"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model,name:account_budget_custom.model_res_partner
|
||||
msgid "Renter"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.ui.menu,name:account_budget_custom.budget_reporting_menu
|
||||
msgid "Reports"
|
||||
|
|
@ -737,6 +732,11 @@ msgstr "التقارير"
|
|||
msgid "Request user"
|
||||
msgstr "المستخدم الطالب"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_crossovered_budget_lines__reserve
|
||||
msgid "Reserve Amount"
|
||||
msgstr "المبلغ المحجوز"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,field_description:account_budget_custom.field_budget_operations__from_reserved
|
||||
msgid "Reserve?"
|
||||
|
|
@ -819,6 +819,12 @@ msgstr ""
|
|||
"اليوم: تاريخ النشاط هو اليوم\n"
|
||||
"المخطط: الأنشطة المستقبلية."
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/models/budget_operations.py:0
|
||||
#, python-format
|
||||
msgid "The amount can not be less than zero."
|
||||
msgstr "لا يمكن أن يكون المبلغ أقل من الصفر."
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/models/budget_operations.py:0
|
||||
#, python-format
|
||||
|
|
@ -870,6 +876,12 @@ msgstr "إجمالي المبلغ"
|
|||
msgid "Total amount in services request line"
|
||||
msgstr "المبلغ"
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/models/account_budget.py:0
|
||||
#, python-format
|
||||
msgid "Total amount of confirmed purchase orders"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/models/account_budget.py:0
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__practical_amount
|
||||
|
|
@ -877,6 +889,12 @@ msgstr "المبلغ"
|
|||
msgid "Total amount of money that has been spent"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/models/account_budget.py:0
|
||||
#, python-format
|
||||
msgid "Total amount of reserved purchase orders"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields.selection,name:account_budget_custom.selection__budget_operations__operation_type__transfer
|
||||
#: model:ir.model.fields.selection,name:account_budget_custom.selection__budget_operations__type__transfer
|
||||
|
|
@ -1004,12 +1022,24 @@ msgstr "النوع"
|
|||
msgid "الإنجاز"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__confirm
|
||||
msgid "المبلغ التعميد : هو عبارة قيمة التعميد ( أوامر الشراء)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/reports/budget_report_xlsx.py:0
|
||||
#, python-format
|
||||
msgid "المبلغ الفعلى"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__reserve
|
||||
msgid ""
|
||||
"المبلغ المحجوز وهو عبارة عن طلبات عروض الأسعار تم الموافقة عليها من الموازنة"
|
||||
" ( ارتباط مبدئى)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/reports/budget_report_xlsx.py:0
|
||||
#, python-format
|
||||
|
|
@ -1046,11 +1076,40 @@ msgstr ""
|
|||
msgid "تاريخ البدء"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__pull_out
|
||||
msgid ""
|
||||
"تخفيض او تحويل الى هو عبارة عن تخفيضات للموازنة او تحويلات الى موزانات أخرى"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__provide
|
||||
msgid ""
|
||||
"تعزيز او تحويل من هو عبارة عن تعزيزات الموازنة او تحويلات من موزانات أخرى"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__remain
|
||||
msgid "تم البقاء على المبلغ المالي"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__above_remain
|
||||
msgid "تم تجاوز المبلغ المالي"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model_terms:ir.ui.view,arch_db:account_budget_custom.crossovered_budget_view_form
|
||||
msgid "مبلغ نهائي"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: model:ir.model.fields,help:account_budget_custom.field_crossovered_budget_lines__final_amount
|
||||
msgid ""
|
||||
"هو مبلغ الموازنة المتاح للارتباط ويشمل مبلغ المخطط + تعزيز او تحويل من - "
|
||||
"تخفيض او تحويل الى"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_budget_custom
|
||||
#: code:addons/account_budget_custom/reports/budget_report_xlsx.py:0
|
||||
#, python-format
|
||||
|
|
|
|||
|
|
@ -81,22 +81,53 @@ class CrossoveredBudgetLines(models.Model):
|
|||
@api.depends('analytic_account_id')
|
||||
def _compute_confirm(self):
|
||||
for rec in self:
|
||||
orders = self.env['purchase.order.line'].search(
|
||||
order_lines = self.env['purchase.order.line'].search(
|
||||
[('account_analytic_id', '=', rec.analytic_account_id.id),
|
||||
('order_id.state', 'in', ['purchase','done'])]).mapped('order_id')
|
||||
total_orders = sum(orders.mapped('amount_total'))
|
||||
invoiced = self.env['account.move'].search(
|
||||
[('purchase_id', 'in', orders.ids), ('state', 'not in', ['draft', 'cancel'])]).mapped('amount_total')
|
||||
rec.confirm = (total_orders - sum(invoiced)) * -1
|
||||
('order_id.date_order', '>=', rec.crossovered_budget_id.date_from),
|
||||
('order_id.date_order', '<=', rec.crossovered_budget_id.date_to),
|
||||
'|', ('product_id.property_account_expense_id', 'in', rec.general_budget_id.account_ids.ids),
|
||||
('product_id.categ_id.property_account_expense_categ_id', 'in', rec.general_budget_id.account_ids.ids),
|
||||
('order_id.state', 'in', ['purchase', 'done'])])
|
||||
orders_without_tax = sum(order_lines.mapped('price_subtotal'))
|
||||
need_tax = 0
|
||||
invoice_amount = 0
|
||||
for line in order_lines:
|
||||
vals = line._prepare_compute_all_values()
|
||||
taxes = line.taxes_id.filtered(lambda x: x.analytic).compute_all(
|
||||
vals['price_unit'],
|
||||
vals['currency_id'],
|
||||
vals['product_qty'],
|
||||
vals['product'],
|
||||
vals['partner'])
|
||||
need_tax += sum(t.get('amount', 0.0) for t in taxes.get('taxes', []))
|
||||
invoiced = self.env['account.move.line'].search(
|
||||
[('purchase_line_id', '=', line.id), ('move_id.state', 'not in', ['draft', 'cancel'])])
|
||||
invoice_amount += sum(invoiced.mapped('price_subtotal')) if not need_tax else sum(
|
||||
invoiced.mapped('move_id.amount_total'))
|
||||
rec.confirm = ((orders_without_tax + need_tax) - invoice_amount) * -1
|
||||
|
||||
@api.depends('analytic_account_id')
|
||||
def _compute_reserve(self):
|
||||
for rec in self:
|
||||
orders = self.env['purchase.order.line'].search(
|
||||
order_lines = self.env['purchase.order.line'].search(
|
||||
[('account_analytic_id', '=', rec.analytic_account_id.id),
|
||||
('order_id.state', 'in', ['draft', 'sent', 'to approve'])]).mapped('order_id')
|
||||
total_orders = sum(orders.mapped('amount_total'))
|
||||
rec.reserve = total_orders * -1
|
||||
('order_id.date_order', '>=', rec.crossovered_budget_id.date_from),
|
||||
('order_id.date_order', '<=', rec.crossovered_budget_id.date_to),
|
||||
'|', ('product_id.property_account_expense_id', 'in', rec.general_budget_id.account_ids.ids),
|
||||
('product_id.categ_id.property_account_expense_categ_id', 'in', rec.general_budget_id.account_ids.ids),
|
||||
('order_id.state', 'in', ['draft', 'sent', 'to approve'])])
|
||||
orders_without_tax = sum(order_lines.mapped('price_subtotal'))
|
||||
need_tax = 0
|
||||
for line in order_lines:
|
||||
vals = line._prepare_compute_all_values()
|
||||
taxes = line.taxes_id.filtered(lambda x: x.analytic).compute_all(
|
||||
vals['price_unit'],
|
||||
vals['currency_id'],
|
||||
vals['product_qty'],
|
||||
vals['product'],
|
||||
vals['partner'])
|
||||
need_tax += sum(t.get('amount', 0.0) for t in taxes.get('taxes', []))
|
||||
rec.reserve = (orders_without_tax + need_tax) * -1
|
||||
|
||||
@api.depends('planned_amount', 'provide', 'pull_out')
|
||||
def _compute_final_amount(self):
|
||||
|
|
@ -185,41 +216,38 @@ class CrossoveredBudgetLines(models.Model):
|
|||
|
||||
def _compute_practical_amount(self):
|
||||
for line in self:
|
||||
result = 0.0
|
||||
acc_ids = line.general_budget_id.account_ids.ids
|
||||
date_to = self.env.context.get('wizard_date_to') or line.date_to
|
||||
date_from = self.env.context.get(
|
||||
'wizard_date_from') or line.date_from
|
||||
if line.analytic_account_id.id:
|
||||
analytic_ids = self.env['account.analytic.account'].search(
|
||||
['|', ('id', '=', line.analytic_account_id.id),
|
||||
('parent_id', 'child_of', line.analytic_account_id.id)])
|
||||
self.env.cr.execute(
|
||||
"""
|
||||
SELECT SUM(amount)
|
||||
FROM account_analytic_line
|
||||
WHERE account_id IN %s
|
||||
AND (date between %s AND %s)
|
||||
AND general_account_id=ANY(%s)""",
|
||||
(tuple(analytic_ids.ids), date_from, date_to, acc_ids,))
|
||||
result = self.env.cr.fetchone()[0] or 0.0
|
||||
line.practical_amount = result
|
||||
else:
|
||||
analytic_line_obj = self.env['account.analytic.line']
|
||||
domain = [('account_id', '=', line.analytic_account_id.id),
|
||||
('date', '>=', date_from),
|
||||
('date', '<=', date_to),
|
||||
]
|
||||
if acc_ids:
|
||||
domain += [('general_account_id', 'in', acc_ids)]
|
||||
|
||||
where_query = analytic_line_obj._where_calc(domain)
|
||||
analytic_line_obj._apply_ir_rules(where_query, 'read')
|
||||
from_clause, where_clause, where_clause_params = where_query.get_sql()
|
||||
select = "SELECT SUM(amount) from " + from_clause + " where " + where_clause
|
||||
|
||||
else:
|
||||
aml_obj = self.env['account.move.line']
|
||||
domain = [('account_id', 'in',
|
||||
line.general_budget_id.account_ids.ids),
|
||||
('date', '>=', date_from),
|
||||
('date', '<=', date_to),
|
||||
('move_id.state', '=', 'posted')
|
||||
('date', '<=', date_to)
|
||||
]
|
||||
where_query = aml_obj._where_calc(domain)
|
||||
aml_obj._apply_ir_rules(where_query, 'read')
|
||||
from_clause, where_clause, where_clause_params = where_query.get_sql()
|
||||
select = "SELECT sum(credit)-sum(debit) from " + from_clause + " where " + where_clause
|
||||
|
||||
self.env.cr.execute(select, where_clause_params)
|
||||
line.practical_amount = self.env.cr.fetchone()[0] or 0.0
|
||||
self.env.cr.execute(select, where_clause_params)
|
||||
line.practical_amount = self.env.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _check_amount(self, amount=0, purchase_remind=0, transfer=False):
|
||||
for obj in self:
|
||||
|
|
|
|||
|
|
@ -40,6 +40,12 @@ class BudgetOperations(models.Model):
|
|||
default='transfer', string='Operation Type', required=True, tracking=True)
|
||||
purchase_remind = fields.Monetary(string='Purchase Remind', tracking=True)
|
||||
|
||||
@api.constrains('purchase_remind','amount')
|
||||
def _amount_can_not_be_less_than_zero(self):
|
||||
for rec in self:
|
||||
if rec.purchase_remind < 0 or rec.amount < 0:
|
||||
raise ValidationError(_('''The amount can not be less than zero.'''))
|
||||
|
||||
@api.onchange('from_crossovered_budget_id', 'operation_type')
|
||||
def get_budget_domain_year(self):
|
||||
for rec in self:
|
||||
|
|
|
|||
|
|
@ -69,14 +69,33 @@ class AccountAccount(models.Model):
|
|||
related='company_id.automticAccountsCodes',
|
||||
)
|
||||
|
||||
def replace_type_with_internal_type(self,domain):
|
||||
# Iterate over each condition and replace if necessary
|
||||
new_domain = []
|
||||
for condition in domain:
|
||||
if isinstance(condition, (list, tuple)) and condition[0] == 'type' and condition[1] == '!=' and condition[
|
||||
2] == 'view':
|
||||
# Replace ['type', '!=', 'view'] with ['internal_type', '!=', 'view']
|
||||
new_domain.append(('internal_type', '!=', 'view'))
|
||||
else:
|
||||
# Keep the condition as is
|
||||
new_domain.append(condition)
|
||||
return new_domain
|
||||
|
||||
@api.model
|
||||
def _name_search(self, name='', args=None, operator='ilike', limit=100, name_get_uid=None):
|
||||
if args is None: args = []
|
||||
domain = args
|
||||
domain = args
|
||||
domain = self.replace_type_with_internal_type(domain)
|
||||
if not self.env.context.get('show_view'):
|
||||
domain += [('internal_type', '!=', 'view')]
|
||||
return super(AccountAccount, self)._name_search(name, domain, operator ,limit ,name_get_uid)
|
||||
|
||||
def _search(self, args, offset=0, limit=None, order=None, count=False, access_rights_uid=None):
|
||||
domain = args
|
||||
domain = self.replace_type_with_internal_type(domain)
|
||||
if not self.env.context.get('show_view'):
|
||||
args += [('internal_type', '!=', 'view')]
|
||||
return super(AccountAccount, self)._search(domain, offset, limit, order, count, access_rights_uid)
|
||||
@api.depends('parent_id')
|
||||
def _get_level(self):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -8,14 +8,15 @@
|
|||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import Warning, ValidationError
|
||||
import datetime
|
||||
|
||||
from odoo.exceptions import RedirectWarning, UserError, ValidationError, AccessError
|
||||
from odoo.tools.misc import formatLang, format_date, get_lang
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_name = "account.move"
|
||||
_inherit = "account.move"
|
||||
|
||||
period_id = fields.Many2one('fiscalyears.periods',
|
||||
string='Period', required=True, readonly=True,
|
||||
string='Period', readonly=True,
|
||||
states={'draft': [('readonly', False)]},
|
||||
help='''The fiscalyear period
|
||||
used for this receipt.''')
|
||||
|
|
@ -34,42 +35,82 @@ class AccountMove(models.Model):
|
|||
raise ValidationError(
|
||||
_('There is no openning fiscal year periods in this date.'))
|
||||
|
||||
@api.constrains('date', 'period_id')
|
||||
def _check_date_period(self):
|
||||
"""
|
||||
Check date and period_id are in the same date range
|
||||
"""
|
||||
for rec in self:
|
||||
if rec.date and rec.period_id:
|
||||
date = fields.Date.from_string(rec.date)
|
||||
period_start_date = fields.Date.from_string(
|
||||
rec.period_id.date_from)
|
||||
period_end_date = fields.Date.from_string(
|
||||
rec.period_id.date_to)
|
||||
if not (date >= period_start_date and
|
||||
date <= period_end_date):
|
||||
raise ValidationError(
|
||||
_('''Date and period must be in the same date range'''))
|
||||
else:
|
||||
raise ValidationError(
|
||||
_('''You must enter date and period for this record'''))
|
||||
# @api.constrains('date', 'period_id')
|
||||
# def _check_date_period(self):
|
||||
# """
|
||||
# Check date and period_id are in the same date range
|
||||
# """
|
||||
# for rec in self:
|
||||
# if rec.date and rec.period_id:
|
||||
# date = fields.Date.from_string(rec.date)
|
||||
# period_start_date = fields.Date.from_string(
|
||||
# rec.period_id.date_from)
|
||||
# period_end_date = fields.Date.from_string(
|
||||
# rec.period_id.date_to)
|
||||
# if not (date >= period_start_date and
|
||||
# date <= period_end_date):
|
||||
# raise ValidationError(
|
||||
# _('''Date and period must be in the same date range'''))
|
||||
# else:
|
||||
# raise ValidationError(
|
||||
# _('''You must enter date and period for this record'''))
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
date = vals.get('date', False)
|
||||
if not date:
|
||||
date = datetime.date.today()
|
||||
period_id = vals.get('period_id', False)
|
||||
if date and not period_id:
|
||||
periods = self.env['fiscalyears.periods'].search( [('state', '=', 'open'),
|
||||
('date_from', '<=', date),
|
||||
('date_to', '>=', date)])
|
||||
if periods:
|
||||
vals.update({'period_id': periods[0].id})
|
||||
else:
|
||||
raise Warning(_('Their is no open periods for date %s') % (date))
|
||||
return super(AccountMove, self).create(vals)
|
||||
def _post(self, soft=True):
|
||||
"""Post/Validate the documents."""
|
||||
if soft:
|
||||
future_moves = self.filtered(lambda move: move.date > fields.Date.context_today(self))
|
||||
future_moves.auto_post = True
|
||||
for move in future_moves:
|
||||
msg = _('This move will be posted at the accounting date: %(date)s',
|
||||
date=format_date(self.env, move.date))
|
||||
move.message_post(body=msg)
|
||||
to_post = self - future_moves
|
||||
else:
|
||||
to_post = self
|
||||
|
||||
# `user_has_group` won't be bypassed by `sudo()` since it doesn't change the user anymore.
|
||||
if not self.env.su and not self.env.user.has_group('account.group_account_invoice'):
|
||||
raise AccessError(_("You don't have the access rights to post an invoice."))
|
||||
|
||||
for move in to_post:
|
||||
if not move.period_id:
|
||||
period = self.env['fiscalyears.periods'].search([
|
||||
('date_from', '<=', move.date),
|
||||
('date_to', '>=', move.date),
|
||||
], limit=1)
|
||||
|
||||
if period:
|
||||
move.period_id = period.id
|
||||
else:
|
||||
raise UserError(_("No valid open period found for the date: %s") % move.date)
|
||||
|
||||
if move.partner_bank_id and not move.partner_bank_id.active:
|
||||
raise UserError(
|
||||
_("The recipient bank account link to this invoice is archived.\nSo you cannot confirm the invoice."))
|
||||
|
||||
if move.state == 'posted':
|
||||
raise UserError(_('The entry %s (id %s) is already posted.') % (move.name, move.id))
|
||||
|
||||
if not move.line_ids.filtered(lambda line: not line.display_type):
|
||||
raise UserError(_('You need to add a line before posting.'))
|
||||
|
||||
to_post.mapped('line_ids').create_analytic_lines()
|
||||
to_post.write({
|
||||
'state': 'posted',
|
||||
'posted_before': True,
|
||||
})
|
||||
|
||||
for move in to_post:
|
||||
move.message_subscribe([p.id for p in [move.partner_id] if p not in move.sudo().message_partner_ids])
|
||||
|
||||
to_post._check_balanced()
|
||||
return to_post
|
||||
|
||||
# @api.model
|
||||
# def create(self, vals):
|
||||
# vals['auto_post'] = True
|
||||
# return super(AccountMove, self).create(vals)
|
||||
#
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_name = "account.move.line"
|
||||
|
|
|
|||
|
|
@ -12,29 +12,30 @@ class AccountPayment(models.Model):
|
|||
def action_post(self):
|
||||
res = super(AccountPayment, self).action_post()
|
||||
for payment in self:
|
||||
paired_payment = payment.copy({
|
||||
'journal_id': payment.destination_journal_id.id,
|
||||
'destination_journal_id': payment.journal_id.id,
|
||||
'payment_type': payment.payment_type == 'outbound' and 'inbound' or 'outbound',
|
||||
'move_id': None,
|
||||
'ref': payment.ref,
|
||||
'paired_internal_transfer_payment_id': payment.id,
|
||||
'date': payment.date,
|
||||
})
|
||||
paired_payment.move_id._post(soft=False)
|
||||
payment.paired_internal_transfer_payment_id = paired_payment
|
||||
if payment.is_internal_transfer:
|
||||
paired_payment = payment.copy({
|
||||
'journal_id': payment.destination_journal_id.id,
|
||||
'destination_journal_id': payment.journal_id.id,
|
||||
'payment_type': payment.payment_type == 'outbound' and 'inbound' or 'outbound',
|
||||
'move_id': None,
|
||||
'ref': payment.ref,
|
||||
'paired_internal_transfer_payment_id': payment.id,
|
||||
'date': payment.date,
|
||||
})
|
||||
paired_payment.move_id._post(soft=False)
|
||||
payment.paired_internal_transfer_payment_id = paired_payment
|
||||
|
||||
body = _(
|
||||
'This payment has been created from <a href=# data-oe-model=account.payment data-oe-id=%d>%s</a>') % (
|
||||
payment.id, payment.name)
|
||||
paired_payment.message_post(body=body)
|
||||
body = _(
|
||||
'A second payment has been created: <a href=# data-oe-model=account.payment data-oe-id=%d>%s</a>') % (
|
||||
paired_payment.id, paired_payment.name)
|
||||
payment.message_post(body=body)
|
||||
|
||||
lines = (payment.move_id.line_ids + paired_payment.move_id.line_ids).filtered(
|
||||
lambda l: l.account_id == payment.destination_account_id and not l.reconciled)
|
||||
lines.reconcile()
|
||||
body = _(
|
||||
'This payment has been created from <a href=# data-oe-model=account.payment data-oe-id=%d>%s</a>') % (
|
||||
payment.id, payment.name)
|
||||
paired_payment.message_post(body=body)
|
||||
body = _(
|
||||
'A second payment has been created: <a href=# data-oe-model=account.payment data-oe-id=%d>%s</a>') % (
|
||||
paired_payment.id, paired_payment.name)
|
||||
payment.message_post(body=body)
|
||||
paired_payment.state='posted'
|
||||
lines = (payment.move_id.line_ids + paired_payment.move_id.line_ids).filtered(
|
||||
lambda l: l.account_id == payment.destination_account_id and not l.reconciled)
|
||||
lines.reconcile()
|
||||
|
||||
return res
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import controllers
|
||||
from . import models
|
||||
from . import models
|
||||
from . import wizard
|
||||
|
|
@ -6,8 +6,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-06-26 18:16+0000\n"
|
||||
"PO-Revision-Date: 2024-06-26 18:16+0000\n"
|
||||
"POT-Creation-Date: 2024-10-13 23:59+0000\n"
|
||||
"PO-Revision-Date: 2024-10-13 23:59+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
|
@ -15,6 +15,13 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_bank_statement_line__rec_payment_count
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_move__rec_payment_count
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_payment__rec_payment_count
|
||||
msgid "# Payments"
|
||||
msgstr ""
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model,name:exp_budget_check.model_account_analytic_account
|
||||
msgid "Analytic Account"
|
||||
|
|
@ -28,7 +35,6 @@ msgstr "موافقة"
|
|||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_analytic_account__is_auto_check
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_grant_project__is_auto_check
|
||||
msgid "Auto Check"
|
||||
msgstr ""
|
||||
|
||||
|
|
@ -75,16 +81,6 @@ msgstr "المبلغ التعميد"
|
|||
msgid "Confirm Bill"
|
||||
msgstr "تأكيد الفاتورة"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_analytic_account__display_name
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_move__display_name
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_move_line__display_name
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_budget_confirmation__display_name
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_crossovered_budget_lines__display_name
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_hr_expense__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "الاسم المعروض"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields.selection,name:exp_budget_check.selection__account_move__state__draft
|
||||
msgid "Draft"
|
||||
|
|
@ -107,7 +103,7 @@ msgstr "المصروف"
|
|||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/models/hr_expense.py:0
|
||||
#, python-format
|
||||
msgid "Expense :%s"
|
||||
msgid "Expense: %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: exp_budget_check
|
||||
|
|
@ -118,16 +114,7 @@ msgid "Hide Budget"
|
|||
msgstr ""
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_analytic_account__id
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_move__id
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_move_line__id
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_budget_confirmation__id
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_crossovered_budget_lines__id
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_hr_expense__id
|
||||
msgid "ID"
|
||||
msgstr "المُعرف"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: 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 ""
|
||||
|
|
@ -157,7 +144,6 @@ msgstr ""
|
|||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_analytic_account__is_analytic_budget
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_grant_project__is_analytic_budget
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_hr_expense__is_budget
|
||||
msgid "Is Use In Budget"
|
||||
msgstr "يستخدم في الموازنة"
|
||||
|
|
@ -172,22 +158,24 @@ msgstr "قيد اليومية"
|
|||
msgid "Journal Item"
|
||||
msgstr "عنصر اليومية"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_analytic_account____last_update
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_move____last_update
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_move_line____last_update
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_budget_confirmation____last_update
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_crossovered_budget_lines____last_update
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_hr_expense____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "آخر تعديل في"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/models/hr_expense.py:0
|
||||
#, python-format
|
||||
msgid "New Expense Report"
|
||||
msgstr ""
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,help:exp_budget_check.field_hr_expense__address_id
|
||||
msgid "Partner-related data of the user"
|
||||
msgstr "بيانات المستخدم المتعلقة بالشريك"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/models/account_invoice.py:0
|
||||
#: model:ir.model,name:exp_budget_check.model_account_payment
|
||||
#, python-format
|
||||
msgid "Payments"
|
||||
msgstr "الدفعات"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/models/hr_expense.py:0
|
||||
#, python-format
|
||||
|
|
@ -211,6 +199,11 @@ msgstr "الرجاء إدخال تاريخ الفاتورة"
|
|||
msgid "Posted"
|
||||
msgstr "مُرحل"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model,name:exp_budget_check.model_account_payment_register
|
||||
msgid "Register Payment"
|
||||
msgstr "تسجيل دفعة"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/models/account_invoice.py:0
|
||||
#: code:addons/exp_budget_check/models/hr_expense.py:0
|
||||
|
|
@ -218,6 +211,11 @@ msgstr "مُرحل"
|
|||
msgid "Rejected By : %s With Reject Reason : %s"
|
||||
msgstr "تم الرقض بواسطة %s . مع سبب الرقض : %s"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_hr_expense__address_id
|
||||
msgid "Related Partner"
|
||||
msgstr "الشريك"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_crossovered_budget_lines__reserve
|
||||
#: model_terms:ir.ui.view,arch_db:exp_budget_check.crossovered_budget_view_form_inherit
|
||||
|
|
@ -232,7 +230,6 @@ msgstr "المبلغ المحجوز"
|
|||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_move__state_a
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_move__state_b
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_move__state_bill
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_payment__state
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_payment__state_a
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_payment__state_b
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_account_payment__state_bill
|
||||
|
|
@ -256,19 +253,31 @@ msgstr "ضريبة"
|
|||
msgid "The Budget Confirmation Doesn't Approve yet"
|
||||
msgstr ""
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/models/account_invoice.py:0
|
||||
#: code:addons/exp_budget_check/models/hr_expense.py:0
|
||||
#, python-format
|
||||
msgid "The Expense account %s is assigned to more than one budget position %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/models/account_budget.py:0
|
||||
#: model:ir.model.fields,help:exp_budget_check.field_crossovered_budget_lines__confirm
|
||||
#, python-format
|
||||
msgid "Total amount of confirmed purchase orders"
|
||||
msgstr "المبلغ التعميد : هو عبارة قيمة التعميد ( أوامر الشراء)"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/models/account_budget.py:0
|
||||
#: model:ir.model.fields,help:exp_budget_check.field_crossovered_budget_lines__reserve
|
||||
#, python-format
|
||||
msgid "Total amount of reserved purchase orders"
|
||||
msgstr "المبلغ المحجوز وهو عبارة عن طلبات عروض الأسعار تم الموافقة عليها من الموازنة ( ارتباط مبدئى)"
|
||||
msgstr ""
|
||||
"المبلغ المحجوز وهو عبارة عن طلبات عروض الأسعار تم الموافقة عليها من الموازنة"
|
||||
" ( ارتباط مبدئى)"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_hr_expense__partner_id
|
||||
msgid "Vendor"
|
||||
msgstr "المورد"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields.selection,name:exp_budget_check.selection__budget_confirmation__type__vendor_bill
|
||||
|
|
@ -288,12 +297,31 @@ msgid "Wait Budget"
|
|||
msgstr "إنتظار تحقق الموازنة"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/models/hr_expense.py:0
|
||||
#: code:addons/exp_budget_check/wizard/payment_register.py:0
|
||||
#, python-format
|
||||
msgid "analytic account is %s not link with budget"
|
||||
msgstr ""
|
||||
msgid ""
|
||||
"You can not create payment for this invoice because there is a draft payment"
|
||||
" for it"
|
||||
msgstr "لا يمكنك إنشاء دفعة لهذه الفاتورة لأن هناك دفعة مسودة لها"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,field_description:exp_budget_check.field_budget_confirmation__type
|
||||
msgid "type"
|
||||
msgstr "النوع"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model_terms:ir.ui.view,arch_db:exp_budget_check.budget_check_view_move_form
|
||||
msgid "الدفعات"
|
||||
msgstr ""
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,help:exp_budget_check.field_crossovered_budget_lines__confirm
|
||||
msgid "المبلغ التعميد : هو عبارة قيمة التعميد ( أوامر الشراء)"
|
||||
msgstr ""
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model.fields,help:exp_budget_check.field_crossovered_budget_lines__reserve
|
||||
msgid ""
|
||||
"المبلغ المحجوز وهو عبارة عن طلبات عروض الأسعار تم الموافقة عليها من الموازنة"
|
||||
" ( ارتباط مبدئى)"
|
||||
msgstr ""
|
||||
|
|
|
|||
|
|
@ -12,22 +12,53 @@ class CrossoveredBudgetLines(models.Model):
|
|||
@api.depends('analytic_account_id')
|
||||
def _compute_confirm(self):
|
||||
for rec in self:
|
||||
orders = self.env['purchase.order.line'].search(
|
||||
order_lines = self.env['purchase.order.line'].search(
|
||||
[('account_analytic_id', '=', rec.analytic_account_id.id),
|
||||
('order_id.state', 'in', ['purchase','done'])]).mapped('order_id')
|
||||
total_orders = sum(orders.mapped('amount_total'))
|
||||
invoiced = self.env['account.move'].search(
|
||||
[('purchase_id', 'in', orders.ids), ('state', 'not in', ['draft', 'cancel'])]).mapped('amount_total')
|
||||
rec.confirm = (total_orders - sum(invoiced)) * -1
|
||||
('order_id.date_order', '>=', rec.crossovered_budget_id.date_from),
|
||||
('order_id.date_order', '<=', rec.crossovered_budget_id.date_to),
|
||||
'|', ('product_id.property_account_expense_id', 'in', rec.general_budget_id.account_ids.ids),
|
||||
('product_id.categ_id.property_account_expense_categ_id', 'in', rec.general_budget_id.account_ids.ids),
|
||||
('order_id.state', 'in', ['purchase', 'done'])])
|
||||
orders_without_tax = sum(order_lines.mapped('price_subtotal'))
|
||||
need_tax = 0
|
||||
invoice_amount = 0
|
||||
for line in order_lines:
|
||||
vals = line._prepare_compute_all_values()
|
||||
taxes = line.taxes_id.filtered(lambda x: x.analytic).compute_all(
|
||||
vals['price_unit'],
|
||||
vals['currency_id'],
|
||||
vals['product_qty'],
|
||||
vals['product'],
|
||||
vals['partner'])
|
||||
need_tax += sum(t.get('amount', 0.0) for t in taxes.get('taxes', []))
|
||||
invoiced = self.env['account.move.line'].search(
|
||||
[('purchase_line_id', '=', line.id), ('move_id.state', 'not in', ['draft', 'cancel'])])
|
||||
invoice_amount += sum(invoiced.mapped('price_subtotal')) if not need_tax else sum(
|
||||
invoiced.mapped('move_id.amount_total'))
|
||||
rec.confirm = ((orders_without_tax + need_tax) - invoice_amount) * -1
|
||||
|
||||
@api.depends('analytic_account_id')
|
||||
def _compute_reserve(self):
|
||||
for rec in self:
|
||||
orders = self.env['purchase.order.line'].search(
|
||||
order_lines = self.env['purchase.order.line'].search(
|
||||
[('account_analytic_id', '=', rec.analytic_account_id.id),
|
||||
('order_id.state', 'in', ['draft', 'sent', 'to approve'])]).mapped('order_id')
|
||||
total_orders = sum(orders.mapped('amount_total'))
|
||||
rec.reserve = total_orders * -1
|
||||
('order_id.date_order', '>=', rec.crossovered_budget_id.date_from),
|
||||
('order_id.date_order', '<=', rec.crossovered_budget_id.date_to),
|
||||
'|', ('product_id.property_account_expense_id', 'in', rec.general_budget_id.account_ids.ids),
|
||||
('product_id.categ_id.property_account_expense_categ_id', 'in', rec.general_budget_id.account_ids.ids),
|
||||
('order_id.state', 'in', ['draft', 'sent', 'to approve'])])
|
||||
orders_without_tax = sum(order_lines.mapped('price_subtotal'))
|
||||
need_tax = 0
|
||||
for line in order_lines:
|
||||
vals = line._prepare_compute_all_values()
|
||||
taxes = line.taxes_id.filtered(lambda x: x.analytic).compute_all(
|
||||
vals['price_unit'],
|
||||
vals['currency_id'],
|
||||
vals['product_qty'],
|
||||
vals['product'],
|
||||
vals['partner'])
|
||||
need_tax += sum(t.get('amount', 0.0) for t in taxes.get('taxes', []))
|
||||
rec.reserve = (orders_without_tax + need_tax) * -1
|
||||
|
||||
def _compute_operations_amount(self):
|
||||
if not self.ids: return
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class BudgetConfirmationCustom(models.Model):
|
|||
self.invoice_id.message_post(body=_(
|
||||
"Rejected By : %s With Reject Reason : %s" % (str(self.env.user.name), str(self.reject_reason or self.env.context.get('reject_reason','')))))
|
||||
|
||||
|
||||
def done(self):
|
||||
super(BudgetConfirmationCustom, self).done()
|
||||
if self.invoice_id and self.type == 'vendor.bill':
|
||||
|
|
@ -60,6 +61,28 @@ class AccountMove(models.Model):
|
|||
is_check = fields.Boolean(defaul=False)
|
||||
is_approve = fields.Boolean(defaul=False)
|
||||
hide_budget = fields.Boolean(defaul=False,copy=False)
|
||||
rec_payment_count = fields.Integer(compute='_compute_rec_payment_count', string='# Payments')
|
||||
|
||||
def _compute_rec_payment_count(self):
|
||||
for invoice in self:
|
||||
payments = self.env['account.payment'].search_count([
|
||||
('invoice_rec_id', '=', invoice.id)
|
||||
])
|
||||
invoice.rec_payment_count = payments
|
||||
|
||||
def action_open_related_payment_records(self):
|
||||
""" Opens a tree view with related records filtered by a dynamic domain """
|
||||
payments = self.env['account.payment'].search([
|
||||
('invoice_rec_id', '=', self.id)
|
||||
]).ids
|
||||
|
||||
return {
|
||||
'name': _('Payments'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'account.payment',
|
||||
'view_mode': 'tree,form',
|
||||
'domain': [('id', 'in', payments)],
|
||||
}
|
||||
def copy(self):
|
||||
self.write({'budget_check': False})
|
||||
# self.write({'is_check':False})
|
||||
|
|
@ -71,19 +94,14 @@ class AccountMove(models.Model):
|
|||
for rec in self.invoice_line_ids:
|
||||
if rec.analytic_account_id.is_analytic_budget and not rec.analytic_account_id.is_auto_check:
|
||||
self.write({
|
||||
'state': 'confirm'
|
||||
'state': 'confirm',
|
||||
'hide_budget': False
|
||||
})
|
||||
break
|
||||
else:
|
||||
self.write({
|
||||
'state': 'budget_approve'
|
||||
})
|
||||
other_confirms = self.env['budget.confirmation'].search(
|
||||
[('invoice_id', '=', self.id), ('state', '=', 'cancel')], limit=1,
|
||||
order='id desc')
|
||||
if other_confirms:
|
||||
other_confirms.state='draft'
|
||||
return
|
||||
if self.purchase_id:
|
||||
confirm_budget = self.env['budget.confirmation'].search([('po_id', '=', self.purchase_id.id)], limit=1,
|
||||
order='id desc')
|
||||
|
|
@ -154,11 +172,6 @@ class AccountMove(models.Model):
|
|||
confirmation_lines = []
|
||||
self.hide_budget = True
|
||||
if not self.budget_check:
|
||||
other_confirms = self.env['budget.confirmation'].search(
|
||||
[('invoice_id', '=', self.id), ('state', '!=', 'cancel')], limit=1,
|
||||
order='id desc')
|
||||
if other_confirms:
|
||||
return
|
||||
amount = 0
|
||||
if self.purchase_id:
|
||||
confirm_budget = self.env['budget.confirmation'].search([('po_id', '=', self.purchase_id.id)], limit=1,
|
||||
|
|
@ -176,23 +189,28 @@ class AccountMove(models.Model):
|
|||
if line.analytic_account_id:
|
||||
if not line.analytic_account_id:
|
||||
raise ValidationError(_('Please Choose Analytic account for This Bill'))
|
||||
budget_post = self.env['account.budget.post'].search([]).filtered(lambda x: line.account_id in x.account_ids)
|
||||
if len(budget_post.ids) > 1:
|
||||
raise ValidationError(
|
||||
_("The Expense account %s is assigned to more than one budget position %s")%(line.account_id.name,[x.name for x in budget_post]))
|
||||
budget_lines = self.env['crossovered.budget.lines'].search(
|
||||
[('analytic_account_id', '=', line.analytic_account_id.id),
|
||||
('general_budget_id.account_ids', 'in', [line.account_id.id]),
|
||||
('general_budget_id', 'in', budget_post.ids),
|
||||
('crossovered_budget_id.state', '=', 'done'),
|
||||
('crossovered_budget_id.date_from', '<=', self.invoice_date),
|
||||
('crossovered_budget_id.date_to', '>=', self.invoice_date)])
|
||||
if not budget_lines:
|
||||
confirmation_lines=[]
|
||||
else:
|
||||
remain = abs(budget_lines[0].remain)
|
||||
amount = amount + (line.price_subtotal + line.price_tax)
|
||||
remain = abs(budget_lines.remain)
|
||||
tax_id = line.tax_ids[0].analytic if line.tax_ids else False
|
||||
amount = amount + (line.price_subtotal + (line.price_tax if tax_id else 0))
|
||||
new_remain = remain - amount
|
||||
confirmation_lines.append((0, 0, {
|
||||
'amount': line.price_subtotal + line.price_tax,
|
||||
'amount': line.price_subtotal + (line.price_tax if tax_id else 0),
|
||||
'analytic_account_id': line.analytic_account_id.id,
|
||||
'description': line.product_id.name,
|
||||
'budget_line_id': budget_lines[0].id,
|
||||
'budget_line_id': budget_lines.id,
|
||||
'remain': new_remain + (line.price_subtotal + line.price_tax),
|
||||
'new_balance': new_remain,
|
||||
'account_id': line.account_id.id
|
||||
|
|
@ -202,7 +220,6 @@ class AccountMove(models.Model):
|
|||
'name': _('Vendor Bill :%s') % self.partner_id.name,
|
||||
'date': self.invoice_date,
|
||||
'beneficiary_id': self.partner_id.id,
|
||||
# 'department_id': self.department_id.id,
|
||||
'type': 'vendor.bill',
|
||||
'ref': self.name,
|
||||
'description': self.ref,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class BudgetConfirmationCustom(models.Model):
|
|||
if self.expense_id and self.type == 'expense':
|
||||
self.expense_id.write({'state': 'draft'})
|
||||
self.expense_id.message_post(body=_(
|
||||
"Rejected By : %s With Reject Reason : %s" % (str(self.env.user.name), str(self.reject_reason))))
|
||||
"Rejected By : %s With Reject Reason : %s" % (str(self.env.user.name), str(self.reject_reason or self.env.context.get('reject_reason','')))))
|
||||
|
||||
def done(self):
|
||||
super(BudgetConfirmationCustom, self).done()
|
||||
|
|
@ -140,40 +140,52 @@ class AccountMove(models.Model):
|
|||
return res
|
||||
|
||||
def action_budget(self):
|
||||
budget_lines = self.analytic_account_id.crossovered_budget_line.filtered(
|
||||
lambda x: x.crossovered_budget_id.state == 'done' and
|
||||
fields.Date.from_string(x.date_from) <= fields.Date.from_string(self.date) <= fields.Date.from_string(x.date_to)
|
||||
)
|
||||
if not budget_lines:
|
||||
raise UserError(_('Analytic account %s is not linked with budget') % self.analytic_account_id.name)
|
||||
else:
|
||||
budget_line = budget_lines[0]
|
||||
remain = abs(budget_line.remain)
|
||||
amount = self.total_amount
|
||||
|
||||
budget_post = self.env['account.budget.post'].search([]).filtered(lambda x: self.account_id in x.account_ids)
|
||||
if len(budget_post.ids) > 1:
|
||||
raise ValidationError(
|
||||
_("The Expense account %s is assigned to more than one budget position %s") % (
|
||||
self.account_id.name, [x.name for x in budget_post]))
|
||||
budget_lines = self.env['crossovered.budget.lines'].search(
|
||||
[('analytic_account_id', '=', self.analytic_account_id.id),
|
||||
('general_budget_id', 'in', budget_post.ids),
|
||||
('crossovered_budget_id.state', '=', 'done'),
|
||||
('crossovered_budget_id.date_from', '<=', self.date),
|
||||
('crossovered_budget_id.date_to', '>=', self.date)])
|
||||
|
||||
budget_line = budget_lines
|
||||
if budget_line:
|
||||
remain = abs(budget_line.remain) if budget_line else 0
|
||||
tax_id = self.tax_ids[0].analytic if self.tax_ids else False
|
||||
price_before_tax= self.unit_amount* self.quantity
|
||||
tax_price = self.total_amount - price_before_tax
|
||||
amount = price_before_tax + (tax_price if tax_id else 0)
|
||||
new_remain = remain - amount
|
||||
else:
|
||||
new_remain = 0
|
||||
amount=0
|
||||
data = {
|
||||
'name': _('Expense: %s') % self.employee_id.name,
|
||||
'date': self.date,
|
||||
'beneficiary_id': self.employee_id.user_id.partner_id.id,
|
||||
'type': 'expense',
|
||||
'ref': self.name,
|
||||
'description': self.name,
|
||||
'total_amount': amount,
|
||||
'lines_ids': [(0, 0, {
|
||||
'amount': amount,
|
||||
'analytic_account_id': self.analytic_account_id.id,
|
||||
'description': self.product_id.name,
|
||||
'budget_line_id': budget_line.id if budget_line else False,
|
||||
'remain': new_remain + amount,
|
||||
'new_balance': new_remain,
|
||||
'account_id': self.account_id.id
|
||||
})] if budget_line else False,
|
||||
'expense_id': self.id
|
||||
}
|
||||
self.env['budget.confirmation'].create(data)
|
||||
|
||||
data = {
|
||||
'name': _('Expense: %s') % self.employee_id.name,
|
||||
'date': self.date,
|
||||
'beneficiary_id': self.employee_id.user_id.partner_id.id, # Ensure correct ID is used
|
||||
'type': 'expense',
|
||||
'ref': self.name,
|
||||
'description': self.name,
|
||||
'total_amount': amount,
|
||||
'lines_ids': [(0, 0, {
|
||||
'amount': amount,
|
||||
'analytic_account_id': self.analytic_account_id.id,
|
||||
'description': self.product_id.name,
|
||||
'budget_line_id': budget_line.id,
|
||||
'remain': new_remain + amount,
|
||||
'new_balance': new_remain,
|
||||
'account_id': self.account_id.id
|
||||
})],
|
||||
'expense_id': self.id
|
||||
}
|
||||
self.env['budget.confirmation'].create(data)
|
||||
|
||||
self.write({
|
||||
'is_check': True,
|
||||
'state': 'wait_budget'
|
||||
})
|
||||
self.write({
|
||||
'is_check': True,
|
||||
'state': 'wait_budget'
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,6 +2,17 @@
|
|||
<odoo>
|
||||
|
||||
|
||||
<record id="view_account_payment_form" model="ir.ui.view">
|
||||
<field name="name">account.payment.form.custom</field>
|
||||
<field name="model">account.payment</field>
|
||||
<field name="inherit_id" ref="account.view_account_payment_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='is_matched']" position="after">
|
||||
<field name="invoice_rec_id" invisible="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_budget_analytic_account_form_custom" model="ir.ui.view">
|
||||
<field name="name">analytic.analytic.account.form.custom</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
|
|
@ -60,8 +71,14 @@
|
|||
</xpath>
|
||||
|
||||
<xpath expr="//div[hasclass('oe_button_box')]" position="inside">
|
||||
<button class="oe_stat_button" name="open_confirmation" type="object" string="Budget Confirmation"/>
|
||||
</xpath>
|
||||
<button class="oe_stat_button" name="open_confirmation" type="object" string="Budget Confirmation"
|
||||
attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}"/>
|
||||
<button name="action_open_related_payment_records" type="object"
|
||||
class="oe_stat_button" icon="fa-money"
|
||||
attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}">
|
||||
<field name="rec_payment_count" widget="statinfo" string="الدفعات"/>
|
||||
</button>
|
||||
</xpath>
|
||||
|
||||
<button name="button_cancel" position="attributes">
|
||||
<attribute name="attrs">{'invisible' : ['|', ('id', '=', False), ('state', 'not in',
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
from . import payment_register
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
from odoo import models, fields, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountPayment(models.Model):
|
||||
_inherit = "account.payment"
|
||||
|
||||
invoice_rec_id = fields.Many2one(comodel_name='account.move', string='Invoice', copy=False)
|
||||
|
||||
|
||||
class AccountPaymentRegister(models.TransientModel):
|
||||
_inherit = 'account.payment.register'
|
||||
|
||||
def _create_payments(self):
|
||||
self.ensure_one()
|
||||
active_id = self.env.context.get('active_id')
|
||||
if active_id:
|
||||
invoice_payment = self.env['account.payment'].search(
|
||||
[('invoice_rec_id', '=', active_id),
|
||||
('state', '=', 'draft')])
|
||||
if invoice_payment:
|
||||
raise UserError(
|
||||
_('You can not create payment for this invoice because there is a draft payment for it'))
|
||||
|
||||
batches = self._get_batches()
|
||||
edit_mode = self.can_edit_wizard and (len(batches[0]['lines']) == 1 or self.group_payment)
|
||||
to_process = []
|
||||
|
||||
if edit_mode:
|
||||
payment_vals = self._create_payment_vals_from_wizard()
|
||||
to_process.append({
|
||||
'create_vals': payment_vals,
|
||||
'to_reconcile': batches[0]['lines'],
|
||||
'batch': batches[0],
|
||||
})
|
||||
else:
|
||||
# Don't group payments: Create one batch per move.
|
||||
if not self.group_payment:
|
||||
new_batches = []
|
||||
for batch_result in batches:
|
||||
for line in batch_result['lines']:
|
||||
new_batches.append({
|
||||
**batch_result,
|
||||
'lines': line,
|
||||
})
|
||||
batches = new_batches
|
||||
|
||||
for batch_result in batches:
|
||||
to_process.append({
|
||||
'create_vals': self._create_payment_vals_from_batch(batch_result),
|
||||
'to_reconcile': batch_result['lines'],
|
||||
'batch': batch_result,
|
||||
})
|
||||
|
||||
payments = self._init_payments(to_process, edit_mode=edit_mode)
|
||||
process_final = [item for item in to_process if item['create_vals']['payment_type'] != 'outbound']
|
||||
self._post_payments(process_final, edit_mode=edit_mode)
|
||||
self._reconcile_payments(process_final, edit_mode=edit_mode)
|
||||
for payment in payments:
|
||||
if payment.payment_type == 'outbound':
|
||||
payment.invoice_rec_id = active_id
|
||||
payment.action_cancel()
|
||||
payment.action_draft()
|
||||
return payments
|
||||
|
|
@ -248,7 +248,9 @@ class HrExpenseSheet(models.Model):
|
|||
.filtered(lambda r: not float_is_zero(r.total_amount, precision_rounding=(
|
||||
r.currency_id or self.env.company.currency_id).rounding))
|
||||
res = expense_line_ids.action_move_create()
|
||||
print(res)
|
||||
# for item in res:
|
||||
# for line in item.line_ids:
|
||||
# line.account_id = self.
|
||||
# write petty_cash_id in created moves
|
||||
self.expense_line_ids.filtered(lambda x: x.is_refused == True).write({'state': 'refused'})
|
||||
for key, item in res.items():
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-07-17 00:08+0000\n"
|
||||
"PO-Revision-Date: 2024-07-17 00:08+0000\n"
|
||||
"POT-Creation-Date: 2024-10-07 06:59+0000\n"
|
||||
"PO-Revision-Date: 2024-10-07 06:59+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
|
@ -15,6 +15,20 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,help:initial_engagement_budget.field_crossovered_budget_lines__remain
|
||||
msgid ""
|
||||
" ( مبلغ متاح - المبلغ المحجوز - مبلغ تعميد - المبلغ الفعلى - المحجوز المبدئي"
|
||||
" ) يكون صفر عند قابل الاشارة"
|
||||
msgstr ""
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,help:initial_engagement_budget.field_crossovered_budget_lines__above_remain
|
||||
msgid ""
|
||||
" هي المبالغ التي تم صرفها بعد انتهاء رصيد المتبقى من الموازنة في حالة "
|
||||
"التجاوز الموازنة"
|
||||
msgstr ""
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_res_company__activate_initial_engagement
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_res_config_settings__activate_initial_engagement
|
||||
|
|
@ -30,18 +44,13 @@ msgstr "تفعيل الربط المبدئي بالموازنات"
|
|||
#: code:addons/initial_engagement_budget/models/account_budget.py:0
|
||||
#, python-format
|
||||
msgid "Amount of money that has been exceeded"
|
||||
msgstr "تم تجاوز المبلغ المالي"
|
||||
msgstr ""
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: code:addons/initial_engagement_budget/models/account_budget.py:0
|
||||
#, python-format
|
||||
msgid "Amount of money that has been remained"
|
||||
msgstr "تم البقاء على المبلغ المالي"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_purchase_request_line__analytic_account_id
|
||||
msgid "Analytic Account"
|
||||
msgstr "حساب تحليلي"
|
||||
msgstr ""
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model,name:initial_engagement_budget.model_crossovered_budget_lines
|
||||
|
|
@ -53,40 +62,16 @@ msgstr "بند الموازنة"
|
|||
msgid "Cancel"
|
||||
msgstr "إلغاء"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model,name:initial_engagement_budget.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr "شركات"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model,name:initial_engagement_budget.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr "ضبط الاعدادات"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields.selection,name:initial_engagement_budget.selection__purchase_request__purchase_cost__default
|
||||
msgid "Default Cost Center"
|
||||
msgstr "حساب تحليلي مرتبط بالشركة"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields.selection,name:initial_engagement_budget.selection__purchase_request__purchase_cost__department
|
||||
msgid "Department"
|
||||
msgstr "الإدارة"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields.selection,name:initial_engagement_budget.selection__purchase_request__state__direct_manager
|
||||
msgid "Direct Manager"
|
||||
msgstr "المدير المباشر"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_crossovered_budget_lines__display_name
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_purchase_request__display_name
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_purchase_request_line__display_name
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_res_company__display_name
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_res_config_settings__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "الاسم المعروض"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields.selection,name:initial_engagement_budget.selection__purchase_request__state__done
|
||||
msgid "Done"
|
||||
|
|
@ -97,20 +82,16 @@ msgstr "تم"
|
|||
msgid "Draft"
|
||||
msgstr "مبدئي"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_crossovered_budget_lines__above_remain
|
||||
msgid "Exceed Amount"
|
||||
msgstr "التجاوز الموازنة"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_purchase_request_line__expected_price
|
||||
msgid "Expected Price"
|
||||
msgstr "السعر التقديري شامل الضريبة "
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_crossovered_budget_lines__id
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_purchase_request__id
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_purchase_request_line__id
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_res_company__id
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_res_config_settings__id
|
||||
msgid "ID"
|
||||
msgstr "المُعرف"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields.selection,name:initial_engagement_budget.selection__purchase_request__state__waiting
|
||||
msgid "In Purchase"
|
||||
|
|
@ -135,47 +116,32 @@ msgstr "وضع الربط المبدئي"
|
|||
msgid "Initial Engagement Budget"
|
||||
msgstr "الربط المبدئي للموازنات"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_crossovered_budget_lines____last_update
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_purchase_request____last_update
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_purchase_request_line____last_update
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_res_company____last_update
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_res_config_settings____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "آخر تعديل في"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: code:addons/initial_engagement_budget/models/purchase_request.py:0
|
||||
#, python-format
|
||||
msgid "Please put cost center to the product line"
|
||||
msgstr "برجاء ادخال حساب تحليلي للمنتج"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields.selection,name:initial_engagement_budget.selection__purchase_request__purchase_cost__product_line
|
||||
msgid "Product Line"
|
||||
msgstr "على مستوي سطر الشراء"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model,name:initial_engagement_budget.model_purchase_request
|
||||
msgid "Purchase Request"
|
||||
msgstr "طلبات الشراء"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_purchase_request__purchase_cost
|
||||
msgid "Purchase Request Cost"
|
||||
msgstr "نوع الحساب التحليلي"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields.selection,name:initial_engagement_budget.selection__purchase_request__state__refuse
|
||||
msgid "Refuse"
|
||||
msgstr "رفض"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_crossovered_budget_lines__remain
|
||||
msgid "Remain of Christening"
|
||||
msgstr ""
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.actions.act_window,name:initial_engagement_budget.action_budget_confirmation_form
|
||||
#: model:ir.ui.menu,name:initial_engagement_budget.menu_budget_confirmation
|
||||
msgid "Request Budget Confirmations"
|
||||
msgstr "الربط المبدئي"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model,name:initial_engagement_budget.model_res_company
|
||||
msgid "Res Company SMS Configuration"
|
||||
msgstr ""
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_purchase_request__state
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_purchase_request__state_a
|
||||
|
|
@ -183,6 +149,12 @@ msgstr "الربط المبدئي"
|
|||
msgid "State"
|
||||
msgstr "الحالة"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: code:addons/initial_engagement_budget/models/purchase_request.py:0
|
||||
#, python-format
|
||||
msgid "The Expense account %s is assigned to more than one budget position %s"
|
||||
msgstr "حساب المصروف %s معين لأكثر من مركز موازنه %s"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: code:addons/initial_engagement_budget/models/purchase_request.py:0
|
||||
#, python-format
|
||||
|
|
@ -202,7 +174,6 @@ msgstr "برجاء ادخال قيمة اكبر من 0"
|
|||
|
||||
#. module: initial_engagement_budget
|
||||
#: code:addons/initial_engagement_budget/models/account_budget.py:0
|
||||
#: model:ir.model.fields,help:initial_engagement_budget.field_crossovered_budget_lines__initial_engagement_amount
|
||||
#, python-format
|
||||
msgid "Total amount of confirmed purchase requests for this budget line."
|
||||
msgstr "المبلغ الإجمالي لطلبات الشراء المؤكدة لهذا البند الميزاني."
|
||||
|
|
@ -222,3 +193,8 @@ msgstr "برجاء ادخال مورد لهذا الطلب"
|
|||
#: model:ir.model,name:initial_engagement_budget.model_purchase_request_line
|
||||
msgid "purchase request line"
|
||||
msgstr "بند طلب الشراء"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,help:initial_engagement_budget.field_crossovered_budget_lines__initial_engagement_amount
|
||||
msgid "المبلغ الإجمالي لطلبات الشراء المؤكدة لهذا البند الميزاني."
|
||||
msgstr ""
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ class PurchaseRequest(models.Model):
|
|||
default="draft",
|
||||
tracking=True
|
||||
)
|
||||
state_a = fields.Selection(related='state')
|
||||
state_b = fields.Selection(related='state')
|
||||
state_a = fields.Selection(related='state',tracking=False)
|
||||
state_b = fields.Selection(related='state',tracking=False)
|
||||
|
||||
initial_engagement_activate = fields.Boolean(compute='_check_initial_engagement_activate', store=True,
|
||||
default=False)
|
||||
|
|
@ -59,29 +59,35 @@ class PurchaseRequest(models.Model):
|
|||
|
||||
for order in self:
|
||||
for rec in order.line_ids:
|
||||
if not (
|
||||
rec.product_id.property_account_expense_id.id and rec.product_id.property_account_expense_id.id or rec.product_id.categ_id.property_account_expense_categ_id.id):
|
||||
account_id = rec.product_id.property_account_expense_id and rec.product_id.property_account_expense_id or rec.product_id.categ_id.property_account_expense_categ_id
|
||||
if not account_id:
|
||||
raise ValidationError(
|
||||
_("This product has no expense account") + ': {}'.format(rec.product_id.name))
|
||||
|
||||
budget_lines = analytic_account.crossovered_budget_line.filtered(
|
||||
lambda x:
|
||||
x.crossovered_budget_id.state == 'done' and
|
||||
rec.product_id.property_account_expense_id.id in x.general_budget_id.account_ids.ids and
|
||||
fields.Date.from_string(x.date_from) <= fields.Date.from_string(self.date) and
|
||||
fields.Date.from_string(x.date_to) >= fields.Date.from_string(self.date))
|
||||
budget_post = self.env['account.budget.post'].search([]).filtered(lambda x: account_id in x.account_ids)
|
||||
if len(budget_post.ids) > 1:
|
||||
raise ValidationError(
|
||||
_("The Expense account %s is assigned to more than one budget position %s") % (
|
||||
account_id.name, [x.name for x in budget_post]))
|
||||
budget_lines = self.env['crossovered.budget.lines'].search(
|
||||
[('analytic_account_id', '=', analytic_account.id),
|
||||
('general_budget_id', 'in', budget_post.ids),
|
||||
('crossovered_budget_id.state', '=', 'done'),
|
||||
('crossovered_budget_id.date_from', '<=', self.date),
|
||||
('crossovered_budget_id.date_to', '>=', self.date)])
|
||||
|
||||
budget_line = budget_lines.mapped('crossovered_budget_id')
|
||||
if len(budget_line) > 1:
|
||||
self.budget_id = budget_line[0].id
|
||||
if budget_lines:
|
||||
remain = abs(budget_lines[0].remain)
|
||||
remain = abs(budget_lines.remain)
|
||||
amount = amount + rec.line_total
|
||||
new_balance = remain - amount
|
||||
confirmation_lines.append((0, 0, {
|
||||
'amount': rec.line_total,
|
||||
'analytic_account_id': analytic_account.id,
|
||||
'description': rec.product_id.name,
|
||||
'budget_line_id': budget_lines[0].id,
|
||||
'budget_line_id': budget_lines.id,
|
||||
'remain': remain,
|
||||
'new_balance': new_balance,
|
||||
'account_id': rec.product_id.property_account_expense_id.id and rec.product_id.property_account_expense_id.id or rec.product_id.categ_id.property_account_expense_categ_id.id
|
||||
|
|
|
|||
|
|
@ -387,12 +387,14 @@ class AccountAsset(models.Model):
|
|||
depreciation_date, already_depreciated_amount, amount_change_ids)
|
||||
newline_vals_list = []
|
||||
for newline_vals in newlines:
|
||||
# no need of amount field, as it is computed and we don't want to trigger its inverse function
|
||||
if 'period_id' in newline_vals:
|
||||
del newline_vals['period_id']
|
||||
del (newline_vals['amount_total'])
|
||||
newline_vals_list.append(newline_vals)
|
||||
new_moves = self.env['account.move'].sudo().create(newline_vals_list)
|
||||
for move in new_moves:
|
||||
commands.append((4, move.id))
|
||||
|
||||
return self.write({'depreciation_move_ids': commands})
|
||||
|
||||
def _recompute_board(self, depreciation_number, starting_sequence, amount_to_depreciate, depreciation_date,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
'website': "http://www.exp-sa.com",
|
||||
'depends': ['account', 'odex25_account_accountant'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'security/security.xml',
|
||||
'views/account_payment_views.xml',
|
||||
],
|
||||
|
|
|
|||
|
|
@ -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:53+0000\n"
|
||||
"PO-Revision-Date: 2024-08-08 13:53+0000\n"
|
||||
"POT-Creation-Date: 2024-10-13 22:59+0000\n"
|
||||
"PO-Revision-Date: 2024-10-13 22:59+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
|
@ -37,6 +37,11 @@ msgstr "الحساب التحليلي"
|
|||
msgid "Cancel"
|
||||
msgstr "إلغاء"
|
||||
|
||||
#. module: odex25_account_payment_fix
|
||||
#: model:res.groups,name:odex25_account_payment_fix.group_cancel
|
||||
msgid "Cancel Payment"
|
||||
msgstr ""
|
||||
|
||||
#. module: odex25_account_payment_fix
|
||||
#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__cancel
|
||||
msgid "Cancelled"
|
||||
|
|
@ -97,6 +102,13 @@ msgstr "الحالة السابقة"
|
|||
msgid "Status"
|
||||
msgstr "الحالة"
|
||||
|
||||
#. module: odex25_account_payment_fix
|
||||
#: code:addons/odex25_account_payment_fix/models/account_payment.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"You can't post this journal entry because the payment is not posted yet."
|
||||
msgstr "لا يمكنك تأكيد هذا القيد اليومي لأن الدفعة لم تؤكد بعد."
|
||||
|
||||
#. module: odex25_account_payment_fix
|
||||
#: code:addons/odex25_account_payment_fix/models/account_payment.py:0
|
||||
#, python-format
|
||||
|
|
|
|||
|
|
@ -1,6 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import AccessError
|
||||
from odoo.exceptions import AccessError, ValidationError
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
def action_post(self):
|
||||
res = super(AccountMove, self).action_post()
|
||||
for rec in self:
|
||||
payment = self.env['account.payment'].search([('move_id', '=', rec.id),
|
||||
('payment_type', '=', 'outbound')], limit=1)
|
||||
if payment and payment.state != 'posted':
|
||||
raise ValidationError(_("You can't post this journal entry because the payment is not posted yet."))
|
||||
return res
|
||||
|
||||
|
||||
class AccountPayment(models.Model):
|
||||
|
|
@ -24,7 +37,8 @@ class AccountPayment(models.Model):
|
|||
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
|
||||
if line.account_id.id == res.destination_account_id.id:
|
||||
line.analytic_account_id = res.analytic_account_id.id
|
||||
return res
|
||||
|
||||
def _check_permission(self, group_xml_id):
|
||||
|
|
@ -40,15 +54,15 @@ class AccountPayment(models.Model):
|
|||
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
|
||||
|
||||
if line.account_id.id == payment.destination_account_id.id:
|
||||
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:
|
||||
if self.payment_type == 'outbound':
|
||||
if self.payment_type == 'outbound' and payment.state != 'draft':
|
||||
self._check_permission(f'odex25_account_payment_fix.group_{payment.state}')
|
||||
if payment_state == 'draft':
|
||||
payment.state = 'cancel'
|
||||
|
|
@ -59,16 +73,18 @@ class AccountPayment(models.Model):
|
|||
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
|
||||
if line.account_id.id == payment.destination_account_id.id:
|
||||
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
|
||||
if line.account_id.id == payment.destination_account_id.id:
|
||||
line.analytic_account_id = payment.analytic_account_id.id
|
||||
payment.state_history = 'cancel'
|
||||
return res
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_stock_valuation_layer_account_user,access_stock_valuation_layer_account_user user,stock_account.model_stock_valuation_layer,base.group_user,1,1,1,1
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_account_payment_form_inherit_odex25_account_accountant" model="ir.ui.view">
|
||||
<record id="view_account_payment_form_inherit_odex25_account_accountant_test" 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="arch" type="xml">
|
||||
<xpath expr="//field[@name='move_id']" position="after">
|
||||
<field name="analytic_account_id"/>
|
||||
<field name="analytic_account_id" attrs="{'invisible':[('partner_type','!=','GL')]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,14 @@ class AccountGeneralLedgerReport(models.AbstractModel):
|
|||
def _get_report_name(self):
|
||||
return _("General Ledger")
|
||||
|
||||
@api.model
|
||||
def _get_options(self, previous_options=None):
|
||||
# OVERRIDE
|
||||
options = super(AccountGeneralLedgerReport, self)._get_options(previous_options=previous_options)
|
||||
if self.env.context.get("readonly_search"):
|
||||
options['readonly_search'] = True
|
||||
return options
|
||||
|
||||
def view_all_journal_items(self, options, params):
|
||||
if params.get('id'):
|
||||
params['id'] = int(params.get('id').split('_')[1])
|
||||
|
|
@ -65,6 +73,7 @@ class AccountGeneralLedgerReport(models.AbstractModel):
|
|||
# Case the whole report is loaded or a line is expanded for the first time.
|
||||
return self._get_general_ledger_lines(options, line_id=line_id)
|
||||
|
||||
|
||||
@api.model
|
||||
def _get_general_ledger_lines(self, options, line_id=None):
|
||||
''' Get lines for the whole report or for a specific line.
|
||||
|
|
|
|||
|
|
@ -289,11 +289,18 @@
|
|||
role="button"/>
|
||||
</template>
|
||||
|
||||
<template id="main_template_with_filter_input_accounts" inherit_id="odex25_account_reports.main_template" primary="True">
|
||||
<template id="main_template_with_filter_input_accounts" inherit_id="odex25_account_reports.main_template" primary="True">
|
||||
<xpath expr="//div[hasclass('print_only')]" position="after">
|
||||
<div class="o_reports_filter_input_wrapper no_print">
|
||||
<div class="o_reports_filter_input_wrapper no_print" >
|
||||
<span class="searchIcon"><i class="fa fa-search" role="img" aria-label="Search" title="Search"></i></span>
|
||||
<input class="o_account_reports_filter_input" type="text" placeholder="Search account" />
|
||||
<t t-if="options.get('readonly_search')">
|
||||
<input class="o_account_reports_filter_input" type="text" placeholder="Search account" readonly="1"/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<input class="o_account_reports_filter_input" type="text" placeholder="Search account" />
|
||||
</t>
|
||||
|
||||
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from . import models
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': "Petty Invoice",
|
||||
'summary': """Accounting""",
|
||||
'category': 'Odex25-Project/Odex25-Project',
|
||||
'description': """
|
||||
Mark invoice as petty cash one
|
||||
|
||||
""",
|
||||
'version': '0.1',
|
||||
'depends': ['account'],
|
||||
'data': [
|
||||
'views/account_move_view.xml',
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * petty_invoice
|
||||
#
|
||||
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"
|
||||
"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: petty_invoice
|
||||
#: model_terms:ir.ui.view,arch_db:petty_invoice.view_account_invoice_filter
|
||||
msgid "Created By"
|
||||
msgstr "تم الإنشاء بواسطة"
|
||||
|
||||
#. module: petty_invoice
|
||||
#: model:ir.model,name:petty_invoice.model_account_move
|
||||
msgid "Journal Entry"
|
||||
msgstr "قيد اليومية"
|
||||
|
||||
#. module: petty_invoice
|
||||
#: model:ir.model.fields,field_description:petty_invoice.field_account_bank_statement_line__is_petty_paid
|
||||
#: model:ir.model.fields,field_description:petty_invoice.field_account_move__is_petty_paid
|
||||
#: model:ir.model.fields,field_description:petty_invoice.field_account_payment__is_petty_paid
|
||||
#: model_terms:ir.ui.view,arch_db:petty_invoice.view_account_invoice_filter
|
||||
msgid "Paid by Petty Cash"
|
||||
msgstr "منصرفه من العهد"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import account_move
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
is_petty_paid = fields.Boolean(string='Paid by Petty Cash', default=False)
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_account_invoice_filter" model="ir.ui.view">
|
||||
<field name="name">account.move.paid.petty.inherit.select</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_account_invoice_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='date']" position="after">
|
||||
<field name="is_petty_paid"/>
|
||||
<filter name="is_petty_paid" string="Paid by Petty Cash"
|
||||
domain="[('is_petty_paid', '=',True)]"/>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//group" position="inside">
|
||||
<filter name="group_by_created_by" string="Created By" context="{'group_by':'create_uid'}"/>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_move_form" model="ir.ui.view">
|
||||
<field name="name">account.move.paid.petty.inherit.form</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='invoice_date']" position="after">
|
||||
<field name="is_petty_paid" readonly="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
<field name="show_journal" invisible="1"/>
|
||||
</field>
|
||||
<xpath expr="//notebook" position="inside">
|
||||
<page string="Allowed Journals" attrs="{'invisible': [('show_journal', '=', False)]}">
|
||||
<page string="Allowed Journals" >
|
||||
<group>
|
||||
<field string="Allowed Journals" name="journal_ids" widget="many2many_tags" options="{'no_create': True}"/>
|
||||
</group>
|
||||
|
|
|
|||
Loading…
Reference in New Issue