Browse Source

[ADD] Initial Commit Accounting Kit

pull/195/head
Ajmal Cybro 4 years ago
parent
commit
3aabb47467
  1. 44
      base_account_budget/README.rst
  2. 22
      base_account_budget/__init__.py
  3. 63
      base_account_budget/__manifest__.py
  4. 7
      base_account_budget/doc/RELEASE_NOTES.md
  5. 24
      base_account_budget/models/__init__.py
  6. 28
      base_account_budget/models/account_analytic_account.py
  7. 187
      base_account_budget/models/account_budget.py
  8. 30
      base_account_budget/security/account_budget_security.xml
  9. 7
      base_account_budget/security/ir.model.access.csv
  10. BIN
      base_account_budget/static/description/assets/icons/check.png
  11. BIN
      base_account_budget/static/description/assets/icons/chevron.png
  12. BIN
      base_account_budget/static/description/assets/icons/cogs.png
  13. BIN
      base_account_budget/static/description/assets/icons/consultation.png
  14. BIN
      base_account_budget/static/description/assets/icons/ecom-black.png
  15. BIN
      base_account_budget/static/description/assets/icons/education-black.png
  16. BIN
      base_account_budget/static/description/assets/icons/hotel-black.png
  17. BIN
      base_account_budget/static/description/assets/icons/license.png
  18. BIN
      base_account_budget/static/description/assets/icons/lifebuoy.png
  19. BIN
      base_account_budget/static/description/assets/icons/manufacturing-black.png
  20. BIN
      base_account_budget/static/description/assets/icons/pos-black.png
  21. BIN
      base_account_budget/static/description/assets/icons/puzzle.png
  22. BIN
      base_account_budget/static/description/assets/icons/restaurant-black.png
  23. BIN
      base_account_budget/static/description/assets/icons/service-black.png
  24. BIN
      base_account_budget/static/description/assets/icons/trading-black.png
  25. BIN
      base_account_budget/static/description/assets/icons/training.png
  26. BIN
      base_account_budget/static/description/assets/icons/update.png
  27. BIN
      base_account_budget/static/description/assets/icons/user.png
  28. BIN
      base_account_budget/static/description/assets/icons/wrench.png
  29. BIN
      base_account_budget/static/description/assets/modules/approval_image.png
  30. BIN
      base_account_budget/static/description/assets/modules/dynamic_image.png
  31. BIN
      base_account_budget/static/description/assets/modules/list_view_image.png
  32. BIN
      base_account_budget/static/description/assets/modules/multiple_ref_image.png
  33. BIN
      base_account_budget/static/description/assets/modules/print_image.png
  34. BIN
      base_account_budget/static/description/assets/modules/product_return_image.png
  35. BIN
      base_account_budget/static/description/assets/screenshots/base_account_budget-1.png
  36. BIN
      base_account_budget/static/description/assets/screenshots/base_account_budget-2.png
  37. BIN
      base_account_budget/static/description/assets/screenshots/base_account_budget-3.png
  38. BIN
      base_account_budget/static/description/assets/screenshots/base_account_budget-4.png
  39. BIN
      base_account_budget/static/description/assets/screenshots/hero.png
  40. BIN
      base_account_budget/static/description/banner.png
  41. BIN
      base_account_budget/static/description/cybro_logo.png
  42. BIN
      base_account_budget/static/description/icon.png
  43. 622
      base_account_budget/static/description/index.html
  44. 38
      base_account_budget/views/account_analytic_account_views.xml
  45. 305
      base_account_budget/views/account_budget_views.xml
  46. 46
      base_accounting_kit/README.rst
  47. 25
      base_accounting_kit/__init__.py
  48. 140
      base_accounting_kit/__manifest__.py
  49. 13
      base_accounting_kit/data/account_asset_data.xml
  50. 134
      base_accounting_kit/data/account_financial_report_data.xml
  51. 23
      base_accounting_kit/data/account_pdc_data.xml
  52. 73
      base_accounting_kit/data/cash_flow_data.xml
  53. 12
      base_accounting_kit/data/followup_levels.xml
  54. 8
      base_accounting_kit/data/multiple_invoice_data.xml
  55. 13
      base_accounting_kit/data/recurring_entry_cron.xml
  56. 7
      base_accounting_kit/doc/RELEASE_NOTES.md
  57. 4132
      base_accounting_kit/i18n/ar_001.po
  58. 4132
      base_accounting_kit/i18n/de_CH.po
  59. 4132
      base_accounting_kit/i18n/es_AR.po
  60. 4132
      base_accounting_kit/i18n/fr_BE.po
  61. 4132
      base_accounting_kit/i18n/uk_UA.po
  62. 4130
      base_accounting_kit/i18n/zh_HK.po
  63. 37
      base_accounting_kit/models/__init__.py
  64. 49
      base_accounting_kit/models/account_account.py
  65. 800
      base_accounting_kit/models/account_asset.py
  66. 1622
      base_accounting_kit/models/account_dashboard.py
  67. 51
      base_accounting_kit/models/account_followup.py
  68. 49
      base_accounting_kit/models/account_journal.py
  69. 177
      base_accounting_kit/models/account_move.py
  70. 156
      base_accounting_kit/models/account_payment.py
  71. 148
      base_accounting_kit/models/credit_limit.py
  72. 46
      base_accounting_kit/models/multiple_invoice.py
  73. 151
      base_accounting_kit/models/multiple_invoice_layout.py
  74. 1180
      base_accounting_kit/models/payment_matching.py
  75. 38
      base_accounting_kit/models/product_template.py
  76. 179
      base_accounting_kit/models/recurring_payments.py
  77. 44
      base_accounting_kit/models/res_config_settings.py
  78. 113
      base_accounting_kit/models/res_partner.py
  79. 35
      base_accounting_kit/report/__init__.py
  80. 68
      base_accounting_kit/report/account_asset_report.py
  81. 77
      base_accounting_kit/report/account_asset_report_views.xml
  82. 176
      base_accounting_kit/report/account_bank_book.py
  83. 133
      base_accounting_kit/report/account_bank_book_view.xml
  84. 167
      base_accounting_kit/report/account_cash_book.py
  85. 108
      base_accounting_kit/report/account_cash_book_view.xml
  86. 125
      base_accounting_kit/report/account_day_book.py
  87. 115
      base_accounting_kit/report/account_day_book_view.xml
  88. 38
      base_accounting_kit/report/account_report_common_account.py
  89. 217
      base_accounting_kit/report/cash_flow_report.py
  90. 88
      base_accounting_kit/report/cash_flow_report.xml
  91. 172
      base_accounting_kit/report/general_ledger_report.py
  92. 107
      base_accounting_kit/report/general_ledger_report.xml
  93. 512
      base_accounting_kit/report/multiple_invoice_layouts.xml
  94. 37
      base_accounting_kit/report/multiple_invoice_report.py
  95. 260
      base_accounting_kit/report/multiple_invoice_report.xml
  96. 96
      base_accounting_kit/report/report.xml
  97. 303
      base_accounting_kit/report/report_aged_partner.py
  98. 98
      base_accounting_kit/report/report_aged_partner.xml
  99. 119
      base_accounting_kit/report/report_financial.py
  100. 146
      base_accounting_kit/report/report_financial.xml

44
base_account_budget/README.rst

@ -0,0 +1,44 @@
Odoo 15 Budgets Management
==========================
* Budgets Management system for Odoo 15 Community edition
Installation
============
- www.odoo.com/documentation/15.0/setup/install.html
- Install our custom addon
License
-------
General Public License, Version 3 (LGPL v3).
(https://www.odoo.com/documentation/user/13.0/legal/licenses/licenses.html)
Company
-------
* 'Cybrosys Techno Solutions <https://cybrosys.com/>`__
Credits
-------
* Developer:
(v13) Varsha Vivek @ Cybrosys
(v14) Sachin @ Cybrosys
(v15) Dino @ Cybrosys
Contacts
--------
* Mail Contact : odoo@cybrosys.com
Bug Tracker
-----------
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported.
Maintainer
==========
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com
Further information
===================
HTML Description: `<static/description
/index.html>`__

22
base_account_budget/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import models

63
base_account_budget/__manifest__.py

@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2021-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
{
'name': 'Odoo 15 Budget Management',
'version': '15.0.1.0.0',
'summary': """ Budget Management for Odoo 15 Community Edition. """,
'description': """ This module allows accountants to manage analytic and budgets.
Once the Budgets are defined (in Accounting/Accounting/Budgets), the Project Managers
can set the planned amount on each Analytic Account.
The accountant has the possibility to see the total of amount planned for each
Budget in order to ensure the total planned is not greater/lower than what he
planned for this Budget. Each list of record can also be switched to a graphical
view of it.
Three reports are available:
1. The first is available from a list of Budgets. It gives the spreading, for
these Budgets, of the Analytic Accounts.
2. The second is a summary of the previous one, it only gives the spreading,
for the selected Budgets, of the Analytic Accounts.
3. The last one is available from the Analytic Chart of Accounts. It gives
the spreading, for the selected Analytic Accounts of Budgets.
Odoo 15 Budget Management,Odoo 15, Odoo 15 Budget, Odoo 15 Accounting,
Odoo 15 Account,Budget Management, Budget""",
'category': 'Accounting',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'depends': ['base', 'account'],
'website': 'https://www.cybrosys.com',
'data': [
'security/ir.model.access.csv',
'security/account_budget_security.xml',
'views/account_analytic_account_views.xml',
'views/account_budget_views.xml',
],
'images': ['static/description/banner.png'],
'license': 'LGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

7
base_account_budget/doc/RELEASE_NOTES.md

@ -0,0 +1,7 @@
## Module <kit_account_budget>
#### 06.10.2021
#### Version 15.0.1.0.0
#### ADD
- Initial commit for base_account_budget

24
base_account_budget/models/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import account_budget
from . import account_analytic_account

28
base_account_budget/models/account_analytic_account.py

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import fields, models
class AccountAnalyticAccount(models.Model):
_inherit = "account.analytic.account"
budget_line = fields.One2many('budget.lines', 'analytic_account_id', 'Budget Lines')

187
base_account_budget/models/account_budget.py

@ -0,0 +1,187 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class AccountBudgetPost(models.Model):
_name = "account.budget.post"
_order = "name"
_description = "Budgetary Position"
name = fields.Char('Name', required=True)
account_ids = fields.Many2many('account.account', 'account_budget_rel', 'budget_id', 'account_id', 'Accounts',
domain=[('deprecated', '=', False)])
budget_line = fields.One2many('budget.lines', 'general_budget_id', 'Budget Lines')
company_id = fields.Many2one('res.company', 'Company', required=True,
default=lambda self: self.env['res.company']._company_default_get(
'account.budget.post'))
def _check_account_ids(self, vals):
if 'account_ids' in vals:
account_ids = vals['account_ids']
else:
account_ids = self.account_ids
if not account_ids:
raise ValidationError(_('The budget must have at least one account.'))
@api.model
def create(self, vals):
self._check_account_ids(vals)
return super(AccountBudgetPost, self).create(vals)
def write(self, vals):
self._check_account_ids(vals)
return super(AccountBudgetPost, self).write(vals)
class Budget(models.Model):
_name = "budget.budget"
_description = "Budget"
_inherit = ['mail.thread']
name = fields.Char('Budget Name', required=True, states={'done': [('readonly', True)]})
creating_user_id = fields.Many2one('res.users', 'Responsible', default=lambda self: self.env.user)
date_from = fields.Date('Start Date', required=True, states={'done': [('readonly', True)]})
date_to = fields.Date('End Date', required=True, states={'done': [('readonly', True)]})
state = fields.Selection([
('draft', 'Draft'),
('cancel', 'Cancelled'),
('confirm', 'Confirmed'),
('validate', 'Validated'),
('done', 'Done')
], 'Status', default='draft', index=True, required=True, readonly=True, copy=False, track_visibility='always')
budget_line = fields.One2many('budget.lines', 'budget_id', 'Budget Lines',
states={'done': [('readonly', True)]}, copy=True)
company_id = fields.Many2one('res.company', 'Company', required=True,
default=lambda self: self.env['res.company']._company_default_get(
'account.budget.post'))
def action_budget_confirm(self):
self.write({'state': 'confirm'})
def action_budget_draft(self):
self.write({'state': 'draft'})
def action_budget_validate(self):
self.write({'state': 'validate'})
def action_budget_cancel(self):
self.write({'state': 'cancel'})
def action_budget_done(self):
self.write({'state': 'done'})
class BudgetLines(models.Model):
_name = "budget.lines"
_rec_name = "budget_id"
_description = "Budget Line"
budget_id = fields.Many2one('budget.budget', 'Budget', ondelete='cascade', index=True, required=True)
analytic_account_id = fields.Many2one('account.analytic.account', 'Analytic Account')
general_budget_id = fields.Many2one('account.budget.post', 'Budgetary Position', required=True)
date_from = fields.Date('Start Date', required=True)
date_to = fields.Date('End Date', required=True)
paid_date = fields.Date('Paid Date')
planned_amount = fields.Float('Planned Amount', required=True, digits=0)
practical_amount = fields.Float(compute='_compute_practical_amount', string='Practical Amount', digits=0)
theoretical_amount = fields.Float(compute='_compute_theoretical_amount', string='Theoretical Amount', digits=0)
percentage = fields.Float(compute='_compute_percentage', string='Achievement')
company_id = fields.Many2one(related='budget_id.company_id', comodel_name='res.company',
string='Company', store=True, readonly=True)
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:
self.env.cr.execute("""
SELECT SUM(amount)
FROM account_analytic_line
WHERE account_id=%s
AND date between %s AND %s
AND general_account_id=ANY(%s)""",
(line.analytic_account_id.id, date_from, date_to, acc_ids,))
result = self.env.cr.fetchone()[0] or 0.0
line.practical_amount = result
def _compute_theoretical_amount(self):
today = fields.Datetime.now()
for line in self:
# Used for the report
if self.env.context.get('wizard_date_from') and self.env.context.get('wizard_date_to'):
date_from = fields.Datetime.from_string(self.env.context.get('wizard_date_from'))
date_to = fields.Datetime.from_string(self.env.context.get('wizard_date_to'))
if date_from < fields.Datetime.from_string(line.date_from):
date_from = fields.Datetime.from_string(line.date_from)
elif date_from > fields.Datetime.from_string(line.date_to):
date_from = False
if date_to > fields.Datetime.from_string(line.date_to):
date_to = fields.Datetime.from_string(line.date_to)
elif date_to < fields.Datetime.from_string(line.date_from):
date_to = False
theo_amt = 0.00
if date_from and date_to:
line_timedelta = fields.Datetime.from_string(line.date_to) - fields.Datetime.from_string(
line.date_from)
elapsed_timedelta = date_to - date_from
if elapsed_timedelta.days > 0:
theo_amt = (
elapsed_timedelta.total_seconds() / line_timedelta.total_seconds()) * line.planned_amount
else:
if line.paid_date:
if fields.Datetime.from_string(line.date_to) <= fields.Datetime.from_string(line.paid_date):
theo_amt = 0.00
else:
theo_amt = line.planned_amount
else:
line_timedelta = fields.Datetime.from_string(line.date_to) - fields.Datetime.from_string(
line.date_from)
elapsed_timedelta = fields.Datetime.from_string(today) - (
fields.Datetime.from_string(line.date_from))
if elapsed_timedelta.days < 0:
# If the budget line has not started yet, theoretical amount should be zero
theo_amt = 0.00
elif line_timedelta.days > 0 and fields.Datetime.from_string(today) < fields.Datetime.from_string(
line.date_to):
# If today is between the budget line date_from and date_to
theo_amt = (
elapsed_timedelta.total_seconds() / line_timedelta.total_seconds()) * line.planned_amount
else:
theo_amt = line.planned_amount
line.theoretical_amount = theo_amt
def _compute_percentage(self):
for line in self:
if line.theoretical_amount != 0.00:
line.percentage = float((line.practical_amount or 0.0) / line.theoretical_amount) * 100
else:
line.percentage = 0.00

30
base_account_budget/security/account_budget_security.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="budget_post_comp_rule" model="ir.rule">
<field name="name">Budget post multi-company</field>
<field name="model_id" ref="model_account_budget_post"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="budget_comp_rule" model="ir.rule">
<field name="name">Budget multi-company</field>
<field name="model_id" ref="model_budget_budget"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="budget_lines_comp_rule" model="ir.rule">
<field name="name">Budget lines multi-company</field>
<field name="model_id" ref="model_budget_lines"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record model="res.users" id="base.user_root">
<field eval="[(4,ref('analytic.group_analytic_accounting'))]" name="groups_id"/>
</record>
</data>
</odoo>

7
base_account_budget/security/ir.model.access.csv

@ -0,0 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_budget_budget,budget.budget,model_budget_budget,account.group_account_manager,1,1,1,1
access_account_budget_post,account.budget.post,model_account_budget_post,account.group_account_manager,1,1,1,1
access_account_budget_post_accountant,account.budget.post accountant,model_account_budget_post,account.group_account_user,1,1,1,1
access_budget_budget_accountant,budget.budget accountant,model_budget_budget,account.group_account_user,1,1,1,1
access_budget_lines_accountant,budget.lines accountant,model_budget_lines,account.group_account_user,1,1,1,1
access_budget,budget.lines manager,model_budget_lines,base.group_user,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_budget_budget budget.budget model_budget_budget account.group_account_manager 1 1 1 1
3 access_account_budget_post account.budget.post model_account_budget_post account.group_account_manager 1 1 1 1
4 access_account_budget_post_accountant account.budget.post accountant model_account_budget_post account.group_account_user 1 1 1 1
5 access_budget_budget_accountant budget.budget accountant model_budget_budget account.group_account_user 1 1 1 1
6 access_budget_lines_accountant budget.lines accountant model_budget_lines account.group_account_user 1 1 1 1
7 access_budget budget.lines manager model_budget_lines base.group_user 1 1 1 0

BIN
base_account_budget/static/description/assets/icons/check.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
base_account_budget/static/description/assets/icons/chevron.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

BIN
base_account_budget/static/description/assets/icons/cogs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
base_account_budget/static/description/assets/icons/consultation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
base_account_budget/static/description/assets/icons/ecom-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

BIN
base_account_budget/static/description/assets/icons/education-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
base_account_budget/static/description/assets/icons/hotel-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

BIN
base_account_budget/static/description/assets/icons/license.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
base_account_budget/static/description/assets/icons/lifebuoy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
base_account_budget/static/description/assets/icons/manufacturing-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

BIN
base_account_budget/static/description/assets/icons/pos-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

BIN
base_account_budget/static/description/assets/icons/puzzle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

BIN
base_account_budget/static/description/assets/icons/restaurant-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

BIN
base_account_budget/static/description/assets/icons/service-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

BIN
base_account_budget/static/description/assets/icons/trading-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
base_account_budget/static/description/assets/icons/training.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

BIN
base_account_budget/static/description/assets/icons/update.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
base_account_budget/static/description/assets/icons/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

BIN
base_account_budget/static/description/assets/icons/wrench.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
base_account_budget/static/description/assets/modules/approval_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
base_account_budget/static/description/assets/modules/dynamic_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
base_account_budget/static/description/assets/modules/list_view_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
base_account_budget/static/description/assets/modules/multiple_ref_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
base_account_budget/static/description/assets/modules/print_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
base_account_budget/static/description/assets/modules/product_return_image.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
base_account_budget/static/description/assets/screenshots/base_account_budget-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
base_account_budget/static/description/assets/screenshots/base_account_budget-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
base_account_budget/static/description/assets/screenshots/base_account_budget-3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
base_account_budget/static/description/assets/screenshots/base_account_budget-4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
base_account_budget/static/description/assets/screenshots/hero.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

BIN
base_account_budget/static/description/banner.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
base_account_budget/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
base_account_budget/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

622
base_account_budget/static/description/index.html

@ -0,0 +1,622 @@
<div class="container" style="padding: 4rem 1.5rem !important">
<div class="row" style="height: 900px !important;">
<div class="col-sm-12 col-md-12 col-lg-12"
style="padding: 4rem 1rem !important; background-color: #714B67 !important; height: 600px !important; border-radius: 20px !important;">
<h1
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #FFFFFF !important; font-size: 3.5rem !important; text-align: center !important;">
Odoo 15 Budget Management</h1>
<p
style="font-family: 'Montserrat', sans-serif !important; font-weight: 300 !important; color: #FFFFFF !important; font-size: 1.4rem !important; text-align: center !important;">
Budget Management in Odoo 15 Community Edition
</p>
<img src="./assets/screenshots/hero.png" class="img-responsive" width="100%" height="auto" />
</div>
</div>
<div class="row">
<div class="col-md-12" style="border-bottom: 1px solid #d5d5d5 !important; margin-bottom: 2rem !important">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.5rem !important;">
<i class="fa fa-compass mr-2"></i>Explore this module
</h2>
</div>
<div class="col-md-6">
<a href="#overview" style="text-decoration: none !important;">
<div class="row"
style="background-color: #f5f2f5 !important; border-radius: 10px !important; margin: 1rem !important; padding: 1.5em !important; height: 100px !important;">
<div class="col-8">
<h3
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.2rem !important;">
Overview</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #714B67 !important; font-size: 0.9rem !important;">
Learn more about this module</p>
</div>
<div class="col-4 text-right d-flex justify-content-end align-items-center">
<i class="fa fa-chevron-right" style="color: #714B67 !important;"></i>
</div>
</div>
</a>
</div>
<div class="col-md-6">
<a href="#features" style="text-decoration: none !important;">
<div class="row"
style="background-color: #f5f2f5 !important; border-radius: 10px !important; margin: 1rem !important; padding: 1.5em !important; height: 100px !important;">
<div class="col-8">
<h3
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.2rem !important;">
Features</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #714B67 !important; font-size: 0.9rem !important;">
View features of this module</p>
</div>
<div class="col-4 text-right d-flex justify-content-end align-items-center">
<i class="fa fa-chevron-right" style="color: #714B67 !important;"></i>
</div>
</div>
</a>
</div>
<div class="col-md-6">
<a href="#screenshots" style="text-decoration: none !important;">
<div class="row"
style="background-color: #f5f2f5 !important; border-radius: 10px !important; margin: 1rem !important; padding: 1.5em !important; height: 100px !important;">
<div class="col-8">
<h3
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.2rem !important;">
Screenshots</h3>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #714B67 !important; font-size: 0.9rem !important;">
See key screenshots of this module</p>
</div>
<div class="col-4 text-right d-flex justify-content-end align-items-center">
<i class="fa fa-chevron-right" style="color: #714B67 !important;"></i>
</div>
</div>
</a>
</div>
</div>
<div class="row" id="overview">
<div class="col-md-12" style="border-bottom: 1px solid #d5d5d5 !important; margin: 2rem 0 !important">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.5rem !important;">
<i class="fa fa-pie-chart mr-2"></i>Overview
</h2>
</div>
<div class="col-mg-12 pl-3">
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important; line-height: 30px !important;">
This module allows accountants to manage analytics and budgets. Once the budget is defined (in
Accounting/Accounting/Budgets), the Project Managers can set the planned amount on each Analytic
Account. The accountant got the possibility to see the total of amount planned for each budget in
order to ensure the total planned is not greater/lower than what he planned for this budget. Each
list of record can also be switched to a graphical view of it.
</p>
</div>
</div>
<div class="row" id="features">
<div class="col-md-12" style="border-bottom: 1px solid #d5d5d5 !important; margin: 2rem 0 !important">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.5rem !important;">
<i class="fa fa-star mr-2"></i>Features
</h2>
</div>
<div class="col-md-6 pl-3 py-3 d-flex">
<div>
<img src="assets/icons/check.png">
</div>
<div>
<h4
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Odoo 15 Community Edition Support</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Budget management system in Odoo 15 Community Edition.</p>
</div>
</div>
<div class="col-md-6 pl-3 py-3 d-flex">
<div>
<img src="assets/icons/check.png">
</div>
<div>
<h4
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Budgetary Positions</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Create and manage Budgetary Positions.</p>
</div>
</div>
<div class="col-md-6 pl-3 py-3 d-flex">
<div>
<img src="assets/icons/check.png">
</div>
<div>
<h4
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Manage with Analytic Accounts</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Manage budgets with analytic accounts.</p>
</div>
</div>
<div class="col-md-6 pl-3 py-3 d-flex">
<div>
<img src="assets/icons/check.png">
</div>
<div>
<h4
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Budgetary Planning with Planned Amount</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Budgetary planning with planned amount on each Analytic Account.</p>
</div>
</div>
<div class="col-md-6 pl-3 py-3 d-flex">
<div>
<img src="assets/icons/check.png">
</div>
<div>
<h4
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Budgetary Reports</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Budgetary reports are also available.</p>
</div>
</div>
</div>
<div class="row" id="screenshots">
<div class="col-md-12" style="border-bottom: 1px solid #d5d5d5 !important; margin: 2rem 0 !important">
<h2
style="font-family: 'Montserrat', sans-serif !important; font-weight: 600 !important; color: #714B67 !important; font-size: 1.5rem !important;">
<i class="fa fa-image mr-2"></i>Screenshots
</h2>
</div>
<div class="col-lg-12 my-2">
<h4 class="mt-2"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Creating Budget</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Create Budget from Accounting > Accounting > Budget > Create.</p>
<img src="assets/screenshots/base_account_budget-1.png" class="img-responsive img-thumbnail border"
width="100%" height="auto" />
</div>
<div class="col-lg-12 my-2">
<h4 class="mt-2"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Set Analytic Account by Project Managers</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
The Project Managers can set the planned amount on each Analytic Account.</p>
<img src="assets/screenshots/base_account_budget-4.png" class="img-responsive img-thumbnail border"
width="100%" height="auto" />
</div>
<div class="col-lg-12 my-2">
<h4 class="mt-2"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Create Budgetary Positions</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
Create Budgetary Positions from Accounting > Configuration > Management > Budgetary Positions >
Create.</p>
<img src="assets/screenshots/base_account_budget-2.png" class="img-responsive img-thumbnail border"
width="100%" height="auto" />
</div>
<div class="col-lg-12 my-2">
<h4 class="mt-2"
style="font-family: 'Roboto', sans-serif !important; font-weight: 600 !important; color: #282F33 !important; font-size: 1.3rem !important;">
Budget report</h4>
<p
style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;">
For Budget report, go to Accounting > Reporting > Management > Budgets.</p>
<img src="assets/screenshots/base_account_budget-3.png" class="img-responsive img-thumbnail border"
width="100%" height="auto" />
</div>
</div>
<!-- SUGGESTED PRODUCTS -->
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center"
style="text-align: center; padding: 2.5rem 1rem !important;">
<h2 style="color: #212529 !important;">Suggested Products</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 80px !important; margin-bottom: 2rem !important;" />
<div id="demo1" class="row carousel slide" data-ride="carousel">
<!-- The slideshow -->
<div class="carousel-inner">
<div class="carousel-item active" style="min-height:0px">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/dynamic_accounts_report/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/dynamic_image.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/product_return_pos/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/product_return_image.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/product_approval_management/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/approval_image.png">
</div>
</a>
</div>
</div>
<div class="carousel-item" style="min-height:0px">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/mrp_work_order_print/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/print_image.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/list_view_sticky_header/" target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/list_view_image.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float:left">
<a href="https://apps.odoo.com/apps/modules/14.0/multiple_reference_per_product/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-top-left-radius:10px; border-top-right-radius:10px"
src="./assets/modules/multiple_ref_image.png">
</div>
</a>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo1" data-slide="prev"
style="left:-25px;width: 35px;color: #000;"> <span class="carousel-control-prev-icon"><i
class="fa fa-chevron-left" style="font-size:24px"></i></span> </a> <a
class="carousel-control-next" href="#demo1" data-slide="next"
style="right:-25px;width: 35px;color: #000;">
<span class="carousel-control-next-icon"><i class="fa fa-chevron-right"
style="font-size:24px"></i></span>
</a>
</div>
</div>
</div>
<!-- END OF SUGGESTED PRODUCTS -->
<!-- OUR SERVICES -->
<section class="container" style="margin-top: 6rem !important;">
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center">
<h2 style="color: #212529 !important;">Our Services</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 80px !important; margin-bottom: 2rem !important;" />
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #1dd1a1 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/cogs.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Customization</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ff6b6b !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/wrench.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6462CD !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/lifebuoy.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Support</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ffa801 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/user.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Hire
Odoo
Developer</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/puzzle.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Integration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6d7680 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/update.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Migration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #786fa6 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/consultation.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Consultancy</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/training.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #e6be26 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/license.png" class="img-responsive" height="48px" width="48px">
</div>
<h6 class="text-center" style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Licensing Consultancy</h6>
</div>
</div>
</section>
<!-- END OF END OF OUR SERVICES -->
<!-- OUR INDUSTRIES -->
<section class="container" style="margin-top: 6rem !important;">
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center">
<h2 style="color: #212529 !important;">Our Industries</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 80px !important; margin-bottom: 2rem !important;" />
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/trading-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Trading
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easily procure
and
sell your products</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/pos-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
POS
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easy
configuration
and convivial experience</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/education-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Education
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
A platform for
educational management</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/manufacturing-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Manufacturing
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Plan, track and
schedule your operations</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/ecom-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
E-commerce &amp; Website
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Mobile
friendly,
awe-inspiring product pages</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/service-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Service Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Keep track of
services and invoice</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/restaurant-black.png" class="img-responsive mb-3" height="48px"
width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Restaurant
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Run your bar or
restaurant methodically</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 10px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/hotel-black.png" class="img-responsive mb-3" height="48px" width="48px">
<h5
style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Hotel Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
An
all-inclusive
hotel management application</p>
</div>
</div>
</div>
</section>
<!-- END OF END OF OUR INDUSTRIES -->
<!-- FOOTER -->
<!-- Footer Section -->
<section class="container" style="margin: 5rem auto 2rem;">
<div class="row" style="max-width:1540px;">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center">
<h2 style="color: #212529 !important;">Need Help?</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 80px !important; margin-bottom: 2rem !important;" />
</div>
</div>
<!-- Contact Cards -->
<div class="row d-flex justify-content-center align-items-center"
style="max-width:1540px; margin: 0 auto 2rem auto;">
<div class="col-lg-12" style="padding: 0rem 3rem 2rem; border-radius: 10px; margin-right: 3rem; ">
<div class="row mt-4">
<div class="col-lg-4">
<a href="mailto:odoo@cybrosys.com" target="_blank" class="btn btn-block mb-2 deep_hover"
style="text-decoration: none; background-color: #4d4d4d; color: #FFF; border-radius: 4px;"><i
class="fa fa-envelope mr-2"></i>odoo@cybrosys.com</a>
</div>
<div class="col-lg-4">
<a href="https://api.whatsapp.com/send?phone=918606827707" target="_blank"
class="btn btn-block mb-2 deep_hover"
style="text-decoration: none; background-color: #25D366; color: #FFF; border-radius: 4px;"><i
class="fa fa-whatsapp mr-2"></i>WhatsApp</a>
</div>
<div class="col-lg-4">
<a href="mailto:info@cybrosys.com" target="_blank" class="btn btn-block deep_hover"
style="text-decoration: none; background-color: #4d4d4d; color: #FFF; border-radius: 4px;"><i
class="fa fa-envelope mr-2"></i>info@cybrosys.com</a>
</div>
</div>
</div>
</div>
<!-- End of Contact Cards -->
</section>
<!-- Footer -->
<section class="oe_container" style="padding: 2rem 3rem 1rem;">
<div class="row" style="max-width:1540px; margin: 0 auto; margin-right: 3rem; ">
<!-- Logo -->
<div class="col-lg-12 d-flex justify-content-center align-items-center" style="margin-top: 3rem;">
<img src="https://www.cybrosys.com/images/logo.png" width="200px" height="auto" />
</div>
<!-- End of Logo -->
<div class="col-lg-12">
<hr
style="margin-top: 3rem;background: linear-gradient(90deg, rgba(2,0,36,0) 0%, rgba(229,229,229,1) 33%, rgba(229,229,229,1) 58%, rgba(0,212,255,0) 100%); height: 2px; border-style: none;">
<!-- End of Footer Section -->
</div>
</div>
</section>
<!-- END OF FOOTER -->
</div>

38
base_account_budget/views/account_analytic_account_views.xml

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="view_account_analytic_account_form_inherit_budget">
<field name="name">account.analytic.account.form.inherit.budget</field>
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field name="priority" eval="50"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='main']" position='after'>
<notebook groups="account.group_account_user">
<page string="Budget Items">
<field name="budget_line" widget="one2many_list" colspan="4" nolabel="1" mode="tree">
<tree string="Budget Items" editable="top">
<field name="budget_id"/>
<field name="general_budget_id"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="paid_date"/>
<field name="planned_amount" widget="monetary"/>
<field name="practical_amount" sum="Practical Amount" widget="monetary"/>
<field name="theoretical_amount" sum="Theoretical Amount" widget="monetary"/>
<field name="percentage"/>
</tree>
<form string="Budget Items">
<field name="budget_id"/>
<field name="general_budget_id"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="paid_date"/>
<field name="planned_amount" widget="monetary"/>
</form>
</field>
</page>
</notebook>
</xpath>
</field>
</record>
</odoo>

305
base_account_budget/views/account_budget_views.xml

@ -0,0 +1,305 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_budget_post_search" model="ir.ui.view">
<field name="name">account.budget.post.search</field>
<field name="model">account.budget.post</field>
<field name="arch" type="xml">
<search string="Budgetary Position">
<field name="name" filter_domain="[('name','ilike',self)]" string="Budgetary Position"/>
<field name="company_id" groups="base.group_multi_company"/>
</search>
</field>
</record>
<record id="view_budget_post_tree" model="ir.ui.view">
<field name="name">account.budget.post.tree</field>
<field name="model">account.budget.post</field>
<field name="arch" type="xml">
<tree string="Budgetary Position">
<field name="name"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="open_budget_post_form" model="ir.actions.act_window">
<field name="name">Budgetary Positions</field>
<field name="res_model">account.budget.post</field>
<field name="view_mode">tree,kanban,form</field>
<field name="view_id" ref="view_budget_post_tree"/>
<field name="search_view_id" ref="view_budget_post_search"/>
</record>
<menuitem action="open_budget_post_form" id="menu_budget_post_form" parent="account.account_management_menu"
sequence="5"/>
<record model="ir.ui.view" id="view_budget_post_form">
<field name="name">account.budget.post.form</field>
<field name="model">account.budget.post</field>
<field name="arch" type="xml">
<form string="Budgetary Position">
<sheet>
<group col="4">
<field name="name"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
</group>
<notebook>
<page string="Accounts">
<field name="account_ids">
<tree>
<field name="code"/>
<field name="name"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="crossovered_budget_view_form">
<field name="name">budget.view.form</field>
<field name="model">budget.budget</field>
<field name="arch" type="xml">
<form string="Budget">
<header>
<button string="Confirm" name="action_budget_confirm" states="draft" type="object"
class="oe_highlight"/>
<button string="Approve" name="action_budget_validate" states="confirm" type="object"
class="oe_highlight"/>
<button string="Done" name="action_budget_done" states="validate" type="object"
class="oe_highlight"/>
<button string="Reset to Draft" name="action_budget_draft" states="cancel" type="object"/>
<button string="Cancel Budget" name="action_budget_cancel" states="confirm,validate" type="object"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirm"/>
</header>
<sheet string="Budget">
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" attrs="{'readonly':[('state','!=','draft')]}" placeholder="Budget Name"/>
</h1>
</div>
<group>
<group>
<field name="creating_user_id" attrs="{'readonly':[('state','!=','draft')]}"/>
</group>
<group>
<label for="date_from" string="Period"/>
<div>
<field name="date_from" placeholder="From" class="oe_inline"
attrs="{'readonly':[('state','!=','draft')]}"/>
-
<field name="date_to" placeholder="To" class="oe_inline" attrs="{'readonly':[('state','!=','draft')]}"
nolabel="1"/>
</div>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
</group>
</group>
<notebook>
<page string="Budget Lines">
<field name="budget_line"
context="{'default_date_from': date_from,'default_date_to': date_to}" colspan="4"
nolabel="1" attrs="{'readonly':[('state','!=','draft')]}">
<tree string="Budget Lines">
<field name="general_budget_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"
required="1"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="paid_date" groups="base.group_no_one"/>
<field name="planned_amount" sum="Planned Amount" widget="monetary"/>
<field name="practical_amount" sum="Practical Amount" widget="monetary"/>
<field name="theoretical_amount" sum="Theoretical Amount" widget="monetary"/>
<field name="percentage"/>
</tree>
<form string="Budget Lines">
<group>
<group>
<field name="general_budget_id"/>
<field name="planned_amount" widget="monetary"/>
<field name="analytic_account_id"
groups="analytic.group_analytic_accounting" required="1"/>
</group>
<group>
<label for="date_from" string="Period"/>
<div>
<field name="date_from" placeholder="From" class="oe_inline"/>
-
<field name="date_to" placeholder="To" class="oe_inline"/>
</div>
<field name="paid_date" groups="base.group_no_one"/>
<field name="company_id" options="{'no_create': True}"
groups="base.group_multi_company"/>
</group>
</group>
</form>
</field>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record model="ir.ui.view" id="budget_budget_view_tree">
<field name="name">budget.view.tree</field>
<field name="model">budget.budget</field>
<field name="arch" type="xml">
<tree decoration-info="state == 'draft'" decoration-muted="state in ('done','cancel')" string="Budget">
<field name="name" colspan="1"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
<field name="creating_user_id"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="view_budget_kanban" model="ir.ui.view">
<field name="name">budget.kanban</field>
<field name="model">budget.budget</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<field name="name"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="creating_user_id"/>
<field name="state"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_global_click">
<div class="row mb4">
<div class="col-8">
<strong>
<field name="name"/>
</strong>
</div>
<div class="col-4">
<span class="float-right">
<field name="state" widget="label_selection"
options="{'classes': {'draft': 'default', 'done': 'success'}}"/>
</span>
</div>
</div>
<div class="row">
<div class="col-10">
<i class="fa fa-clock-o"/>
<t t-esc="record.date_from.value"/>-
<t t-esc="record.date_to.value"/>
</div>
<div class="col-xs-2">
<span class="float-right">
<img alt="" t-att-src="kanban_image('res.users', 'image_small', record.creating_user_id.raw_value)"
t-att-title="record.creating_user_id.value" width="24" height="24"
class="oe_kanban_avatar float-right"/>
</span>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record model="ir.actions.act_window" id="act_budget_view">
<field name="name">Budgets</field>
<field name="res_model">budget.budget</field>
<field name="view_mode">tree,kanban,form</field>
<field name="view_id" ref="budget_budget_view_tree"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a new budget.
</p>
<p>
A budget is a forecast of your company's income and/or expenses
expected for a period in the future. A budget is defined on some
financial accounts and/or analytic accounts (that may represent
projects, departments, categories of products, etc.)
</p>
<p>
By keeping track of where your money goes, you may be less
likely to overspend, and more likely to meet your financial
goals. Forecast a budget by detailing the expected revenue per
analytic account and monitor its evolution based on the actuals
realised during that period.
</p>
</field>
</record>
<menuitem parent="account.menu_finance_entries_management"
id="menu_act_budget_view"
name="Budgets"
action="act_budget_view" sequence="60"
groups="account.group_account_user"/>
<record id="view_budget_line_search" model="ir.ui.view">
<field name="name">account.budget.line.search</field>
<field name="model">budget.lines</field>
<field name="arch" type="xml">
<search string="Budget Lines">
<field name="analytic_account_id"/>
</search>
</field>
</record>
<record model="ir.ui.view" id="view_budget_line_tree">
<field name="name">budget.line.tree</field>
<field name="model">budget.lines</field>
<field name="arch" type="xml">
<tree string="Budget Lines">
<field name="budget_id" invisible="1"/>
<field name="general_budget_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="paid_date" groups="base.group_no_one"/>
<field name="planned_amount" widget="monetary"/>
<field name="practical_amount" widget="monetary"/>
<field name="theoretical_amount" widget="monetary"/>
<field name="percentage"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_budget_line_form">
<field name="name">budget.line.form</field>
<field name="model">budget.lines</field>
<field name="arch" type="xml">
<form string="Budget Lines">
<sheet>
<group col="4">
<field name="budget_id"/>
<field name="analytic_account_id"/>
<field name="general_budget_id"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="paid_date"/>
<field name="planned_amount" widget="monetary"/>
<field name="practical_amount" widget="monetary"/>
<field name="theoretical_amount" widget="monetary"/>
<field name="percentage"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="act_budget_lines_view">
<field name="name">Budgets</field>
<field name="res_model">budget.lines</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_budget_line_tree"/>
</record>
<menuitem parent="account.account_reports_management_menu"
id="menu_act_crossovered_budget_lines_view"
action="act_budget_lines_view" sequence="20"/>
</odoo>

46
base_accounting_kit/README.rst

@ -0,0 +1,46 @@
Accounting Kit
==============
* Full accounting kit for Odoo 15 community editions
Installation
============
- www.odoo.com/documentation/15.0/setup/install.html
- Install our custom addon
License
-------
General Public License, Version 3 (LGPL v3).
(https://www.odoo.com/documentation/user/13.0/legal/licenses/licenses.html)
Company
-------
* 'Cybrosys Techno Solutions <https://cybrosys.com/>`__
Credits
-------
* Developer:
(v13) Milind Mohan @ Cybrosys
(v13) Mashhood K U @ Cybrosys
(v13) Sreejith @ Cybrosys
(v13) Varsha Vivek @ Cybrosys
(v14) Risha @ Cybrosys
(V15) Mehjabin @ Cybrosys
Contacts
--------
* Mail Contact : odoo@cybrosys.com
Bug Tracker
-----------
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported.
Maintainer
==========
This module is maintained by Cybrosys Technologies.
For support and more information, please visit https://www.cybrosys.com
Further information
===================
HTML Description: `<static/description/index.html>`__

25
base_accounting_kit/__init__.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import models
from . import report
from . import wizard

140
base_accounting_kit/__manifest__.py

@ -0,0 +1,140 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2021-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
{
'name': 'Odoo 15 Full Accounting Kit',
'version': '15.0.1.0.0',
'category': 'Accounting',
'live_test_url': 'https://www.youtube.com/watch?v=peAp2Tx_XIs',
'summary': """ Asset and Budget Management,
Accounting Reports, PDC, Lock dates,
Credit Limit, Follow Ups,
Day-Bank-Cash book reports.""",
'description': """
AccountingKit, Fullaccounting, Odoo accounting, Odooaccounting, all in one accounting,
allinoneaccounting, accounting,
Odoo 15 Accounting,Accounting Reports, Odoo 15 Accounting
PDF Reports, Asset Management, Budget Management,
Customer Credit Limit, Recurring Payment,
PDC Management, Customer Follow-up,
Lock Dates into Odoo 15 Community Edition,
Odoo Accounting,Odoo 15 Accounting Reports,Odoo 15,,
Full Accounting, Complete Accounting,
Odoo Community Accounting, Accounting for odoo 15,
Full Accounting Package,
Financial Reports, Financial Report for Odoo 15,
Reconciliation Widget,
Reconciliation Widget For Odoo15,
Payments Matching
""",
'author': 'Cybrosys Techno Solutions, Odoo SA',
'website': "https://www.cybrosys.com",
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'depends': ['base', 'account', 'sale', 'account_check_printing', 'base_account_budget'],
'data': [
'security/ir.model.access.csv',
'security/security.xml',
'data/account_financial_report_data.xml',
'data/cash_flow_data.xml',
'data/account_pdc_data.xml',
'data/followup_levels.xml',
'data/account_asset_data.xml',
'data/recurring_entry_cron.xml',
'data/multiple_invoice_data.xml',
'views/assets.xml',
'views/dashboard_views.xml',
'views/reports_config_view.xml',
'views/accounting_menu.xml',
'views/account_group.xml',
'views/credit_limit_view.xml',
'views/account_configuration.xml',
'views/account_payment_view.xml',
'views/res_config_view.xml',
'views/recurring_payments_view.xml',
'views/account_followup.xml',
'views/followup_report.xml',
'wizard/asset_depreciation_confirmation_wizard_views.xml',
'wizard/asset_modify_views.xml',
'views/account_asset_views.xml',
'views/account_move_views.xml',
'views/account_asset_templates.xml',
'views/product_template_views.xml',
'views/payment_matching.xml',
'views/multiple_invoice_layout_view.xml',
'views/multiple_invoice_form.xml',
'wizard/financial_report.xml',
'wizard/general_ledger.xml',
'wizard/partner_ledger.xml',
'wizard/tax_report.xml',
'wizard/account_lock_date.xml',
'wizard/trial_balance.xml',
'wizard/aged_partner.xml',
'wizard/journal_audit.xml',
'wizard/cash_flow_report.xml',
'wizard/account_bank_book_wizard_view.xml',
'wizard/account_cash_book_wizard_view.xml',
'wizard/account_day_book_wizard_view.xml',
'report/report_financial.xml',
'report/general_ledger_report.xml',
'report/report_journal_audit.xml',
'report/report_aged_partner.xml',
'report/report_trial_balance.xml',
'report/report_tax.xml',
'report/report_partner_ledger.xml',
'report/cash_flow_report.xml',
'report/account_bank_book_view.xml',
'report/account_cash_book_view.xml',
'report/account_day_book_view.xml',
'report/account_asset_report_views.xml',
'report/report.xml',
'report/multiple_invoice_layouts.xml',
'report/multiple_invoice_report.xml',
],
'assets': {
'web.assets_backend': [
'base_accounting_kit/static/src/scss/style.scss',
'base_accounting_kit/static/src/scss/account_asset.scss',
'base_accounting_kit/static/lib/bootstrap-toggle-master/css/bootstrap-toggle.min.css',
'base_accounting_kit/static/src/js/account_dashboard.js',
'base_accounting_kit/static/src/js/account_asset.js',
'base_accounting_kit/static/src/js/payment_model.js',
'base_accounting_kit/static/src/js/payment_render.js',
'base_accounting_kit/static/src/js/payment_matching.js',
'base_accounting_kit/static/lib/Chart.bundle.js',
'base_accounting_kit/static/lib/Chart.bundle.min.js',
'base_accounting_kit/static/lib/Chart.min.js',
'base_accounting_kit/static/lib/Chart.js',
'base_accounting_kit/static/lib/bootstrap-toggle-master/js/bootstrap-toggle.min.js',
],
'web.assets_qweb': [
'base_accounting_kit/static/src/xml/template.xml',
'base_accounting_kit/static/src/xml/payment_matching.xml',
],
},
'license': 'LGPL-3',
'images': ['static/description/banner.gif'],
'installable': True,
'auto_install': False,
'application': True,
}

13
base_accounting_kit/data/account_asset_data.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding='UTF-8'?>
<odoo>
<record id="account_asset_cron" model="ir.cron">
<field name="name">Account Asset: Generate asset entries</field>
<field name="model_id" ref="model_account_asset_asset"/>
<field name="state">code</field>
<field name="code">model._cron_generate_entries()</field>
<field name="interval_number">1</field>
<field name="interval_type">months</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
</record>
</odoo>

134
base_accounting_kit/data/account_financial_report_data.xml

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Financial Reports -->
<record id="account_financial_report_profitandloss0"
model="account.financial.report">
<field name="name">Profit and Loss</field>
<field name="sign" eval="'-1'"/>
<field name="type">sum</field>
</record>
<record id="account_financial_report_income0"
model="account.financial.report">
<field name="name">Income</field>
<field name="sign" eval="'-1'"/>
<field name="sequence">1</field>
<field name="parent_id"
ref="account_financial_report_profitandloss0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_other_income0"
model="account.financial.report">
<field name="name">Other Income</field>
<field name="sequence">10</field>
<field name="parent_id"
ref="account_financial_report_income0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
<field name="account_type_ids"
eval="[(4,ref('account.data_account_type_other_income'))]"/>
</record>
<record id="financial_report_gross_profit"
model="account.financial.report">
<field name="name">Gross Profit</field>
<field name="parent_id"
ref="account_financial_report_income0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">sum</field>
<field name="sequence">3</field>
</record>
<record id="financial_report_cost_of_revenue"
model="account.financial.report">
<field name="name">Cost of Revenue</field>
<field name="sequence">10</field>
<field name="parent_id"
ref="financial_report_gross_profit"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
<field name="account_type_ids"
eval="[(4,ref('account.data_account_type_direct_costs'))]"/>
</record>
<record id="account_financial_report_operating_income0"
model="account.financial.report">
<field name="name">Operating Income</field>
<field name="sequence">1</field>
<field name="parent_id"
ref="financial_report_gross_profit"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
<field name="account_type_ids"
eval="[(4,ref('account.data_account_type_revenue'))]"/>
</record>
<record id="account_financial_report_expense0"
model="account.financial.report">
<field name="name">Expense</field>
<field name="sign" eval="'-1'"/>
<field name="sequence">2</field>
<field name="parent_id"
ref="account_financial_report_profitandloss0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
<field name="account_type_ids"
eval="[(4,ref('account.data_account_type_expenses')), (4,ref('account.data_account_type_direct_costs')), (4,ref('account.data_account_type_depreciation'))]"/>
</record>
<record id="account_financial_report_balancesheet0"
model="account.financial.report">
<field name="name">Balance Sheet</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_assets0"
model="account.financial.report">
<field name="name">Assets</field>
<field name="parent_id"
ref="account_financial_report_balancesheet0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
<field name="account_type_ids"
eval="[(4,ref('account.data_account_type_receivable')), (4,ref('account.data_account_type_liquidity')), (4,ref('account.data_account_type_current_assets')), (4,ref('account.data_account_type_non_current_assets'), (4,ref('account.data_account_type_prepayments'))), (4,ref('account.data_account_type_fixed_assets'))]"/>
</record>
<record id="account_financial_report_liabilitysum0"
model="account.financial.report">
<field name="name">Liability</field>
<field name="sequence">1</field>
<field name="parent_id"
ref="account_financial_report_balancesheet0"/>
<field name="display_detail">no_detail</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_liability0"
model="account.financial.report">
<field name="name">Liability</field>
<field name="parent_id"
ref="account_financial_report_liabilitysum0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">account_type</field>
<field name="account_type_ids"
eval="[(4,ref('account.data_account_type_payable')), (4,ref('account.data_account_type_equity')), (4,ref('account.data_account_type_current_liabilities')), (4,ref('account.data_account_type_non_current_liabilities'))]"/>
</record>
<record id="account_financial_report_profitloss_toreport0"
model="account.financial.report">
<field name="name">Profit (Loss) to report</field>
<field name="parent_id"
ref="account_financial_report_liabilitysum0"/>
<field name="display_detail">no_detail</field>
<field name="type">account_report</field>
<field name="account_report_id"
ref="account_financial_report_profitandloss0"/>
</record>
</data>
</odoo>

23
base_accounting_kit/data/account_pdc_data.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="account_payment_method_pdc_in" model="account.payment.method">
<field name="name">PDC</field>
<field name="code">pdc</field>
<field name="payment_type">inbound</field>
</record>
<record id="account_payment_method_pdc_out" model="account.payment.method">
<field name="name">PDC</field>
<field name="code">pdc</field>
<field name="payment_type">outbound</field>
</record>
<!-- decimal precision for account -->
<record forcecreate="True" id="decimal_account" model="decimal.precision">
<field name="name">Account</field>
<field name="digits" eval="3"/>
</record>
</data>
</odoo>

73
base_accounting_kit/data/cash_flow_data.xml

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="account_financial_report_cash_flow0" model="account.financial.report">
<field name="name">Cash Flow Statement</field>
<field name="type">sum</field>
</record>
<record id="account_financial_report_operation0" model="account.financial.report">
<field name="name">Operations</field>
<field name="sequence">1</field>
<field name="parent_id" ref="account_financial_report_cash_flow0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">sum</field>
</record>
<record id="cash_in_from_operation0" model="account.financial.report">
<field name="name">Cash In</field>
<field name="sequence">1</field>
<field name="parent_id" ref="account_financial_report_operation0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field>
</record>
<record id="cash_out_operation1" model="account.financial.report">
<field name="name">Cash Out</field>
<field name="sequence">2</field>
<field name="parent_id" ref="account_financial_report_operation0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field>
</record>
<record id="account_financial_report_investing_activity0" model="account.financial.report">
<field name="name">Investing Activities</field>
<field name="sequence">2</field>
<field name="parent_id" ref="account_financial_report_cash_flow0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">sum</field>
</record>
<record id="cash_in_investing0" model="account.financial.report">
<field name="name">Cash In</field>
<field name="parent_id" ref="account_financial_report_investing_activity0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field>
</record>
<record id="cash_out_investing1" model="account.financial.report">
<field name="name">Cash Out</field>
<field name="parent_id" ref="account_financial_report_investing_activity0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field>
</record>
<record id="account_financial_report_financing_activity1" model="account.financial.report">
<field name="name">Financing Activities</field>
<field name="sequence">3</field>
<field name="parent_id" ref="account_financial_report_cash_flow0"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">sum</field>
</record>
<record id="cash_in_financial0" model="account.financial.report">
<field name="name">Cash In</field>
<field name="parent_id" ref="account_financial_report_financing_activity1"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field>
</record>
<record id="cash_out_financial1" model="account.financial.report">
<field name="name">Cash Out</field>
<field name="parent_id" ref="account_financial_report_financing_activity1"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field>
</record>
</data>
</odoo>

12
base_accounting_kit/data/followup_levels.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<record model="followup.line" id="followup_line_id" >
<field name="name">Reminder</field>
<field name="delay">5</field>
</record>
<record model="account.followup" id="followup">
<field name="followup_line_ids" eval="[(6,0,[ref('followup_line_id')])]"/>
</record>
</data>
</odoo>

8
base_accounting_kit/data/multiple_invoice_data.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="multiple_invoice_sample_name" model="multiple.invoice">
<field name="copy_name">Sample Name</field>
</record>
</data>
</odoo>

13
base_accounting_kit/data/recurring_entry_cron.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding='UTF-8'?>
<odoo>
<record id="recurring_template_cron" model="ir.cron">
<field name="name">Generate Recurring Entries</field>
<field name="model_id" ref="model_account_recurring_payments"/>
<field name="state">code</field>
<field name="code">model._cron_generate_entries()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
</record>
</odoo>

7
base_accounting_kit/doc/RELEASE_NOTES.md

@ -0,0 +1,7 @@
## Module <base_accounting_kit>
#### 06.10.2021
#### Version 15.0.1.0.0
#### ADD
- Initial commit for Odoo 15 accounting

4132
base_accounting_kit/i18n/ar_001.po

File diff suppressed because it is too large

4132
base_accounting_kit/i18n/de_CH.po

File diff suppressed because it is too large

4132
base_accounting_kit/i18n/es_AR.po

File diff suppressed because it is too large

4132
base_accounting_kit/i18n/fr_BE.po

File diff suppressed because it is too large

4132
base_accounting_kit/i18n/uk_UA.po

File diff suppressed because it is too large

4130
base_accounting_kit/i18n/zh_HK.po

File diff suppressed because it is too large

37
base_accounting_kit/models/__init__.py

@ -0,0 +1,37 @@
#############################################################################
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import account_account
from . import account_asset
from . import account_followup
from . import account_journal
from . import account_move
from . import account_payment
from . import credit_limit
from . import product_template
from . import recurring_payments
from . import res_config_settings
from . import res_partner
from . import account_dashboard
from . import payment_matching
from . import multiple_invoice
from . import multiple_invoice_layout

49
base_accounting_kit/models/account_account.py

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
import time
from odoo import api, models, fields, _
from odoo.exceptions import UserError
class CashFlow(models.Model):
_inherit = 'account.account'
def get_cash_flow_ids(self):
cash_flow_id = self.env.ref('base_accounting_kit.account_financial_report_cash_flow0')
if cash_flow_id:
return [('parent_id.id', '=', cash_flow_id.id)]
cash_flow_type = fields.Many2one('account.financial.report', string="Cash Flow type", domain=get_cash_flow_ids)
@api.onchange('cash_flow_type')
def onchange_cash_flow_type(self):
for rec in self.cash_flow_type:
# update new record
rec.write({
'account_ids': [(4, self._origin.id)]
})
if self._origin.cash_flow_type.ids:
for rec in self._origin.cash_flow_type:
# remove old record
rec.write({'account_ids': [(3, self._origin.id)]})

800
base_accounting_kit/models/account_asset.py

@ -0,0 +1,800 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
import calendar
from datetime import date, datetime
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, _
from odoo.exceptions import UserError, ValidationError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
from odoo.tools import float_compare, float_is_zero
class AccountAssetCategory(models.Model):
_name = 'account.asset.category'
_description = 'Asset category'
active = fields.Boolean(default=True)
name = fields.Char(required=True, index=True, string="Asset Type")
account_analytic_id = fields.Many2one('account.analytic.account',
string='Analytic Account')
account_asset_id = fields.Many2one('account.account',
string='Asset Account', required=True,
domain=[('internal_type', '=', 'other'),
('deprecated', '=', False)],
help="Account used to record the purchase of the asset at its original price.")
account_depreciation_id = fields.Many2one('account.account',
string='Depreciation Entries: Asset Account',
required=True, domain=[
('internal_type', '=', 'other'), ('deprecated', '=', False)],
help="Account used in the depreciation entries, to decrease the asset value.")
account_depreciation_expense_id = fields.Many2one('account.account',
string='Depreciation Entries: Expense Account',
required=True, domain=[
('internal_type', '=', 'other'), ('deprecated', '=', False)],
help="Account used in the periodical entries, to record a part of the asset as expense.")
journal_id = fields.Many2one('account.journal', string='Journal',
required=True)
company_id = fields.Many2one('res.company', string='Company',
required=True, default=lambda self: self.env.company)
method = fields.Selection(
[('linear', 'Linear'), ('degressive', 'Degressive')],
string='Computation Method', required=True, default='linear',
help="Choose the method to use to compute the amount of depreciation lines.\n"
" * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n"
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor")
method_number = fields.Integer(string='Number of Depreciations', default=5,
help="The number of depreciations needed to depreciate your asset")
method_period = fields.Integer(string='Period Length', default=1,
help="State here the time between 2 depreciations, in months",
required=True)
method_progress_factor = fields.Float('Degressive Factor', default=0.3)
method_time = fields.Selection(
[('number', 'Number of Entries'), ('end', 'Ending Date')],
string='Time Method', required=True, default='number',
help="Choose the method to use to compute the dates and number of entries.\n"
" * Number of Entries: Fix the number of entries and the time between 2 depreciations.\n"
" * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond.")
method_end = fields.Date('Ending date')
prorata = fields.Boolean(string='Prorata Temporis',
help='Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first of January')
open_asset = fields.Boolean(string='Auto-confirm Assets',
help="Check this if you want to automatically confirm the assets of this category when created by invoices.")
group_entries = fields.Boolean(string='Group Journal Entries',
help="Check this if you want to group the generated entries by categories.")
type = fields.Selection([('sale', 'Sale: Revenue Recognition'),
('purchase', 'Purchase: Asset')], required=True,
index=True, default='purchase')
@api.onchange('account_asset_id')
def onchange_account_asset(self):
if self.type == "purchase":
self.account_depreciation_id = self.account_asset_id
elif self.type == "sale":
self.account_depreciation_expense_id = self.account_asset_id
@api.onchange('type')
def onchange_type(self):
if self.type == 'sale':
self.prorata = True
self.method_period = 1
else:
self.method_period = 12
@api.onchange('method_time')
def _onchange_method_time(self):
if self.method_time != 'number':
self.prorata = False
class AccountAssetAsset(models.Model):
_name = 'account.asset.asset'
_description = 'Asset/Revenue Recognition'
_inherit = ['mail.thread']
entry_count = fields.Integer(compute='_entry_count',
string='# Asset Entries')
name = fields.Char(string='Asset Name', required=True, readonly=True,
states={'draft': [('readonly', False)]})
code = fields.Char(string='Reference', size=32, readonly=True,
states={'draft': [('readonly', False)]})
value = fields.Float(string='Gross Value', required=True, readonly=True,
digits=0, states={'draft': [('readonly', False)]})
currency_id = fields.Many2one('res.currency', string='Currency',
required=True, readonly=True,
states={'draft': [('readonly', False)]},
default=lambda
self: self.env.company.currency_id.id)
company_id = fields.Many2one('res.company', string='Company',
required=True, readonly=True,
states={'draft': [('readonly', False)]},
default=lambda self: self.env.company)
note = fields.Text()
category_id = fields.Many2one('account.asset.category', string='Category',
required=True, change_default=True,
readonly=True,
states={'draft': [('readonly', False)]})
date = fields.Date(string='Date', required=True, readonly=True,
states={'draft': [('readonly', False)]},
default=fields.Date.context_today)
state = fields.Selection(
[('draft', 'Draft'), ('open', 'Running'), ('close', 'Close')],
'Status', required=True, copy=False, default='draft',
help="When an asset is created, the status is 'Draft'.\n"
"If the asset is confirmed, the status goes in 'Running' and the depreciation lines can be posted in the accounting.\n"
"You can manually close an asset when the depreciation is over. If the last line of depreciation is posted, the asset automatically goes in that status.")
active = fields.Boolean(default=True)
partner_id = fields.Many2one('res.partner', string='Partner',
readonly=True,
states={'draft': [('readonly', False)]}, )
method = fields.Selection(
[('linear', 'Linear'), ('degressive', 'Degressive')],
string='Computation Method', required=True, readonly=True,
states={'draft': [('readonly', False)]}, default='linear',
help="Choose the method to use to compute the amount of depreciation lines.\n * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n"
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor")
method_number = fields.Integer(string='Number of Depreciations',
readonly=True,
states={'draft': [('readonly', False)]},
default=5,
help="The number of depreciations needed to depreciate your asset")
method_period = fields.Integer(string='Number of Months in a Period',
required=True, readonly=True, default=12,
states={'draft': [('readonly', False)]},
help="The amount of time between two depreciations, in months")
method_end = fields.Date(string='Ending Date', readonly=True,
states={'draft': [('readonly', False)]})
method_progress_factor = fields.Float(string='Degressive Factor',
readonly=True, default=0.3, states={
'draft': [('readonly', False)]})
value_residual = fields.Float(compute='_amount_residual',
digits=0, string='Residual Value')
method_time = fields.Selection(
[('number', 'Number of Entries'), ('end', 'Ending Date')],
string='Time Method', required=True, readonly=True, default='number',
states={'draft': [('readonly', False)]},
help="Choose the method to use to compute the dates and number of entries.\n"
" * Number of Entries: Fix the number of entries and the time between 2 depreciations.\n"
" * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond.")
prorata = fields.Boolean(string='Prorata Temporis', readonly=True,
states={'draft': [('readonly', False)]},
help='Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first January / Start date of fiscal year')
depreciation_line_ids = fields.One2many('account.asset.depreciation.line',
'asset_id',
string='Depreciation Lines',
readonly=True, states={
'draft': [('readonly', False)], 'open': [('readonly', False)]})
salvage_value = fields.Float(string='Salvage Value', digits=0,
readonly=True,
states={'draft': [('readonly', False)]},
help="It is the amount you plan to have that you cannot depreciate.")
invoice_id = fields.Many2one('account.move', string='Invoice',
states={'draft': [('readonly', False)]},
copy=False)
type = fields.Selection(related="category_id.type", string='Type',
required=True)
def unlink(self):
for asset in self:
if asset.state in ['open', 'close']:
raise UserError(
_('You cannot delete a document is in %s state.') % (
asset.state,))
for depreciation_line in asset.depreciation_line_ids:
if depreciation_line.move_id:
raise UserError(_(
'You cannot delete a document that contains posted entries.'))
return super(AccountAssetAsset, self).unlink()
def _get_last_depreciation_date(self):
"""
@param id: ids of a account.asset.asset objects
@return: Returns a dictionary of the effective dates of the last depreciation entry made for given asset ids. If there isn't any, return the purchase date of this asset
"""
self.env.cr.execute("""
SELECT a.id as id, COALESCE(MAX(m.date),a.date) AS date
FROM account_asset_asset a
LEFT JOIN account_asset_depreciation_line rel ON (rel.asset_id = a.id)
LEFT JOIN account_move m ON (rel.move_id = m.id)
WHERE a.id IN %s
GROUP BY a.id, m.date """, (tuple(self.ids),))
result = dict(self.env.cr.fetchall())
return result
@api.model
def _cron_generate_entries(self):
self.compute_generated_entries(datetime.today())
@api.model
def compute_generated_entries(self, date, asset_type=None):
# Entries generated : one by grouped category and one by asset from ungrouped category
created_move_ids = []
type_domain = []
if asset_type:
type_domain = [('type', '=', asset_type)]
ungrouped_assets = self.env['account.asset.asset'].search(
type_domain + [('state', '=', 'open'),
('category_id.group_entries', '=', False)])
created_move_ids += ungrouped_assets._compute_entries(date,
group_entries=False)
for grouped_category in self.env['account.asset.category'].search(
type_domain + [('group_entries', '=', True)]):
assets = self.env['account.asset.asset'].search(
[('state', '=', 'open'),
('category_id', '=', grouped_category.id)])
created_move_ids += assets._compute_entries(date,
group_entries=True)
return created_move_ids
def _compute_board_amount(self, sequence, residual_amount, amount_to_depr,
undone_dotation_number,
posted_depreciation_line_ids, total_days,
depreciation_date):
amount = 0
if sequence == undone_dotation_number:
amount = residual_amount
else:
if self.method == 'linear':
amount = amount_to_depr / (undone_dotation_number - len(
posted_depreciation_line_ids))
if self.prorata:
amount = amount_to_depr / self.method_number
if sequence == 1:
if self.method_period % 12 != 0:
date = datetime.strptime(str(self.date), '%Y-%m-%d')
month_days = \
calendar.monthrange(date.year, date.month)[1]
days = month_days - date.day + 1
amount = (
amount_to_depr / self.method_number) / month_days * days
else:
days = (self.company_id.compute_fiscalyear_dates(
depreciation_date)[
'date_to'] - depreciation_date).days + 1
amount = (
amount_to_depr / self.method_number) / total_days * days
elif self.method == 'degressive':
amount = residual_amount * self.method_progress_factor
if self.prorata:
if sequence == 1:
if self.method_period % 12 != 0:
date = datetime.strptime(str(self.date), '%Y-%m-%d')
month_days = \
calendar.monthrange(date.year, date.month)[1]
days = month_days - date.day + 1
amount = (
residual_amount * self.method_progress_factor) / month_days * days
else:
days = (self.company_id.compute_fiscalyear_dates(
depreciation_date)[
'date_to'] - depreciation_date).days + 1
amount = (
residual_amount * self.method_progress_factor) / total_days * days
return amount
def _compute_board_undone_dotation_nb(self, depreciation_date, total_days):
undone_dotation_number = self.method_number
if self.method_time == 'end':
end_date = datetime.strptime(str(self.method_end), DF).date()
undone_dotation_number = 0
while depreciation_date <= end_date:
depreciation_date = date(depreciation_date.year,
depreciation_date.month,
depreciation_date.day) + relativedelta(
months=+self.method_period)
undone_dotation_number += 1
if self.prorata:
undone_dotation_number += 1
return undone_dotation_number
def compute_depreciation_board(self):
self.ensure_one()
posted_depreciation_line_ids = self.depreciation_line_ids.filtered(
lambda x: x.move_check).sorted(key=lambda l: l.depreciation_date)
unposted_depreciation_line_ids = self.depreciation_line_ids.filtered(
lambda x: not x.move_check)
# Remove old unposted depreciation lines. We cannot use unlink() with One2many field
commands = [(2, line_id.id, False) for line_id in
unposted_depreciation_line_ids]
if self.value_residual != 0.0:
amount_to_depr = residual_amount = self.value_residual
if self.prorata:
# if we already have some previous validated entries, starting date is last entry + method perio
if posted_depreciation_line_ids and \
posted_depreciation_line_ids[-1].depreciation_date:
last_depreciation_date = datetime.strptime(
posted_depreciation_line_ids[-1].depreciation_date,
DF).date()
depreciation_date = last_depreciation_date + relativedelta(
months=+self.method_period)
else:
depreciation_date = datetime.strptime(
str(self._get_last_depreciation_date()[self.id]),
DF).date()
else:
# depreciation_date = 1st of January of purchase year if annual valuation, 1st of
# purchase month in other cases
if self.method_period >= 12:
if self.company_id.fiscalyear_last_month:
asset_date = date(year=int(self.date.year),
month=int(
self.company_id.fiscalyear_last_month),
day=int(
self.company_id.fiscalyear_last_day)) + relativedelta(
days=1) + \
relativedelta(year=int(
self.date.year)) # e.g. 2018-12-31 +1 -> 2019
else:
asset_date = datetime.strptime(
str(self.date)[:4] + '-01-01', DF).date()
else:
asset_date = datetime.strptime(str(self.date)[:7] + '-01',
DF).date()
# if we already have some previous validated entries, starting date isn't 1st January but last entry + method period
if posted_depreciation_line_ids and \
posted_depreciation_line_ids[-1].depreciation_date:
last_depreciation_date = datetime.strptime(str(
posted_depreciation_line_ids[-1].depreciation_date),
DF).date()
depreciation_date = last_depreciation_date + relativedelta(
months=+self.method_period)
else:
depreciation_date = asset_date
day = depreciation_date.day
month = depreciation_date.month
year = depreciation_date.year
total_days = (year % 4) and 365 or 366
undone_dotation_number = self._compute_board_undone_dotation_nb(
depreciation_date, total_days)
for x in range(len(posted_depreciation_line_ids),
undone_dotation_number):
sequence = x + 1
amount = self._compute_board_amount(sequence, residual_amount,
amount_to_depr,
undone_dotation_number,
posted_depreciation_line_ids,
total_days,
depreciation_date)
amount = self.currency_id.round(amount)
if float_is_zero(amount,
precision_rounding=self.currency_id.rounding):
continue
residual_amount -= amount
vals = {
'amount': amount,
'asset_id': self.id,
'sequence': sequence,
'name': (self.code or '') + '/' + str(sequence),
'remaining_value': residual_amount,
'depreciated_value': self.value - (
self.salvage_value + residual_amount),
'depreciation_date': depreciation_date.strftime(DF),
}
commands.append((0, False, vals))
# Considering Depr. Period as months
depreciation_date = date(year, month, day) + relativedelta(
months=+self.method_period)
day = depreciation_date.day
month = depreciation_date.month
year = depreciation_date.year
self.write({'depreciation_line_ids': commands})
return True
def validate(self):
self.write({'state': 'open'})
fields = [
'method',
'method_number',
'method_period',
'method_end',
'method_progress_factor',
'method_time',
'salvage_value',
'invoice_id',
]
ref_tracked_fields = self.env['account.asset.asset'].fields_get(fields)
for asset in self:
tracked_fields = ref_tracked_fields.copy()
if asset.method == 'linear':
del (tracked_fields['method_progress_factor'])
if asset.method_time != 'end':
del (tracked_fields['method_end'])
else:
del (tracked_fields['method_number'])
dummy, tracking_value_ids = asset._mail_track(tracked_fields,
dict.fromkeys(
fields))
asset.message_post(subject=_('Asset created'),
tracking_value_ids=tracking_value_ids)
def _get_disposal_moves(self):
move_ids = []
for asset in self:
unposted_depreciation_line_ids = asset.depreciation_line_ids.filtered(
lambda x: not x.move_check)
if unposted_depreciation_line_ids:
old_values = {
'method_end': asset.method_end,
'method_number': asset.method_number,
}
# Remove all unposted depr. lines
commands = [(2, line_id.id, False) for line_id in
unposted_depreciation_line_ids]
# Create a new depr. line with the residual amount and post it
sequence = len(asset.depreciation_line_ids) - len(
unposted_depreciation_line_ids) + 1
today = datetime.today().strftime(DF)
vals = {
'amount': asset.value_residual,
'asset_id': asset.id,
'sequence': sequence,
'name': (asset.code or '') + '/' + str(sequence),
'remaining_value': 0,
'depreciated_value': asset.value - asset.salvage_value,
# the asset is completely depreciated
'depreciation_date': today,
}
commands.append((0, False, vals))
asset.write(
{'depreciation_line_ids': commands, 'method_end': today,
'method_number': sequence})
tracked_fields = self.env['account.asset.asset'].fields_get(
['method_number', 'method_end'])
changes, tracking_value_ids = asset._mail_track(
tracked_fields, old_values)
if changes:
asset.message_post(subject=_(
'Asset sold or disposed. Accounting entry awaiting for validation.'),
tracking_value_ids=tracking_value_ids)
move_ids += asset.depreciation_line_ids[-1].create_move(
post_move=False)
return move_ids
def set_to_close(self):
move_ids = self._get_disposal_moves()
if move_ids:
name = _('Disposal Move')
view_mode = 'form'
if len(move_ids) > 1:
name = _('Disposal Moves')
view_mode = 'tree,form'
return {
'name': name,
'view_mode': view_mode,
'res_model': 'account.move',
'type': 'ir.actions.act_window',
'target': 'current',
'res_id': move_ids[0],
}
# Fallback, as if we just clicked on the smartbutton
return self.open_entries()
def set_to_draft(self):
self.write({'state': 'draft'})
@api.depends('value', 'salvage_value', 'depreciation_line_ids.move_check',
'depreciation_line_ids.amount')
def _amount_residual(self):
for record in self:
total_amount = 0.0
for line in record.depreciation_line_ids:
if line.move_check:
total_amount += line.amount
record.value_residual = record.value - total_amount - record.salvage_value
@api.onchange('company_id')
def onchange_company_id(self):
self.currency_id = self.company_id.currency_id.id
@api.depends('depreciation_line_ids.move_id')
def _entry_count(self):
for asset in self:
res = self.env['account.asset.depreciation.line'].search_count(
[('asset_id', '=', asset.id), ('move_id', '!=', False)])
asset.entry_count = res or 0
@api.constrains('prorata', 'method_time')
def _check_prorata(self):
if self.prorata and self.method_time != 'number':
raise ValidationError(_(
'Prorata temporis can be applied only for time method "number of depreciations".'))
@api.onchange('category_id')
def onchange_category_id(self):
vals = self.onchange_category_id_values(self.category_id.id)
# We cannot use 'write' on an object that doesn't exist yet
if vals:
for k, v in vals['value'].items():
setattr(self, k, v)
def onchange_category_id_values(self, category_id):
if category_id:
category = self.env['account.asset.category'].browse(category_id)
return {
'value': {
'method': category.method,
'method_number': category.method_number,
'method_time': category.method_time,
'method_period': category.method_period,
'method_progress_factor': category.method_progress_factor,
'method_end': category.method_end,
'prorata': category.prorata,
}
}
@api.onchange('method_time')
def onchange_method_time(self):
if self.method_time != 'number':
self.prorata = False
def copy_data(self, default=None):
if default is None:
default = {}
default['name'] = self.name + _(' (copy)')
return super(AccountAssetAsset, self).copy_data(default)
def _compute_entries(self, date, group_entries=False):
depreciation_ids = self.env['account.asset.depreciation.line'].search([
('asset_id', 'in', self.ids), ('depreciation_date', '<=', date),
('move_check', '=', False)])
if group_entries:
return depreciation_ids.create_grouped_move()
return depreciation_ids.create_move()
@api.model
def create(self, vals):
asset = super(AccountAssetAsset,
self.with_context(mail_create_nolog=True)).create(vals)
asset.sudo().compute_depreciation_board()
return asset
def write(self, vals):
res = super(AccountAssetAsset, self).write(vals)
if 'depreciation_line_ids' not in vals and 'state' not in vals:
for rec in self:
rec.compute_depreciation_board()
return res
def open_entries(self):
move_ids = []
for asset in self:
for depreciation_line in asset.depreciation_line_ids:
if depreciation_line.move_id:
move_ids.append(depreciation_line.move_id.id)
return {
'name': _('Journal Entries'),
'view_mode': 'tree,form',
'res_model': 'account.move',
'view_id': False,
'type': 'ir.actions.act_window',
'domain': [('id', 'in', move_ids)],
}
class AccountAssetDepreciationLine(models.Model):
_name = 'account.asset.depreciation.line'
_description = 'Asset depreciation line'
name = fields.Char(string='Depreciation Name', required=True, index=True)
sequence = fields.Integer(required=True)
asset_id = fields.Many2one('account.asset.asset', string='Asset',
required=True, ondelete='cascade')
parent_state = fields.Selection(related='asset_id.state',
string='State of Asset')
amount = fields.Float(string='Current Depreciation', digits=0,
required=True)
remaining_value = fields.Float(string='Next Period Depreciation', digits=0,
required=True)
depreciated_value = fields.Float(string='Cumulative Depreciation',
required=True)
depreciation_date = fields.Date('Depreciation Date', index=True)
move_id = fields.Many2one('account.move', string='Depreciation Entry')
move_check = fields.Boolean(compute='_get_move_check', string='Linked', store=True)
move_posted_check = fields.Boolean(compute='_get_move_posted_check',
string='Posted', store=True)
@api.depends('move_id')
def _get_move_check(self):
for line in self:
line.move_check = bool(line.move_id)
@api.depends('move_id.state')
def _get_move_posted_check(self):
for line in self:
line.move_posted_check = True if line.move_id and line.move_id.state == 'posted' else False
def create_move(self, post_move=True):
created_moves = self.env['account.move']
prec = self.env['decimal.precision'].precision_get('Account')
if self.mapped('move_id'):
raise UserError(_(
'This depreciation is already linked to a journal entry! Please post or delete it.'))
for line in self:
category_id = line.asset_id.category_id
depreciation_date = self.env.context.get(
'depreciation_date') or line.depreciation_date or fields.Date.context_today(
self)
company_currency = line.asset_id.company_id.currency_id
current_currency = line.asset_id.currency_id
amount = current_currency.with_context(
date=depreciation_date).compute(line.amount, company_currency)
asset_name = line.asset_id.name + ' (%s/%s)' % (
line.sequence, len(line.asset_id.depreciation_line_ids))
partner = self.env['res.partner']._find_accounting_partner(
line.asset_id.partner_id)
move_line_1 = {
'name': asset_name,
'account_id': category_id.account_depreciation_id.id,
'debit': 0.0 if float_compare(amount, 0.0,
precision_digits=prec) > 0 else -amount,
'credit': amount if float_compare(amount, 0.0,
precision_digits=prec) > 0 else 0.0,
'journal_id': category_id.journal_id.id,
'partner_id': partner.id,
'analytic_account_id': category_id.account_analytic_id.id if category_id.type == 'sale' else False,
'currency_id': company_currency != current_currency and current_currency.id or False,
'amount_currency': company_currency != current_currency and - 1.0 * line.amount or 0.0,
}
move_line_2 = {
'name': asset_name,
'account_id': category_id.account_depreciation_expense_id.id,
'credit': 0.0 if float_compare(amount, 0.0,
precision_digits=prec) > 0 else -amount,
'debit': amount if float_compare(amount, 0.0,
precision_digits=prec) > 0 else 0.0,
'journal_id': category_id.journal_id.id,
'partner_id': partner.id,
'analytic_account_id': category_id.account_analytic_id.id if category_id.type == 'purchase' else False,
'currency_id': company_currency != current_currency and current_currency.id or False,
'amount_currency': company_currency != current_currency and line.amount or 0.0,
}
move_vals = {
'ref': line.asset_id.code,
'date': depreciation_date or False,
'journal_id': category_id.journal_id.id,
'line_ids': [(0, 0, move_line_1), (0, 0, move_line_2)],
}
move = self.env['account.move'].create(move_vals)
line.write({'move_id': move.id, 'move_check': True})
created_moves |= move
if post_move and created_moves:
created_moves.filtered(lambda m: any(
m.asset_depreciation_ids.mapped(
'asset_id.category_id.open_asset'))).post()
return [x.id for x in created_moves]
def create_grouped_move(self, post_move=True):
if not self.exists():
return []
created_moves = self.env['account.move']
category_id = self[
0].asset_id.category_id # we can suppose that all lines have the same category
depreciation_date = self.env.context.get(
'depreciation_date') or fields.Date.context_today(self)
amount = 0.0
for line in self:
# Sum amount of all depreciation lines
company_currency = line.asset_id.company_id.currency_id
current_currency = line.asset_id.currency_id
amount += current_currency.compute(line.amount, company_currency)
name = category_id.name + _(' (grouped)')
move_line_1 = {
'name': name,
'account_id': category_id.account_depreciation_id.id,
'debit': 0.0,
'credit': amount,
'journal_id': category_id.journal_id.id,
'analytic_account_id': category_id.account_analytic_id.id if category_id.type == 'sale' else False,
}
move_line_2 = {
'name': name,
'account_id': category_id.account_depreciation_expense_id.id,
'credit': 0.0,
'debit': amount,
'journal_id': category_id.journal_id.id,
'analytic_account_id': category_id.account_analytic_id.id if category_id.type == 'purchase' else False,
}
move_vals = {
'ref': category_id.name,
'date': depreciation_date or False,
'journal_id': category_id.journal_id.id,
'line_ids': [(0, 0, move_line_1), (0, 0, move_line_2)],
}
move = self.env['account.move'].create(move_vals)
self.write({'move_id': move.id, 'move_check': True})
created_moves |= move
if post_move and created_moves:
self.post_lines_and_close_asset()
created_moves.post()
return [x.id for x in created_moves]
def post_lines_and_close_asset(self):
# we re-evaluate the assets to determine whether we can close them
# `message_post` invalidates the (whole) cache
# preprocess the assets and lines in which a message should be posted,
# and then post in batch will prevent the re-fetch of the same data over and over.
assets_to_close = self.env['account.asset.asset']
for line in self:
asset = line.asset_id
if asset.currency_id.is_zero(asset.value_residual):
assets_to_close |= asset
self.log_message_when_posted()
assets_to_close.write({'state': 'close'})
for asset in assets_to_close:
asset.message_post(body=_("Document closed."))
def log_message_when_posted(self):
def _format_message(message_description, tracked_values):
message = ''
if message_description:
message = '<span>%s</span>' % message_description
for name, values in tracked_values.items():
message += '<div> &nbsp; &nbsp; &bull; <b>%s</b>: ' % name
message += '%s</div>' % values
return message
# `message_post` invalidates the (whole) cache
# preprocess the assets in which messages should be posted,
# and then post in batch will prevent the re-fetch of the same data over and over.
assets_to_post = {}
for line in self:
if line.move_id and line.move_id.state == 'draft':
partner_name = line.asset_id.partner_id.name
currency_name = line.asset_id.currency_id.name
msg_values = {_('Currency'): currency_name,
_('Amount'): line.amount}
if partner_name:
msg_values[_('Partner')] = partner_name
msg = _format_message(_('Depreciation line posted.'),
msg_values)
assets_to_post.setdefault(line.asset_id, []).append(msg)
for asset, messages in assets_to_post.items():
for msg in messages:
asset.message_post(body=msg)
def unlink(self):
for record in self:
if record.move_check:
if record.asset_id.category_id.type == 'purchase':
msg = _("You cannot delete posted depreciation lines.")
else:
msg = _("You cannot delete posted installment lines.")
raise UserError(msg)
return super(AccountAssetDepreciationLine, self).unlink()

1622
base_accounting_kit/models/account_dashboard.py

File diff suppressed because it is too large

51
base_accounting_kit/models/account_followup.py

@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import fields, models
class Followup(models.Model):
_name = 'account.followup'
_description = 'Account Follow-up'
_rec_name = 'name'
followup_line_ids = fields.One2many('followup.line', 'followup_id',
'Follow-up', copy=True)
company_id = fields.Many2one('res.company', 'Company',
default=lambda self: self.env.company)
name = fields.Char(related='company_id.name', readonly=True)
class FollowupLine(models.Model):
_name = 'followup.line'
_description = 'Follow-up Criteria'
_order = 'delay'
name = fields.Char('Follow-Up Action', required=True, translate=True)
sequence = fields.Integer(
help="Gives the sequence order when displaying a list of follow-up lines.")
delay = fields.Integer('Due Days', required=True,
help="The number of days after the due date of the invoice"
" to wait before sending the reminder."
" Could be negative if you want to send a polite alert beforehand.")
followup_id = fields.Many2one('account.followup', 'Follow Ups',
ondelete="cascade")

49
base_accounting_kit/models/account_journal.py

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models, api
class AccountJournal(models.Model):
_inherit = "account.journal"
def action_open_reconcile(self):
if self.type in ['bank', 'cash']:
# Open reconciliation view for bank statements belonging to this journal
bank_stmt = self.env['account.bank.statement'].search([('journal_id', 'in', self.ids)]).mapped('line_ids')
return {
'type': 'ir.actions.client',
'tag': 'bank_statement_reconciliation_view',
'context': {'statement_line_ids': bank_stmt.ids, 'company_ids': self.mapped('company_id').ids},
}
else:
# Open reconciliation view for customers/suppliers
action_context = {'show_mode_selector': False, 'company_ids': self.mapped('company_id').ids}
if self.type == 'sale':
action_context.update({'mode': 'customers'})
elif self.type == 'purchase':
action_context.update({'mode': 'suppliers'})
return {
'type': 'ir.actions.client',
'tag': 'manual_reconciliation_view',
'context': action_context,
}

177
base_accounting_kit/models/account_move.py

@ -0,0 +1,177 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, _
from odoo.addons.base.models import decimal_precision as dp
from odoo.exceptions import UserError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
class AccountMove(models.Model):
_inherit = 'account.move'
asset_depreciation_ids = fields.One2many('account.asset.depreciation.line',
'move_id',
string='Assets Depreciation Lines')
def button_cancel(self):
for move in self:
for line in move.asset_depreciation_ids:
line.move_posted_check = False
return super(AccountMove, self).button_cancel()
def post(self):
self.mapped('asset_depreciation_ids').post_lines_and_close_asset()
return super(AccountMove, self).post()
@api.model
def _refund_cleanup_lines(self, lines):
result = super(AccountMove, self)._refund_cleanup_lines(lines)
for i, line in enumerate(lines):
for name, field in line._fields.items():
if name == 'asset_category_id':
result[i][2][name] = False
break
return result
def action_cancel(self):
res = super(AccountMove, self).action_cancel()
self.env['account.asset.asset'].sudo().search(
[('invoice_id', 'in', self.ids)]).write({'active': False})
return res
def action_post(self):
result = super(AccountMove, self).action_post()
for inv in self:
context = dict(self.env.context)
# Within the context of an invoice,
# this default value is for the type of the invoice, not the type of the asset.
# This has to be cleaned from the context before creating the asset,
# otherwise it tries to create the asset with the type of the invoice.
context.pop('default_type', None)
inv.invoice_line_ids.with_context(context).asset_create()
return result
class AccountInvoiceLine(models.Model):
_inherit = 'account.move.line'
asset_category_id = fields.Many2one('account.asset.category',
string='Asset Category')
asset_start_date = fields.Date(string='Asset Start Date',
compute='_get_asset_date', readonly=True,
store=True)
asset_end_date = fields.Date(string='Asset End Date',
compute='_get_asset_date', readonly=True,
store=True)
asset_mrr = fields.Float(string='Monthly Recurring Revenue',
compute='_get_asset_date',
readonly=True, digits='Account',
store=True)
@api.depends('asset_category_id', 'move_id.invoice_date')
def _get_asset_date(self):
for record in self:
record.asset_mrr = 0
record.asset_start_date = False
record.asset_end_date = False
cat = record.asset_category_id
if cat:
if cat.method_number == 0 or cat.method_period == 0:
raise UserError(_(
'The number of depreciations or the period length of your asset category cannot be null.'))
months = cat.method_number * cat.method_period
if record.move_id in ['out_invoice', 'out_refund']:
record.asset_mrr = record.price_subtotal_signed / months
if record.move_id.invoice_date:
start_date = datetime.strptime(
str(record.move_id.invoice_date), DF).replace(day=1)
end_date = (start_date + relativedelta(months=months,
days=-1))
record.asset_start_date = start_date.strftime(DF)
record.asset_end_date = end_date.strftime(DF)
def asset_create(self):
for record in self:
if record.asset_category_id:
vals = {
'name': record.name,
'code': record.move_id.name or False,
'category_id': record.asset_category_id.id,
'value': record.price_subtotal,
'partner_id': record.partner_id.id,
'company_id': record.move_id.company_id.id,
'currency_id': record.move_id.company_currency_id.id,
'date': record.move_id.invoice_date,
'invoice_id': record.move_id.id,
}
changed_vals = record.env[
'account.asset.asset'].onchange_category_id_values(
vals['category_id'])
vals.update(changed_vals['value'])
asset = record.env['account.asset.asset'].create(vals)
if record.asset_category_id.open_asset:
asset.validate()
return True
@api.onchange('asset_category_id')
def onchange_asset_category_id(self):
if self.move_id == 'out_invoice' and self.asset_category_id:
self.account_id = self.asset_category_id.account_asset_id.id
elif self.move_id == 'in_invoice' and self.asset_category_id:
self.account_id = self.asset_category_id.account_asset_id.id
@api.onchange('product_uom_id')
def _onchange_uom_id(self):
result = super(AccountInvoiceLine, self)._onchange_uom_id()
self.onchange_asset_category_id()
return result
@api.onchange('product_id')
def _onchange_product_id(self):
vals = super(AccountInvoiceLine, self)._onchange_product_id()
if self.product_id:
if self.move_id == 'out_invoice':
self.asset_category_id = self.product_id.product_tmpl_id.deferred_revenue_category_id
elif self.move_id == 'in_invoice':
self.asset_category_id = self.product_id.product_tmpl_id.asset_category_id
return vals
def _set_additional_fields(self, invoice):
if not self.asset_category_id:
if invoice.type == 'out_invoice':
self.asset_category_id = self.product_id.product_tmpl_id.deferred_revenue_category_id.id
elif invoice.type == 'in_invoice':
self.asset_category_id = self.product_id.product_tmpl_id.asset_category_id.id
self.onchange_asset_category_id()
super(AccountInvoiceLine, self)._set_additional_fields(invoice)
def get_invoice_line_account(self, type, product, fpos, company):
return product.asset_category_id.account_asset_id or super(
AccountInvoiceLine, self).get_invoice_line_account(type, product,
fpos, company)

156
base_accounting_kit/models/account_payment.py

@ -0,0 +1,156 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class AccountRegisterPayments(models.TransientModel):
_inherit = "account.payment.register"
bank_reference = fields.Char(copy=False)
cheque_reference = fields.Char(copy=False)
effective_date = fields.Date('Effective Date',
help='Effective date of PDC', copy=False,
default=False)
def _prepare_payment_vals(self, invoices):
res = super(AccountRegisterPayments, self)._prepare_payment_vals(
invoices)
# Check payment method is Check or PDC
check_pdc_ids = self.env['account.payment.method'].search(
[('code', 'in', ['pdc', 'check_printing'])])
if self.payment_method_id.id in check_pdc_ids.ids:
currency_id = self.env['res.currency'].browse(res['currency_id'])
journal_id = self.env['account.journal'].browse(res['journal_id'])
# Updating values in case of Multi payments
res.update({
'bank_reference': self.bank_reference,
'cheque_reference': self.cheque_reference,
'check_manual_sequencing': journal_id.check_manual_sequencing,
'effective_date': self.effective_date,
'check_amount_in_words': currency_id.amount_to_text(
res['amount']),
})
return res
class AccountPayment(models.Model):
_inherit = "account.payment"
bank_reference = fields.Char(copy=False)
cheque_reference = fields.Char(copy=False)
effective_date = fields.Date('Effective Date',
help='Effective date of PDC', copy=False,
default=False)
def open_payment_matching_screen(self):
# Open reconciliation view for customers/suppliers
move_line_id = False
for move_line in self.line_ids:
if move_line.account_id.reconcile:
move_line_id = move_line.id
break
if not self.partner_id:
raise UserError(_("Payments without a customer can't be matched"))
action_context = {'company_ids': [self.company_id.id], 'partner_ids': [
self.partner_id.commercial_partner_id.id]}
if self.partner_type == 'customer':
action_context.update({'mode': 'customers'})
elif self.partner_type == 'supplier':
action_context.update({'mode': 'suppliers'})
if move_line_id:
action_context.update({'move_line_id': move_line_id})
return {
'type': 'ir.actions.client',
'tag': 'manual_reconciliation_view',
'context': action_context,
}
def print_checks(self):
""" Check that the recordset is valid, set the payments state to
sent and call print_checks() """
# Since this method can be called via a client_action_multi, we
# need to make sure the received records are what we expect
self = self.filtered(lambda r:
r.payment_method_id.code
in ['check_printing', 'pdc']
and r.state != 'reconciled')
if len(self) == 0:
raise UserError(_(
"Payments to print as a checks must have 'Check' "
"or 'PDC' selected as payment method and "
"not have already been reconciled"))
if any(payment.journal_id != self[0].journal_id for payment in self):
raise UserError(_(
"In order to print multiple checks at once, they "
"must belong to the same bank journal."))
if not self[0].journal_id.check_manual_sequencing:
# The wizard asks for the number printed on the first
# pre-printed check so payments are attributed the
# number of the check the'll be printed on.
last_printed_check = self.search([
('journal_id', '=', self[0].journal_id.id),
('check_number', '!=', "0")], order="check_number desc",
limit=1)
next_check_number = last_printed_check and int(
last_printed_check.check_number) + 1 or 1
return {
'name': _('Print Pre-numbered Checks'),
'type': 'ir.actions.act_window',
'res_model': 'print.prenumbered.checks',
'view_mode': 'form',
'target': 'new',
'context': {
'payment_ids': self.ids,
'default_next_check_number': next_check_number,
}
}
else:
self.filtered(lambda r: r.state == 'draft').post()
self.write({'state': 'sent'})
return self.do_print_checks()
def _prepare_payment_moves(self):
""" supered function to set effective date """
res = super(AccountPayment, self)._prepare_payment_moves()
inbound_pdc_id = self.env.ref(
'base_accounting_kit.account_payment_method_pdc_in').id
outbound_pdc_id = self.env.ref(
'base_accounting_kit.account_payment_method_pdc_out').id
if self.payment_method_id.id == inbound_pdc_id or \
self.payment_method_id.id == outbound_pdc_id \
and self.effective_date:
res[0]['date'] = self.effective_date
for line in res[0]['line_ids']:
line[2]['date_maturity'] = self.effective_date
return res
class AccountPaymentMethod(models.Model):
_inherit = "account.payment.method"
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res['pdc'] = {'mode': 'multi', 'domain': [('type', '=', 'bank')]}
return res

148
base_accounting_kit/models/credit_limit.py

@ -0,0 +1,148 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models, fields, api
from odoo.exceptions import UserError
from odoo.tools.translate import _
class ResPartner(models.Model):
_inherit = 'res.partner'
warning_stage = fields.Float(string='Warning Amount',
help="A warning message will appear once the "
"selected customer is crossed warning "
"amount. Set its value to 0.00 to"
" disable this feature")
blocking_stage = fields.Float(string='Blocking Amount',
help="Cannot make sales once the selected "
"customer is crossed blocking amount."
"Set its value to 0.00 to disable "
"this feature")
due_amount = fields.Float(string="Total Sale",
compute="compute_due_amount")
active_limit = fields.Boolean("Active Credit Limit", default=False)
enable_credit_limit = fields.Boolean(string="Credit Limit Enabled",
compute="_compute_enable_credit_limit")
def compute_due_amount(self):
for rec in self:
if not rec.id:
continue
rec.due_amount = rec.credit - rec.debit
def _compute_enable_credit_limit(self):
""" Check credit limit is enabled in account settings """
params = self.env['ir.config_parameter'].sudo()
customer_credit_limit = params.get_param('customer_credit_limit',
default=False)
for rec in self:
rec.enable_credit_limit = True if customer_credit_limit else False
@api.constrains('warning_stage', 'blocking_stage')
def constrains_warning_stage(self):
if self.active_limit and self.enable_credit_limit:
if self.warning_stage >= self.blocking_stage:
if self.blocking_stage > 0:
raise UserError(_(
"Warning amount should be less than Blocking amount"))
class SaleOrder(models.Model):
_inherit = 'sale.order'
has_due = fields.Boolean()
is_warning = fields.Boolean()
due_amount = fields.Float(related='partner_id.due_amount')
def _action_confirm(self):
"""To check the selected customers due amount is exceed than
blocking stage"""
if self.partner_id.active_limit \
and self.partner_id.enable_credit_limit:
if self.due_amount >= self.partner_id.blocking_stage:
if self.partner_id.blocking_stage != 0:
raise UserError(_(
"%s is in Blocking Stage and "
"has a due amount of %s %s to pay") % (
self.partner_id.name, self.due_amount,
self.currency_id.symbol))
return super(SaleOrder, self)._action_confirm()
@api.onchange('partner_id')
def check_due(self):
"""To show the due amount and warning stage"""
if self.partner_id and self.partner_id.due_amount > 0 \
and self.partner_id.active_limit \
and self.partner_id.enable_credit_limit:
self.has_due = True
else:
self.has_due = False
if self.partner_id and self.partner_id.active_limit\
and self.partner_id.enable_credit_limit:
if self.due_amount >= self.partner_id.warning_stage:
if self.partner_id.warning_stage != 0:
self.is_warning = True
else:
self.is_warning = False
class AccountMove(models.Model):
_inherit = 'account.move'
has_due = fields.Boolean()
is_warning = fields.Boolean()
due_amount = fields.Float(related='partner_id.due_amount')
def action_post(self):
"""To check the selected customers due amount is exceed than
blocking stage"""
pay_type = ['out_invoice', 'out_refund', 'out_receipt']
for rec in self:
if rec.partner_id.active_limit and rec.move_type in pay_type \
and rec.partner_id.enable_credit_limit:
if rec.due_amount >= rec.partner_id.blocking_stage:
if rec.partner_id.blocking_stage != 0:
raise UserError(_(
"%s is in Blocking Stage and "
"has a due amount of %s %s to pay") % (
rec.partner_id.name, rec.due_amount,
rec.currency_id.symbol))
return super(AccountMove, self).action_post()
@api.onchange('partner_id')
def check_due(self):
"""To show the due amount and warning stage"""
if self.partner_id and self.partner_id.due_amount > 0 \
and self.partner_id.active_limit \
and self.partner_id.enable_credit_limit:
self.has_due = True
else:
self.has_due = False
if self.partner_id and self.partner_id.active_limit \
and self.partner_id.enable_credit_limit:
if self.due_amount >= self.partner_id.warning_stage:
if self.partner_id.warning_stage != 0:
self.is_warning = True
else:
self.is_warning = False

46
base_accounting_kit/models/multiple_invoice.py

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
from odoo import fields, models
class MultipleInvoice(models.Model):
"""Multiple Invoice Model"""
_name = "multiple.invoice"
_order = "sequence"
sequence = fields.Integer('Sequence No')
copy_name = fields.Char('Invoice Copy Name')
journal_id = fields.Many2one('account.journal', string="Journal")
class AccountJournal(models.Model):
"""Inheriting Account Journal Model"""
_inherit = "account.journal"
multiple_invoice_ids = fields.One2many('multiple.invoice', 'journal_id',
string='Multiple Invoice')
multiple_invoice_type = fields.Selection(
[('text', 'Text'), ('watermark', 'Watermark')], required=True,
default='text', string="Display Type")
text_position = fields.Selection([
('header', 'Header'),
('footer', 'Footer'),
('body', 'Document Body')
], required=True, default='header')
body_text_position = fields.Selection([
('tl', 'Top Left'),
('tr', 'Top Right'),
('bl', 'Bottom Left'),
('br', 'Bottom Right'),
], default='tl')
text_align = fields.Selection([
('right', 'Right'),
('left', 'Left'),
('center', 'Center'),
], default='right')
layout = fields.Char(related="company_id.external_report_layout_id.key")

151
base_accounting_kit/models/multiple_invoice_layout.py

@ -0,0 +1,151 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models
from odoo.modules import get_resource_path
try:
import sass as libsass
except ImportError:
libsass = None
class MultipleInvoiceLayout(models.TransientModel):
"""
Customise the invoice copy document layout and display a live preview
"""
_name = 'multiple.invoice.layout'
_description = 'Multiple Invoice Document Layout'
def _get_default_journal(self):
return self.env['account.journal'].search(
[('id', '=', self.env.context.get('active_id'))]).id
company_id = fields.Many2one(
'res.company', default=lambda self: self.env.company, required=True)
layout = fields.Char(related="company_id.external_report_layout_id.key")
journal_id = fields.Many2one('account.journal', string='Journal',
required=True, default=_get_default_journal)
multiple_invoice_type = fields.Selection(
related='journal_id.multiple_invoice_type', readonly=False,
required=True)
text_position = fields.Selection(related='journal_id.text_position',
readonly=False, required=True,
default='header')
body_text_position = fields.Selection(
related='journal_id.body_text_position',
readonly=False)
text_align = fields.Selection(
related='journal_id.text_align',
readonly=False)
preview = fields.Html(compute='_compute_preview',
sanitize=False,
sanitize_tags=False,
sanitize_attributes=False,
sanitize_style=False,
sanitize_form=False,
strip_style=False,
strip_classes=False)
@api.depends('multiple_invoice_type', 'text_position', 'body_text_position',
'text_align')
def _compute_preview(self):
""" compute a qweb based preview to display on the wizard """
styles = self._get_asset_style()
for wizard in self:
if wizard.company_id:
preview_css = self._get_css_for_preview(styles, wizard.id)
layout = self._get_layout_for_preview()
ir_ui_view = wizard.env['ir.ui.view']
wizard.preview = ir_ui_view._render_template(
'base_accounting_kit.multiple_invoice_wizard_preview',
{'company': wizard.company_id, 'preview_css': preview_css,
'layout': layout,
'mi_type': self.multiple_invoice_type,
'txt_position': self.text_position,
'body_txt_position': self.body_text_position,
'txt_align': self.text_align,
'mi': self.env.ref(
'base_accounting_kit.multiple_invoice_sample_name')
})
else:
wizard.preview = False
def _get_asset_style(self):
template_style = self.env.ref('web.styles_company_report',
raise_if_not_found=False)
if not template_style:
return b''
company_styles = template_style._render({
'company_ids': self.company_id,
})
return company_styles
@api.model
def _get_css_for_preview(self, scss, new_id):
"""
Compile the scss into css.
"""
css_code = self._compile_scss(scss)
return css_code
@api.model
def _compile_scss(self, scss_source):
"""
This code will compile valid scss into css.
Parameters are the same from odoo/addons/base/models/assetsbundle.py
Simply copied and adapted slightly
"""
# No scss ? still valid, returns empty css
if not scss_source.strip():
return ""
precision = 8
output_style = 'expanded'
bootstrap_path = get_resource_path('web', 'static', 'lib', 'bootstrap',
'scss')
try:
return libsass.compile(
string=scss_source,
include_paths=[
bootstrap_path,
],
output_style=output_style,
precision=precision,
)
except libsass.CompileError as e:
raise libsass.CompileError(e.args[0])
def _get_layout_for_preview(self):
if self.layout == 'web.external_layout_boxed':
new_layout = 'base_accounting_kit.boxed'
elif self.layout == 'web.external_layout_bold':
new_layout = 'base_accounting_kit.bold'
elif self.layout == 'web.external_layout_striped':
new_layout = 'base_accounting_kit.striped'
else:
new_layout = 'base_accounting_kit.standard'
return new_layout
def document_layout_save(self):
# meant to be overridden
return self.env.context.get('report_action') or {
'type': 'ir.actions.act_window_close'}

1180
base_accounting_kit/models/payment_matching.py

File diff suppressed because it is too large

38
base_accounting_kit/models/product_template.py

@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
asset_category_id = fields.Many2one('account.asset.category', string='Asset Type', company_dependent=True, ondelete="restrict")
deferred_revenue_category_id = fields.Many2one('account.asset.category', string='Deferred Revenue Type', company_dependent=True, ondelete="restrict")
def _get_asset_accounts(self):
res = super(ProductTemplate, self)._get_asset_accounts()
if self.asset_category_id:
res['stock_input'] = self.property_account_expense_id
if self.deferred_revenue_category_id:
res['stock_output'] = self.property_account_income_id
return res

179
base_accounting_kit/models/recurring_payments.py

@ -0,0 +1,179 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from datetime import datetime, date
from dateutil.relativedelta import relativedelta
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class FilterRecurringEntries(models.Model):
_inherit = 'account.move'
recurring_ref = fields.Char()
class RecurringPayments(models.Model):
_name = 'account.recurring.payments'
_description = 'Accounting Recurring Payment'
def _get_next_schedule(self):
if self.date:
recurr_dates = []
today = datetime.today()
start_date = datetime.strptime(str(self.date), '%Y-%m-%d')
while start_date <= today:
recurr_dates.append(str(start_date.date()))
if self.recurring_period == 'days':
start_date += relativedelta(days=self.recurring_interval)
elif self.recurring_period == 'weeks':
start_date += relativedelta(weeks=self.recurring_interval)
elif self.recurring_period == 'months':
start_date += relativedelta(months=self.recurring_interval)
else:
start_date += relativedelta(years=self.recurring_interval)
self.next_date = start_date.date()
name = fields.Char('Name')
debit_account = fields.Many2one('account.account', 'Debit Account',
required=True,
domain="['|', ('company_id', '=', False), "
"('company_id', '=', company_id)]")
credit_account = fields.Many2one('account.account', 'Credit Account',
required=True,
domain="['|', ('company_id', '=', False), "
"('company_id', '=', company_id)]")
journal_id = fields.Many2one('account.journal', 'Journal', required=True)
analytic_account_id = fields.Many2one('account.analytic.account',
'Analytic Account')
date = fields.Date('Starting Date', required=True, default=date.today())
next_date = fields.Date('Next Schedule', compute=_get_next_schedule,
readonly=True, copy=False)
recurring_period = fields.Selection(selection=[('days', 'Days'),
('weeks', 'Weeks'),
('months', 'Months'),
('years', 'Years')],
store=True, required=True)
amount = fields.Float('Amount')
description = fields.Text('Description')
state = fields.Selection(selection=[('draft', 'Draft'),
('running', 'Running')],
default='draft', string='Status')
journal_state = fields.Selection(selection=[('draft', 'Unposted'),
('posted', 'Posted')],
required=True, default='draft',
string='Generate Journal As')
recurring_interval = fields.Integer('Recurring Interval', default=1)
partner_id = fields.Many2one('res.partner', 'Partner')
pay_time = fields.Selection(selection=[('pay_now', 'Pay Directly'),
('pay_later', 'Pay Later')],
store=True, required=True)
company_id = fields.Many2one('res.company',
default=lambda l: l.env.company.id)
recurring_lines = fields.One2many('account.recurring.entries.line', 'tmpl_id')
@api.onchange('partner_id')
def onchange_partner_id(self):
if self.partner_id.property_account_receivable_id:
self.credit_account = self.partner_id.property_account_payable_id
@api.model
def _cron_generate_entries(self):
data = self.env['account.recurring.payments'].search(
[('state', '=', 'running')])
entries = self.env['account.move'].search(
[('recurring_ref', '!=', False)])
journal_dates = []
journal_codes = []
remaining_dates = []
for entry in entries:
journal_dates.append(str(entry.date))
if entry.recurring_ref:
journal_codes.append(str(entry.recurring_ref))
today = datetime.today()
for line in data:
if line.date:
recurr_dates = []
start_date = datetime.strptime(str(line.date), '%Y-%m-%d')
while start_date <= today:
recurr_dates.append(str(start_date.date()))
if line.recurring_period == 'days':
start_date += relativedelta(
days=line.recurring_interval)
elif line.recurring_period == 'weeks':
start_date += relativedelta(
weeks=line.recurring_interval)
elif line.recurring_period == 'months':
start_date += relativedelta(
months=line.recurring_interval)
else:
start_date += relativedelta(
years=line.recurring_interval)
for rec in recurr_dates:
recurr_code = str(line.id) + '/' + str(rec)
if recurr_code not in journal_codes:
remaining_dates.append({
'date': rec,
'template_name': line.name,
'amount': line.amount,
'tmpl_id': line.id,
})
child_ids = self.recurring_lines.create(remaining_dates)
for line in child_ids:
tmpl_id = line.tmpl_id
recurr_code = str(tmpl_id.id) + '/' + str(line.date)
line_ids = [(0, 0, {
'account_id': tmpl_id.credit_account.id,
'partner_id': tmpl_id.partner_id.id,
'credit': line.amount,
'analytic_account_id': tmpl_id.analytic_account_id.id,
}), (0, 0, {
'account_id': tmpl_id.debit_account.id,
'partner_id': tmpl_id.partner_id.id,
'debit': line.amount,
'analytic_account_id': tmpl_id.analytic_account_id.id,
})]
vals = {
'date': line.date,
'recurring_ref': recurr_code,
'company_id': self.env.company.id,
'journal_id': tmpl_id.journal_id.id,
'ref': line.template_name,
'narration': 'Recurring entry',
'line_ids': line_ids
}
move_id = self.env['account.move'].create(vals)
if tmpl_id.journal_state == 'posted':
move_id.post()
class GetAllRecurringEntries(models.TransientModel):
_name = 'account.recurring.entries.line'
_description = 'Account Recurring Entries Line'
date = fields.Date('Date')
template_name = fields.Char('Name')
amount = fields.Float('Amount')
tmpl_id = fields.Many2one('account.recurring.payments', string='id')

44
base_accounting_kit/models/res_config_settings.py

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models, fields, api
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
customer_credit_limit = fields.Boolean(string="Customer Credit Limit")
@api.model
def get_values(self):
res = super(ResConfigSettings, self).get_values()
params = self.env['ir.config_parameter'].sudo()
customer_credit_limit = params.get_param('customer_credit_limit',
default=False)
res.update(customer_credit_limit=customer_credit_limit)
return res
def set_values(self):
super(ResConfigSettings, self).set_values()
self.env['ir.config_parameter'].sudo().set_param(
"customer_credit_limit",
self.customer_credit_limit)

113
base_accounting_kit/models/res_partner.py

@ -0,0 +1,113 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from datetime import date, timedelta
from odoo import fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
invoice_list = fields.One2many('account.move', 'partner_id',
string="Invoice Details",
readonly=True,
domain=(
[('payment_state', '=', 'not_paid'),
('move_type', '=', 'out_invoice')]))
total_due = fields.Monetary(compute='_compute_for_followup', store=False,
readonly=True)
next_reminder_date = fields.Date(compute='_compute_for_followup',
store=False, readonly=True)
total_overdue = fields.Monetary(compute='_compute_for_followup',
store=False, readonly=True)
followup_status = fields.Selection(
[('in_need_of_action', 'In need of action'),
('with_overdue_invoices', 'With overdue invoices'),
('no_action_needed', 'No action needed')],
string='Followup status',
)
def _compute_for_followup(self):
"""
Compute the fields 'total_due', 'total_overdue' , 'next_reminder_date' and 'followup_status'
"""
for record in self:
total_due = 0
total_overdue = 0
today = fields.Date.today()
for am in record.invoice_list:
if am.company_id == self.env.company:
amount = am.amount_residual
total_due += amount
is_overdue = today > am.invoice_date_due if am.invoice_date_due else today > am.date
if is_overdue:
total_overdue += amount or 0
min_date = record.get_min_date()
action = record.action_after()
if min_date:
date_reminder = min_date + timedelta(days=action)
if date_reminder:
record.next_reminder_date = date_reminder
else:
date_reminder = today
record.next_reminder_date = date_reminder
if total_overdue > 0 and date_reminder > today:
followup_status = "with_overdue_invoices"
elif total_due > 0 and date_reminder <= today:
followup_status = "in_need_of_action"
else:
followup_status = "no_action_needed"
record.total_due = total_due
record.total_overdue = total_overdue
record.followup_status = followup_status
def get_min_date(self):
today = date.today()
for this in self:
if this.invoice_list:
min_list = this.invoice_list.mapped('invoice_date_due')
while False in min_list:
min_list.remove(False)
return min(min_list)
else:
return today
def get_delay(self):
delay = """select id,delay from followup_line where followup_id =
(select id from account_followup where company_id = %s)
order by delay limit 1"""
self._cr.execute(delay, [self.env.company.id])
record = self._cr.dictfetchall()
return record
def action_after(self):
lines = self.env['followup.line'].search([(
'followup_id.company_id', '=', self.env.company.id)])
if lines:
record = self.get_delay()
for i in record:
return i['delay']

35
base_accounting_kit/report/__init__.py

@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import general_ledger_report
from . import account_report_common_account
from . import report_partner_ledger
from . import report_tax
from . import report_trial_balance
from . import report_aged_partner
from . import report_journal_audit
from . import report_financial
from . import cash_flow_report
from . import account_bank_book
from . import account_cash_book
from . import account_day_book
from . import account_asset_report
from . import multiple_invoice_report

68
base_accounting_kit/report/account_asset_report.py

@ -0,0 +1,68 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, tools
class AssetAssetReport(models.Model):
_name = "asset.asset.report"
_description = "Assets Analysis"
_auto = False
name = fields.Char(string='Year', required=False, readonly=True)
date = fields.Date(readonly=True)
depreciation_date = fields.Date(string='Depreciation Date', readonly=True)
asset_id = fields.Many2one('account.asset.asset', string='Asset', readonly=True)
asset_category_id = fields.Many2one('account.asset.category', string='Asset category', readonly=True)
partner_id = fields.Many2one('res.partner', string='Partner', readonly=True)
state = fields.Selection([('draft', 'Draft'), ('open', 'Running'), ('close', 'Close')], string='Status', readonly=True)
depreciation_value = fields.Float(string='Amount of Depreciation Lines', readonly=True)
installment_value = fields.Float(string='Amount of Installment Lines', readonly=True)
move_check = fields.Boolean(string='Posted', readonly=True)
installment_nbr = fields.Integer(string='# of Installment Lines', readonly=True)
depreciation_nbr = fields.Integer(string='# of Depreciation Lines', readonly=True)
gross_value = fields.Float(string='Gross Amount', readonly=True)
posted_value = fields.Float(string='Posted Amount', readonly=True)
unposted_value = fields.Float(string='Unposted Amount', readonly=True)
company_id = fields.Many2one('res.company', string='Company', readonly=True)
def init(self):
tools.drop_view_if_exists(self._cr, 'asset_asset_report')
self._cr.execute("""
create or replace view asset_asset_report as (
select
min(dl.id) as id,
dl.name as name,
dl.depreciation_date as depreciation_date,
a.date as date,
(CASE WHEN dlmin.id = min(dl.id)
THEN a.value
ELSE 0
END) as gross_value,
dl.amount as depreciation_value,
dl.amount as installment_value,
(CASE WHEN dl.move_check
THEN dl.amount
ELSE 0
END) as posted_value,
(CASE WHEN NOT dl.move_check
THEN dl.amount
ELSE 0
END) as unposted_value,
dl.asset_id as asset_id,
dl.move_check as move_check,
a.category_id as asset_category_id,
a.partner_id as partner_id,
a.state as state,
count(dl.*) as installment_nbr,
count(dl.*) as depreciation_nbr,
a.company_id as company_id
from account_asset_depreciation_line dl
left join account_asset_asset a on (dl.asset_id=a.id)
left join (select min(d.id) as id,ac.id as ac_id from account_asset_depreciation_line as d inner join account_asset_asset as ac ON (ac.id=d.asset_id) group by ac_id) as dlmin on dlmin.ac_id=a.id
where a.active is true
group by
dl.amount,dl.asset_id,dl.depreciation_date,dl.name,
a.date, dl.move_check, a.state, a.category_id, a.partner_id, a.company_id,
a.value, a.id, a.salvage_value, dlmin.id
)""")

77
base_accounting_kit/report/account_asset_report_views.xml

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="action_account_asset_report_pivot">
<field name="name">asset.asset.report.pivot</field>
<field name="model">asset.asset.report</field>
<field name="arch" type="xml">
<pivot string="Assets Analysis" disable_linking="True">
<field name="asset_category_id" type="row"/>
<field name="gross_value" type="measure"/>
<field name="unposted_value" type="measure"/>
</pivot>
</field>
</record>
<record model="ir.ui.view" id="action_account_asset_report_graph">
<field name="name">asset.asset.report.graph</field>
<field name="model">asset.asset.report</field>
<field name="arch" type="xml">
<graph string="Assets Analysis">
<field name="asset_category_id" type="row"/>
<field name="gross_value" type="measure"/>
<field name="unposted_value" type="measure"/>
</graph>
</field>
</record>
<record id="view_asset_asset_report_search" model="ir.ui.view">
<field name="name">asset.asset.report.search</field>
<field name="model">asset.asset.report</field>
<field name="arch" type="xml">
<search string="Assets Analysis">
<field name="date"/>
<field name="depreciation_date"/>
<filter string="Draft" name="draft" domain="[('state','=','draft')]" help="Assets in draft state"/>
<filter string="Running" name="running" domain="[('state','=','open')]" help="Assets in running state"/>
<filter string="Not archived" name="only_active" domain="[('asset_id.active','=', True)]"/>
<separator/>
<filter string="Posted" name="posted" domain="[('move_check','=',True)]" help="Posted depreciation lines" context="{'unposted_value_visible': 0}"/>
<field name="asset_id"/>
<field name="asset_category_id"/>
<group expand="0" string="Extended Filters...">
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group expand="1" string="Group By">
<filter string="Asset" name="asset" context="{'group_by':'asset_id'}"/>
<filter string="Asset Category" name="asset_category" context="{'group_by':'asset_category_id'}"/>
<filter string="Company" name="company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator/>
<filter string="Purchase Month" name="purchase_month" help="Date of asset purchase"
context="{'group_by':'date:month'}"/>
<filter string="Depreciation Month" name="deprecation_month" help="Date of depreciation"
context="{'group_by':'depreciation_date:month'}"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_asset_asset_report">
<field name="name">Assets Analysis</field>
<field name="res_model">asset.asset.report</field>
<field name="view_mode">graph,pivot</field>
<field name="search_view_id" ref="view_asset_asset_report_search"/>
<field name="domain">[('asset_category_id.type', '=', 'purchase')]</field>
<field name="context">{'search_default_only_active': 1}</field>
<field name="help" type="html">
<p>
From this report, you can have an overview on all depreciations. The
search bar can also be used to personalize your assets depreciation reporting.
</p>
</field>
</record>
<menuitem name="Assets" action="action_asset_asset_report"
id="menu_action_asset_asset_report"
parent="account.account_reports_management_menu" sequence="21"/>
</odoo>

176
base_accounting_kit/report/account_bank_book.py

@ -0,0 +1,176 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from datetime import time
from odoo import models, api, _
from odoo.exceptions import UserError
class ReportBankBook(models.AbstractModel):
_name = 'report.base_accounting_kit.report_bank_book'
_description = 'Bank Book Report'
def _get_account_move_entry(self, accounts, init_balance, sortby,
display_account):
cr = self.env.cr
move_line = self.env['account.move.line']
move_lines = {x: [] for x in accounts.ids}
# Prepare initial sql query and Get the initial move lines
if init_balance:
init_tables, init_where_clause, init_where_params = move_line.with_context(
date_from=self.env.context.get('date_from'), date_to=False,
initial_bal=True)._query_get()
init_wheres = [""]
if init_where_clause.strip():
init_wheres.append(init_where_clause.strip())
init_filters = " AND ".join(init_wheres)
filters = init_filters.replace('account_move_line__move_id',
'm').replace('account_move_line',
'l')
sql = ("""SELECT 0 AS lid, l.account_id AS account_id, \
'' AS ldate, '' AS lcode, 0.0 AS amount_currency, \
'' AS lref, 'Initial Balance' AS lname, \
COALESCE(SUM(l.debit),0.0) AS debit, \
COALESCE(SUM(l.credit),0.0) AS credit, \
COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance, \
'' AS lpartner_id,\
'' AS move_name, '' AS mmove_id, '' AS currency_code,\
NULL AS currency_id,\
'' AS invoice_id, '' AS invoice_type, '' AS invoice_number,\
'' AS partner_name\
FROM account_move_line l\
LEFT JOIN account_move m ON (l.move_id=m.id)\
LEFT JOIN res_currency c ON (l.currency_id=c.id)\
LEFT JOIN res_partner p ON (l.partner_id=p.id)\
JOIN account_journal j ON (l.journal_id=j.id)\
WHERE l.account_id IN %s""" + filters + ' GROUP BY l.account_id')
params = (tuple(accounts.ids),) + tuple(init_where_params)
cr.execute(sql, params)
for row in cr.dictfetchall():
move_lines[row.pop('account_id')].append(row)
sql_sort = 'l.date, l.move_id'
if sortby == 'sort_journal_partner':
sql_sort = 'j.code, p.name, l.move_id'
# Prepare sql query base on selected parameters from wizard
tables, where_clause, where_params = move_line._query_get()
wheres = [""]
if where_clause.strip():
wheres.append(where_clause.strip())
filters = " AND ".join(wheres)
filters = filters.replace('account_move_line__move_id', 'm').replace(
'account_move_line', 'l')
# Get move lines base on sql query and Calculate the total
# balance of move lines
sql = ('''SELECT l.id AS lid, l.account_id \
AS account_id, l.date AS ldate, j.code AS lcode,\
l.currency_id, l.amount_currency, l.ref AS lref, l.name AS lname,\
COALESCE(l.debit,0) AS debit, \
COALESCE(l.credit,0) AS credit, \
COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance,\
m.name AS move_name, c.symbol AS \
currency_code, p.name AS partner_name\
FROM account_move_line l\
JOIN account_move m ON (l.move_id=m.id)\
LEFT JOIN res_currency c ON (l.currency_id=c.id)\
LEFT JOIN res_partner p ON (l.partner_id=p.id)\
JOIN account_journal j ON (l.journal_id=j.id)\
JOIN account_account acc ON (l.account_id = acc.id) \
WHERE l.account_id IN %s ''' + filters + ''' GROUP BY \
l.id, l.account_id, l.date, j.code, l.currency_id, \
l.amount_currency, l.ref, l.name, m.name, \
c.symbol, p.name ORDER BY ''' + sql_sort)
params = (tuple(accounts.ids),) + tuple(where_params)
cr.execute(sql, params)
for row in cr.dictfetchall():
balance = 0
for line in move_lines.get(row['account_id']):
balance += line['debit'] - line['credit']
row['balance'] += balance
move_lines[row.pop('account_id')].append(row)
# Calculate the debit, credit and balance for Accounts
account_res = []
for account in accounts:
currency = account.currency_id and \
account.currency_id or account.company_id.currency_id
res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance'])
res['code'] = account.code
res['name'] = account.name
res['move_lines'] = move_lines[account.id]
for line in res.get('move_lines'):
res['debit'] += line['debit']
res['credit'] += line['credit']
res['balance'] = line['balance']
if display_account == 'all':
account_res.append(res)
if display_account == 'movement' and res.get('move_lines'):
account_res.append(res)
if display_account == 'not_zero' and not currency.is_zero(
res['balance']):
account_res.append(res)
return account_res
@api.model
def _get_report_values(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model'):
raise UserError(
_("Form content is missing, this report cannot be printed."))
model = self.env.context.get('active_model')
docs = self.env[model].browse(self.env.context.get('active_ids', []))
init_balance = data['form'].get('initial_balance', True)
sortby = data['form'].get('sortby', 'sort_date')
display_account = 'movement'
codes = []
if data['form'].get('journal_ids', False):
codes = [journal.code for journal in
self.env['account.journal'].search(
[('id', 'in', data['form']['journal_ids'])])]
account_ids = data['form']['account_ids']
accounts = self.env['account.account'].search(
[('id', 'in', account_ids)])
if not accounts:
journals = self.env['account.journal'].search([('type', '=', 'bank')])
accounts = []
for journal in journals:
accounts.append(journal.company_id.account_journal_payment_credit_account_id.id)
accounts = self.env['account.account'].search([('id', 'in', accounts)])
accounts_res = self.with_context(data['form'].get('used_context', {}))._get_account_move_entry(
accounts,
init_balance,
sortby,
display_account)
return {
'doc_ids': docids,
'doc_model': model,
'data': data['form'],
'docs': docs,
'time': time,
'Accounts': accounts_res,
'print_journal': codes,
}

133
base_accounting_kit/report/account_bank_book_view.xml

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_bank_book">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>
<t t-call="web.internal_layout">
<div class="page">
<h2><span t-esc="env.company.name"/>: Bank Book Report
</h2>
<div class="row">
<div class="col-xs-4" style="width:40%;">
<strong>Journals:</strong>
<p t-esc="', '.join([ lt or '' for lt in print_journal ])"/>
</div>
<div class="col-xs-4" style="width:30%;">
<strong>Display Account</strong>
<p>
<span t-if="data['display_account'] == 'all'">All accounts'</span>
<span t-if="data['display_account'] == 'movement'">With movements</span>
<span t-if="data['display_account'] == 'not_zero'">With balance not equal to zero</span>
</p>
</div>
<div class="col-xs-4" style="width:30%;">
<strong>Target Moves:</strong>
<p t-if="data['target_move'] == 'all'">All Entries</p>
<p t-if="data['target_move'] == 'posted'">All Posted Entries</p>
</div>
</div>
<br/>
<div class="row">
<div style="width:70%;">
<strong>Sorted By:</strong>
<p t-if="data['sortby'] == 'sort_date'">Date</p>
<p t-if="data['sortby'] == 'sort_journal_partner'">Journal and Partner</p>
</div>
<div style="width:30%;">
<t t-if="data['date_from']">
<strong>Date from :</strong>
<span t-esc="data['date_from']"/>
<br/>
</t>
<t t-if="data['date_to']">
<strong>Date to :</strong>
<span t-esc="data['date_to']"/>
</t>
</div>
</div>
<br/>
<table class="table table-condensed">
<thead>
<tr class="text-center">
<th>Date</th>
<th>JRNL</th>
<th>Partner</th>
<th>Ref</th>
<th>Move</th>
<th>Entry Label</th>
<th>Debit</th>
<th>Credit</th>
<th>Balance</th>
<th groups="base.group_multi_currency">Currency</th>
</tr>
</thead>
<tbody>
<t t-foreach="Accounts" t-as="account">
<tr style="font-weight: bold;">
<td colspan="6">
<span style="color: white;" t-esc="'..'"/>
<span t-esc="account['code']"/>
<span t-esc="account['name']"/>
</td>
<td class="text-right">
<span t-esc="account['debit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="account['credit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="account['balance']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td groups="base.group_multi_currency"/>
</tr>
<tr t-foreach="account['move_lines']" t-as="line">
<td>
<span t-esc="line['ldate']"/>
</td>
<td>
<span t-esc="line['lcode']"/>
</td>
<td>
<span t-esc="line['partner_name']"/>
</td>
<td>
<span t-if="line['lref']" t-esc="line['lref']"/>
</td>
<td>
<span t-esc="line['move_name']"/>
</td>
<td>
<span t-esc="line['lname']"/>
</td>
<td class="text-right">
<span t-esc="line['debit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['credit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['balance']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td t-if="line['amount_currency']" class="text-right" groups="base.group_multi_currency">
<span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/>
<span t-esc="line['currency_code'] if line['amount_currency'] > 0.00 else ''"/>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>

167
base_accounting_kit/report/account_cash_book.py

@ -0,0 +1,167 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from datetime import time
from odoo import models, api, _
from odoo.exceptions import UserError
class ReportCashBook(models.AbstractModel):
_name = 'report.base_accounting_kit.report_cash_book'
_description = 'Cash Book Report'
def _get_account_move_entry(self, accounts, init_balance, sortby,
display_account):
cr = self.env.cr
move_line = self.env['account.move.line']
move_lines = {x: [] for x in accounts.ids}
# Prepare initial sql query and Get the initial move lines
if init_balance:
init_tables, init_where_clause, init_where_params = move_line.with_context(
date_from=self.env.context.get('date_from'), date_to=False,
initial_bal=True)._query_get()
init_wheres = [""]
if init_where_clause.strip():
init_wheres.append(init_where_clause.strip())
init_filters = " AND ".join(init_wheres)
filters = init_filters.replace('account_move_line__move_id',
'm').replace('account_move_line',
'l')
sql = ("""SELECT 0 AS lid, l.account_id AS account_id, '' AS ldate, '' AS lcode, 0.0 AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance, '' AS lpartner_id,\
'' AS move_name, '' AS mmove_id, '' AS currency_code,\
NULL AS currency_id,\
'' AS invoice_id, '' AS invoice_type, '' AS invoice_number,\
'' AS partner_name\
FROM account_move_line l\
LEFT JOIN account_move m ON (l.move_id=m.id)\
LEFT JOIN res_currency c ON (l.currency_id=c.id)\
LEFT JOIN res_partner p ON (l.partner_id=p.id)\
JOIN account_journal j ON (l.journal_id=j.id)\
WHERE l.account_id IN %s""" + filters + ' GROUP BY l.account_id')
params = (tuple(accounts.ids),) + tuple(init_where_params)
cr.execute(sql, params)
for row in cr.dictfetchall():
move_lines[row.pop('account_id')].append(row)
sql_sort = 'l.date, l.move_id'
if sortby == 'sort_journal_partner':
sql_sort = 'j.code, p.name, l.move_id'
# Prepare sql query base on selected parameters from wizard
tables, where_clause, where_params = move_line._query_get()
wheres = [""]
if where_clause.strip():
wheres.append(where_clause.strip())
filters = " AND ".join(wheres)
filters = filters.replace('account_move_line__move_id', 'm').replace(
'account_move_line', 'l')
if not accounts:
journals = self.env['account.journal'].search([('type', '=', 'cash')])
accounts = []
for journal in journals:
accounts.append(journal.company_id.account_journal_payment_credit_account_id.id)
accounts = self.env['account.account'].search([('id','in',accounts)])
# Get move lines base on sql query and Calculate the total balance of move lines
sql = ('''SELECT l.id AS lid, l.account_id AS account_id, l.date AS ldate, j.code AS lcode, l.currency_id, l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance,\
m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name\
FROM account_move_line l\
JOIN account_move m ON (l.move_id=m.id)\
LEFT JOIN res_currency c ON (l.currency_id=c.id)\
LEFT JOIN res_partner p ON (l.partner_id=p.id)\
JOIN account_journal j ON (l.journal_id=j.id)\
JOIN account_account acc ON (l.account_id = acc.id) \
WHERE l.account_id IN %s ''' + filters + ''' GROUP BY l.id, l.account_id, l.date, j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, p.name ORDER BY ''' + sql_sort)
params = (tuple(accounts.ids),) + tuple(where_params)
cr.execute(sql, params)
for row in cr.dictfetchall():
balance = 0
for line in move_lines.get(row['account_id']):
balance += line['debit'] - line['credit']
row['balance'] += balance
move_lines[row.pop('account_id')].append(row)
# Calculate the debit, credit and balance for Accounts
account_res = []
for account in accounts:
currency = account.currency_id and account.currency_id or account.company_id.currency_id
res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance'])
res['code'] = account.code
res['name'] = account.name
res['move_lines'] = move_lines[account.id]
for line in res.get('move_lines'):
res['debit'] += line['debit']
res['credit'] += line['credit']
res['balance'] = line['balance']
if display_account == 'all':
account_res.append(res)
if display_account == 'movement' and res.get('move_lines'):
account_res.append(res)
if display_account == 'not_zero' and not currency.is_zero(
res['balance']):
account_res.append(res)
return account_res
@api.model
def _get_report_values(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model'):
raise UserError(
_("Form content is missing, this report cannot be printed."))
model = self.env.context.get('active_model')
docs = self.env[model].browse(
self.env.context.get('active_ids', []))
init_balance = data['form'].get('initial_balance', True)
sortby = data['form'].get('sortby', 'sort_date')
display_account = 'movement'
codes = []
if data['form'].get('journal_ids', False):
codes = [journal.code for journal in
self.env['account.journal'].search(
[('id', 'in', data['form']['journal_ids'])])]
account_ids = data['form']['account_ids']
accounts = self.env['account.account'].search(
[('id', 'in', account_ids)])
if not accounts:
journals = self.env['account.journal'].search([('type', '=', 'cash')])
accounts = []
for journal in journals:
accounts.append(journal.company_id.account_journal_payment_credit_account_id.id)
accounts = self.env['account.account'].search([('id', 'in', accounts)])
accounts_res = self.with_context(
data['form'].get('used_context', {}))._get_account_move_entry(
accounts,
init_balance,
sortby,
display_account)
return {
'doc_ids': docids,
'doc_model': model,
'data': data['form'],
'docs': docs,
'time': time,
'Accounts': accounts_res,
'print_journal': codes,
}

108
base_accounting_kit/report/account_cash_book_view.xml

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_cash_book">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>
<t t-call="web.internal_layout">
<div class="page">
<h2><span t-esc="env.company.name"/>: Cash Book Report</h2>
<div class="row">
<div class="col-xs-4" style="width:40%;">
<strong>Journals:</strong>
<p t-esc="', '.join([ lt or '' for lt in print_journal ])"/>
</div>
<div class="col-xs-4" style="width:30%;">
<strong>Display Account</strong>
<p>
<span t-if="data['display_account'] == 'all'">All accounts'</span>
<span t-if="data['display_account'] == 'movement'">With movements</span>
<span t-if="data['display_account'] == 'not_zero'">With balance not equal to zero</span>
</p>
</div>
<div class="col-xs-4" style="width:30%;">
<strong>Target Moves:</strong>
<p t-if="data['target_move'] == 'all'">All Entries</p>
<p t-if="data['target_move'] == 'posted'">All Posted Entries</p>
</div>
</div>
<br/>
<div class="row">
<div style="width:70%;">
<strong>Sorted By:</strong>
<p t-if="data['sortby'] == 'sort_date'">Date</p>
<p t-if="data['sortby'] == 'sort_journal_partner'">Journal and Partner</p>
</div>
<div style="width:30%;">
<t t-if="data['date_from']"><strong>Date from :</strong> <span t-esc="data['date_from']"/><br/></t>
<t t-if="data['date_to']"><strong>Date to :</strong> <span t-esc="data['date_to']"/></t>
</div>
</div>
<br/>
<table class="table table-condensed">
<thead>
<tr class="text-center">
<th>Date</th>
<th>JRNL</th>
<th>Partner</th>
<th>Ref</th>
<th>Move</th>
<th>Entry Label</th>
<th>Debit</th>
<th>Credit</th>
<th>Balance</th>
<th groups="base.group_multi_currency">Currency</th>
</tr>
</thead>
<tbody>
<t t-foreach="Accounts" t-as="account">
<tr style="font-weight: bold;">
<td colspan="6">
<span style="color: white;" t-esc="'..'"/>
<span t-esc="account['code']"/>
<span t-esc="account['name']"/>
</td>
<td class="text-right">
<span t-esc="account['debit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="account['credit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="account['balance']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td groups="base.group_multi_currency"/>
</tr>
<tr t-foreach="account['move_lines']" t-as="line">
<td><span t-esc="line['ldate']"/></td>
<td><span t-esc="line['lcode']"/></td>
<td><span t-esc="line['partner_name']"/></td>
<td><span t-if="line['lref']" t-esc="line['lref']"/></td>
<td><span t-esc="line['move_name']"/></td>
<td><span t-esc="line['lname']"/></td>
<td class="text-right">
<span t-esc="line['debit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['credit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['balance']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td t-if="line['amount_currency']" class="text-right" groups="base.group_multi_currency">
<span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/>
<span t-esc="line['currency_code'] if line['amount_currency'] > 0.00 else ''"/>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>

125
base_accounting_kit/report/account_day_book.py

@ -0,0 +1,125 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
import time
from datetime import timedelta, datetime
from odoo import models, api, _
from odoo.exceptions import UserError
class DayBookPdfReport(models.AbstractModel):
_name = 'report.base_accounting_kit.day_book_report_template'
_description = 'Day Book Report'
def _get_account_move_entry(self, accounts, form_data, pass_date):
cr = self.env.cr
move_line = self.env['account.move.line']
tables, where_clause, where_params = move_line._query_get()
wheres = [""]
if where_clause.strip():
wheres.append(where_clause.strip())
if form_data['target_move'] == 'posted':
target_move = "AND m.state = 'posted'"
else:
target_move = ''
sql = ('''
SELECT l.id AS lid, acc.name as accname, l.account_id AS account_id, l.date AS ldate, j.code AS lcode, l.currency_id,
l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit,
COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance,
m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name
FROM account_move_line l
JOIN account_move m ON (l.move_id=m.id)
LEFT JOIN res_currency c ON (l.currency_id=c.id)
LEFT JOIN res_partner p ON (l.partner_id=p.id)
JOIN account_journal j ON (l.journal_id=j.id)
JOIN account_account acc ON (l.account_id = acc.id)
WHERE l.account_id IN %s AND l.journal_id IN %s ''' + target_move + ''' AND l.date = %s
GROUP BY l.id, l.account_id, l.date,
j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, p.name , acc.name
ORDER BY l.date DESC
''')
params = (
tuple(accounts.ids), tuple(form_data['journal_ids']), pass_date)
cr.execute(sql, params)
data = cr.dictfetchall()
res = {}
debit = credit = balance = 0.00
for line in data:
debit += line['debit']
credit += line['credit']
balance += line['balance']
res['debit'] = debit
res['credit'] = credit
res['balance'] = balance
res['lines'] = data
return res
@api.model
def _get_report_values(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model'):
raise UserError(
_("Form content is missing, this report cannot be printed."))
model = self.env.context.get('active_model')
docs = self.env[model].browse(
self.env.context.get('active_ids', []))
form_data = data['form']
codes = []
if data['form'].get('journal_ids', False):
codes = [journal.code for journal in
self.env['account.journal'].search(
[('id', 'in', data['form']['journal_ids'])])]
active_acc = data['form']['account_ids']
accounts = self.env['account.account'].search(
[('id', 'in', active_acc)]) if data['form']['account_ids'] else \
self.env['account.account'].search([])
date_start = datetime.strptime(form_data['date_from'],
'%Y-%m-%d').date()
date_end = datetime.strptime(form_data['date_to'], '%Y-%m-%d').date()
days = date_end - date_start
dates = []
record = []
for i in range(days.days + 1):
dates.append(date_start + timedelta(days=i))
for head in dates:
pass_date = str(head)
accounts_res = self.with_context(
data['form'].get('used_context', {}))._get_account_move_entry(
accounts, form_data, pass_date)
if accounts_res['lines']:
record.append({
'date': head,
'debit': accounts_res['debit'],
'credit': accounts_res['credit'],
'balance': accounts_res['balance'],
'child_lines': accounts_res['lines']
})
return {
'doc_ids': docids,
'doc_model': model,
'data': data['form'],
'docs': docs,
'time': time,
'Accounts': record,
'print_journal': codes,
}

115
base_accounting_kit/report/account_day_book_view.xml

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="day_book_report_template">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>
<t t-call="web.internal_layout">
<div class="page">
<h2><span t-esc="env.company.name"/>: Day Book Report
</h2>
<div class="row mt32" style="margin-bottom:3%;">
<div class="col-7">
<strong>Journals:</strong>
<p t-esc="', '.join([ lt or '' for lt in print_journal ])"/>
</div>
<div class="col-2">
<strong>Target Moves:</strong>
<p t-if="data['target_move'] == 'all'">All Entries</p>
<p t-if="data['target_move'] == 'posted'">All Posted Entries</p>
</div>
<div class="col-3">
<t t-if="data['date_from']">
<strong>Date from :</strong>
<span t-esc="data['date_from']"/>
<br/>
</t>
<t t-if="data['date_to']">
<strong>Date to :</strong>
<span t-esc="data['date_to']"/>
</t>
</div>
</div>
<table class="table table-condensed">
<thead>
<tr class="text-center">
<th>Date</th>
<th>JRNL</th>
<th>Partner</th>
<th>Ref</th>
<th>Move</th>
<th>Entry Label</th>
<th>Debit</th>
<th>Credit</th>
<th>Balance</th>
<th groups="base.group_multi_currency">Currency</th>
</tr>
</thead>
<tbody>
<t t-foreach="Accounts" t-as="account">
<tr style="font-weight: bold;background: #ededed;">
<td colspan="6">
<span style="color: white;" t-esc="'..'"/>
<span t-esc="account['date']"/>
</td>
<td class="text-right">
<span t-esc="account['debit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="account['credit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="account['balance']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td groups="base.group_multi_currency"/>
</tr>
<tr t-foreach="account['child_lines']" t-as="line">
<td>
<span t-esc="line['ldate']"/>
</td>
<td>
<span t-esc="line['lcode']"/>
</td>
<td>
<span t-esc="line['partner_name']"/>
</td>
<td>
<span t-if="line['lref']" t-esc="line['lref']"/>
</td>
<td>
<span t-esc="line['move_name']"/>
</td>
<td>
<span t-esc="line['lname']"/>
</td>
<td class="text-right">
<span t-esc="line['debit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['credit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['balance']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td t-if="line['amount_currency']" class="text-right" groups="base.group_multi_currency">
<span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/>
<span t-esc="line['currency_code'] if line['amount_currency'] > 0.00 else ''"/>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>

38
base_accounting_kit/report/account_report_common_account.py

@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, fields, models
class AccountCommonAccountReport(models.TransientModel):
_name = 'account.common.account.report'
_description = 'Account Common Account Report'
_inherit = "account.common.report"
display_account = fields.Selection(
[('all', 'All'), ('movement', 'With movements'),
('not_zero', 'With balance is not equal to 0')],
string='Display Accounts', required=True, default='movement')
def pre_print_report(self, data):
data['form'].update(self.read(['display_account'])[0])
return data

217
base_accounting_kit/report/cash_flow_report.py

@ -0,0 +1,217 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
import time
from odoo import api, models, _
from odoo.exceptions import UserError
class ReportFinancial(models.AbstractModel):
_name = 'report.base_accounting_kit.report_cash_flow'
_description = 'Cash Flow Report'
def _compute_account_balance(self, accounts):
mapping = {
'balance': "COALESCE(SUM(debit),0) - COALESCE(SUM(credit), 0) as balance",
'debit': "COALESCE(SUM(debit), 0) as debit",
'credit': "COALESCE(SUM(credit), 0) as credit",
}
res = {}
for account in accounts:
res[account.id] = dict.fromkeys(mapping, 0.0)
if accounts:
tables, where_clause, where_params = self.env[
'account.move.line']._query_get()
tables = tables.replace('"', '') if tables else "account_move_line"
wheres = [""]
if where_clause.strip():
wheres.append(where_clause.strip())
filters = " AND ".join(wheres)
request = "SELECT account_id as id, " + ', '.join(
mapping.values()) + \
" FROM " + tables + \
" WHERE account_id IN %s " \
+ filters + \
" GROUP BY account_id"
params = (tuple(accounts._ids),) + tuple(where_params)
self.env.cr.execute(request, params)
for row in self.env.cr.dictfetchall():
res[row['id']] = row
return res
def _compute_report_balance(self, reports):
res = {}
fields = ['credit', 'debit', 'balance']
for report in reports:
if report.id in res:
continue
res[report.id] = dict((fn, 0.0) for fn in fields)
if report.type == 'accounts':
# it's the sum of credit or debit
res2 = self._compute_report_balance(report.parent_id)
for key, value in res2.items():
cash_in_operation = self.env.ref(
'base_accounting_kit.cash_in_from_operation0')
cash_out_operation = self.env.ref(
'base_accounting_kit.cash_out_operation1')
cash_in_financial = self.env.ref(
'base_accounting_kit.cash_in_financial0')
cash_out_financial = self.env.ref(
'base_accounting_kit.cash_out_financial1')
cash_in_investing = self.env.ref(
'base_accounting_kit.cash_in_investing0')
cash_out_investing = self.env.ref(
'base_accounting_kit.cash_out_investing1')
if report == cash_in_operation or report == cash_in_financial or report == cash_in_investing:
res[report.id]['debit'] += value['debit']
res[report.id]['balance'] += value['debit']
elif report == cash_out_operation or report == cash_out_financial or report == cash_out_investing:
res[report.id]['credit'] += value['credit']
res[report.id]['balance'] += -(value['credit'])
elif report.type == 'account_type':
# it's the sum the leaf accounts with such an account type
accounts = self.env['account.account'].search(
[('user_type_id', 'in', report.account_type_ids.ids)])
res[report.id]['account'] = self._compute_account_balance(
accounts)
for value in res[report.id]['account'].values():
for field in fields:
res[report.id][field] += value.get(field)
elif report.type == 'account_report' and report.account_report_id:
# it's the amount of the linked
res[report.id]['account'] = self._compute_account_balance(
report.account_ids)
for value in res[report.id]['account'].values():
for field in fields:
res[report.id][field] += value.get(field)
elif report.type == 'sum':
# it's the sum of the linked accounts
res[report.id]['account'] = self._compute_account_balance(
report.account_ids)
for values in res[report.id]['account'].values():
for field in fields:
res[report.id][field] += values.get(field)
return res
def get_account_lines(self, data):
lines = []
account_report = self.env['account.financial.report'].search(
[('id', '=', data['account_report_id'][0])])
child_reports = account_report._get_children_by_order()
res = self.with_context(
data.get('used_context'))._compute_report_balance(child_reports)
if data['enable_filter']:
comparison_res = self.with_context(
data.get('comparison_context'))._compute_report_balance(
child_reports)
for report_id, value in comparison_res.items():
res[report_id]['comp_bal'] = value['balance']
report_acc = res[report_id].get('account')
if report_acc:
for account_id, val in comparison_res[report_id].get(
'account').items():
report_acc[account_id]['comp_bal'] = val['balance']
for report in child_reports:
vals = {
'name': report.name,
'balance': res[report.id]['balance'] * int(report.sign),
'type': 'report',
'level': bool(report.style_overwrite) and int(
report.style_overwrite) or report.level,
'account_type': report.type or False,
# used to underline the financial report balances
}
if data['debit_credit']:
vals['debit'] = res[report.id]['debit']
vals['credit'] = res[report.id]['credit']
if data['enable_filter']:
vals['balance_cmp'] = res[report.id]['comp_bal'] * int(
report.sign)
lines.append(vals)
if report.display_detail == 'no_detail':
# the rest of the loop is used to display the details of the financial report, so it's not needed here.
continue
if res[report.id].get('account'):
# if res[report.id].get('debit'):
sub_lines = []
for account_id, value in res[report.id]['account'].items():
# if there are accounts to display, we add them to the lines with a level equals to their level in
# the COA + 1 (to avoid having them with a too low level that would conflicts with the level of data
# financial reports for Assets, liabilities...)
flag = False
account = self.env['account.account'].browse(account_id)
vals = {
'name': account.code + ' ' + account.name,
'balance': value['balance'] * int(report.sign) or 0.0,
'type': 'account',
'level': report.display_detail == 'detail_with_hierarchy' and 4,
'account_type': account.internal_type,
}
if data['debit_credit']:
vals['debit'] = value['debit']
vals['credit'] = value['credit']
if not account.company_id.currency_id.is_zero(
vals[
'debit']) or not account.company_id.currency_id.is_zero(
vals['credit']):
flag = True
if not account.company_id.currency_id.is_zero(
vals['balance']):
flag = True
if data['enable_filter']:
vals['balance_cmp'] = value['comp_bal'] * int(
report.sign)
if not account.company_id.currency_id.is_zero(
vals['balance_cmp']):
flag = True
if flag:
sub_lines.append(vals)
lines += sorted(sub_lines,
key=lambda sub_line: sub_line['name'])
return lines
@api.model
def _get_report_values(self, docids, data=None):
if not data.get('form') or not self.env.context.get(
'active_model') or not self.env.context.get('active_id'):
raise UserError(
_("Form content is missing, this report cannot be printed."))
model = self.env.context.get('active_model')
docs = self.env[model].browse(self.env.context.get('active_id'))
report_lines = self.get_account_lines(data.get('form'))
return {
'doc_ids': self.ids,
'doc_model': model,
'data': data['form'],
'docs': docs,
'time': time,
'get_account_lines': report_lines,
}

88
base_accounting_kit/report/cash_flow_report.xml

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_cash_flow">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.internal_layout">
<div class="page">
<h2 t-esc="data['account_report_id'][1]"/>
<div class="row mt32 mb32">
<div class="col-4">
<strong>Target Moves:</strong>
<p>
<span t-if="data['target_move'] == 'all'">All Entries</span>
<span t-if="data['target_move'] == 'posted'">All Posted Entries</span>
</p>
</div>
<div class="col-4">
<p>
<strong>Date from :</strong>
<span t-esc="data['date_from']"/>
<br/>
<strong>Date to :</strong>
<span t-esc="data['date_to']"/>
</p>
</div>
</div>
<table class="table table-sm table-reports">
<thead>
<tr>
<th>
<strong>Name</strong>
</th>
<th class="text-right" t-if="data['debit_credit']">
<strong>Debit</strong>
</th>
<th class="text-right" t-if="data['debit_credit']">
<strong>Credit</strong>
</th>
<th class="text-right">
<strong>Balance</strong>
</th>
<th class="text-right" t-if="data['enable_filter']">
<strong t-esc="data['label_filter']"/>
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="get_account_lines" t-as="a">
<t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: normal;'"/>
</t>
<t t-if="not a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: bold;'"/>
</t>
<td>
<span style="color: white;" t-esc="'..' * a.get('level', 0)"/>
<span t-att-style="style" t-esc="a.get('name')"/>
</td>
<td t-if="data['debit_credit']" class="text-right" style="white-space: text-nowrap;">
<span t-att-style="style" t-esc="a.get('debit')" t-if="data['debit_credit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td t-if="data['debit_credit']" class="text-right" style="white-space: text-nowrap;">
<span t-att-style="style" t-esc="a.get('credit')"
t-if="data['debit_credit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right" style="white-space: text-nowrap;">
<span t-att-style="style" t-esc="a.get('balance')"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-att-style="style" t-esc="a.get('balance_cmp')"
t-if="data['enable_filter']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
</t>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</t>
</template>
</odoo>

172
base_accounting_kit/report/general_ledger_report.py

@ -0,0 +1,172 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
import time
from odoo import api, models, _
from odoo.exceptions import UserError
class ReportGeneralLedger(models.AbstractModel):
_name = 'report.base_accounting_kit.report_general_ledger'
_description = 'General Ledger Report'
def _get_account_move_entry(self, accounts, init_balance, sortby,
display_account):
"""
:param:
accounts: the recordset of accounts
init_balance: boolean value of initial_balance
sortby: sorting by date or partner and journal
display_account: type of account(receivable, payable and both)
Returns a dictionary of accounts with following key and value {
'code': account code,
'name': account name,
'debit': sum of total debit amount,
'credit': sum of total credit amount,
'balance': total balance,
'amount_currency': sum of amount_currency,
'move_lines': list of move line
}
"""
cr = self.env.cr
MoveLine = self.env['account.move.line']
move_lines = {x: [] for x in accounts.ids}
# Prepare initial sql query and Get the initial move lines
if init_balance:
init_tables, init_where_clause, init_where_params = MoveLine.with_context(
date_from=self.env.context.get('date_from'), date_to=False,
initial_bal=True)._query_get()
init_wheres = [""]
if init_where_clause.strip():
init_wheres.append(init_where_clause.strip())
init_filters = " AND ".join(init_wheres)
filters = init_filters.replace('account_move_line__move_id',
'm').replace('account_move_line',
'l')
sql = ("""SELECT 0 AS lid, l.account_id AS account_id, '' AS ldate, '' AS lcode, 0.0 AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance, '' AS lpartner_id,\
'' AS move_name, '' AS mmove_id, '' AS currency_code,\
NULL AS currency_id,\
'' AS invoice_id, '' AS invoice_type, '' AS invoice_number,\
'' AS partner_name\
FROM account_move_line l\
LEFT JOIN account_move m ON (l.move_id=m.id)\
LEFT JOIN res_currency c ON (l.currency_id=c.id)\
LEFT JOIN res_partner p ON (l.partner_id=p.id)\
LEFT JOIN account_move i ON (m.id =i.id)\
JOIN account_journal j ON (l.journal_id=j.id)\
WHERE l.account_id IN %s""" + filters + ' GROUP BY l.account_id')
params = (tuple(accounts.ids),) + tuple(init_where_params)
cr.execute(sql, params)
for row in cr.dictfetchall():
move_lines[row.pop('account_id')].append(row)
sql_sort = 'l.date, l.move_id'
if sortby == 'sort_journal_partner':
sql_sort = 'j.code, p.name, l.move_id'
# Prepare sql query base on selected parameters from wizard
tables, where_clause, where_params = MoveLine._query_get()
wheres = [""]
if where_clause.strip():
wheres.append(where_clause.strip())
filters = " AND ".join(wheres)
filters = filters.replace('account_move_line__move_id', 'm').replace(
'account_move_line', 'l')
# Get move lines base on sql query and Calculate the total balance of move lines
sql = ('''SELECT l.id AS lid, l.account_id AS account_id, l.date AS ldate, j.code AS lcode, l.currency_id, l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance,\
m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name\
FROM account_move_line l\
JOIN account_move m ON (l.move_id=m.id)\
LEFT JOIN res_currency c ON (l.currency_id=c.id)\
LEFT JOIN res_partner p ON (l.partner_id=p.id)\
JOIN account_journal j ON (l.journal_id=j.id)\
JOIN account_account acc ON (l.account_id = acc.id) \
WHERE l.account_id IN %s ''' + filters + ''' GROUP BY l.id, l.account_id, l.date, j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, p.name ORDER BY ''' + sql_sort)
params = (tuple(accounts.ids),) + tuple(where_params)
cr.execute(sql, params)
for row in cr.dictfetchall():
balance = 0
for line in move_lines.get(row['account_id']):
balance += line['debit'] - line['credit']
row['balance'] += balance
move_lines[row.pop('account_id')].append(row)
# Calculate the debit, credit and balance for Accounts
account_res = []
for account in accounts:
currency = account.currency_id and account.currency_id or account.company_id.currency_id
res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance'])
res['code'] = account.code
res['name'] = account.name
res['move_lines'] = move_lines[account.id]
for line in res.get('move_lines'):
res['debit'] += line['debit']
res['credit'] += line['credit']
res['balance'] = line['balance']
if display_account == 'all':
account_res.append(res)
if display_account == 'movement' and res.get('move_lines'):
account_res.append(res)
if display_account == 'not_zero' and not currency.is_zero(
res['balance']):
account_res.append(res)
return account_res
@api.model
def _get_report_values(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model'):
raise UserError(
_("Form content is missing, this report cannot be printed."))
model = self.env.context.get('active_model')
docs = self.env[model].browse(
self.env.context.get('active_ids', []))
init_balance = data['form'].get('initial_balance', True)
sortby = data['form'].get('sortby', 'sort_date')
display_account = data['form']['display_account']
codes = []
if data['form'].get('journal_ids', False):
codes = [journal.code for journal in
self.env['account.journal'].search(
[('id', 'in', data['form']['journal_ids'])])]
accounts = docs if model == 'account.account' else self.env[
'account.account'].search([])
accounts_res = self.with_context(
data['form'].get('used_context', {}))._get_account_move_entry(
accounts, init_balance, sortby, display_account)
return {
'doc_ids': docids,
'doc_model': model,
'data': data['form'],
'docs': docs,
'time': time,
'Accounts': accounts_res,
'print_journal': codes,
}

107
base_accounting_kit/report/general_ledger_report.xml

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_general_ledger">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>
<t t-call="web.internal_layout">
<div class="page">
<h2><span t-esc="env.company.name"/>: General ledger</h2>
<div class="row mt32">
<div class="col-4">
<strong>Journals:</strong>
<p t-esc="', '.join([ lt or '' for lt in print_journal ])"/>
</div>
<div class="col-4">
<strong>Display Account</strong>
<p>
<span t-if="data['display_account'] == 'all'">All accounts'</span>
<span t-if="data['display_account'] == 'movement'">With movements</span>
<span t-if="data['display_account'] == 'not_zero'">With balance not equal to zero</span>
</p>
</div>
<div class="col-4">
<strong>Target Moves:</strong>
<p t-if="data['target_move'] == 'all'">All Entries</p>
<p t-if="data['target_move'] == 'posted'">All Posted Entries</p>
</div>
</div>
<div class="row mb32">
<div class="col-4">
<strong>Sorted By:</strong>
<p t-if="data['sortby'] == 'sort_date'">Date</p>
<p t-if="data['sortby'] == 'sort_journal_partner'">Journal and Partner</p>
</div>
<div class="col-4">
<t t-if="data['date_from']"><strong>Date from :</strong> <span t-esc="data['date_from']"/><br/></t>
<t t-if="data['date_to']"><strong>Date to :</strong> <span t-esc="data['date_to']"/></t>
</div>
</div>
<table class="table table-sm table-reports">
<thead>
<tr class="text-center">
<th>Date</th>
<th>JRNL</th>
<th>Partner</th>
<th>Ref</th>
<th>Move</th>
<th>Entry Label</th>
<th>Debit</th>
<th>Credit</th>
<th>Balance</th>
<th groups="base.group_multi_currency">Currency</th>
</tr>
</thead>
<tbody>
<t t-foreach="Accounts" t-as="account">
<tr style="font-weight: bold;">
<td colspan="6">
<span style="color: white;" t-esc="'..'"/>
<span t-esc="account['code']"/>
<span t-esc="account['name']"/>
</td>
<td class="text-right">
<span t-esc="account['debit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="account['credit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="account['balance']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td groups="base.group_multi_currency"/>
</tr>
<tr t-foreach="account['move_lines']" t-as="line">
<td><span t-esc="line['ldate']"/></td>
<td><span t-esc="line['lcode']"/></td>
<td><span t-esc="line['partner_name']"/></td>
<td><span t-if="line['lref']" t-esc="line['lref']"/></td>
<td><span t-esc="line['move_name']"/></td>
<td><span t-esc="line['lname']"/></td>
<td class="text-right">
<span t-esc="line['debit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['credit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['balance']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<t t-if="line['amount_currency']">
<td class="text-right" groups="base.group_multi_currency">
<span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/>
<span t-esc="line['currency_code'] if line['amount_currency'] > 0.00 else ''"/>
</td>
</t>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>

512
base_accounting_kit/report/multiple_invoice_layouts.xml

@ -0,0 +1,512 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="base_accounting_kit.standard">
<div t-attf-class="header o_company_#{company.id}_layout" t-att-style="report_header_style">
<div class="row">
<div class="col-3 mb4">
<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" style="max-height: 45px;" alt="Logo"/>
<!--Header-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'header'">
<div class="row">
<div t-if="txt_align == 'left'" class="text-left">
<span t-esc="mi.copy_name" style="font-size: 20px; padding-left:25px; white-space:nowrap;"/>
</div>
<div t-if="txt_align == 'center'" class="text-center">
<span t-esc="mi.copy_name" style="font-size: 20px;
margin-left:340px; margin-right:340px; white-space:nowrap;"/>
</div>
</div>
</t>
</t>
</div>
<div class="col-9 text-right" style="margin-top:22px;" t-field="company.report_header" name="moto"/>
</div>
<!--Header-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'header'">
<div t-if="txt_align == 'right'" class="text-right">
<span t-esc="mi.copy_name" style="font-size: 20px;"/>
</div>
</t>
</t>
<div t-if="company.logo or company.report_header" class="row zero_min_height">
<div class="col-12">
<div style="border-bottom: 1px solid black;"/>
</div>
</div>
<div class="row">
<div class="col-6" name="company_address">
<span t-if="company.company_details" t-field="company.company_details"></span>
</div>
</div>
<!--Watermark-->
<t t-if="mi_type =='watermark'">
<div style="opacity:0.15; font-size:100px; width:85%; text-align:center;top:500px; right:100px; position: fixed; z-index:99; -webkit-transform: rotate(-30deg);">
<t t-esc="mi.copy_name"/>
</div>
</t>
</div>
<div t-attf-class="article o_report_layout_standard o_company_#{company.id}_layout {{ 'o_layout_background' if company.layout_background in ['Geometric', 'Custom'] else '' }}" t-attf-style="background-image: url({{ 'data:image/png;base64,%s' % company.layout_background_image.decode('utf-8') if company.layout_background_image and company.layout_background == 'Custom' else '/base/static/img/bg_background_template.jpg' if company.layout_background == 'Geometric' else ''}});" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')">
<div class="pt-5">
<!-- This div ensures that the address is not cropped by the header. -->
<t t-call="web.address_layout"/>
</div>
<t t-out="0"/>
</div>
<div t-attf-class="footer o_standard_footer o_company_#{company.id}_layout">
<div class="text-center" style="border-top: 1px solid black;">
<ul class="list-inline mb4">
<div t-field="company.report_footer"/>
<!--Footer-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'footer'">
<div t-if="txt_align == 'right'" class="text-right">
<span t-esc="mi.copy_name" style="font-size: 15px;"/>
</div>
<div t-if="txt_align == 'left'" class="text-left">
<span t-esc="mi.copy_name" style="font-size: 15px;"/>
</div>
<div t-if="txt_align == 'center'" class="text-center;">
<span t-esc="mi.copy_name" style="font-size: 15px;"/>
</div>
</t>
</t>
</ul>
<div t-if="report_type == 'pdf'" class="text-muted">
Page: <span class="page"/> / <span class="topage"/>
</div>
</div>
</div>
</template>
<template id="base_accounting_kit.boxed">
<div t-attf-class="header o_company_#{company.id}_layout" t-att-style="report_header_style">
<div class="o_boxed_header">
<div class="row mb8">
<div class="col-6">
<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" alt="Logo"/>
<!--Header-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'header'">
<div t-if="txt_align == 'left'">
<span t-esc="mi.copy_name" style="font-size: 25px; white-space:nowrap;"/>
</div>
<div t-if="txt_align == 'center'" class="text-align: center">
<span t-esc="mi.copy_name" style="font-size: 25px;
margin-left:340px; margin-right:340px; white-space:nowrap;"/>
</div>
</t>
</t>
</div>
<div class="col-6 text-right mb4">
<h4 class="mt0" t-field="company.report_header"/>
<div name="company_address" class="float-right mb4">
<span t-if="company.company_details" t-field="company.company_details"></span>
<!--Header-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'header'">
<div t-if="txt_align == 'right'" class="float-right mb4">
<span t-esc="mi.copy_name" style="font-size: 25px;"/>
</div>
</t>
</t>
<br/>
</div>
</div>
</div>
</div>
<!--Watermark-->
<t t-if="mi_type =='watermark'">
<div style="opacity:0.15; font-size:100px; width:85%; text-align:center;top:500px; right:100px; position: fixed; z-index:99; -webkit-transform: rotate(-30deg);">
<t t-esc="mi.copy_name"/>
</div>
</t>
</div>
<div t-attf-class="article o_report_layout_boxed o_company_#{company.id}_layout {{ 'o_layout_background' if company.layout_background in ['Geometric', 'Custom'] else '' }}" t-attf-style="background-image: url({{ 'data:image/png;base64,%s' % company.layout_background_image.decode('utf-8') if company.layout_background_image and company.layout_background == 'Custom' else '/base/static/img/bg_background_template.jpg' }});" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')">
<div class="pt-5">
<!-- This div ensures that the address is not cropped by the header. -->
<t t-call="web.address_layout"/>
</div>
<t t-out="0"/>
</div>
<div t-attf-class="footer o_boxed_footer o_company_#{company.id}_layout">
<div class="text-center">
<div t-field="company.report_footer"/>
<!--Footer-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'footer'">
<div t-if="txt_align == 'right'" class="text-right">
<span t-esc="mi.copy_name" style="font-size: 20px;"/>
</div>
<div t-if="txt_align == 'left'" class="text-left">
<span t-esc="mi.copy_name" style="font-size: 20px;"/>
</div>
<div t-if="txt_align == 'center'" class="text-center;">
<span t-esc="mi.copy_name" style="font-size: 20px;"/>
</div>
</t>
</t>
<div t-if="report_type == 'pdf'">
Page: <span class="page"/> / <span class="topage"/>
</div>
</div>
</div>
</template>
<template id="base_accounting_kit.bold">
<div t-attf-class="header o_company_#{company.id}_layout" t-att-style="report_header_style">
<div class="o_clean_header">
<div class="row">
<div class="col-6">
<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" alt="Logo"/>
<!--Header-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'header'">
<div t-if="txt_align == 'left'">
<br/>
<span t-esc="mi.copy_name" style="font-size: 20px; padding-left:25px; white-space:nowrap;"/>
</div>
<div t-if="txt_align == 'center'" class="text-align: center">
<br/>
<span t-esc="mi.copy_name" style="font-size: 20px;
margin-left:280px; margin-right:280px; white-space:nowrap;"/>
</div>
</t>
</t>
</div>
<div class="col-5 offset-1" name="company_address">
<ul class="list-unstyled">
<strong><li t-if="company.name"><span t-field="company.name"/></li></strong>
<li t-if="forced_vat or company.vat">
<t t-esc="company.country_id.vat_label or 'Tax ID'"/>:
<span t-if="forced_vat" t-esc="forced_vat"/>
<span t-else="" t-field="company.vat"/>
</li>
<li t-if="company.phone">Tel: <span class="o_force_ltr" t-field="company.phone"/></li>
<li t-if="company.email"><span t-field="company.email"/></li>
<li t-if="company.website"><span t-field="company.website"/></li>
<!--Header-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'header'">
<div t-if="txt_align == 'right'">
<span t-esc="mi.copy_name" style="font-size: 20px;"/>
</div>
</t>
</t>
</ul>
</div>
</div>
</div>
<!--Watermark-->
<t t-if="mi_type =='watermark'">
<div style="opacity:0.15; font-size:100px; width:85%; text-align:center;top:500px; right:100px; position: fixed; z-index:99; -webkit-transform: rotate(-30deg);">
<t t-esc="mi.copy_name"/>
</div>
</t>
</div>
<div t-attf-class="article o_report_layout_bold o_company_#{company.id}_layout {{ 'o_layout_background' if company.layout_background in ['Geometric', 'Custom'] else '' }}" t-attf-style="background-image: url({{ 'data:image/png;base64,%s' % company.layout_background_image.decode('utf-8') if company.layout_background_image and company.layout_background == 'Custom' else '/base/static/img/bg_background_template.jpg' }});" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')">
<t t-call="web.address_layout"/>
<t t-out="0"/>
</div>
<div t-attf-class="footer o_clean_footer o_company_#{company.id}_layout">
<div class="row">
<div class="col-4">
<span t-field="company.report_footer"/>
<!--Footer Left-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'footer'">
<div t-if="txt_align == 'left'" class="text-left">
<span t-esc="mi.copy_name" style="font-size: 18px; padding-left:25px; white-space:nowrap;"/>
</div>
</t>
</t>
</div>
<div class="col-4">
<span t-if="company.company_details" t-field="company.company_details"/>
</div>
<div class="col-3">
<h5 class="mt0 mb0" t-field="company.report_header"/>
<!--Footer-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'footer'">
<div t-if="txt_align == 'right'" class="text-right">
<span t-esc="mi.copy_name" style="font-size: 18px;"/>
</div>
<div t-if="txt_align == 'center'" class="text-center;">
<span t-esc="mi.copy_name" style="font-size: 18px;"/>
</div>
</t>
</t>
</div>
<div class="col-1">
<ul t-if="report_type == 'pdf'" class="list-inline pagenumber float-right text-center">
<li class="list-inline-item"><strong><span class="page"/></strong></li>
</ul>
</div>
</div>
</div>
</template>
<template id="base_accounting_kit.striped">
<div t-attf-class="o_company_#{company.id}_layout header" t-att-style="report_header_style">
<div class="o_background_header">
<div class="float-right">
<h3 class="mt0 text-right" t-field="company.report_header"/>
</div>
<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" class="float-left" alt="Logo"/>
<div class="float-left company_address">
<span t-if="company.company_details" t-field="company.company_details"></span>
</div>
<!--Header-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'header'">
<div t-if="txt_align == 'right'" class="text-right" style="position: relative; top: 50px;">
<span t-esc="mi.copy_name" style="font-size: 20px;"/>
</div>
<div t-if="txt_align == 'center'" class="text-center">
<br/>
<span t-esc="mi.copy_name" style="font-size: 20px;
margin-left:280px; margin-right:280px; white-space:nowrap;"/>
</div>
<div t-if="txt_align == 'left'" class="text-left" style="position: fixed; top: 70px; left:20px;">
<br/>
<span t-esc="mi.copy_name" style="font-size: 20px; white-space:nowrap;"/>
</div>
</t>
</t>
<div class="clearfix mb8"/>
</div>
<!--Watermark-->
<t t-if="mi_type =='watermark'">
<div style="opacity:0.15; font-size:100px; width:85%; text-align:center;top:500px; right:100px; position: fixed; z-index:99; -webkit-transform: rotate(-30deg);">
<t t-esc="mi.copy_name"/>
</div>
</t>
</div>
<div t-attf-class="o_company_#{company.id}_layout article o_report_layout_striped {{ 'o_layout_background' if company.layout_background in ['Geometric', 'Custom'] else '' }}" t-attf-style="background-image: url({{ 'data:image/png;base64,%s' % company.layout_background_image.decode('utf-8') if company.layout_background_image and company.layout_background == 'Custom' else '/base/static/img/bg_background_template.jpg' }});" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')">
<t t-call="web.address_layout"/>
<t t-out="0"/>
</div>
<div t-attf-class="o_company_#{company.id}_layout footer o_background_footer">
<div class="text-center">
<ul class="list-inline">
<div t-field="company.report_footer"/>
</ul>
<!--Footer-->
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'footer'">
<div t-if="txt_align == 'right'" class="text-right">
<span t-esc="mi.copy_name" style="font-size: 15px;"/>
</div>
<div t-if="txt_align == 'left'" class="text-left">
<span t-esc="mi.copy_name" style="font-size: 15px;"/>
</div>
<div t-if="txt_align == 'center'" class="text-center;">
<span t-esc="mi.copy_name" style="font-size: 15px;"/>
</div>
</t>
</t>
<div t-if="report_type == 'pdf'" class="text-muted">
Page:
<span class="page"/>
of
<span class="topage"/>
</div>
</div>
</div>
</template>
<template id="multiple_invoice_wizard_preview">
<t t-call="web.html_preview_container">
<t t-call="base_accounting_kit.new_external_layout">
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'body'">
<div t-if="body_txt_position == 'tr'" style="font-size:25px; text-align:right;">
<span>Sample Name</span>
</div>
<div t-if="body_txt_position == 'tl'" style="font-size:25px; text-align:left;">
<span>Sample Name</span>
</div>
</t>
</t>
<div class="pt-5">
<div class="address row">
<div name="address" class="col-md-5 ml-auto">
<address>
<address class="mb-0" itemscope="itemscope"
itemtype="http://schema.org/Organization">
<div>
<span itemprop="name">Deco Addict</span>
</div>
<div itemprop="address" itemscope="itemscope"
itemtype="http://schema.org/PostalAddress">
<div class="d-flex align-items-baseline">
<span class="w-100 o_force_ltr" itemprop="streetAddress">77 Santa Barbara
Rd<br/>Pleasant Hill CA 94523<br/>United States</span>
</div>
</div>
</address>
</address>
</div>
</div>
</div>
<div class="page">
<h2>
<span>Invoice</span>
<span>INV/2020/07/0003</span>
</h2>
<div id="informations" class="row mt32 mb32">
<div class="col-auto mw-100 mb-2" name="invoice_date">
<strong>Invoice Date:</strong>
<p class="m-0">07/08/2020</p>
</div>
<div class="col-auto mw-100 mb-2" name="due_date">
<strong>Due Date:</strong>
<p class="m-0">08/07/2020</p>
</div>
</div>
<table class="table table-sm o_main_table" name="invoice_line_table">
<thead>
<tr>
<th name="th_description" class="text-left"><span>Description</span></th>
<th name="th_quantity" class="text-right"><span>Quantity</span></th>
<th name="th_priceunit" class="text-right d-none d-md-table-cell"><span>Unit Price</span></th>
<th name="th_taxes" class="text-left d-none d-md-table-cell"><span>Taxes</span></th>
<th name="th_subtotal" class="text-right">
<span>Amount</span>
</th>
</tr>
</thead>
<tbody class="invoice_tbody">
<tr>
<td name="account_invoice_line_name"><span>[FURN_8999] Three-Seat Sofa<br/>
Three Seater Sofa with Lounger in Steel Grey Colour</span></td>
<td class="text-right">
<span>5.000</span>
</td>
<td class="text-right d-none d-md-table-cell">
<span class="text-nowrap">1,500.00</span>
</td>
<td class="text-left d-none d-md-table-cell">
<span id="line_tax_ids">15.00%</span>
</td>
<td class="text-right o_price_total">
<span class="text-nowrap">$ <span class="oe_currency_value">7,500.00</span></span>
</td>
</tr>
<tr>
<td name="account_invoice_line_name"><span>[FURN_8220] Four Person Desk<br/>
Four person modern office workstation</span></td>
<td class="text-right">
<span>5.000</span>
</td>
<td class="text-right d-none d-md-table-cell">
<span class="text-nowrap">23,500.00</span>
</td>
<td class="text-left d-none d-md-table-cell">
<span id="line_tax_ids">15.00%</span>
</td>
<td class="text-right o_price_total">
<span class="text-nowrap">$ <span class="oe_currency_value">117,500.00</span></span>
</td>
</tr>
</tbody>
</table>
<div class="clearfix">
<div id="total" class="row">
<div class="col-sm-7 col-md-6 ml-auto">
<table class="table table-sm" style="page-break-inside: avoid;">
<tbody><tr class="border-black o_subtotal" style="">
<td><strong>Subtotal</strong></td>
<td class="text-right">
<span>$ <span class="oe_currency_value">125,000.00</span></span>
</td>
</tr>
<tr style="">
<td><span class="text-nowrap">Tax 15%</span></td>
<td class="text-right o_price_total">
<span class="text-nowrap">$ 18,750.00</span>
</td>
</tr>
<tr class="border-black o_total">
<td><strong>Total</strong></td>
<td class="text-right">
<span class="text-nowrap">$ <span class="oe_currency_value">
143,750.00</span></span>
</td>
</tr>
</tbody></table>
</div>
</div>
</div>
<p>
Please use the following communication for your payment : <b><span>
INV/2020/07/0003</span></b>
</p>
<p name="payment_term">
<span>Payment terms: 300 Days</span>
</p>
<t t-if="mi_type == 'text'">
<t t-if="txt_position == 'body'">
<div t-if="body_txt_position == 'br'" style="font-size:25px; text-align:right;">
<span>Sample Name</span>
</div>
<div t-if="body_txt_position == 'bl'" style="font-size:25px; text-align:left;">
<span>Sample Name</span>
</div>
</t>
</t>
</div>
</t>
</t>
</template>
<template id="new_external_layout">
<t t-if="not o" t-set="o" t-value="doc"/>
<t t-if="not company">
<!-- Multicompany -->
<t t-if="company_id">
<t t-set="company" t-value="company_id"/>
</t>
<t t-elif="o and 'company_id' in o">
<t t-set="company" t-value="o.company_id.sudo()"/>
</t>
<t t-else="else">
<t t-set="company" t-value="res_company"/>
</t>
</t>
<t t-if="layout" t-call="{{layout}}"><t t-raw="0"/></t>
<t t-else="else" t-call="base_accounting_kit.standard"><t t-raw="0"/></t>
</template>
</odoo>

37
base_accounting_kit/report/multiple_invoice_report.py

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
from odoo import models, api
class ReportInvoiceMultiple(models.AbstractModel):
_name = 'report.base_accounting_kit.report_multiple_invoice'
_inherit = 'report.account.report_invoice'
@api.model
def _get_report_values(self, docids, data=None):
rslt = super()._get_report_values(docids, data)
inv = rslt['docs']
layout = inv.journal_id.company_id.external_report_layout_id.key
if layout == 'web.external_layout_boxed':
new_layout = 'base_accounting_kit.boxed'
elif layout == 'web.external_layout_bold':
new_layout = 'base_accounting_kit.bold'
elif layout == 'web.external_layout_striped':
new_layout = 'base_accounting_kit.striped'
else:
new_layout = 'base_accounting_kit.standard'
rslt['mi_type'] = inv.journal_id.multiple_invoice_type
rslt['mi_ids'] = inv.journal_id.multiple_invoice_ids
rslt['txt_position'] = inv.journal_id.text_position
rslt['body_txt_position'] = inv.journal_id.body_text_position
rslt['txt_align'] = inv.journal_id.text_align
rslt['layout'] = new_layout
rslt['report_type'] = data.get('report_type') if data else ''
return rslt

260
base_accounting_kit/report/multiple_invoice_report.xml

@ -0,0 +1,260 @@
<odoo>
<template id="report_multiple_invoice_new">
<t t-call="base_accounting_kit.new_external_layout">
<t t-set="o" t-value="o.with_context(lang=lang)" />
<t t-set="address">
<address t-field="o.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<div t-if="o.partner_id.vat" class="mt16">
<t t-if="o.company_id.country_id.vat_label" t-esc="o.company_id.country_id.vat_label" id="inv_tax_id_label"/>
<t t-else="">Tax ID</t>: <span t-field="o.partner_id.vat"/></div>
</t>
<div class="page">
<t t-set="txt_style" t-value="'font-size:25px; text-align:center;top:0px; left:15px; position:absolute; z-index:99;'"/>
<t t-if="body_txt_position == 'tr'">
<t t-set="txt_style" t-value="'font-size:25px; text-align:center;top:0px; right:15px; position:absolute; z-index:99;'"/>
</t>
<t t-if="body_txt_position == 'br'">
<t t-set="txt_style" t-value="'font-size:25px; text-align:right;'"/>
</t>
<t t-if="body_txt_position == 'bl'">
<t t-set="txt_style" t-value="'font-size:25px; text-align:left;'"/>
</t>
<h2>
<span t-if="o.move_type == 'out_invoice' and o.state == 'posted'">Invoice</span>
<span t-if="o.move_type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
<span t-if="o.move_type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span>
<span t-if="o.move_type == 'out_refund'">Credit Note</span>
<span t-if="o.move_type == 'in_refund'">Vendor Credit Note</span>
<span t-if="o.move_type == 'in_invoice'">Vendor Bill</span>
<span t-if="o.name != '/'" t-field="o.name"/>
</h2>
<div id="informations" class="row mt32 mb32">
<div class="col-auto col-3 mw-100 mb-2" t-if="o.invoice_date" name="invoice_date">
<strong>Invoice Date:</strong>
<p class="m-0" t-field="o.invoice_date"/>
</div>
<div class="col-auto col-3 mw-100 mb-2" t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted'" name="due_date">
<strong>Due Date:</strong>
<p class="m-0" t-field="o.invoice_date_due"/>
</div>
<div class="col-auto col-3 mw-100 mb-2" t-if="o.invoice_origin" name="origin">
<strong>Source:</strong>
<p class="m-0" t-field="o.invoice_origin"/>
</div>
<div class="col-auto col-3 mw-100 mb-2" t-if="o.partner_id.ref" name="customer_code">
<strong>Customer Code:</strong>
<p class="m-0" t-field="o.partner_id.ref"/>
</div>
<div class="col-auto col-3 mw-100 mb-2" t-if="o.ref" name="reference">
<strong>Reference:</strong>
<p class="m-0" t-field="o.ref"/>
</div>
</div>
<t t-set="display_discount" t-value="any(l.discount for l in o.invoice_line_ids)"/>
<table class="table table-sm o_main_table" name="invoice_line_table">
<thead>
<tr>
<th name="th_description" class="text-left"><span>Description</span></th>
<th name="th_quantity" class="text-right"><span>Quantity</span></th>
<th name="th_priceunit" t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"><span>Unit Price</span></th>
<th name="th_price_unit" t-if="display_discount" t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span>Disc.%</span>
</th>
<th name="th_taxes" t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"><span>Taxes</span></th>
<th name="th_subtotal" class="text-right">
<span groups="account.group_show_line_subtotals_tax_excluded">Amount</span>
<span groups="account.group_show_line_subtotals_tax_included">Total Price</span>
</th>
</tr>
</thead>
<tbody class="invoice_tbody">
<t t-set="current_subtotal" t-value="0"/>
<t t-set="lines" t-value="o.invoice_line_ids.sorted(key=lambda l: (-l.sequence, l.date, l.move_name, -l.id), reverse=True)"/>
<t t-foreach="lines" t-as="line">
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
<tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
<t t-if="not line.display_type" name="account_invoice_line_accountable">
<td name="account_invoice_line_name"><span t-field="line.name" t-options="{'widget': 'text'}"/></td>
<td class="text-right">
<span t-field="line.quantity"/>
<span t-field="line.product_uom_id" groups="uom.group_uom"/>
</td>
<td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span class="text-nowrap" t-field="line.price_unit"/>
</td>
<td t-if="display_discount" t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span class="text-nowrap" t-field="line.discount"/>
</td>
<td t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_ids))" id="line_tax_ids"/>
</td>
<td class="text-right o_price_total">
<span class="text-nowrap" t-field="line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<span class="text-nowrap" t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
</td>
</t>
<t t-if="line.display_type == 'line_section'">
<td colspan="99">
<span t-field="line.name" t-options="{'widget': 'text'}"/>
</td>
<t t-set="current_section" t-value="line"/>
<t t-set="current_subtotal" t-value="0"/>
</t>
<t t-if="line.display_type == 'line_note'">
<td colspan="99">
<span t-field="line.name" t-options="{'widget': 'text'}"/>
</td>
</t>
</tr>
<t t-if="current_section and (line_last or lines[line_index+1].display_type == 'line_section')">
<tr class="is-subtotal text-right">
<td colspan="99">
<strong class="mr16">Subtotal</strong>
<span
t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
/>
</td>
</tr>
</t>
</t>
</tbody>
</table>
<div class="clearfix">
<div id="total" class="row">
<div t-attf-class="#{'col-6' if report_type != 'html' else 'col-sm-7 col-md-6'} ml-auto">
<table class="table table-sm" style="page-break-inside: avoid;">
<tr class="border-black o_subtotal" style="">
<td><strong>Subtotal</strong></td>
<td class="text-right">
<span t-field="o.amount_untaxed"/>
</td>
</tr>
<t t-foreach="o.amount_by_group" t-as="amount_by_group">
<tr style="">
<t t-if="len(o.line_ids.filtered(lambda line: line.tax_line_id)) in [0, 1] and o.amount_untaxed == amount_by_group[2]">
<td><span class="text-nowrap" t-esc="amount_by_group[0]"/></td>
<td class="text-right o_price_total">
<span class="text-nowrap" t-esc="amount_by_group[3]" />
</td>
</t>
<t t-else="">
<td>
<span t-esc="amount_by_group[0]"/>
<span class="text-nowrap"> on
<t t-esc="amount_by_group[4]"/>
</span>
</td>
<td class="text-right o_price_total">
<span class="text-nowrap" t-esc="amount_by_group[3]"/>
</td>
</t>
</tr>
</t>
<tr class="border-black o_total">
<td><strong>Total</strong></td>
<td class="text-right">
<span class="text-nowrap" t-field="o.amount_total"/>
</td>
</tr>
<t t-if="print_with_payments">
<t t-if="o.payment_state != 'invoicing_legacy'">
<t t-set="payments_vals" t-value="o.sudo()._get_reconciled_info_JSON_values()"/>
<t t-foreach="payments_vals" t-as="payment_vals">
<tr>
<td>
<i class="oe_form_field text-right oe_payment_label">Paid on <t t-esc="payment_vals['date']" t-options='{"widget": "date"}'/></i>
</td>
<td class="text-right">
<span t-esc="payment_vals['amount']" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
</t>
<t t-if="len(payments_vals) > 0">
<tr class="border-black">
<td><strong>Amount Due</strong></td>
<td class="text-right">
<span t-field="o.amount_residual"/>
</td>
</tr>
</t>
</t>
</t>
</table>
</div>
</div>
</div>
<p t-if="o.move_type in ('out_invoice', 'in_refund') and o.payment_reference" name="payment_communication">
Please use the following communication for your payment : <b><span t-field="o.payment_reference"/></b>
</p>
<p t-if="o.invoice_payment_term_id" name="payment_term">
<span t-field="o.invoice_payment_term_id.note"/>
</p>
<p t-if="o.narration" name="comment">
<span t-field="o.narration"/>
</p>
<p t-if="o.fiscal_position_id.note" name="note">
<span t-field="o.fiscal_position_id.note"/>
</p>
<p t-if="o.invoice_incoterm_id" name="incoterm">
<strong>Incoterm: </strong><span t-field="o.invoice_incoterm_id.code"/> - <span t-field="o.invoice_incoterm_id.name"/>
</p>
<div id="qrcode" t-if="o.display_qr_code">
<p t-if="qr_code_urls.get(o.id)">
<strong class="text-center">Scan me with your banking app.</strong><br/><br/>
<img class="border border-dark rounded" t-att-src="qr_code_urls[o.id]"/>
</p>
</div>
<t t-if="mi_type == 'text'">
<div t-if="txt_position == 'body'" t-att-style="txt_style">
<span t-esc="mi.copy_name" />
</div>
</t>
</div>
</t>
</template>
<template id="report_multiple_invoice">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="lang" t-value="o.invoice_user_id.sudo().lang if o.move_type in ('in_invoice', 'in_refund') else o.partner_id.lang"/>
<t t-set="print_with_payments" t-value="True"/>
<t t-if="o._get_name_invoice_report() == 'account.report_invoice_document'"
t-call="account.report_invoice_document" t-lang="lang"/>
<t t-foreach="mi_ids" t-as="mi">
<t t-call="base_accounting_kit.report_multiple_invoice_new" t-lang="lang"/>
</t>
</t>
</t>
</template>
<record id="report_multiple_invoice_copies" model="ir.actions.report">
<field name="name">Multiple Invoice Copies</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.report_multiple_invoice</field>
<field name="report_file">base_accounting_kit.report_multiple_invoice</field>
<field name="binding_model_id" ref="account.model_account_move"/>
<field name="binding_type">report</field>
</record>
</odoo>

96
base_accounting_kit/report/report.xml

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- # Financial report -->
<record id="financial_report_pdf" model="ir.actions.report">
<field name="name">Financial reports</field>
<field name="model">financial.report</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.report_financial</field>
<field name="report_file">base_accounting_kit.report_financial</field>
</record>
<!-- # General ledger report -->
<record id="action_report_general_ledger" model="ir.actions.report">
<field name="name">General Ledger</field>
<field name="model">account.report.general.ledger</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.report_general_ledger</field>
<field name="report_file">base_accounting_kit.report_general_ledger</field>
</record>
<!-- # Partner ledger report -->
<record id="action_report_partnerledger" model="ir.actions.report">
<field name="name">Partner Ledger</field>
<field name="model">account.report.partner.ledger</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.report_partnerledger</field>
<field name="report_file">base_accounting_kit.report_partnerledger</field>
</record>
<!-- # Ageing report -->
<record id="action_report_aged_partner_balance" model="ir.actions.report">
<field name="name">Aged Partner Balance</field>
<field name="model">res.partner</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.report_agedpartnerbalance</field>
<field name="report_file">base_accounting_kit.report_agedpartnerbalance</field>
</record>
<!-- # Journal audit report -->
<record id="action_report_journal" model="ir.actions.report">
<field name="name">Journals Audit</field>
<field name="model">account.common.journal.report</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.report_journal_audit</field>
<field name="report_file">base_accounting_kit.report_journal_audit</field>
</record>
<!-- # Tax report -->
<record id="action_report_account_tax" model="ir.actions.report">
<field name="name">Tax Report</field>
<field name="model">kit.account.tax.report</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.report_tax</field>
<field name="report_file">base_accounting_kit.report_tax</field>
</record>
<!-- # Trial balance report -->
<record id="action_report_trial_balance" model="ir.actions.report">
<field name="name">Trial Balance</field>
<field name="model">account.balance.report</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.report_trial_balance</field>
<field name="report_file">base_accounting_kit.report_trial_balance</field>
</record>
<!-- # CAsh flow statements -->
<record id="action_report_cash_flow" model="ir.actions.report">
<field name="name">Cash Flow Statement</field>
<field name="model">account.financial.report</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.report_cash_flow</field>
<field name="report_file">base_accounting_kit.report_cash_flow</field>
</record>
<!-- # Accounting Bank Book Report -->
<record id="action_report_bank_book" model="ir.actions.report">
<field name="name">Bank Book Report</field>
<field name="model">account.bank.book.report</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.report_bank_book</field>
<field name="report_file">base_accounting_kit.report_bank_book</field>
<field name="attachment_use">False</field>
</record>
<!-- # Accounting Cash Book Report -->
<record id="action_report_cash_book" model="ir.actions.report">
<field name="name">Cash Book Report</field>
<field name="model">account.cash.book.report</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.report_cash_book</field>
<field name="report_file">base_accounting_kit.report_cash_book</field>
<field name="attachment_use">False</field>
</record>
<!-- # Accounting Day Book Report -->
<record id="day_book_pdf_report" model="ir.actions.report">
<field name="name">Day Book PDF Report</field>
<field name="model">account.day.book.report</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">base_accounting_kit.day_book_report_template</field>
<field name="report_file">base_accounting_kit.day_book_report_template</field>
<field name="attachment_use">True</field>
</record>
</odoo>

303
base_accounting_kit/report/report_aged_partner.py

@ -0,0 +1,303 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
import time
from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo import api, models, _
from odoo.exceptions import UserError
from odoo.tools import float_is_zero
class ReportAgedPartnerBalance(models.AbstractModel):
_name = 'report.base_accounting_kit.report_agedpartnerbalance'
_description = 'Aged Partner Balance Report'
def _get_partner_move_lines(self, account_type, date_from, target_move,
period_length):
# This method can receive the context key 'include_nullified_amount' {Boolean}
# Do an invoice and a payment and unreconcile. The amount will be nullified
# By default, the partner wouldn't appear in this report.
# The context key allow it to appear
# In case of a period_length of 30 days as of 2019-02-08, we want the following periods:
# Name Stop Start
# 1 - 30 : 2019-02-07 - 2019-01-09
# 31 - 60 : 2019-01-08 - 2018-12-10
# 61 - 90 : 2018-12-09 - 2018-11-10
# 91 - 120 : 2018-11-09 - 2018-10-11
# +120 : 2018-10-10
periods = {}
start = datetime.strptime(date_from, "%Y-%m-%d")
date_from = datetime.strptime(date_from, "%Y-%m-%d").date()
for i in range(5)[::-1]:
stop = start - relativedelta(days=period_length)
period_name = str((5 - (i + 1)) * period_length + 1) + '-' + str(
(5 - i) * period_length)
period_stop = (start - relativedelta(days=1)).strftime('%Y-%m-%d')
if i == 0:
period_name = '+' + str(4 * period_length)
periods[str(i)] = {
'name': period_name,
'stop': period_stop,
'start': (i != 0 and stop.strftime('%Y-%m-%d') or False),
}
start = stop
res = []
total = []
cr = self.env.cr
user_company = self.env.company
user_currency = user_company.currency_id
ResCurrency = self.env['res.currency'].with_context(date=date_from)
company_ids = self._context.get('company_ids') or [user_company.id]
move_state = ['draft', 'posted']
if target_move == 'posted':
move_state = ['posted']
arg_list = (tuple(move_state), tuple(account_type))
# build the reconciliation clause to see what partner needs to be printed
reconciliation_clause = '(l.reconciled IS FALSE)'
cr.execute(
'SELECT debit_move_id, credit_move_id FROM account_partial_reconcile where max_date > %s',
(date_from,))
reconciled_after_date = []
for row in cr.fetchall():
reconciled_after_date += [row[0], row[1]]
if reconciled_after_date:
reconciliation_clause = '(l.reconciled IS FALSE OR l.id IN %s)'
arg_list += (tuple(reconciled_after_date),)
arg_list += (date_from, tuple(company_ids))
query = '''
SELECT DISTINCT l.partner_id, UPPER(res_partner.name)
FROM account_move_line AS l left join res_partner on l.partner_id = res_partner.id, account_account, account_move am
WHERE (l.account_id = account_account.id)
AND (l.move_id = am.id)
AND (am.state IN %s)
AND (account_account.internal_type IN %s)
AND ''' + reconciliation_clause + '''
AND (l.date <= %s)
AND l.company_id IN %s
ORDER BY UPPER(res_partner.name)'''
cr.execute(query, arg_list)
partners = cr.dictfetchall()
# put a total of 0
for i in range(7):
total.append(0)
# Build a string like (1,2,3) for easy use in SQL query
partner_ids = [partner['partner_id'] for partner in partners if
partner['partner_id']]
lines = dict(
(partner['partner_id'] or False, []) for partner in partners)
if not partner_ids:
return [], [], {}
# This dictionary will store the not due amount of all partners
undue_amounts = {}
query = '''SELECT l.id
FROM account_move_line AS l, account_account, account_move am
WHERE (l.account_id = account_account.id) AND (l.move_id = am.id)
AND (am.state IN %s)
AND (account_account.internal_type IN %s)
AND (COALESCE(l.date_maturity,l.date) >= %s)\
AND ((l.partner_id IN %s) OR (l.partner_id IS NULL))
AND (l.date <= %s)
AND l.company_id IN %s'''
cr.execute(query, (
tuple(move_state), tuple(account_type), date_from,
tuple(partner_ids), date_from, tuple(company_ids)))
aml_ids = cr.fetchall()
aml_ids = aml_ids and [x[0] for x in aml_ids] or []
for line in self.env['account.move.line'].browse(aml_ids):
partner_id = line.partner_id.id or False
if partner_id not in undue_amounts:
undue_amounts[partner_id] = 0.0
line_amount = ResCurrency._compute(line.company_id.currency_id,
user_currency, line.balance)
if user_currency.is_zero(line_amount):
continue
for partial_line in line.matched_debit_ids:
if partial_line.max_date <= date_from:
line_amount += ResCurrency._compute(
partial_line.company_id.currency_id, user_currency,
partial_line.amount)
for partial_line in line.matched_credit_ids:
if partial_line.max_date <= date_from:
line_amount -= ResCurrency._compute(
partial_line.company_id.currency_id, user_currency,
partial_line.amount)
if not self.env.company.currency_id.is_zero(line_amount):
undue_amounts[partner_id] += line_amount
lines[partner_id].append({
'line': line,
'amount': line_amount,
'period': 6,
})
# Use one query per period and store results in history (a list variable)
# Each history will contain: history[1] = {'<partner_id>': <partner_debit-credit>}
history = []
for i in range(5):
args_list = (
tuple(move_state), tuple(account_type), tuple(partner_ids),)
dates_query = '(COALESCE(l.date_maturity,l.date)'
if periods[str(i)]['start'] and periods[str(i)]['stop']:
dates_query += ' BETWEEN %s AND %s)'
args_list += (
periods[str(i)]['start'], periods[str(i)]['stop'])
elif periods[str(i)]['start']:
dates_query += ' >= %s)'
args_list += (periods[str(i)]['start'],)
else:
dates_query += ' <= %s)'
args_list += (periods[str(i)]['stop'],)
args_list += (date_from, tuple(company_ids))
query = '''SELECT l.id
FROM account_move_line AS l, account_account, account_move am
WHERE (l.account_id = account_account.id) AND (l.move_id = am.id)
AND (am.state IN %s)
AND (account_account.internal_type IN %s)
AND ((l.partner_id IN %s) OR (l.partner_id IS NULL))
AND ''' + dates_query + '''
AND (l.date <= %s)
AND l.company_id IN %s'''
cr.execute(query, args_list)
partners_amount = {}
aml_ids = cr.fetchall()
aml_ids = aml_ids and [x[0] for x in aml_ids] or []
for line in self.env['account.move.line'].browse(aml_ids):
partner_id = line.partner_id.id or False
if partner_id not in partners_amount:
partners_amount[partner_id] = 0.0
line_amount = ResCurrency._compute(line.company_id.currency_id,
user_currency, line.balance)
if user_currency.is_zero(line_amount):
continue
for partial_line in line.matched_debit_ids:
if partial_line.max_date <= date_from:
line_amount += ResCurrency._compute(
partial_line.company_id.currency_id, user_currency,
partial_line.amount)
for partial_line in line.matched_credit_ids:
if partial_line.max_date <= date_from:
line_amount -= ResCurrency._compute(
partial_line.company_id.currency_id, user_currency,
partial_line.amount)
if not self.env.company.currency_id.is_zero(
line_amount):
partners_amount[partner_id] += line_amount
lines[partner_id].append({
'line': line,
'amount': line_amount,
'period': i + 1,
})
history.append(partners_amount)
for partner in partners:
if partner['partner_id'] is None:
partner['partner_id'] = False
at_least_one_amount = False
values = {}
undue_amt = 0.0
if partner[
'partner_id'] in undue_amounts: # Making sure this partner actually was found by the query
undue_amt = undue_amounts[partner['partner_id']]
total[6] = total[6] + undue_amt
values['direction'] = undue_amt
if not float_is_zero(values['direction'],
precision_rounding=self.env.company.currency_id.rounding):
at_least_one_amount = True
for i in range(5):
during = False
if partner['partner_id'] in history[i]:
during = [history[i][partner['partner_id']]]
# Adding counter
total[(i)] = total[(i)] + (during and during[0] or 0)
values[str(i)] = during and during[0] or 0.0
if not float_is_zero(values[str(i)],
precision_rounding=self.env.company.currency_id.rounding):
at_least_one_amount = True
values['total'] = sum(
[values['direction']] + [values[str(i)] for i in range(5)])
## Add for total
total[(i + 1)] += values['total']
values['partner_id'] = partner['partner_id']
if partner['partner_id']:
browsed_partner = self.env['res.partner'].browse(
partner['partner_id'])
values['name'] = browsed_partner.name and len(
browsed_partner.name) >= 45 and browsed_partner.name[
0:40] + '...' or browsed_partner.name
values['trust'] = browsed_partner.trust
else:
values['name'] = _('Unknown Partner')
values['trust'] = False
if at_least_one_amount or (
self._context.get('include_nullified_amount') and lines[
partner['partner_id']]):
res.append(values)
return res, total, lines
@api.model
def _get_report_values(self, docids, data=None):
if not data.get('form') or not self.env.context.get(
'active_model') or not self.env.context.get('active_id'):
raise UserError(
_("Form content is missing, this report cannot be printed."))
total = []
model = self.env.context.get('active_model')
docs = self.env[model].browse(self.env.context.get('active_id'))
target_move = data['form'].get('target_move', 'all')
date_from = data['form'].get('date_from', time.strftime('%Y-%m-%d'))
if data['form']['result_selection'] == 'customer':
account_type = ['receivable']
elif data['form']['result_selection'] == 'supplier':
account_type = ['payable']
else:
account_type = ['payable', 'receivable']
movelines, total, dummy = self._get_partner_move_lines(account_type,
date_from,
target_move,
data['form'][
'period_length'])
return {
'doc_ids': self.ids,
'doc_model': model,
'data': data['form'],
'docs': docs,
'time': time,
'get_partner_lines': movelines,
'get_direction': total,
}

98
base_accounting_kit/report/report_aged_partner.xml

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_agedpartnerbalance">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>
<t t-call="web.internal_layout">
<div class="page">
<h2>Aged Partner Balance</h2>
<div class="row mt32">
<div class="col-3">
<strong>Start Date:</strong>
<p t-esc="data['date_from']"/>
</div>
<div class="col-3">
<strong>Period Length (days)</strong>
<p t-esc="data['period_length']"/>
</div>
</div>
<div class="row mb32">
<div class="col-3">
<strong>Partner's:</strong>
<p>
<span t-if="data['result_selection'] == 'customer'">Receivable Accounts</span>
<span t-if="data['result_selection'] == 'supplier'">Payable Accounts</span>
<span t-if="data['result_selection'] == 'customer_supplier'">Receivable and Payable Accounts</span>
</p>
</div>
<div class="col-3">
<strong>Target Moves:</strong>
<p>
<span t-if="data['target_move'] == 'all'">All Entries</span>
<span t-if="data['target_move'] == 'posted'">All Posted Entries</span>
</p>
</div>
</div>
<table class="table table-sm table-reports">
<thead>
<tr>
<th>Partners</th>
<th class="text-right">
<span>Not due</span>
</th>
<th class="text-right"><span t-esc="data['4']['name']"/></th>
<th class="text-right"><span t-esc="data['3']['name']"/></th>
<th class="text-right"><span t-esc="data['2']['name']"/></th>
<th class="text-right"><span t-esc="data['1']['name']"/></th>
<th class="text-right"><span t-esc="data['0']['name']"/></th>
<th class="text-right">Total</th>
</tr>
<tr t-if="get_partner_lines">
<th>Account Total</th>
<th class="text-right"><span t-esc="get_direction[6]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th>
<th class="text-right"><span t-esc="get_direction[4]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th>
<th class="text-right"><span t-esc="get_direction[3]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th>
<th class="text-right"><span t-esc="get_direction[2]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th>
<th class="text-right"><span t-esc="get_direction[1]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th>
<th class="text-right"><span t-esc="get_direction[0]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th>
<th class="text-right"><span t-esc="get_direction[5]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th>
</tr>
</thead>
<tbody>
<tr t-foreach="get_partner_lines" t-as="partner">
<td>
<span t-esc="partner['name']"/>
</td>
<td class="text-right">
<span t-esc="partner['direction']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="partner['4']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="partner['3']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="partner['2']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="partner['1']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="partner['0']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="partner['total']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>

119
base_accounting_kit/report/report_financial.py

@ -0,0 +1,119 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, fields, models
# ---------------------------------------------------------
# Account Financial Report
# ---------------------------------------------------------
class AccountFinancialReport(models.Model):
_name = "account.financial.report"
_description = "Account Report"
_rec_name = 'name'
@api.depends('parent_id', 'parent_id.level')
def _get_level(self):
"""Returns a dictionary with key=the ID of a record and
value = the level of this
record in the tree structure."""
for report in self:
level = 0
if report.parent_id:
level = report.parent_id.level + 1
report.level = level
def _get_children_by_order(self):
"""returns a recordset of all the children computed recursively,
and sorted by sequence. Ready for the printing"""
res = self
children = self.search([('parent_id', 'in', self.ids)],
order='sequence ASC')
if children:
for child in children:
res += child._get_children_by_order()
return res
name = fields.Char('Report Name', required=True, translate=True)
parent_id = fields.Many2one('account.financial.report', 'Parent')
children_ids = fields.One2many(
'account.financial.report',
'parent_id',
'Account Report')
sequence = fields.Integer('Sequence')
level = fields.Integer(compute='_get_level', string='Level', store=True)
type = fields.Selection(
[('sum', 'View'),
('accounts', 'Accounts'),
('account_type', 'Account Type'),
('account_report', 'Report Value')],
'Type',
default='sum')
account_ids = fields.Many2many(
'account.account',
'account_account_financial_report',
'report_line_id',
'account_id',
'Accounts')
account_report_id = fields.Many2one(
'account.financial.report',
'Report Value')
account_type_ids = fields.Many2many(
'account.account.type',
'account_account_financial_report_type',
'report_id', 'account_type_id',
'Account Types')
sign = fields.Selection(
[("-1", 'Reverse balance sign'), ("1", 'Preserve balance sign')],
'Sign on Reports', required=True, default="1",
help='For accounts that are typically more'
' debited than credited and that you'
' would like to print as negative'
' amounts in your reports, you should'
' reverse the sign of the balance;'
' e.g.: Expense account. The same applies'
' for accounts that are typically more'
' credited than debited and that you would'
' like to print as positive amounts in'
' your reports; e.g.: Income account.')
display_detail = fields.Selection(
[('no_detail', 'No detail'),
('detail_flat', 'Display children flat'),
('detail_with_hierarchy', 'Display children with hierarchy')],
'Display details',
default='detail_flat')
style_overwrite = fields.Selection(
[('0', 'Automatic formatting'),
('1', 'Main Title 1 (bold, underlined)'),
('2', 'Title 2 (bold)'),
('3', 'Title 3 (bold, smaller)'),
('4', 'Normal Text'),
('5', 'Italic Text (smaller)'),
('6', 'Smallest Text')],
'Financial Report Style',
default='0',
help="You can set up here the format you want this"
" record to be displayed. If you leave the"
" automatic formatting, it will be computed"
" based on the financial reports hierarchy "
"(auto-computed field 'level').")

146
base_accounting_kit/report/report_financial.xml

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_financial">
<t t-call="web.html_container">
<t t-call="web.internal_layout">
<t t-set="data_report_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>
<div class="page">
<h2 t-esc="data['form']['account_report_id'][1]"/>
<div class="row mt32 mb32">
<div class="col-4">
<strong>Target Moves:</strong>
<p>
<span t-if="data['form']['target_move'] == 'all'">All Entries</span>
<span t-if="data['form']['target_move'] == 'posted'">All Posted Entries</span>
</p>
</div>
<div class="col-4">
<p>
<t t-if="data['form']['date_from']">
<strong>Date from :</strong>
<span t-esc="data['form']['date_from']"/>
<br/>
</t>
<t t-if="data['form']['date_to']">
<strong>Date to :</strong>
<span t-esc="data['form']['date_to']"/>
</t>
</p>
</div>
</div>
<table class="table table-sm table-reports" t-if="data['form']['debit_credit'] == 1">
<thead>
<tr>
<th>Name</th>
<th class="text-right">Debit</th>
<th class="text-right">Credit</th>
<th class="text-right">Balance</th>
</tr>
</thead>
<tbody>
<tr t-foreach="report_lines" t-as="a">
<t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: normal;'"/>
</t>
<t t-if="not a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: bold;'"/>
</t>
<td>
<span style="color: white;" t-esc="'..' * a.get('level', 0)"/>
<span t-att-style="style" t-esc="a.get('name')"/>
</td>
<td class="text-right" style="white-space: text-nowrap;">
<span t-att-style="style" t-esc="a.get('debit')"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right" style="white-space: text-nowrap;">
<span t-att-style="style" t-esc="a.get('credit')"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right" style="white-space: text-nowrap;">
<span t-att-style="style" t-esc="a.get('balance')"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
</t>
</tr>
</tbody>
</table>
<table class="table table-sm table-reports"
t-if="not data['form']['enable_filter'] and not data['form']['debit_credit']">
<thead>
<tr>
<th>Name</th>
<th class="text-right">Balance</th>
</tr>
</thead>
<tbody>
<tr t-foreach="report_lines" t-as="a">
<t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: normal;'"/>
</t>
<t t-if="not a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: bold;'"/>
</t>
<td>
<span style="color: white;" t-esc="'..' * a.get('level', 0)"/>
<span t-att-style="style" t-esc="a.get('name')"/>
</td>
<td class="text-right">
<span t-att-style="style" t-esc="a.get('balance')"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
</t>
</tr>
</tbody>
</table>
<table class="table table-sm table-reports"
t-if="data['form']['enable_filter'] == 1 and not data['form']['debit_credit']">
<thead>
<tr>
<th>Name</th>
<th class="text-right">Balance</th>
<th class="text-right">
<!-- <span t-esc="data['form']['label_filter']"/>-->
<span>Comp</span>
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="report_lines" t-as="a">
<t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: normal;'"/>
</t>
<t t-if="not a.get('level') &gt; 3">
<t t-set="style" t-value="'font-weight: bold;'"/>
</t>
<td>
<span style="color: white;" t-esc="'..'"/>
<span t-att-style="style" t-esc="a.get('name')"/>
</td>
<td class="text-right">
<span t-att-style="style" t-esc="a.get('balance')"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-att-style="style" t-esc="a.get('balance_cmp')"/>
</td>
</t>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save