Browse Source

Jan 22 [UPDT] : Updated 'base_accounting_kit'

pull/313/head
AjmalCybro 1 year ago
parent
commit
7ad7336d3f
  1. 14
      base_accounting_kit/__manifest__.py
  2. 11
      base_accounting_kit/data/account_financial_report_data.xml
  3. 2
      base_accounting_kit/data/account_pdc_data.xml
  4. 36
      base_accounting_kit/data/cash_flow_data.xml
  5. 7
      base_accounting_kit/data/followup_levels.xml
  6. 2
      base_accounting_kit/data/multiple_invoice_data.xml
  7. 2
      base_accounting_kit/data/recurring_entry_cron.xml
  8. 8
      base_accounting_kit/doc/RELEASE_NOTES.md
  9. 36
      base_accounting_kit/models/account_account.py
  10. 301
      base_accounting_kit/models/account_asset.py
  11. 16
      base_accounting_kit/models/account_followup.py
  12. 23
      base_accounting_kit/models/account_journal.py
  13. 64
      base_accounting_kit/models/account_move.py
  14. 3
      base_accounting_kit/models/credit_limit.py
  15. 3
      base_accounting_kit/models/multiple_invoice.py
  16. 12
      base_accounting_kit/models/multiple_invoice_layout.py
  17. 8
      base_accounting_kit/models/product_template.py
  18. 26
      base_accounting_kit/models/recurring_payments.py
  19. 46
      base_accounting_kit/models/res_company.py
  20. 8
      base_accounting_kit/models/res_config_settings.py
  21. 13
      base_accounting_kit/models/res_partner.py
  22. 38
      base_accounting_kit/report/account_asset_report.py
  23. 56
      base_accounting_kit/report/account_asset_report_views.xml
  24. 31
      base_accounting_kit/report/account_bank_book.py
  25. 53
      base_accounting_kit/report/account_bank_book_view.xml
  26. 59
      base_accounting_kit/report/account_cash_book.py
  27. 261
      base_accounting_kit/report/account_cash_book_view.xml
  28. 22
      base_accounting_kit/report/account_day_book.py
  29. 57
      base_accounting_kit/report/account_day_book_view.xml
  30. 20
      base_accounting_kit/report/account_report_common_account.py
  31. 33
      base_accounting_kit/report/cash_flow_report.py
  32. 79
      base_accounting_kit/report/cash_flow_report.xml
  33. 40
      base_accounting_kit/report/general_ledger_report.py
  34. 122
      base_accounting_kit/report/general_ledger_report.xml
  35. 786
      base_accounting_kit/report/multiple_invoice_layouts.xml
  36. 12
      base_accounting_kit/report/multiple_invoice_report.py
  37. 529
      base_accounting_kit/report/multiple_invoice_report.xml
  38. 148
      base_accounting_kit/report/report.xml
  39. 47
      base_accounting_kit/report/report_aged_partner.py
  40. 113
      base_accounting_kit/report/report_aged_partner.xml
  41. 20
      base_accounting_kit/report/report_financial.py
  42. 89
      base_accounting_kit/report/report_financial.xml
  43. 26
      base_accounting_kit/report/report_journal_audit.py
  44. 39
      base_accounting_kit/report/report_journal_audit.xml
  45. 13
      base_accounting_kit/report/report_partner_ledger.py
  46. 33
      base_accounting_kit/report/report_partner_ledger.xml
  47. 14
      base_accounting_kit/report/report_tax.py
  48. 29
      base_accounting_kit/report/report_tax.xml
  49. 19
      base_accounting_kit/report/report_trial_balance.py
  50. 59
      base_accounting_kit/report/report_trial_balance.xml
  51. 28
      base_accounting_kit/security/security.xml
  52. 249
      base_accounting_kit/views/account_asset_views.xml
  53. 4
      base_accounting_kit/views/account_configuration.xml
  54. 220
      base_accounting_kit/views/account_followup.xml
  55. 23
      base_accounting_kit/views/account_group.xml
  56. 18
      base_accounting_kit/views/account_move_views.xml
  57. 21
      base_accounting_kit/views/account_payment_view.xml
  58. 40
      base_accounting_kit/views/accounting_menu.xml
  59. 145
      base_accounting_kit/views/credit_limit_view.xml
  60. 244
      base_accounting_kit/views/followup_report.xml
  61. 17
      base_accounting_kit/views/multiple_invoice_form.xml
  62. 78
      base_accounting_kit/views/multiple_invoice_layout_view.xml
  63. 2
      base_accounting_kit/views/product_template_views.xml
  64. 2
      base_accounting_kit/views/product_views.xml
  65. 178
      base_accounting_kit/views/recurring_payments_view.xml
  66. 158
      base_accounting_kit/views/reports_config_view.xml
  67. 71
      base_accounting_kit/views/res_config_view.xml
  68. 19
      base_accounting_kit/wizard/account_bank_book_wizard.py
  69. 80
      base_accounting_kit/wizard/account_bank_book_wizard_view.xml
  70. 24
      base_accounting_kit/wizard/account_cash_book_wizard.py
  71. 82
      base_accounting_kit/wizard/account_cash_book_wizard_view.xml
  72. 8
      base_accounting_kit/wizard/account_day_book_wizard.py
  73. 74
      base_accounting_kit/wizard/account_day_book_wizard_view.xml
  74. 12
      base_accounting_kit/wizard/account_lock_date.py
  75. 14
      base_accounting_kit/wizard/account_lock_date.xml
  76. 23
      base_accounting_kit/wizard/account_report_common_partner.py
  77. 13
      base_accounting_kit/wizard/aged_partner.py
  78. 11
      base_accounting_kit/wizard/aged_partner.xml
  79. 21
      base_accounting_kit/wizard/asset_depreciation_confirmation_wizard.py
  80. 35
      base_accounting_kit/wizard/asset_depreciation_confirmation_wizard_views.xml
  81. 47
      base_accounting_kit/wizard/asset_modify.py
  82. 36
      base_accounting_kit/wizard/asset_modify_views.xml
  83. 34
      base_accounting_kit/wizard/cash_flow_report.py
  84. 20
      base_accounting_kit/wizard/cash_flow_report.xml
  85. 74
      base_accounting_kit/wizard/financial_report.py
  86. 115
      base_accounting_kit/wizard/financial_report.xml
  87. 7
      base_accounting_kit/wizard/general_ledger.py
  88. 6
      base_accounting_kit/wizard/general_ledger.xml
  89. 4
      base_accounting_kit/wizard/journal_audit.py
  90. 25
      base_accounting_kit/wizard/journal_audit.xml
  91. 13
      base_accounting_kit/wizard/partner_ledger.py
  92. 8
      base_accounting_kit/wizard/partner_ledger.xml
  93. 26
      base_accounting_kit/wizard/tax_report.py
  94. 7
      base_accounting_kit/wizard/tax_report.xml
  95. 9
      base_accounting_kit/wizard/trial_balance.py
  96. 7
      base_accounting_kit/wizard/trial_balance.xml

14
base_accounting_kit/__manifest__.py

@ -21,14 +21,16 @@
#############################################################################
{
'name': 'Odoo 17 Full Accounting Kit',
'version': '17.0.1.0.0',
'version': '17.0.1.0.1',
'category': 'Accounting',
'summary': """Odoo 17 Accounting, Asset and Budget Management,Accounting Reports, PDC,
'summary': """Odoo 17 Accounting, Asset and Budget Management,
Accounting Reports, PDC,
Lock dates, Credit Limit, Follow Ups, Day-Bank-Cash book reports.""",
'description': """ Odoo 17 Accounting, The module used to manage the Full Account Features.
that can manage the Account Reports,Journals Asset and Budget Management,
Accounting Reports, PDC, Lock dates, Credit Limit, Follow Ups,
Day-Bank-Cash book report, odoo17, odoo17 accounting, odoo accounting, v17 accounting,Odoo 17 Accounting, odoo apps""",
'description': """ Odoo 17 Accounting, The module used to manage the Full
Account Features that can manage the Account Reports,Journals Asset and
Budget Management, Accounting Reports, PDC, Lock dates, Credit Limit,
Follow Ups, Day-Bank-Cash book report, odoo17, odoo17 accounting,
odoo accounting, v17 accounting,Odoo 17 Accounting, odoo apps""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',

11
base_accounting_kit/data/account_financial_report_data.xml

@ -8,7 +8,6 @@
<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>
@ -29,7 +28,6 @@
<field name="type">account_type</field>
<field name="account_type_ids">income_other</field>
</record>
<record id="financial_report_gross_profit"
model="account.financial.report">
<field name="name">Gross Profit</field>
@ -39,7 +37,6 @@
<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>
@ -50,7 +47,6 @@
<field name="type">account_type</field>
<field name="account_type_ids">expense_direct_cost</field>
</record>
<record id="account_financial_report_operating_income0"
model="account.financial.report">
<field name="name">Operating Income</field>
@ -61,7 +57,6 @@
<field name="type">account_type</field>
<field name="account_type_ids">income</field>
</record>
<record id="account_financial_report_expense0"
model="account.financial.report">
<field name="name">Expense</field>
@ -73,13 +68,11 @@
<field name="type">account_type</field>
<field name="account_type_ids">expense</field>
</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>
@ -89,7 +82,6 @@
<field name="type">account_type</field>
<field name="account_type_ids">income_other</field>
</record>
<record id="account_financial_report_liabilitysum0"
model="account.financial.report">
<field name="name">Liability</field>
@ -99,7 +91,6 @@
<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>
@ -109,7 +100,6 @@
<field name="type">account_type</field>
<field name="account_type_ids">income_other</field>
</record>
<record id="account_financial_report_profitloss_toreport0"
model="account.financial.report">
<field name="name">Profit (Loss) to report</field>
@ -120,7 +110,6 @@
<field name="account_report_id"
ref="account_financial_report_profitandloss0"/>
</record>
<record id="account_common_report_view" model="ir.ui.view">
<field name="name">Common Report</field>
<field name="model">account.report</field>

2
base_accounting_kit/data/account_pdc_data.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- Account payment method-->
<!-- Account payment method-->
<record id="account_payment_method_pdc_in"
model="account.payment.method">
<field name="name">PDC</field>

36
base_accounting_kit/data/cash_flow_data.xml

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- Records for the account.financial.report model-->
<record id="account_financial_report_cash_flow0" model="account.financial.report">
<data noupdate="1">
<!-- Records for the account.financial.report model-->
<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">
<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>
@ -22,7 +22,6 @@
<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>
@ -30,46 +29,47 @@
<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">
<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="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="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">
<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="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="parent_id"
ref="account_financial_report_financing_activity1"/>
<field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field>
</record>

7
base_accounting_kit/data/followup_levels.xml

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- Data file for the follow-up lines-->
<record model="followup.line" id="followup_line_id" >
<!-- Data file for the follow-up lines-->
<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')])]"/>
<field name="followup_line_ids"
eval="[(6,0,[ref('followup_line_id')])]"/>
</record>
</data>
</odoo>

2
base_accounting_kit/data/multiple_invoice_data.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- Data file for the Multiple Invoice-->
<!-- Data file for the Multiple Invoice-->
<record id="multiple_invoice_sample_name" model="multiple.invoice">
<field name="copy_name">Sample Name</field>
</record>

2
base_accounting_kit/data/recurring_entry_cron.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding='UTF-8'?>
<odoo>
<data noupdate="1">
<!-- The schedular action for Recurring Entries-->
<!-- The schedular action for Recurring Entries-->
<record id="recurring_template_cron" model="ir.cron">
<field name="name">Generate Recurring Entries</field>
<field name="model_id" ref="model_account_recurring_payments"/>

8
base_accounting_kit/doc/RELEASE_NOTES.md

@ -1,7 +1,11 @@
## Module <base_accounting_kit>
#### 06.11.2022
#### Version 16.0.1.0.0
#### 06.11.2023
#### Version 17.0.1.0.0
#### ADD
- Initial commit for Odoo 17 Full Accounting Kit
#### 15.01.2024
#### Version 17.0.1.0.1
##### UPDT
- Bug Fix-Resolved the alignment issues.

36
base_accounting_kit/models/account_account.py

@ -30,11 +30,14 @@ class CashFlow(models.Model):
def get_cash_flow_ids(self):
"""Returns a list of cashflows for the account"""
cash_flow_id = self.env.ref('base_accounting_kit.account_financial_report_cash_flow0')
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)
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):
@ -63,7 +66,8 @@ class AccountCommonReport(models.Model):
comodel_name='account.journal',
string='Journals',
required=True,
default=lambda self: self.env['account.journal'].search([('company_id', '=', self.company_id.id)]),
default=lambda self: self.env['account.journal'].search(
[('company_id', '=', self.company_id.id)]),
domain="[('company_id', '=', company_id)]")
date_from = fields.Date(string='Start Date')
date_to = fields.Date(string='End Date')
@ -84,8 +88,10 @@ class AccountCommonReport(models.Model):
def _build_contexts(self, data):
"""Builds the context information for the given data"""
result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or ''
result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][
'journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form'][
'target_move'] or ''
result['date_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False
result['strict_range'] = True if result['date_from'] else False
@ -103,9 +109,12 @@ class AccountCommonReport(models.Model):
data = {}
data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move', 'company_id'])[0]
data['form'] = self.read(
['date_from', 'date_to', 'journal_ids', 'target_move',
'company_id'])[0]
used_context = self._build_contexts(data)
data['form']['used_context'] = dict(used_context, lang=get_lang(self.env).code)
data['form']['used_context'] = dict(used_context,
lang=get_lang(self.env).code)
return self.with_context(discard_logo_check=True)._print_report(data)
@ -152,16 +161,21 @@ class AccountCommonJournalReport(models.TransientModel):
data = {}
data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move', 'company_id'])[0]
data['form'] = self.read(
['date_from', 'date_to', 'journal_ids', 'target_move',
'company_id'])[0]
used_context = self._build_contexts(data)
data['form']['used_context'] = dict(used_context, lang=get_lang(self.env).code)
data['form']['used_context'] = dict(used_context,
lang=get_lang(self.env).code)
return self.with_context(discard_logo_check=True)._print_report(data)
def _build_contexts(self, data):
"""Builds the context information for the given data"""
result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or ''
result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][
'journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form'][
'target_move'] or ''
result['date_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False
result['strict_range'] = True if result['date_from'] else False

301
base_accounting_kit/models/account_asset.py

@ -21,9 +21,7 @@
#############################################################################
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
@ -47,48 +45,82 @@ class AccountAssetCategory(models.Model):
readonly=True, hide=True)
account_analytic_id = fields.Many2one('account.analytic.account',
string='Analytic Account',
domain="[('company_id', '=', company_id)]")
domain="[('company_id', '=', "
"company_id)]")
account_asset_id = fields.Many2one('account.account',
string='Asset Account', required=True,
domain="[('account_type', '!=', 'asset_receivable'),('account_type', '!=', 'liability_payable'),('account_type', '!=', 'asset_cash'),('account_type', '!=', 'liability_credit_card'),('deprecated', '=', False)]",
help="Account used to record the purchase of the asset at its original price.")
domain="[('account_type', '!=', "
"'asset_receivable'),"
"('account_type', '!=', "
"'liability_payable'),"
"('account_type', '!=', "
"'asset_cash'),('account_type', "
"'!=', 'liability_credit_card'),"
"('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 Account',
required=True,
domain="[('account_type', '!=', 'asset_receivable'),('account_type', '!=', 'liability_payable'),('account_type', '!=', 'asset_cash'),('account_type', '!=', 'liability_credit_card'),('deprecated', '=', False),('company_id', '=', company_id)]",
help="Account used in the depreciation entries, to decrease the asset value.")
domain="[('account_type', '!=', 'asset_receivable'),('account_type',"
" '!=', 'liability_payable'),"
"('account_type', '!=', 'asset_cash')"
",('account_type', '!=', 'liability_credit_card'),"
"('deprecated', '=', False),('company_id', '=', company_id)]",
help="Account used in the depreciation entries,"
" to decrease the asset value.")
account_depreciation_expense_id = fields.Many2one(
'account.account', string='Expense Account',
required=True,
domain="[('account_type', '!=', 'asset_receivable'),('account_type', '!=','liability_payable'),('account_type', '!=', 'asset_cash'),('account_type', '!=','liability_credit_card'),('deprecated', '=', False),('company_id', '=', company_id)]",
help="Account used in the periodical entries, to record a part of the asset as expense.")
domain="[('account_type', '!=', 'asset_receivable'),"
"('account_type', '!=','liability_payable'),"
"('account_type', '!=', 'asset_cash'),"
"('account_type', '!=','liability_credit_card'),"
"('deprecated', '=', False),('company_id', '=', company_id)]",
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)
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")
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")
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",
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.")
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')
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.")
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.")
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')
@ -127,57 +159,76 @@ class AccountAssetAsset(models.Model):
digits=0)
currency_id = fields.Many2one('res.currency', string='Currency',
required=True, readonly=True,
default=lambda self: self.env.company.currency_id.id)
default=lambda
self: self.env.company.currency_id.id)
company_id = fields.Many2one('res.company', string='Company',
required=True, readonly=True,
default=lambda self: self.env.company)
note = fields.Text()
category_id = fields.Many2one('account.asset.category', string='Category',
category_id = fields.Many2one('account.asset.category',
string='Category',
required=True, change_default=True,
readonly=True,)
readonly=True, )
date = fields.Date(string='Date', required=True, readonly=True,
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.")
"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)
method = fields.Selection(
[('linear', 'Linear'), ('degressive', 'Degressive')],
string='Computation Method', required=True, readonly=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")
string='Computation Method', required=True, readonly=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',
readonly=True,
default=5,
help="The number of depreciations needed to depreciate your asset")
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,
help="The amount of time between two depreciations, in months")
method_end = fields.Date(string='Ending Date', readonly=True,)
help="The amount of time between two "
"depreciations, in months")
method_end = fields.Date(string='Ending Date', readonly=True, )
method_progress_factor = fields.Float(string='Degressive Factor',
readonly=True, default=0.3,)
readonly=True, default=0.3, )
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',
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.")
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,
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,)
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, )
salvage_value = fields.Float(string='Salvage Value', digits=0,
readonly=True,
help="It is the amount you plan to have that you cannot depreciate.")
help="It is the amount you plan to have that "
"you cannot depreciate.")
invoice_id = fields.Many2one('account.move', string='Invoice',
copy=False)
type = fields.Selection(related="category_id.type", string='Type',
@ -192,18 +243,22 @@ class AccountAssetAsset(models.Model):
for depreciation_line in asset.depreciation_line_ids:
if depreciation_line.move_id:
raise UserError(_(
'You cannot delete a document that contains posted entries.'))
'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
@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_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),))
@ -219,7 +274,8 @@ class AccountAssetAsset(models.Model):
@api.model
def compute_generated_entries(self, date, asset_type=None):
# Entries generated : one by grouped category and one by asset from ungrouped category
# Entries generated : one by grouped category and one by asset
# from ungrouped category
created_move_ids = []
type_domain = []
if asset_type:
@ -228,8 +284,8 @@ class AccountAssetAsset(models.Model):
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)
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)]):
@ -260,14 +316,16 @@ class AccountAssetAsset(models.Model):
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
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
amount = ((
amount_to_depr /
self.method_number) /
total_days * days)
elif self.method == 'degressive':
amount = residual_amount * self.method_progress_factor
if self.prorata:
@ -278,14 +336,18 @@ class AccountAssetAsset(models.Model):
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
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
amount = ((
residual_amount *
self.method_progress_factor) /
total_days * days)
return amount
def _compute_board_undone_dotation_nb(self, depreciation_date, total_days):
@ -310,14 +372,16 @@ class AccountAssetAsset(models.Model):
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
# 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 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(
@ -330,25 +394,29 @@ class AccountAssetAsset(models.Model):
str(self._get_last_depreciation_date()[self.id]),
DF).date()
else:
# depreciation_date = 1st of January of purchase year if annual valuation, 1st of
# 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
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 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(
@ -386,7 +454,8 @@ class AccountAssetAsset(models.Model):
'asset_id': self.id,
'sequence': sequence,
'name': (self.code or '') + '/' + str(sequence),
'remaining_value': residual_amount if residual_amount >= 0 else 0.0,
'remaining_value': residual_amount if
residual_amount >= 0 else 0.0,
'depreciated_value': self.value - (
self.salvage_value + residual_amount),
'depreciation_date': depreciation_date.strftime(DF),
@ -433,8 +502,9 @@ class AccountAssetAsset(models.Model):
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)
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,
@ -469,7 +539,8 @@ class AccountAssetAsset(models.Model):
tracked_fields, old_values)
if changes:
asset.message_post(subject=_(
'Asset sold or disposed. Accounting entry awaiting for validation.'),
'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)
@ -498,7 +569,8 @@ class AccountAssetAsset(models.Model):
def set_to_draft(self):
self.write({'state': 'draft'})
@api.depends('value', 'salvage_value', 'depreciation_line_ids.move_check',
@api.depends('value', 'salvage_value',
'depreciation_line_ids.move_check',
'depreciation_line_ids.amount')
def _amount_residual(self):
for record in self:
@ -506,7 +578,8 @@ class AccountAssetAsset(models.Model):
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
record.value_residual = (record.value - total_amount -
record.salvage_value)
@api.onchange('company_id')
def onchange_company_id(self):
@ -523,7 +596,8 @@ class AccountAssetAsset(models.Model):
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".'))
'Prorata temporis can be applied only for time method '
'"number of depreciations".'))
@api.onchange('category_id')
def onchange_category_id(self):
@ -614,7 +688,8 @@ class AccountAssetDepreciationLine(models.Model):
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_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',
@ -628,61 +703,79 @@ class AccountAssetDepreciationLine(models.Model):
@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
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.'))
'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)
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)
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,
precision_digits=prec) > 0
else -amount,
'credit': amount if float_compare(amount, 0.0,
precision_digits=prec) > 0 else 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 company_currency.id,
'amount_currency': company_currency != current_currency and - 1.0 * line.amount or 0.0,
# '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 company_currency.id,
'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,
precision_digits=prec) > 0
else -amount,
'debit': amount if float_compare(amount, 0.0,
precision_digits=prec) > 0 else 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 company_currency.id,
'amount_currency': company_currency != current_currency and line.amount or 0.0,
# '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 company_currency.id,
'amount_currency': company_currency != current_currency and
line.amount or 0.0,
}
line_ids = [(0, 0, {
'account_id': category_id.account_depreciation_id.id,
'partner_id': partner.id,
'credit': amount if float_compare(amount, 0.0,
precision_digits=prec) > 0 else 0.0,
precision_digits=prec) > 0
else 0.0,
}), (0, 0, {
'account_id': category_id.account_depreciation_expense_id.id,
'partner_id': partner.id,
'debit': amount if float_compare(amount, 0.0,
precision_digits=prec) > 0 else 0.0,
precision_digits=prec) > 0
else 0.0,
})]
move = self.env['account.move'].create({
'ref': line.asset_id.code,
@ -703,7 +796,6 @@ class AccountAssetDepreciationLine(models.Model):
lambda x: x.name == 'Automatic Balancing Line').unlink()
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(
@ -713,10 +805,10 @@ class AccountAssetDepreciationLine(models.Model):
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
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
@ -725,7 +817,6 @@ class AccountAssetDepreciationLine(models.Model):
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,
@ -733,7 +824,8 @@ class AccountAssetDepreciationLine(models.Model):
'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,
'analytic_account_id': category_id.account_analytic_id.id
if category_id.type == 'sale' else False,
}
move_line_2 = {
'name': name,
@ -741,7 +833,8 @@ class AccountAssetDepreciationLine(models.Model):
'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,
'analytic_account_id': category_id.account_analytic_id.id
if category_id.type == 'purchase' else False,
}
move_vals = {
'ref': category_id.name,
@ -752,7 +845,6 @@ class AccountAssetDepreciationLine(models.Model):
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()
@ -762,7 +854,8 @@ class AccountAssetDepreciationLine(models.Model):
# 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.
# 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
@ -782,10 +875,10 @@ class AccountAssetDepreciationLine(models.Model):
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.
# 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':

16
base_accounting_kit/models/account_followup.py

@ -19,7 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import fields, models
@ -28,7 +27,8 @@ class Followup(models.Model):
_description = 'Account Follow-up'
_rec_name = 'name'
followup_line_ids = fields.One2many('followup.line', 'followup_id',
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)
@ -42,10 +42,14 @@ class FollowupLine(models.Model):
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.")
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"
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',
" Could be negative if you want to send a "
"polite alert beforehand.")
followup_id = fields.Many2one('account.followup',
'Follow Ups',
ondelete="cascade")

23
base_accounting_kit/models/account_journal.py

@ -27,29 +27,6 @@ class AccountJournal(models.Model):
journal"""
_inherit = "account.journal"
# def action_open_reconcile(self):
# self.ensure_one()
#
# if self.type in ('bank', 'cash'):
# return self.env['account.bank.statement.line']._action_open_bank_reconciliation_widget(
# default_context={
# 'default_journal_id': self.id,
# 'search_default_journal_id': self.id,
# 'search_default_not_matched': True,
# },
# )
# 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,
# }
def action_open_reconcile(self):
"""Function to open reconciliation view for bank statements
belonging to this journal"""

64
base_accounting_kit/models/account_move.py

@ -32,9 +32,10 @@ class AccountMove(models.Model):
field to the account"""
_inherit = 'account.move'
asset_depreciation_ids = fields.One2many('account.asset.depreciation.line',
'move_id',
string='Assets Depreciation Lines')
asset_depreciation_ids = fields.One2many(
'account.asset.depreciation.line',
'move_id',
string='Assets Depreciation Lines')
def button_cancel(self):
"""Button action to cancel the transfer"""
@ -108,7 +109,8 @@ class AccountInvoiceLine(models.Model):
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.'))
'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
@ -167,9 +169,12 @@ class AccountInvoiceLine(models.Model):
vals = super(AccountInvoiceLine, self)._compute_price_unit()
if self.product_id:
if self.move_id.move_type == 'out_invoice':
self.asset_category_id = self.product_id.product_tmpl_id.deferred_revenue_category_id
self.asset_category_id = (
self.product_id.product_tmpl_id.
deferred_revenue_category_id)
elif self.move_id.move_type == 'in_invoice':
self.asset_category_id = self.product_id.product_tmpl_id.asset_category_id
self.asset_category_id = (
self.product_id.product_tmpl_id.asset_category_id)
return vals
def _set_additional_fields(self, invoice):
@ -177,9 +182,12 @@ class AccountInvoiceLine(models.Model):
move types"""
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
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.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)
@ -193,12 +201,10 @@ class AccountInvoiceLine(models.Model):
def _query_get(self, domain=None):
"""Used to add domain constraints to the query"""
self.check_access_rights('read')
context = dict(self._context or {})
domain = domain or []
if not isinstance(domain, (list, tuple)):
domain = ast.literal_eval(domain)
date_field = 'date'
if context.get('aged_balance'):
date_field = 'date_maturity'
@ -212,55 +218,49 @@ class AccountInvoiceLine(models.Model):
domain += [(date_field, '<', context['date_from'])]
else:
domain += [(date_field, '>=', context['date_from'])]
if context.get('journal_ids'):
domain += [('journal_id', 'in', context['journal_ids'])]
state = context.get('state')
if state and state.lower() != 'all':
domain += [('parent_state', '=', state)]
if context.get('company_id'):
domain += [('company_id', '=', context['company_id'])]
elif context.get('allowed_company_ids'):
domain += [('company_id', 'in', self.env.companies.ids)]
else:
domain += [('company_id', '=', self.env.company.id)]
if context.get('reconcile_date'):
domain += ['|', ('reconciled', '=', False), '|',
('matched_debit_ids.max_date', '>', context['reconcile_date']),
('matched_credit_ids.max_date', '>', context['reconcile_date'])]
('matched_debit_ids.max_date', '>',
context['reconcile_date']),
('matched_credit_ids.max_date', '>',
context['reconcile_date'])]
if context.get('account_tag_ids'):
domain += [('account_id.tag_ids', 'in', context['account_tag_ids'].ids)]
domain += [
('account_id.tag_ids', 'in', context['account_tag_ids'].ids)]
if context.get('account_ids'):
domain += [('account_id', 'in', context['account_ids'].ids)]
if context.get('analytic_tag_ids'):
domain += [('analytic_tag_ids', 'in', context['analytic_tag_ids'].ids)]
domain += [
('analytic_tag_ids', 'in', context['analytic_tag_ids'].ids)]
if context.get('analytic_account_ids'):
domain += [('analytic_account_id', 'in', context['analytic_account_ids'].ids)]
domain += [('analytic_account_id', 'in',
context['analytic_account_ids'].ids)]
if context.get('partner_ids'):
domain += [('partner_id', 'in', context['partner_ids'].ids)]
if context.get('partner_categories'):
domain += [('partner_id.category_id', 'in', context['partner_categories'].ids)]
domain += [('partner_id.category_id', 'in',
context['partner_categories'].ids)]
where_clause = ""
where_clause_params = []
tables = ''
if domain:
domain.append(('display_type', 'not in', ('line_section', 'line_note')))
domain.append(
('display_type', 'not in', ('line_section', 'line_note')))
domain.append(('parent_state', '!=', 'cancel'))
query = self._where_calc(domain)
# Wrap the query with 'company_id IN (...)' to avoid bypassing company access rights.
# Wrap the query with 'company_id IN (...)' to avoid bypassing
# company access rights.
self._apply_ir_rules(query)
tables, where_clause, where_clause_params = query.get_sql()
return tables, where_clause, where_clause_params

3
base_accounting_kit/models/credit_limit.py

@ -19,8 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models, fields, api
from odoo import api, fields, models
from odoo.exceptions import UserError
from odoo.tools.translate import _

3
base_accounting_kit/models/multiple_invoice.py

@ -30,7 +30,8 @@ class MultipleInvoice(models.Model):
sequence = fields.Integer(string='Sequence No')
copy_name = fields.Char(string='Invoice Copy Name')
journal_id = fields.Many2one('account.journal', string="Journal")
journal_id = fields.Many2one('account.journal',
string="Journal")
class AccountJournal(models.Model):

12
base_accounting_kit/models/multiple_invoice_layout.py

@ -42,9 +42,11 @@ class MultipleInvoiceLayout(models.TransientModel):
[('id', '=', self.env.context.get('active_id'))]).id
company_id = fields.Many2one(
'res.company', default=lambda self: self.env.company, required=True)
'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',
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,
@ -67,7 +69,8 @@ class MultipleInvoiceLayout(models.TransientModel):
strip_style=False,
strip_classes=False)
@api.depends('multiple_invoice_type', 'text_position', 'body_text_position',
@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 """
@ -123,7 +126,8 @@ class MultipleInvoiceLayout(models.TransientModel):
precision = 8
output_style = 'expanded'
bootstrap_path = get_resource_path('web', 'static', 'lib', 'bootstrap',
bootstrap_path = get_resource_path('web', 'static',
'lib', 'bootstrap',
'scss')
try:
return libsass.compile(

8
base_accounting_kit/models/product_template.py

@ -26,8 +26,12 @@ class ProductTemplate(models.Model):
"""Inherited the model for adding new fields and functions"""
_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")
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()

26
base_accounting_kit/models/recurring_payments.py

@ -21,7 +21,7 @@
#############################################################################
from datetime import datetime, date
from dateutil.relativedelta import relativedelta
from odoo import api, models, fields
from odoo import api, fields, models
class FilterRecurringEntries(models.Model):
@ -55,19 +55,24 @@ class RecurringPayments(models.Model):
self.next_date = start_date.date()
name = fields.Char(string='Name')
debit_account = fields.Many2one('account.account', 'Debit Account',
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',
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)
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,
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'),
@ -90,7 +95,8 @@ class RecurringPayments(models.Model):
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')
recurring_lines = fields.One2many(
'account.recurring.entries.line', 'tmpl_id')
@api.onchange('partner_id')
def onchange_partner_id(self):
@ -115,7 +121,8 @@ class RecurringPayments(models.Model):
for line in data:
if line.date:
recurr_dates = []
start_date = datetime.strptime(str(line.date), '%Y-%m-%d')
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':
@ -175,6 +182,7 @@ class GetAllRecurringEntries(models.TransientModel):
date = fields.Date('Date')
template_name = fields.Char('Name')
amount = fields.Float('Amount')
tmpl_id = fields.Many2one('account.recurring.payments', string='id')
tmpl_id = fields.Many2one('account.recurring.payments',
string='id')

46
base_accounting_kit/models/res_company.py

@ -19,11 +19,8 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from datetime import date, timedelta
from odoo import fields, models,_
from odoo.exceptions import UserError, ValidationError, AccessError, RedirectWarning
from odoo import models, _
from odoo.exceptions import RedirectWarning
class ResCompany(models.Model):
@ -31,44 +28,51 @@ class ResCompany(models.Model):
def _validate_fiscalyear_lock(self, values):
if values.get('fiscalyear_lock_date'):
draft_entries = self.env['account.move'].search([
('company_id', 'in', self.ids),
('state', '=', 'draft'),
('date', '<=', values['fiscalyear_lock_date'])])
if draft_entries:
error_msg = _('There are still unposted entries in the period you want to lock. You should either post or delete them.')
error_msg = _('There are still unposted entries in the '
'period you want to lock. You should either post '
'or delete them.')
action_error = {
'view_mode': 'tree',
'name': 'Unposted Entries',
'res_model': 'account.move',
'type': 'ir.actions.act_window',
'domain': [('id', 'in', draft_entries.ids)],
'search_view_id': [self.env.ref('account.view_account_move_filter').id, 'search'],
'views': [[self.env.ref('account.view_move_tree').id, 'list'], [self.env.ref('account.view_move_form').id, 'form']],
'search_view_id': [self.env.ref(
'account.view_account_move_filter').id, 'search'],
'views': [[self.env.ref(
'account.view_move_tree').id, 'list'],
[self.env.ref('account.view_move_form').id,
'form']],
}
raise RedirectWarning(error_msg, action_error, _('Show unposted entries'))
unreconciled_statement_lines = self.env['account.bank.statement.line'].search([
raise RedirectWarning(error_msg, action_error,
_('Show unposted entries'))
unreconciled_statement_lines = self.env[
'account.bank.statement.line'].search([
('company_id', 'in', self.ids),
('is_reconciled', '=', False),
('date', '<=', values['fiscalyear_lock_date']),
('move_id.state', 'in', ('draft', 'posted')),
])
if unreconciled_statement_lines:
error_msg = _("There are still unreconciled bank statement lines in the period you want to lock."
"You should either reconcile or delete them.")
error_msg = _(
"There are still unreconciled bank statement lines in the "
"period you want to lock."
"You should either reconcile or delete them.")
action_error = {
'view_mode': 'tree',
'name': 'Unreconciled Transactions',
'res_model': 'account.bank.statement.line',
'type': 'ir.actions.act_window',
'domain': [('id', 'in', unreconciled_statement_lines.ids)],
# 'search_view_id': [self.env.ref('account.view_account_move_filter').id, 'search'],
'views': [[self.env.ref('base_accounting_kit.view_bank_statement_line_tree').id, 'list']]
# [self.env.ref('account.view_move_form').id, 'form']],
'views': [[self.env.ref(
'base_accounting_kit.view_bank_statement_line_tree').id,
'list']]
}
# action_error = self._get_fiscalyear_lock_statement_lines_redirect_action(unreconciled_statement_lines)
raise RedirectWarning(error_msg, action_error, _('Show Unreconciled Bank Statement Line'))
raise RedirectWarning(error_msg, action_error,
_('Show Unreconciled Bank'
' Statement Line'))

8
base_accounting_kit/models/res_config_settings.py

@ -19,8 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models, fields, api
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
@ -28,8 +27,9 @@ class ResConfigSettings(models.TransientModel):
customer_credit_limit = fields.Boolean(string="Customer Credit Limit")
use_anglo_saxon_accounting = fields.Boolean(string="Use Anglo-Saxon accounting", readonly=False,
related='company_id.anglo_saxon_accounting')
use_anglo_saxon_accounting = fields.Boolean(
string="Use Anglo-Saxon accounting", readonly=False,
related='company_id.anglo_saxon_accounting')
@api.model
def get_values(self):

13
base_accounting_kit/models/res_partner.py

@ -19,16 +19,15 @@
# 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',
invoice_list = fields.One2many('account.move',
'partner_id',
string="Invoice Details",
readonly=True,
domain=(
@ -49,7 +48,8 @@ class ResPartner(models.Model):
def _compute_for_followup(self):
"""
Compute the fields 'total_due', 'total_overdue' , 'next_reminder_date' and 'followup_status'
Compute the fields 'total_due', 'total_overdue' ,
'next_reminder_date' and 'followup_status'
"""
for record in self:
total_due = 0
@ -60,7 +60,8 @@ class ResPartner(models.Model):
amount = am.amount_residual
total_due += amount
is_overdue = today > am.invoice_date_due if am.invoice_date_due else today > am.date
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()
@ -99,14 +100,12 @@ class ResPartner(models.Model):
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:

38
base_accounting_kit/report/account_asset_report.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, fields, models, tools
from odoo import fields, models, tools
class AssetAssetReport(models.Model):
@ -30,19 +30,29 @@ class AssetAssetReport(models.Model):
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)
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)
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)
company_id = fields.Many2one('res.company', string='Company',
readonly=True)
def init(self):
tools.drop_view_if_exists(self._cr, 'asset_asset_report')
@ -77,10 +87,14 @@ class AssetAssetReport(models.Model):
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
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.date, dl.move_check, a.state, a.category_id,
a.partner_id, a.company_id,
a.value, a.id, a.salvage_value, dlmin.id
)""")

56
base_accounting_kit/report/account_asset_report_views.xml

@ -1,6 +1,5 @@
<?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>
@ -23,7 +22,6 @@
</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>
@ -31,46 +29,62 @@
<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)]"/>
<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}"/>
<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="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"/>
<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'}"/>
<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="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>
<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"/>

31
base_accounting_kit/report/account_bank_book.py

@ -34,19 +34,19 @@ class ReportBankBook(models.AbstractModel):
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_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')
'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, \
@ -78,7 +78,8 @@ class ReportBankBook(models.AbstractModel):
if where_clause.strip():
wheres.append(where_clause.strip())
filters = " AND ".join(wheres)
filters = filters.replace('account_move_line__move_id', 'm').replace(
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
@ -131,7 +132,6 @@ class ReportBankBook(models.AbstractModel):
if display_account == 'not_zero' and not currency.is_zero(
res['balance']):
account_res.append(res)
return account_res
@api.model
@ -139,7 +139,6 @@ class ReportBankBook(models.AbstractModel):
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)
@ -154,13 +153,17 @@ class ReportBankBook(models.AbstractModel):
accounts = self.env['account.account'].search(
[('id', 'in', account_ids)])
if not accounts:
journals = self.env['account.journal'].search([('type', '=', 'bank')])
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.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,

53
base_accounting_kit/report/account_bank_book_view.xml

@ -5,12 +5,10 @@
<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>
@ -19,15 +17,24 @@
<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>
<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>
<p t-if="data['target_move'] == 'all'">All Entries
</p>
<p t-if="data['target_move'] == 'posted'">All Posted
Entries
</p>
</div>
</div>
<br/>
@ -35,7 +42,9 @@
<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>
<p t-if="data['sortby'] == 'sort_journal_partner'">
Journal and Partner
</p>
</div>
<div style="width:30%;">
<t t-if="data['date_from']">
@ -52,7 +61,7 @@
<br/>
<table class="table table-condensed">
<thead>
<tr class="text-center">
<tr class="text-centre">
<th>Date</th>
<th>JRNL</th>
<th>Partner</th>
@ -62,14 +71,17 @@
<th>Debit</th>
<th>Credit</th>
<th>Balance</th>
<th groups="base.group_multi_currency">Currency</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 style="color: white;"
t-esc="'..'"/>
<span t-esc="account['code']"/>
<span t-esc="account['name']"/>
</td>
@ -87,7 +99,8 @@
</td>
<td groups="base.group_multi_currency"/>
</tr>
<tr t-foreach="account['move_lines']" t-as="line">
<tr t-foreach="account['move_lines']"
t-as="line">
<td>
<span t-esc="line['ldate']"/>
</td>
@ -98,7 +111,8 @@
<span t-esc="line['partner_name']"/>
</td>
<td>
<span t-if="line['lref']" t-esc="line['lref']"/>
<span t-if="line['lref']"
t-esc="line['lref']"/>
</td>
<td>
<span t-esc="line['move_name']"/>
@ -116,12 +130,17 @@
</td>
<td class="text-right">
<span t-esc="line['balance']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
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 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>

59
base_accounting_kit/report/account_cash_book.py

@ -31,16 +31,15 @@ class ReportCashBook(models.AbstractModel):
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(
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()
initial_bal=True)._query_get())
init_wheres = [""]
if init_where_clause.strip():
init_wheres.append(init_where_clause.strip())
@ -48,7 +47,11 @@ class ReportCashBook(models.AbstractModel):
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,\
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,\
@ -58,7 +61,8 @@ class ReportCashBook(models.AbstractModel):
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')
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():
@ -73,39 +77,48 @@ class ReportCashBook(models.AbstractModel):
if where_clause.strip():
wheres.append(where_clause.strip())
filters = " AND ".join(wheres)
filters = filters.replace('account_move_line__move_id', 'm').replace(
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')])
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.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\
# 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)
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
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
@ -121,7 +134,6 @@ class ReportCashBook(models.AbstractModel):
if display_account == 'not_zero' and not currency.is_zero(
res['balance']):
account_res.append(res)
return account_res
@api.model
@ -129,7 +141,6 @@ class ReportCashBook(models.AbstractModel):
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', []))
@ -145,11 +156,15 @@ class ReportCashBook(models.AbstractModel):
accounts = self.env['account.account'].search(
[('id', 'in', account_ids)])
if not accounts:
journals = self.env['account.journal'].search([('type', '=', 'cash')])
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.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,

261
base_accounting_kit/report/account_cash_book_view.xml

@ -1,108 +1,167 @@
<?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 ])"/>
<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>
<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>
<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>
<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>
<br/>
<table class="table table-condensed">
<thead>
<tr class="text-left">
<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>
</t>
</tbody>
</table>
</div>
</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>
</t>
</template>
</template>
</odoo>

22
base_accounting_kit/report/account_day_book.py

@ -42,19 +42,25 @@ class DayBookPdfReport(models.AbstractModel):
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
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
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
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 = (
@ -78,7 +84,6 @@ class DayBookPdfReport(models.AbstractModel):
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', []))
@ -95,7 +100,8 @@ class DayBookPdfReport(models.AbstractModel):
date_start = datetime.strptime(form_data['date_from'],
'%Y-%m-%d').date()
date_end = datetime.strptime(form_data['date_to'], '%Y-%m-%d').date()
date_end = datetime.strptime(form_data['date_to'],
'%Y-%m-%d').date()
days = date_end - date_start
dates = []
record = []

57
base_accounting_kit/report/account_day_book_view.xml

@ -12,12 +12,15 @@
<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 ])"/>
<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>
<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']">
@ -31,10 +34,9 @@
</t>
</div>
</div>
<table class="table table-condensed">
<thead>
<tr class="text-center">
<tr class="text-left">
<th>Date</th>
<th>JRNL</th>
<th>Partner</th>
@ -49,26 +51,34 @@
</thead>
<tbody>
<t t-foreach="Accounts" t-as="account">
<tr style="font-weight: bold;background: #ededed;">
<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}"/>
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}"/>
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}"/>
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">
<tr t-foreach="account['child_lines']"
t-as="line">
<td>
<span t-esc="line['ldate']"/>
</td>
@ -79,7 +89,8 @@
<span t-esc="line['partner_name']"/>
</td>
<td>
<span t-if="line['lref']" t-esc="line['lref']"/>
<span t-if="line['lref']"
t-esc="line['lref']"/>
</td>
<td>
<span t-esc="line['move_name']"/>
@ -89,19 +100,31 @@
</td>
<td class="text-right">
<span t-esc="line['debit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
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}"/>
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}"/>
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 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>

20
base_accounting_kit/report/account_report_common_account.py

@ -45,16 +45,21 @@ class AccountCommonAccountReport(models.TransientModel):
string='Display Accounts', required=True, default='movement')
target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries'),
], string='Target Moves', required=True, default='posted')
], string='Target Moves', required=True,
default='posted')
date_from = fields.Date(string='Start Date')
date_to = fields.Date(string='End Date')
company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True,
company_id = fields.Many2one('res.company', string='Company',
required=True,
readonly=True,
default=lambda self: self.env.company)
def _build_contexts(self, data):
result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or ''
result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][
'journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form'][
'target_move'] or ''
result['date_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False
result['strict_range'] = True if result['date_from'] else False
@ -69,9 +74,12 @@ class AccountCommonAccountReport(models.TransientModel):
data = {}
data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move', 'company_id'])[0]
data['form'] = self.read(
['date_from', 'date_to', 'journal_ids', 'target_move',
'company_id'])[0]
used_context = self._build_contexts(data)
data['form']['used_context'] = dict(used_context, lang=get_lang(self.env).code)
data['form']['used_context'] = dict(used_context,
lang=get_lang(self.env).code)
return self.with_context(discard_logo_check=True)._print_report(data)
def pre_print_report(self, data):

33
base_accounting_kit/report/cash_flow_report.py

@ -32,11 +32,11 @@ class ReportFinancial(models.AbstractModel):
def _compute_account_balance(self, accounts):
mapping = {
'balance': "COALESCE(SUM(debit),0) - COALESCE(SUM(credit), 0) as balance",
'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)
@ -83,10 +83,12 @@ class ReportFinancial(models.AbstractModel):
'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:
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:
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':
@ -105,7 +107,6 @@ class ReportFinancial(models.AbstractModel):
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(
@ -133,7 +134,6 @@ class ReportFinancial(models.AbstractModel):
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,
@ -147,39 +147,40 @@ class ReportFinancial(models.AbstractModel):
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.
# 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
# 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,
'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(
if (not account.company_id.currency_id.is_zero(
vals[
'debit']) or not account.company_id.currency_id.is_zero(
vals['credit']):
'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']):

79
base_accounting_kit/report/cash_flow_report.xml

@ -6,13 +6,16 @@
<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>
<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">
@ -27,20 +30,23 @@
</div>
<table class="table table-sm table-reports">
<thead>
<tr>
<tr class="text-left">
<th>
<strong>Name</strong>
</th>
<th class="text-right" t-if="data['debit_credit']">
<th
t-if="data['debit_credit']">
<strong>Debit</strong>
</th>
<th class="text-right" t-if="data['debit_credit']">
<th
t-if="data['debit_credit']">
<strong>Credit</strong>
</th>
<th class="text-right">
<th>
<strong>Balance</strong>
</th>
<th class="text-right" t-if="data['enable_filter']">
<th
t-if="data['enable_filter']">
<strong t-esc="data['label_filter']"/>
</th>
</tr>
@ -49,32 +55,59 @@
<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-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 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')"/>
<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 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')"
<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}"/>
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 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')"
<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}"/>
t-options="{
'widget': 'monetary',
'display_currency':
env.company.currency_id}"/>
</td>
</t>
</tr>

40
base_accounting_kit/report/general_ledger_report.py

@ -55,17 +55,23 @@ class ReportGeneralLedger(models.AbstractModel):
# Prepare initial sql query and Get the initial move lines
if init_balance:
init_tables, init_where_clause, init_where_params = MoveLine.with_context(
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()
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',
'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,\
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,\
@ -76,7 +82,8 @@ class ReportGeneralLedger(models.AbstractModel):
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')
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():
@ -92,19 +99,27 @@ class ReportGeneralLedger(models.AbstractModel):
if where_clause.strip():
wheres.append(where_clause.strip())
filters = " AND ".join(wheres)
filters = filters.replace('account_move_line__move_id', 'm').replace(
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\
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)
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)
@ -118,7 +133,8 @@ class ReportGeneralLedger(models.AbstractModel):
# 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
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
@ -134,7 +150,6 @@ class ReportGeneralLedger(models.AbstractModel):
if display_account == 'not_zero' and not currency.is_zero(
res['balance']):
account_res.append(res)
return account_res
@api.model
@ -142,11 +157,9 @@ class ReportGeneralLedger(models.AbstractModel):
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']
@ -155,7 +168,6 @@ class ReportGeneralLedger(models.AbstractModel):
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(

122
base_accounting_kit/report/general_ledger_report.xml

@ -7,42 +7,62 @@
<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>
<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 ])"/>
<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>
<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>
<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>
<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>
<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">
<tr class="text-left">
<th>Date</th>
<th>JRNL</th>
<th>Partner</th>
@ -52,48 +72,88 @@
<th>Debit</th>
<th>Credit</th>
<th>Balance</th>
<th groups="base.group_multi_currency">Currency</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 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}"/>
<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}"/>
<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}"/>
<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>
<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}"/>
<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}"/>
<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}"/>
<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 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>

786
base_accounting_kit/report/multiple_invoice_layouts.xml

@ -1,334 +1,434 @@
<?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 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-->
<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 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 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 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>
<!--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>
<div t-if="company.logo or company.report_header" class="row zero_min_height">
</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>
<span t-if="company.company_details"
t-field="company.company_details"/>
</div>
</div>
<!--Watermark-->
<!--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);">
<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>
</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 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. -->
<!-- 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 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-->
<!--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;"/>
<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;"/>
<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-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"/>
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 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-->
<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 == 'right'" class="float-right mb4">
<span t-esc="mi.copy_name" style="font-size: 25px;"/>
<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>
<br/>
</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>
</div>
<!--Watermark-->
<!--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);">
<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>
</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 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-->
<!--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;"/>
<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;"/>
<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;"/>
<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"/>
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 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-->
<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 == 'right'">
<span t-esc="mi.copy_name" style="font-size: 20px;"/>
<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>
</ul>
</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>
</div>
<!--Watermark-->
<!--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);">
<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>
</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')">
<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-->
<!--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;"/>
<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"/>
<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-->
<!--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;"/>
<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-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 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 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;
<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>
</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>
</t>
<div class="clearfix mb8"/>
<div class="clearfix mb8"/>
</div>
<!--Watermark-->
<!--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);">
<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>
</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')">
<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-->
<!--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;"/>
<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;"/>
<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;"/>
<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"/>
@ -338,159 +438,216 @@
</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-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 class="text-left">
<th name="th_description">
<span>Description</span>
</th>
<th name="th_quantity">
<span>Quantity</span>
</th>
<th name="th_priceunit"
class="d-none d-md-table-cell">
<span>Unit Price</span>
</th>
<th name="th_taxes"
class="d-none d-md-table-cell">
<span>Taxes</span>
</th>
<th name="th_subtotal">
<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 == 'tr'" style="font-size:25px; text-align:right;">
<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 == 'tl'" style="font-size:25px; text-align:left;">
<div t-if="body_txt_position == 'bl'"
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>
</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">
@ -503,10 +660,11 @@
<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>
<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>
</odoo>

12
base_accounting_kit/report/multiple_invoice_report.py

@ -19,8 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models, api
from odoo import api, models
class ReportInvoiceMultiple(models.AbstractModel):
@ -31,28 +30,21 @@ class ReportInvoiceMultiple(models.AbstractModel):
@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
return rslt

529
base_accounting_kit/report/multiple_invoice_report.xml

@ -1,252 +1,328 @@
<?xml version="1.0" encoding="utf-8"?>
<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 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>
<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>
<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>
<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>
<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 class="text-left">
<th name="th_description" >
<span>Description</span>
</th>
<th name="th_quantity">
<span>Quantity</span>
</th>
<th name="th_priceunit"
t-attf-class="
{{ '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="
{{ 'd-none d-md-table-cell' if
report_type == 'html' else '' }}">
<span>Disc.%</span>
</th>
<th name="th_taxes"
t-attf-class="
{{ 'd-none d-md-table-cell' if
report_type == 'html' else '' }}">
<span>Taxes</span>
</th>
<th name="th_subtotal">
<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-esc="lines"/>
<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>
</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-esc="lines"/>
<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 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-options='{"widget":
"monetary", "display_currency":
o.currency_id}'
/>
</td>
</tr>
</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.tax_totals['groups_by_subtotal'][subtotal_to_show]" 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>
</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.tax_totals['groups_by_subtotal']
[subtotal_to_show]"
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 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>
</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>
</table>
</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"/>
</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 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>
<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="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-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-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>
@ -256,5 +332,4 @@
<field name="binding_model_id" ref="account.model_account_move"/>
<field name="binding_type">report</field>
</record>
</odoo>
</odoo>

148
base_accounting_kit/report/report.xml

@ -1,96 +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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>

47
base_accounting_kit/report/report_aged_partner.py

@ -19,12 +19,9 @@
# 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
@ -36,11 +33,14 @@ class ReportAgedPartnerBalance(models.AbstractModel):
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
# 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:
# 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
@ -63,7 +63,6 @@ class ReportAgedPartnerBalance(models.AbstractModel):
'start': (i != 0 and stop.strftime('%Y-%m-%d') or False),
}
start = stop
res = []
total = []
cr = self.env.cr
@ -78,20 +77,20 @@ class ReportAgedPartnerBalance(models.AbstractModel):
# 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',
'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
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)
@ -101,12 +100,10 @@ class ReportAgedPartnerBalance(models.AbstractModel):
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']]
@ -114,7 +111,6 @@ class ReportAgedPartnerBalance(models.AbstractModel):
(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
@ -177,7 +173,8 @@ class ReportAgedPartnerBalance(models.AbstractModel):
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)
WHERE (l.account_id = account_account.id) AND
(l.move_id = am.id)
AND (am.state IN %s)
AND (account_account.account_type IN %s)
AND ((l.partner_id IN %s) OR (l.partner_id IS NULL))
@ -192,7 +189,8 @@ class ReportAgedPartnerBalance(models.AbstractModel):
partner_id = line.partner_id.id or False
if partner_id not in partners_amount:
partners_amount[partner_id] = 0.0
line_amount = ResCurrency._get_conversion_rate(line.company_id.currency_id,
line_amount = ResCurrency._get_conversion_rate(
line.company_id.currency_id,
user_currency, line.balance)
if user_currency.is_zero(line_amount):
continue
@ -206,7 +204,6 @@ class ReportAgedPartnerBalance(models.AbstractModel):
line_amount -= ResCurrency._get_conversion_rate(
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
@ -223,15 +220,14 @@ class ReportAgedPartnerBalance(models.AbstractModel):
values = {}
undue_amt = 0.0
if partner[
'partner_id'] in undue_amounts: # Making sure this partner actually was found by the query
'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]:
@ -240,7 +236,8 @@ class ReportAgedPartnerBalance(models.AbstractModel):
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):
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)])
@ -257,7 +254,6 @@ class ReportAgedPartnerBalance(models.AbstractModel):
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']]):
@ -270,8 +266,6 @@ class ReportAgedPartnerBalance(models.AbstractModel):
'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'))
@ -284,11 +278,12 @@ class ReportAgedPartnerBalance(models.AbstractModel):
account_type = ['liability_payable']
else:
account_type = ['liability_payable', 'asset_receivable']
movelines, total, dummy = self._get_partner_move_lines(account_type,
date_from,
target_move,
data['form']['period_length'])
data['form']
['period_length']
)
return {
'doc_ids': self.ids,
'doc_model': model,

113
base_accounting_kit/report/report_aged_partner.xml

@ -8,7 +8,6 @@
<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>
@ -23,43 +22,90 @@
<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>
<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>
<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>
<tr class="text-left">
<th>Partners</th>
<th class="text-right">
<th>
<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>
<th>
<span t-esc="data['4']['name']"/>
</th>
<th>
<span t-esc="data['3']['name']"/>
</th>
<th>
<span t-esc="data['2']['name']"/>
</th>
<th>
<span t-esc="data['1']['name']"/>
</th>
<th>
<span t-esc="data['0']['name']"/>
</th>
<th>Total</th>
</tr>
<tr t-if="get_partner_lines">
<tr t-if="get_partner_lines" class="text-centre">
<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>
<th>
<span t-esc="get_direction[6]"
t-options="{'widget':
'monetary', 'display_currency':
env.company.currency_id}"/>
</th>
<th>
<span t-esc="get_direction[4]"
t-options="{'widget': 'monetary',
'display_currency': env.company.currency_id}"/>
</th>
<th>
<span t-esc="get_direction[3]"
t-options="{'widget': 'monetary',
'display_currency': env.company.currency_id}"/>
</th>
<th>
<span t-esc="get_direction[2]"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</th>
<th>
<span t-esc="get_direction[1]"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</th>
<th>
<span t-esc="get_direction[0]"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</th>
<th>
<span t-esc="get_direction[5]"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</th>
</tr>
</thead>
<tbody>
@ -68,25 +114,32 @@
<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}"/>
<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}"/>
<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}"/>
<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}"/>
<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}"/>
<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}"/>
<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}"/>
<span t-esc="partner['total']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td>
</tr>
</tbody>

20
base_accounting_kit/report/report_financial.py

@ -35,8 +35,9 @@ class AccountTypes(models.Model):
('payable', 'Payable'),
('liquidity', 'Liquidity'),
], required=True, default='other',
help="The 'Internal Type' is used for features available on " \
"different types of accounts: liquidity type is for cash or bank accounts" \
help="The 'Internal Type' is used for features available on "
"different types of accounts: liquidity type is for cash or "
"bank accounts" \
", payable/receivable is for vendor/customer accounts.")
@ -68,13 +69,15 @@ class AccountFinancialReport(models.Model):
return res
name = fields.Char('Report Name', required=True, translate=True)
parent_id = fields.Many2one('account.financial.report', 'Parent')
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, recursive=True)
level = fields.Integer(compute='_get_level', string='Level', store=True,
recursive=True)
type = fields.Selection(
[('sum', 'View'),
('accounts', 'Accounts'),
@ -116,15 +119,10 @@ class AccountFinancialReport(models.Model):
("off_balance", "Off-Balance Sheet"),
],
string="Type",
help="These types are defined according to your country. The type contains more information " \
help="These types are defined according to your country. "
"The type contains more information "
"about the account and its specificities."
)
# account_type_ids = fields.Many2many(
# 'account.account.template',
# '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",

89
base_accounting_kit/report/report_financial.xml

@ -8,13 +8,16 @@
<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>
<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">
@ -31,47 +34,56 @@
</p>
</div>
</div>
<table class="table table-sm table-reports" t-if="data['form']['debit_credit'] == 1">
<table class="table table-sm table-reports"
t-if="data['form']['debit_credit'] == 1">
<thead>
<tr>
<tr class="text-left">
<th>Name</th>
<th class="text-right">Debit</th>
<th class="text-right">Credit</th>
<th class="text-right">Balance</th>
<th>Debit</th>
<th>Credit</th>
<th>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-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 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')"/>
<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')"
<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')"
<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')"
<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>
@ -84,25 +96,29 @@
<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-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 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')"/>
<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')"
<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>
@ -110,7 +126,6 @@
<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>
@ -119,21 +134,27 @@
<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-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 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')"/>
<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')"
<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')"/>
<span t-att-style="style"
t-esc="a.get('balance_cmp')"/>
</td>
</t>
</tr>
@ -143,4 +164,4 @@
</t>
</t>
</template>
</odoo>
</odoo>

26
base_accounting_kit/report/report_journal_audit.py

@ -19,9 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
import time
from odoo import api, models, _
from odoo.exceptions import UserError
@ -36,11 +34,13 @@ class ReportJournal(models.AbstractModel):
move_state = ['draft', 'posted']
if target_move == 'posted':
move_state = ['posted']
query_get_clause = self._get_query_get_clause(data)
params = [tuple(move_state), tuple(journal_ids)] + query_get_clause[2]
query = 'SELECT "account_move_line".id FROM ' + query_get_clause[
0] + ', account_move am, account_account acc WHERE "account_move_line".account_id = acc.id AND "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + \
0] + (', account_move am, account_account acc WHERE '
'"account_move_line".account_id = acc.id AND '
'"account_move_line".move_id=am.id AND am.state IN %s AND '
'"account_move_line".journal_id IN %s AND ') + \
query_get_clause[1] + ' ORDER BY '
if sort_selection == 'date':
query += '"account_move_line".date'
@ -55,13 +55,13 @@ class ReportJournal(models.AbstractModel):
move_state = ['draft', 'posted']
if data['form'].get('target_move', 'all') == 'posted':
move_state = ['posted']
query_get_clause = self._get_query_get_clause(data)
params = [tuple(move_state), tuple(journal_id.ids)] + query_get_clause[
2]
self.env.cr.execute('SELECT SUM(debit) FROM ' + query_get_clause[
0] + ', account_move am '
'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' +
'WHERE "account_move_line".move_id=am.id AND am.state IN %s'
' AND "account_move_line".journal_id IN %s AND ' +
query_get_clause[1] + ' ',
tuple(params))
return self.env.cr.fetchone()[0] or 0.0
@ -70,13 +70,13 @@ class ReportJournal(models.AbstractModel):
move_state = ['draft', 'posted']
if data['form'].get('target_move', 'all') == 'posted':
move_state = ['posted']
query_get_clause = self._get_query_get_clause(data)
params = [tuple(move_state), tuple(journal_id.ids)] + query_get_clause[
2]
self.env.cr.execute('SELECT SUM(credit) FROM ' + query_get_clause[
0] + ', account_move am '
'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' +
'WHERE "account_move_line".move_id=am.id AND am.state IN %s '
'AND "account_move_line".journal_id IN %s AND ' +
query_get_clause[1] + ' ',
tuple(params))
return self.env.cr.fetchone()[0] or 0.0
@ -85,12 +85,12 @@ class ReportJournal(models.AbstractModel):
move_state = ['draft', 'posted']
if data['form'].get('target_move', 'all') == 'posted':
move_state = ['posted']
query_get_clause = self._get_query_get_clause(data)
params = [tuple(move_state), tuple(journal_id.ids)] + query_get_clause[
2]
query = """
SELECT rel.account_tax_id, SUM("account_move_line".balance) AS base_amount
SELECT rel.account_tax_id, SUM("account_move_line".balance)
AS base_amount
FROM account_move_line_account_tax_rel rel, """ + query_get_clause[
0] + """
LEFT JOIN account_move am ON "account_move_line".move_id = am.id
@ -105,13 +105,13 @@ class ReportJournal(models.AbstractModel):
for row in self.env.cr.fetchall():
ids.append(row[0])
base_amounts[row[0]] = row[1]
res = {}
for tax in self.env['account.tax'].browse(ids):
self.env.cr.execute(
'SELECT sum(debit - credit) FROM ' + query_get_clause[
0] + ', account_move am '
'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' +
'WHERE "account_move_line".move_id=am.id AND am.state'
' IN %s AND "account_move_line".journal_id IN %s AND ' +
query_get_clause[1] + ' AND tax_line_id = %s',
tuple(params + [tax.id]))
res[tax] = {
@ -133,10 +133,8 @@ class ReportJournal(models.AbstractModel):
if not data.get('form'):
raise UserError(
_("Form content is missing, this report cannot be printed."))
target_move = data['form'].get('target_move', 'all')
sort_selection = data['form'].get('sort_selection', 'date')
res = {}
for journal in data['form']['journal_ids']:
res[journal] = self.with_context(

39
base_accounting_kit/report/report_journal_audit.xml

@ -14,36 +14,37 @@
<t t-esc="o.name"/>
Journal
</h2>
<div class="row mt32">
<div class="col-3">
<strong>Company:</strong>
<p t-esc="env.company.name"/>
</div>
<div class="col-3">
<strong>Journal:</strong>
<p t-esc="o.name"/>
</div>
<div class="col-3">
<strong>Entries Sorted By:</strong>
<p t-if="data['form'].get('sort_selection') != 'l.date'">Journal Entry Number</p>
<p t-if="data['form'].get('sort_selection') == 'l.date'">Date</p>
<p t-if="data['form'].get('sort_selection') != 'l.date'">
Journal Entry Number
</p>
<p t-if="data['form'].get('sort_selection') == 'l.date'">
Date
</p>
</div>
<div class="col-3">
<strong>Target Moves:</strong>
<p t-if="data['form']['target_move'] == 'all'">All Entries</p>
<p t-if="data['form']['target_move'] == 'posted'">All Posted Entries</p>
<p t-if="data['form']['target_move'] == 'all'">
All Entries
</p>
<p t-if="data['form']['target_move'] == 'posted'">
All Posted Entries
</p>
</div>
</div>
<table class="table table-sm">
<thead>
<tr>
<tr class="text-left">
<th>Move</th>
<th>Date</th>
<th>Account</th>
@ -51,10 +52,11 @@
<th>Label</th>
<th>Debit</th>
<th>Credit</th>
<th t-if="data['form']['amount_currency']">Currency</th>
<th t-if="data['form']['amount_currency']">
Currency
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="lines[o.id]" t-as="aml">
<td>
@ -87,7 +89,6 @@
</tr>
</tbody>
</table>
<div class="row">
<div class="col-4 pull-right">
<table class="table table-sm">
@ -107,13 +108,14 @@
</table>
</div>
</div>
<div class="row">
<div class="col-4">
<table class="table table-sm table-reports">
<thead>
<tr>
<th colspan="3">Tax Declaration</th>
<th colspan="3">Tax
Declaration
</th>
</tr>
<tr>
<th>Name</th>
@ -122,7 +124,8 @@
</tr>
</thead>
<tbody>
<t t-set="taxes" t-value="get_taxes(data, o)"/>
<t t-set="taxes"
t-value="get_taxes(data, o)"/>
<tr t-foreach="taxes" t-as="tax">
<td>
<span t-esc="tax.name"/>

13
base_accounting_kit/report/report_partner_ledger.py

@ -19,9 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
import time
from odoo import api, models, _
from odoo.exceptions import UserError
@ -41,7 +39,12 @@ class ReportPartnerLedger(models.AbstractModel):
tuple(data['computed']['account_ids'])] + \
query_get_data[2]
query = """
SELECT "account_move_line".id, "account_move_line".date, j.code, acc.code as a_code, acc.name as a_name, "account_move_line".ref, m.name as move_name, "account_move_line".name, "account_move_line".debit, "account_move_line".credit, "account_move_line".amount_currency,"account_move_line".currency_id, c.symbol AS currency_code
SELECT "account_move_line".id, "account_move_line".date, j.code,
acc.code as a_code, acc.name as a_name, "account_move_line".ref,
m.name as move_name, "account_move_line".name,
"account_move_line".debit, "account_move_line".credit,
"account_move_line".amount_currency,
"account_move_line".currency_id, c.symbol AS currency_code
FROM """ + query_get_data[0] + """
LEFT JOIN account_journal j ON ("account_move_line".journal_id = j.id)
LEFT JOIN account_account acc ON ("account_move_line".account_id = acc.id)
@ -79,7 +82,6 @@ class ReportPartnerLedger(models.AbstractModel):
data['form'].get('used_context', {}))._query_get()
reconcile_clause = "" if data['form'][
'reconciled'] else ' AND "account_move_line".full_reconcile_id IS NULL '
params = [partner.id, tuple(data['computed']['move_state']),
tuple(data['computed']['account_ids'])] + \
query_get_data[2]
@ -102,9 +104,7 @@ class ReportPartnerLedger(models.AbstractModel):
if not data.get('form'):
raise UserError(
_("Form content is missing, this report cannot be printed."))
data['computed'] = {}
obj_partner = self.env['res.partner']
query_get_data = self.env['account.move.line'].with_context(
data['form'].get('used_context', {}))._query_get()
@ -118,7 +118,6 @@ class ReportPartnerLedger(models.AbstractModel):
data['computed']['ACCOUNT_TYPE'] = ['asset_receivable']
else:
data['computed']['ACCOUNT_TYPE'] = ['liability_payable', 'asset_receivable']
self.env.cr.execute("""
SELECT a.id
FROM account_account a

33
base_accounting_kit/report/report_partner_ledger.xml

@ -26,14 +26,17 @@
</div>
<div class="col-3">
<strong>Target Moves:</strong>
<p t-if="data['form']['target_move'] == 'all'">All Entries</p>
<p t-if="data['form']['target_move'] == 'posted'">All Posted Entries</p>
<p t-if="data['form']['target_move'] == 'all'">All
Entries
</p>
<p t-if="data['form']['target_move'] == 'posted'">
All Posted Entries
</p>
</div>
</div>
<table class="table table-sm table-reports">
<thead>
<tr>
<tr class="text-left">
<th>Date</th>
<th>JRNL</th>
<th>Account</th>
@ -41,7 +44,9 @@
<th>Debit</th>
<th>Credit</th>
<th>Balance</th>
<th t-if="data['form']['amount_currency']">Currency</th>
<th t-if="data['form']['amount_currency']">
Currency
</th>
</tr>
</thead>
<t t-foreach="docs" t-as="o">
@ -80,20 +85,28 @@
</td>
<td class="text-right">
<span t-esc="line['debit']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
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}"/>
t-options="{'widget': 'monetary',
'display_currency':
env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['progress']"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
t-options="{'widget': 'monetary',
'display_currency':
env.company.currency_id}"/>
</td>
<td class="text-right" t-if="data['form']['amount_currency']">
<td class="text-right"
t-if="data['form']['amount_currency']">
<t t-if="line['currency_id']">
<span t-esc="line['amount_currency']"
t-options="{'widget': 'monetary', 'display_currency': line['currency_id']}"/>
t-options="{'widget': 'monetary',
'display_currency': line['currency_id']}"/>
</t>
</td>
</tr>

14
base_accounting_kit/report/report_tax.py

@ -19,9 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from _datetime import datetime
from odoo import api, models, _
from odoo.exceptions import UserError
@ -41,15 +39,18 @@ class ReportTax(models.AbstractModel):
}
def _sql_from_amls_one(self):
sql = """SELECT "account_move_line".tax_line_id, COALESCE(SUM("account_move_line".debit-"account_move_line".credit), 0)
sql = """SELECT "account_move_line".tax_line_id,
COALESCE(SUM("account_move_line".debit-"account_move_line".credit), 0)
FROM %s
WHERE %s GROUP BY "account_move_line".tax_line_id"""
return sql
def _sql_from_amls_two(self):
sql = """SELECT r.account_tax_id, COALESCE(SUM("account_move_line".debit-"account_move_line".credit), 0)
sql = """SELECT r.account_tax_id, COALESCE(SUM(
"account_move_line".debit-"account_move_line".credit), 0)
FROM %s
INNER JOIN account_move_line_account_tax_rel r ON ("account_move_line".id = r.account_move_line_id)
INNER JOIN account_move_line_account_tax_rel r ON
("account_move_line".id = r.account_move_line_id)
INNER JOIN account_tax t ON (r.account_tax_id = t.id)
WHERE %s GROUP BY r.account_tax_id"""
return sql
@ -59,14 +60,12 @@ class ReportTax(models.AbstractModel):
sql = self._sql_from_amls_one()
tables, where_clause, where_params = self.env[
'account.move.line']._query_get()
query = sql % (tables, where_clause)
self.env.cr.execute(query, where_params)
results = self.env.cr.fetchall()
for result in results:
if result[0] in taxes:
taxes[result[0]]['tax'] = abs(result[1])
# compute the net amount
sql2 = self._sql_from_amls_two()
query = sql2 % (tables, where_clause)
@ -108,7 +107,6 @@ class ReportTax(models.AbstractModel):
self.with_context(date_to=date_to,
strict_range=True)._compute_from_amls(options,
taxes)
groups = dict((tp, []) for tp in ['sale', 'purchase'])
for tax in taxes.values():
if tax['tax']:

29
base_accounting_kit/report/report_tax.xml

@ -27,7 +27,7 @@
</div>
<table class="table table-sm table-reports">
<thead>
<tr align="left">
<tr class="text-left">
<th>Sale</th>
<th>Net</th>
<th>Tax</th>
@ -38,12 +38,16 @@
<span t-esc="line.get('name')"/>
</td>
<td>
<span t-att-style="style" t-esc="line.get('net')"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
<span t-att-style="style"
t-esc="line.get('net')"
t-options="{'widget': 'monetary',
'display_currency': env.company.currency_id}"/>
</td>
<td>
<span t-att-style="style" t-esc="line.get('tax')"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
<span t-att-style="style"
t-esc="line.get('tax')"
t-options="{'widget': 'monetary',
'display_currency': env.company.currency_id}"/>
</td>
</tr>
<br/>
@ -54,17 +58,22 @@
<td/>
<td/>
</tr>
<tr align="left" t-foreach="lines['purchase']" t-as="line">
<tr align="left" t-foreach="lines['purchase']"
t-as="line">
<td>
<span t-esc="line.get('name')"/>
</td>
<td>
<span t-att-style="style" t-esc="line.get('net')"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
<span t-att-style="style"
t-esc="line.get('net')"
t-options="{'widget': 'monetary',
'display_currency': env.company.currency_id}"/>
</td>
<td>
<span t-att-style="style" t-esc="line.get('tax')"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
<span t-att-style="style"
t-esc="line.get('tax')"
t-options="{'widget': 'monetary',
'display_currency': env.company.currency_id}"/>
</td>
</tr>
</table>

19
base_accounting_kit/report/report_trial_balance.py

@ -19,9 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
import time
from odoo import api, models, _
from odoo.exceptions import UserError
@ -34,8 +32,10 @@ class ReportTrialBalance(models.AbstractModel):
""" compute the balance, debit and credit for the provided accounts
:Arguments:
`accounts`: list of accounts record,
`display_account`: it's used to display either all accounts or those accounts which balance is > 0
:Returns a list of dictionary of Accounts with following key and value
`display_account`: it's used to display either all accounts or
those accounts which balance is > 0
:Returns a list of dictionary of Accounts with following key
and value
`name`: Account name,
`code`: Account code,
`credit`: total amount of credit,
@ -56,8 +56,11 @@ class ReportTrialBalance(models.AbstractModel):
filters = " AND ".join(wheres)
# compute the balance, debit and credit for the provided accounts
request = (
"SELECT account_id AS id, SUM(debit) AS debit, SUM(credit) AS credit, (SUM(debit) - SUM(credit)) AS balance" + \
" FROM " + tables + " WHERE account_id IN %s " + filters + " GROUP BY account_id")
"SELECT account_id AS id, SUM(debit) AS debit, "
"SUM(credit) AS credit, (SUM(debit) - SUM(credit)) "
"AS balance" +
" 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():
@ -66,7 +69,8 @@ class ReportTrialBalance(models.AbstractModel):
account_res = []
for account in accounts:
res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance'])
currency = account.currency_id and account.currency_id or account.company_id.currency_id
currency = (account.currency_id and account.currency_id or
account.company_id.currency_id)
res['code'] = account.code
res['name'] = account.name
if account.id in account_result:
@ -89,7 +93,6 @@ class ReportTrialBalance(models.AbstractModel):
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', []))

59
base_accounting_kit/report/report_trial_balance.xml

@ -7,35 +7,51 @@
<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"/>: Trial Balance</h2>
<h2><span t-esc="env.company.name"/>: Trial Balance
</h2>
<div class="row mt32">
<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>
<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">
<p>
<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>
<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>
</p>
</div>
<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>
<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>
<tr class="text-left">
<th>Code</th>
<th>Account</th>
<th class="text-right">Debit</th>
@ -46,20 +62,31 @@
<tbody>
<tr t-foreach="Accounts" t-as="account">
<td>
<span t-att-style="style" t-esc="account['code']"/>
<span t-att-style="style"
t-esc="account['code']"/>
</td>
<td>
<span style="color: white;" t-esc="'..'"/>
<span t-att-style="style" t-esc="account['name']"/>
<span t-att-style="style"
t-esc="account['name']"/>
</td>
<td class="text-right">
<span t-att-style="style" t-esc="account['debit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
<span t-att-style="style"
t-esc="account['debit']"
t-options="{'widget': 'monetary',
'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-att-style="style" t-esc="account['credit']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
<span t-att-style="style"
t-esc="account['credit']"
t-options="{'widget': 'monetary',
'display_currency': env.company.currency_id}"/>
</td>
<td class="text-right">
<span t-att-style="style" t-esc="account['balance']" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
<span t-att-style="style"
t-esc="account['balance']"
t-options="{'widget': 'monetary',
'display_currency': env.company.currency_id}"/>
</td>
</tr>
</tbody>

28
base_accounting_kit/security/security.xml

@ -4,45 +4,37 @@
<record model="res.groups" id="group_account_dashboard">
<field name="name">Access to Accounting Dashboard</field>
</record>
<record id="account_asset_category_multi_company_rule" model="ir.rule">
<field name="name">Account Asset Category multi-company</field>
<field ref="model_account_asset_category" name="model_id"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
<field name="domain_force">
['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
</field>
</record>
<record id="account_asset_asset_multi_company_rule" model="ir.rule">
<field name="name">Account Asset multi-company</field>
<field ref="model_account_asset_asset" name="model_id"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
<field name="domain_force">
['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
</field>
</record>
<!-- Rename user group as Accountant -->
<record id="account.group_account_user" model="res.groups">
<field name="name">Accountant</field>
<field name="implied_ids" eval="[(4, ref('account.group_account_invoice'))]"/>
<field name="category_id" ref="base.module_category_accounting_accounting"/>
<field name="implied_ids"
eval="[(4, ref('account.group_account_invoice'))]"/>
<field name="category_id"
ref="base.module_category_accounting_accounting"/>
</record>
<!-- Rename user group as Chief Accountant -->
<record id="account.group_account_manager" model="res.groups">
<field name="name">Chief Accountant</field>
<field name="implied_ids"
eval="[(3, ref('account.group_account_invoice')), (4, ref('account.group_account_user'))]"/>
<field name="category_id" ref="base.module_category_accounting_accounting"/>
<field name="category_id"
ref="base.module_category_accounting_accounting"/>
</record>
<!-- <record id="group_analytic_accounting_multi_company" model="res.groups">-->
<!-- <field name="name">Analytic Accounting Multi Company</field>-->
<!-- <field name="category_id" ref="base_accounting_kit.module_category_multi_analytic"/>-->
<!-- <field name="implied_ids" eval="[(4, ref('base.group_multi_company')),(4, ref('analytic.group_analytic_accounting'))]"/>-->
<!-- </record>-->
<!-- <record model="ir.module.category" id="module_category_multi_analytic">-->
<!-- <field name="name">Technical</field>-->
<!-- <field name="sequence">61</field>-->
<!-- <field name="visible" eval="0" />-->
<!-- </record>-->
</data>
</odoo>

249
base_accounting_kit/views/account_asset_views.xml

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!--
Asset Category
-->
<record model="ir.ui.view" id="view_account_asset_category_form">
<field name="name">account.asset.category.form</field>
<field name="model">account.asset.category</field>
@ -13,44 +11,66 @@
<sheet>
<group>
<div class="oe_title">
<label for="name" string="Asset Type" class="oe_edit_only" invisible="type != 'purchase'"/>
<label for="name" string="Deferred Revenue Type" class="oe_edit_only" invisible="type in 'purchase'"/>
<label for="name" string="Asset Type"
class="oe_edit_only"
invisible="type != 'purchase'"/>
<label for="name" string="Deferred Revenue Type"
class="oe_edit_only"
invisible="type in 'purchase'"/>
<h1>
<field name="name" placeholder="e.g. Computers"/>
<field name="name"
placeholder="e.g. Computers"/>
</h1>
</div>
<group>
<field name="type" invisible="1"/>
<field name="company_id" options="{'no_create': True}"/>
<field name="company_id"
options="{'no_create': True}"/>
<field name="price"/>
</group>
<group string="Journal Entries">
<field name="journal_id"/>
<div>
<label for="account_asset_id" invisible="type != 'purchase'"/>
<label for="account_asset_id" string="Deferred Revenue Account" invisible="type != 'sale'"/>
<label for="account_asset_id"
invisible="type != 'purchase'"/>
<label for="account_asset_id"
string="Deferred Revenue Account"
invisible="type != 'sale'"/>
</div>
<field name="account_asset_id" nolabel="1" invisible="not type"/>
<field name="account_asset_id" nolabel="1"
invisible="not type"/>
<div>
<label for="account_depreciation_id" invisible="type != 'purchase'"/>
<label for="account_depreciation_id" string="Recognition Income Account" invisible="type != 'sale'"/>
<label for="account_depreciation_id"
invisible="type != 'purchase'"/>
<label for="account_depreciation_id"
string="Recognition Income Account"
invisible="type != 'sale'"/>
</div>
<field name="account_depreciation_id" nolabel="1" />
<field name="account_depreciation_id" nolabel="1"/>
<div>
<label for="account_depreciation_expense_id" invisible="type != 'purchase'"/>
<label for="account_depreciation_expense_id" string="Recognition Account" invisible="type != 'sale'"/>
<label for="account_depreciation_expense_id"
invisible="type != 'purchase'"/>
<label for="account_depreciation_expense_id"
string="Recognition Account"
invisible="type != 'sale'"/>
</div>
<field name="account_depreciation_expense_id" nolabel="1"/>
<field name="account_depreciation_expense_id"
nolabel="1"/>
<field name="account_analytic_id"/>
</group>
<group string="Periodicity">
<field name="method_time" string="Time Method Based On" widget="radio" invisible="type != 'purchase'"/>
<field name="method_number" string="Number of Entries"
<field name="method_time"
string="Time Method Based On" widget="radio"
invisible="type != 'purchase'"/>
<field name="method_number"
string="Number of Entries"
invisible="method_time != 'number' and not type"
required="method_time in 'number'"/>
<label for="method_period" string="One Entry Every"/>
<label for="method_period"
string="One Entry Every"/>
<div>
<field name="method_period" nolabel="1" invisible="not type" class="oe_inline"/>
<field name="method_period" nolabel="1"
invisible="not type" class="oe_inline"/>
months
</div>
<field name="method_end"
@ -61,7 +81,8 @@
<field name="open_asset"/>
<field name="group_entries"/>
</group>
<group invisible="type in 'sale'" string="Depreciation Method">
<group invisible="type in 'sale'"
string="Depreciation Method">
<field name="method" widget="radio"/>
<field name="method_progress_factor"
invisible="method in 'linear'"
@ -74,7 +95,6 @@
</form>
</field>
</record>
<record id="view_account_asset_asset_category_kanban" model="ir.ui.view">
<field name="name">account.asset.category.kanban</field>
<field name="model">account.asset.category</field>
@ -88,20 +108,29 @@
<div t-attf-class="oe_kanban_card oe_kanban_global_click">
<div class="row mb4">
<div class="col-xs-6">
<strong><span><t t-esc="record.name.value"/></span></strong>
<strong>
<span>
<t t-esc="record.name.value"/>
</span>
</strong>
</div>
<div class="col-xs-6 text-right">
<span class="badge"><strong><t t-esc="record.method.value"/></strong></span>
<span class="badge">
<strong>
<t t-esc="record.method.value"/>
</strong>
</span>
</div>
</div>
<div> <t t-esc="record.journal_id.value"/></div>
<div>
<t t-esc="record.journal_id.value"/>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record model="ir.ui.view" id="view_account_asset_category_tree">
<field name="name">account.asset.category.tree</field>
<field name="model">account.asset.category</field>
@ -114,63 +143,83 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_account_asset_category_search">
<field name="name">account.asset.category.search</field>
<field name="model">account.asset.category</field>
<field name="arch" type="xml">
<search string="Search Asset Category">
<filter name="type" string="Sales" domain="[('type','=', 'sale')]" help="Deferred Revenues"/>
<filter name="type" string="Purchase" domain="[('type','=', 'purchase')]" help="Assets"/>
<filter name="type" string="Sales"
domain="[('type','=', 'sale')]"
help="Deferred Revenues"/>
<filter name="type" string="Purchase"
domain="[('type','=', 'purchase')]" help="Assets"/>
<field name="name" string="Category"/>
<field name="journal_id"/>
<group expand="0" string="Group By...">
<filter name="type" string="Type" domain="[]" context="{'group_by':'type'}"/>
<filter name="type" string="Type" domain="[]"
context="{'group_by':'type'}"/>
</group>
</search>
</field>
</record>
<record model="ir.ui.view" id="view_account_asset_asset_form">
<field name="name">account.asset.asset.form</field>
<field name="model">account.asset.asset</field>
<field name="arch" type="xml">
<form string="Asset">
<header>
<button name="validate" invisible="state != 'draft'" string="Confirm" type="object" class="oe_highlight"/>
<button type="object" name="compute_depreciation_board" string="Compute Depreciation" invisible="state != 'draft'"/>
<button name="set_to_close" invisible="state != 'open'" string="Sell or Dispose" type="object" class="oe_highlight"/>
<button name="set_to_draft" string="Set to Draft" type="object"
<button name="validate" invisible="state != 'draft'"
string="Confirm" type="object"
class="oe_highlight"/>
<button type="object" name="compute_depreciation_board"
string="Compute Depreciation"
invisible="state != 'draft'"/>
<button name="set_to_close" invisible="state != 'open'"
string="Sell or Dispose" type="object"
class="oe_highlight"/>
<button name="set_to_draft" string="Set to Draft"
type="object"
invisible="entry_count != 0 or state != 'open'"/>
<button name="%(action_asset_modify)d" invisible="state != 'open'" string="Modify Depreciation" type="action"/>
<field name="state" widget="statusbar" statusbar_visible="draft,open"/>
<button name="%(action_asset_modify)d"
invisible="state != 'open'"
string="Modify Depreciation" type="action"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,open"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button" name="open_entries" type="object" icon="fa-pencil">
<field string="Items" name="entry_count" widget="statinfo" />
<button class="oe_stat_button" name="open_entries"
type="object" icon="fa-pencil">
<field string="Items" name="entry_count"
widget="statinfo"/>
</button>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" placeholder="e.g. Laptop iBook"
readonly="state != 'draft'"/>
readonly="state != 'draft'"/>
</h1>
</div>
<group>
<group>
<field name="category_id" domain="[('type', '=', 'purchase')]"
<field name="category_id"
domain="[('type', '=', 'purchase')]"
context="{'default_type': 'purchase'}"
help="Category of asset" readonly="state != 'draft'"/>
help="Category of asset"
readonly="state != 'draft'"/>
<field name="code" readonly="state != 'draft'"/>
<field name="date" help="Date of asset"/>
<field name="type" invisible="1"/>
</group>
<group>
<field name="currency_id" groups="base.group_multi_currency" readonly="state != 'draft'"/>
<field name="company_id" options="{'no_create': True}"
groups="base.group_multi_company" readonly="state != 'draft'"/>
<field name="currency_id"
groups="base.group_multi_currency"
readonly="state != 'draft'"/>
<field name="company_id"
options="{'no_create': True}"
groups="base.group_multi_company"
readonly="state != 'draft'"/>
<field name="value" widget="monetary"
options="{'currency_field': 'currency_id'}"
help="Gross value of asset"
@ -179,8 +228,10 @@
options="{'currency_field': 'currency_id'}"
readonly="state != 'draft'"
invisible="type in 'sale'"/>
<field name="value_residual" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="partner_id" string="Vendor" readonly="state != 'draft'"
<field name="value_residual" widget="monetary"
options="{'currency_field': 'currency_id'}"/>
<field name="partner_id" string="Vendor"
readonly="state != 'draft'"
domain="[('supplier_rank', '>', 0)]"/>
<field name="invoice_id" string="Invoice"
options="{'no_create': True}"
@ -192,28 +243,38 @@
<field name="depreciation_line_ids" mode="tree"
readonly="state not in ['draft', 'open']"
options="{'reload_whole_on_button': true}">
<tree string="Depreciation Lines" decoration-info="(move_check == False)" create="false">
<tree string="Depreciation Lines"
decoration-info="(move_check == False)"
create="false">
<field name="depreciation_date"/>
<field name="depreciated_value" readonly="1"/>
<field name="amount" widget="monetary" string="Depreciation"/>
<field name="remaining_value" readonly="1" widget="monetary" string="Residual"/>
<field name="move_check" widget="deprec_lines_toggler"
<field name="depreciated_value"
readonly="1"/>
<field name="amount" widget="monetary"
string="Depreciation"/>
<field name="remaining_value" readonly="1"
widget="monetary" string="Residual"/>
<field name="move_check"
widget="deprec_lines_toggler"
invisible="parent_state != 'open'"/>
<field name="move_posted_check" invisible="1"/>
<field name="move_posted_check"
invisible="1"/>
<field name="parent_state" invisible="1"/>
</tree>
<form string="Depreciation Lines">
<group>
<group>
<field name="parent_state" invisible="1"/>
<field name="parent_state"
invisible="1"/>
<field name="name"/>
<field name="sequence"/>
<field name="move_id"/>
<field name="move_check"/>
<field name="parent_state" invisible="1"/>
<field name="parent_state"
invisible="1"/>
</group>
<group>
<field name="amount" widget="monetary"/>
<field name="amount"
widget="monetary"/>
<field name="depreciation_date"/>
<field name="depreciated_value"/>
<field name="remaining_value"/>
@ -225,13 +286,15 @@
<page string="Depreciation Information">
<group>
<field name="method" widget="radio"
invisible="type in 'sale'" readonly="state != 'draft'"/>
invisible="type in 'sale'"
readonly="state != 'draft'"/>
<field name="method_progress_factor"
invisible="method in 'linear'"
readonly="method in 'degressive' and state != 'draft'"/>
<field name="method_time"
readonly="state != 'draft'"
string="Time Method Based On" widget="radio"
string="Time Method Based On"
widget="radio"
invisible="type != 'purchase'"/>
<field name="prorata"
readonly="state != 'draft'"
@ -243,12 +306,13 @@
invisible="method_time in 'end'"
required="method_time in 'number'"
/>
<field name="method_period" readonly="state != 'draft'"/>
<field name="method_period"
readonly="state != 'draft'"/>
<field name="method_end"
readonly="state != 'draft'"
required="method_time in 'end'"
invisible="method_time in 'number'"
/>
/>
</group>
</page>
</notebook>
@ -260,7 +324,6 @@
</form>
</field>
</record>
<record id="view_account_asset_asset_kanban" model="ir.ui.view">
<field name="name">account.asset.asset.kanban</field>
<field name="model">account.asset.asset</field>
@ -275,19 +338,29 @@
<div t-attf-class="oe_kanban_global_click">
<div class="row mb4">
<div class="col-xs-6">
<strong><span><t t-esc="record.name.value"/></span></strong>
<strong>
<span>
<t t-esc="record.name.value"/>
</span>
</strong>
</div>
<div class="col-xs-6 pull-right text-right">
<strong><t t-esc="record.date.value"/></strong>
<strong>
<t t-esc="record.date.value"/>
</strong>
</div>
</div>
<div class="row">
<div class="col-xs-6 text-muted">
<span><t t-esc="record.category_id.value"/></span>
<span>
<t t-esc="record.category_id.value"/>
</span>
</div>
<div class="col-xs-6">
<span class="pull-right text-right">
<field name="state" widget="label_selection" options="{'classes': {'draft': 'primary', 'open': 'success', 'close': 'default'}}"/>
<field name="state"
widget="label_selection"
options="{'classes': {'draft': 'primary', 'open': 'success', 'close': 'default'}}"/>
</span>
</div>
</div>
@ -297,12 +370,12 @@
</kanban>
</field>
</record>
<record model="ir.ui.view" id="view_account_asset_asset_purchase_tree">
<field name="name">account.asset.asset.purchase.tree</field>
<field name="model">account.asset.asset</field>
<field name="arch" type="xml">
<tree string="Assets" decoration-info="(state == 'draft')" decoration-muted="(state == 'close')">
<tree string="Assets" decoration-info="(state == 'draft')"
decoration-muted="(state == 'close')">
<field name="name"/>
<field name="category_id"/>
<field name="date"/>
@ -315,7 +388,6 @@
</tree>
</field>
</record>
<record id="view_account_asset_search" model="ir.ui.view">
<field name="name">account.asset.asset.search</field>
<field name="model">account.asset.asset</field>
@ -323,20 +395,24 @@
<search string="Asset Account">
<field name="name" string="Asset"/>
<field name="date"/>
<filter name="state" string="Current" domain="[('state','in', ('draft','open'))]" help="Assets in draft and open states"/>
<filter name="state" string="Closed" domain="[('state','=', 'close')]" help="Assets in closed state"/>
<filter name="state" string="Current"
domain="[('state','in', ('draft','open'))]"
help="Assets in draft and open states"/>
<filter name="state" string="Closed"
domain="[('state','=', 'close')]"
help="Assets in closed state"/>
<field name="category_id"/>
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
<field name="partner_id"
filter_domain="[('partner_id','child_of',self)]"/>
<group expand="0" string="Group By...">
<filter name="date" string="Month" domain="[]" context="{'group_by':'date'}"/>
<filter name="category_id" string="Category" domain="[]" context="{'group_by':'category_id'}"/>
<filter name="date" string="Month" domain="[]"
context="{'group_by':'date'}"/>
<filter name="category_id" string="Category" domain="[]"
context="{'group_by':'category_id'}"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_account_asset_asset_form">
<field name="name">Assets</field>
<field name="res_model">account.asset.asset</field>
@ -344,22 +420,23 @@
<field name="view_id" ref="view_account_asset_asset_purchase_tree"/>
<field name="domain">[('category_id.type', '=', 'purchase')]</field>
</record>
<menuitem parent="account.menu_finance_entries_management" id="menu_action_account_asset_asset_form" action="action_account_asset_asset_form" sequence="101" groups="account.group_account_user"/>
<menuitem parent="account.menu_finance_entries_management"
id="menu_action_account_asset_asset_form"
action="action_account_asset_asset_form" sequence="101"
groups="account.group_account_user"/>
<!-- Configuration -->
<menuitem id="menu_finance_config_assets" name="Assets and Revenues" parent="account.menu_finance_configuration" sequence="25"/>
<record model="ir.actions.act_window" id="action_account_asset_asset_list_normal_purchase">
<menuitem id="menu_finance_config_assets" name="Assets and Revenues"
parent="account.menu_finance_configuration" sequence="25"/>
<record model="ir.actions.act_window"
id="action_account_asset_asset_list_normal_purchase">
<field name="name">Asset Types</field>
<field name="res_model">account.asset.category</field>
<field name="domain">[('type', '=', 'purchase')]</field>
<field name="view_mode">tree,kanban,form</field>
<field name="context">{'default_type': 'purchase'}</field>
</record>
<menuitem parent="account.account_management_menu" id="menu_action_account_asset_asset_list_normal_purchase" action="action_account_asset_asset_list_normal_purchase" sequence="6"/>
<menuitem parent="account.account_management_menu"
id="menu_action_account_asset_asset_list_normal_purchase"
action="action_account_asset_asset_list_normal_purchase"
sequence="6"/>
</odoo>

4
base_accounting_kit/views/account_configuration.xml

@ -12,8 +12,4 @@
</data>
</field>
</record>
</odoo>

220
base_accounting_kit/views/account_followup.xml

@ -1,113 +1,123 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="view_account_followup_followup_line_tree" model="ir.ui.view">
<field name="name">followup.line.tree</field>
<field name="model">followup.line</field>
<field name="arch" type="xml">
<tree string="Follow-up Steps" >
<record id="view_account_followup_followup_line_tree"
model="ir.ui.view">
<field name="name">followup.line.tree</field>
<field name="model">followup.line</field>
<field name="arch" type="xml">
<tree string="Follow-up Steps">
<field name="name"/>
<field name="delay"/>
</tree>
</field>
</record>
<record id="view_account_followup_followup_line_form"
model="ir.ui.view">
<field name="name">followup.line.form</field>
<field name="model">followup.line</field>
<field name="arch" type="xml">
<form string="Follow-up Steps">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name"/>
<field name="delay"/>
</tree>
</field>
</record>
<record id="view_account_followup_followup_line_form" model="ir.ui.view">
<field name="name">followup.line.form</field>
<field name="model">followup.line</field>
<field name="arch" type="xml">
<form string="Follow-up Steps">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
<div class="oe_inline">
After <field name="delay" class="oe_inline"/> days overdue, do the following actions:
</div>
</form>
</field>
</record>
<record id="view_account_followup_followup_form" model="ir.ui.view">
<field name="name">account.followup.form</field>
<field name="model">account.followup</field>
<field name="arch" type="xml">
<form string="Follow-up">
<h1><field name="name"/></h1>
<label for="company_id" groups="base.group_multi_company"/>
<field name="company_id" options="{'no_create': True}" class="oe_inline" groups="base.group_multi_company"/>
<p class="oe_grey">
To remind customers of paying their invoices, you can
define different actions depending on how severely
overdue the customer is. These actions are bundled
into follow-up levels that are triggered when the due
date of an invoice has passed a certain
number of days. If there are other overdue invoices for the
same customer, the actions of the most
overdue invoice will be executed.
</p>
<field name="followup_line_ids"/>
</form>
</field>
</record>
<record id="view_account_followup_followup_tree" model="ir.ui.view">
<field name="name">account.followup.tree</field>
<field name="model">account.followup</field>
<field name="arch" type="xml">
<tree string="Follow-up">
<field name="company_id" />
</tree>
</field>
</record>
<record id="view_account_followup_filter" model="ir.ui.view">
<field name="name">account.followup.select</field>
<field name="model">account.followup</field>
<field name="arch" type="xml">
<search string="Search Follow-up">
<field name="company_id" groups="base.group_multi_company"/>
</search>
</field>
</record>
<record id="view_account_followup_followup_kanban" model="ir.ui.view">
<field name="name">account.followup.kanban</field>
<field name="model">account.followup</field>
<field name="arch" type="xml">
<kanban>
</h1>
<div class="oe_inline">
After
<field name="delay" class="oe_inline"/>
days overdue, do the following actions:
</div>
</form>
</field>
</record>
<record id="view_account_followup_followup_form" model="ir.ui.view">
<field name="name">account.followup.form</field>
<field name="model">account.followup</field>
<field name="arch" type="xml">
<form string="Follow-up">
<h1>
<field name="name"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_global_click">
<div>
<strong><i class="fa fa-building" role="img" aria-label="Enterprise"/> <t t-esc="record.name.value"/></strong>
</div>
</h1>
<label for="company_id" groups="base.group_multi_company"/>
<field name="company_id" options="{'no_create': True}"
class="oe_inline" groups="base.group_multi_company"/>
<p class="oe_grey">
To remind customers of paying their invoices, you can
define different actions depending on how severely
overdue the customer is. These actions are bundled
into follow-up levels that are triggered when the due
date of an invoice has passed a certain
number of days. If there are other overdue invoices for
the
same customer, the actions of the most
overdue invoice will be executed.
</p>
<field name="followup_line_ids"/>
</form>
</field>
</record>
<record id="view_account_followup_followup_tree" model="ir.ui.view">
<field name="name">account.followup.tree</field>
<field name="model">account.followup</field>
<field name="arch" type="xml">
<tree string="Follow-up">
<field name="company_id"/>
</tree>
</field>
</record>
<record id="view_account_followup_filter" model="ir.ui.view">
<field name="name">account.followup.select</field>
<field name="model">account.followup</field>
<field name="arch" type="xml">
<search string="Search Follow-up">
<field name="company_id" groups="base.group_multi_company"/>
</search>
</field>
</record>
<record id="view_account_followup_followup_kanban" model="ir.ui.view">
<field name="name">account.followup.kanban</field>
<field name="model">account.followup</field>
<field name="arch" type="xml">
<kanban>
<field name="name"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_global_click">
<div>
<strong>
<i class="fa fa-building" role="img"
aria-label="Enterprise"/>
<t t-esc="record.name.value"/>
</strong>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="action_account_followup_definition_form" model="ir.actions.act_window">
<field name="name">Payment Follow-ups</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.followup</field>
<field name="search_view_id" ref="view_account_followup_filter"/>
<field name="view_mode">tree,kanban,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="action_account_followup_definition_form"
model="ir.actions.act_window">
<field name="name">Payment Follow-ups</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.followup</field>
<field name="search_view_id" ref="view_account_followup_filter"/>
<field name="view_mode">tree,kanban,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Define follow-up levels and their related actions
</p><p>
For each step, specify the actions to be taken and delay in days. It is
possible to use print and e-mail templates to send specific messages to
</p>
<p>
For each step, specify the actions to be taken and delay in
days. It is
possible to use print and e-mail templates to send specific
messages to
the customer.
</p>
</field>
</record>
<menuitem action="action_account_followup_definition_form" id="account_followup_menu"
parent="account.account_management_menu" name="Follow-up Levels"
groups="account.group_account_manager" sequence="2"/>
</data>
</p>
</field>
</record>
<menuitem action="action_account_followup_definition_form"
id="account_followup_menu"
parent="account.account_management_menu"
name="Follow-up Levels"
groups="account.group_account_manager" sequence="2"/>
</odoo>

23
base_accounting_kit/views/account_group.xml

@ -1,16 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="action_account_group" model="ir.actions.act_window">
<field name="name">Account Groups</field>
<field name="res_model">account.group</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="menu_account_group" name="Account Groups"
action="action_account_group" sequence="10"
parent="account.account_account_menu"/>
</data>
<record id="action_account_group" model="ir.actions.act_window">
<field name="name">Account Groups</field>
<field name="res_model">account.group</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="menu_account_group" name="Account Groups"
action="action_account_group" sequence="10"
parent="account.account_account_menu"/>
</odoo>

18
base_accounting_kit/views/account_move_views.xml

@ -1,20 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Add "Asset Category" to supplier invoices -->
<record model="ir.ui.view" id="view_invoice_asset_category">
<field name="name">account.invoice.supplier.form</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='account_id']" position="before">
<field string="Asset Category" column_invisible="parent.move_type != 'in_invoice'"
name="asset_category_id" domain="[('type','=','purchase')]" context="{'default_type':'purchase'}"/>
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='account_id']"
position="before">
<field string="Asset Category"
column_invisible="parent.move_type != 'in_invoice'"
name="asset_category_id"
domain="[('type','=','purchase')]"
context="{'default_type':'purchase'}"/>
</xpath>
<xpath expr="//field[@name='line_ids']/tree/field[@name='account_id']" position="after">
<field string="Asset Category" name="asset_category_id" invisible="1"/>
<xpath expr="//field[@name='line_ids']/tree/field[@name='account_id']"
position="after">
<field string="Asset Category" name="asset_category_id"
invisible="1"/>
</xpath>
</field>
</record>
</odoo>

21
base_accounting_kit/views/account_payment_view.xml

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_check_printing.view_account_payment_form_inherited" model="ir.ui.view">
<record id="account_check_printing.view_account_payment_form_inherited"
model="ir.ui.view">
<field name="name">account.payment.form.inherited</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="after">
<widget name="web_ribbon" title="Sent"
invisible="is_move_sent != True"/>
</xpath>
<xpath expr="//div[@name='button_box']" position="after">
<widget name="web_ribbon" title="Sent"
invisible="is_move_sent != True"/>
</xpath>
<xpath expr="//button[@name='action_post']" position="before">
<button name="print_checks" class="oe_highlight"
invisible="payment_method_code not in ['check_printing','pdc'] or state != 'posted'"
@ -37,7 +38,6 @@
</xpath>
</field>
</record>
<record id="view_bank_statement_line_tree" model="ir.ui.view">
<field name="name">account.bank.statement.line.tree</field>
<field name="model">account.bank.statement.line</field>
@ -63,8 +63,10 @@
<field name="ref" groups="base.group_no_one" optional="hidden"/>
<field name="narration" string="Notes" optional="hidden"/>
<field name="transaction_type" optional="hidden"/>
<field name="amount_currency" optional="hidden" groups="base.group_multi_currency"/>
<field name="foreign_currency_id" optional="hidden" groups="base.group_multi_currency"/>
<field name="amount_currency" optional="hidden"
groups="base.group_multi_currency"/>
<field name="foreign_currency_id" optional="hidden"
groups="base.group_multi_currency"/>
<field name="amount"/>
<field name="account_number" optional="hidden"/>
</tree>
@ -74,7 +76,8 @@
<record model="ir.ui.view" id="view_account_reg_payment_form_check_pdc">
<field name="name">view.account.reg.payment.form.check.pdc</field>
<field name="model">account.payment.register</field>
<field name="inherit_id" ref="account.view_account_payment_register_form"/>
<field name="inherit_id"
ref="account.view_account_payment_register_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='payment_date']" position="after">
<field name="effective_date"/>

40
base_accounting_kit/views/accounting_menu.xml

@ -1,30 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<!-- Change invoicing menu to Accounting -->
<record model="ir.ui.menu" id="account.menu_finance">
<field name="name">Accounting</field>
</record>
<!-- Change settings invoicing menu to Accounting -->
<!-- need to check-->
<!-- <record id="res_config_settings_view_accounting_kit" model="ir.ui.view">-->
<!-- <field name="name">res.config.settings.view.form.inherit.kit</field>-->
<!-- <field name="model">res.config.settings</field>-->
<!-- <field name="inherit_id" ref="account.res_config_settings_view_form"/>-->
<!-- <field name="arch" type="xml">-->
<!-- <div data-key="account" position="attributes">-->
<!-- <attribute name="data-string">Accounting</attribute>-->
<!-- <attribute name="string">Accounting</attribute>-->
<!-- </div>-->
<!-- </field>-->
<!-- </record>-->
<menuitem id="account_reports_generic_statements" sequence="1"
name="Generic Statements" parent="account.menu_finance_reports"/>
<menuitem id="account_reports_daily_reports" sequence="2"
name="Daily Reports" parent="account.menu_finance_reports"/>
<menuitem id="account_reports_partner" sequence="3"
name="Partner Reports" parent="account.menu_finance_reports"/>
<menuitem id="account_reports_audit" sequence="4"
name="Audit Reports" parent="account.menu_finance_reports"/>
</data>
<!-- Change invoicing menu to Accounting -->
<record model="ir.ui.menu" id="account.menu_finance">
<field name="name">Accounting</field>
</record>
<menuitem id="account_reports_generic_statements" sequence="1"
name="Generic Statements"
parent="account.menu_finance_reports"/>
<menuitem id="account_reports_daily_reports" sequence="2"
name="Daily Reports" parent="account.menu_finance_reports"/>
<menuitem id="account_reports_partner" sequence="3"
name="Partner Reports" parent="account.menu_finance_reports"/>
<menuitem id="account_reports_audit" sequence="4"
name="Audit Reports" parent="account.menu_finance_reports"/>
</odoo>

145
base_accounting_kit/views/credit_limit_view.xml

@ -1,70 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="view_customer_form" model="ir.ui.view">
<field name="name">Credit Limit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='accounting']" position="inside">
<group string="Credit Limit" invisible="not enable_credit_limit">
<group>
<field name="active_limit"/>
<field name="enable_credit_limit" invisible="1"/>
<field name="warning_stage" invisible="not active_limit"/>
<field name="blocking_stage" invisible="not active_limit"/>
</group>
<record id="view_customer_form" model="ir.ui.view">
<field name="name">Credit Limit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='accounting']" position="inside">
<group string="Credit Limit"
invisible="not enable_credit_limit">
<group>
<field name="active_limit"/>
<field name="enable_credit_limit" invisible="1"/>
<field name="warning_stage"
invisible="not active_limit"/>
<field name="blocking_stage"
invisible="not active_limit"/>
</group>
</xpath>
</field>
</record>
<record id="header_view" model="ir.ui.view">
<field name="name">Credit Limit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='payment_term_id']" position="after">
<field name="has_due" invisible="1"/>
<field name="is_warning" invisible="1"/>
</xpath>
<xpath expr="//header" position="after">
<div class="alert alert-info" role="alert" style="height: 40px; margin-bottom:0px;"
invisible="not has_due">
This Customer's due amount is <strong><field name="due_amount"/></strong>.
</div>
</xpath>
<xpath expr="//sheet/div[@name='button_box']" position="after">
<div role="alert" class="alert alert-danger" style="height: 40px; width: 350px; margin-bottom:0px;"
invisible="not is_warning">
This customer's <strong>warning limit</strong> has been crossed.
</div>
</xpath>
</field>
</record>
<record id="account_move_form_inherited" model="ir.ui.view">
<field name="name">Account Move</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='ref']" position="after">
<field name="has_due" invisible="1"/>
<field name="is_warning" invisible="1"/>
</xpath>
<xpath expr="//header" position="after">
<div class="alert alert-info" role="alert" style="height: 40px; margin-bottom:0px;"
invisible="not has_due or move_type not in ['out_invoice','out_refund','out_receipt']">
This Customer's due amount is <strong><field name="due_amount"/></strong>.
</div>
</xpath>
<xpath expr="//sheet/div[@name='button_box']" position="after">
<div role="alert" class="alert alert-danger" style="height: 40px; width: 350px; margin-bottom:0px;"
invisible="not is_warning or move_type not in ['out_invoice','out_refund','out_receipt']">
This customer's <strong>warning limit</strong> has been crossed.
</div>
</xpath>
</field>
</record>
</data>
</group>
</xpath>
</field>
</record>
<record id="header_view" model="ir.ui.view">
<field name="name">Credit Limit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='payment_term_id']" position="after">
<field name="has_due" invisible="1"/>
<field name="is_warning" invisible="1"/>
</xpath>
<xpath expr="//header" position="after">
<div class="alert alert-info" role="alert"
style="height: 40px; margin-bottom:0px;"
invisible="not has_due">
This Customer's due amount is
<strong>
<field name="due_amount"/>
</strong>
.
</div>
</xpath>
<xpath expr="//sheet/div[@name='button_box']" position="after">
<div role="alert" class="alert alert-danger"
style="height: 40px; width: 350px; margin-bottom:0px;"
invisible="not is_warning">
This customer's <strong>warning limit</strong> has been
crossed.
</div>
</xpath>
</field>
</record>
<record id="account_move_form_inherited" model="ir.ui.view">
<field name="name">Account Move</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='ref']" position="after">
<field name="has_due" invisible="1"/>
<field name="is_warning" invisible="1"/>
</xpath>
<xpath expr="//header" position="after">
<div class="alert alert-info" role="alert"
style="height: 40px; margin-bottom:0px;"
invisible="not has_due or move_type not in ['out_invoice','out_refund','out_receipt']">
This Customer's due amount is
<strong>
<field name="due_amount"/>
</strong>
.
</div>
</xpath>
<xpath expr="//sheet/div[@name='button_box']" position="after">
<div role="alert" class="alert alert-danger"
style="height: 40px; width: 350px; margin-bottom:0px;"
invisible="not is_warning or move_type not in ['out_invoice','out_refund','out_receipt']">
This customer's <strong>warning limit</strong> has been
crossed.
</div>
</xpath>
</field>
</record>
</odoo>

244
base_accounting_kit/views/followup_report.xml

@ -1,133 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="customer_statements_form_view" model="ir.ui.view">
<field name="name">customer.statements.followup</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<form string="report" create="false" edit="false">
<header>
<field name="followup_status" widget="statusbar"/>
</header>
<div class="alert alert-info" role="alert"
style="font-size: 15px;display: inline-block; margin-top:10px;margin-left: 201px;">
<span>Wonder how to Send Followup mails and Print Followup Reports ? Download our
<a target="_blank"
href="https://apps.odoo.com/apps/modules/16.0/customer_followup_community">
<b>Customer Followup</b>
</a>
Module !
</span>
<record id="customer_statements_form_view" model="ir.ui.view">
<field name="name">customer.statements.followup</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<form string="report" create="false" edit="false">
<header>
<field name="followup_status" widget="statusbar"/>
</header>
<div class="alert alert-info" role="alert"
style="font-size: 15px;display: inline-block; margin-top:10px;margin-left: 201px;">
<span>Wonder how to Send Followup mails and Print Followup
Reports ? Download our
<a target="_blank"
href="https://apps.odoo.com/apps/modules/16.0/customer_followup_community">
<b>Customer Followup</b>
</a>
Module !
</span>
</div>
<sheet>
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
</h1>
</div>
<sheet>
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
</h1>
</div>
<br/>
<div class="alert alert-warning o_account_reports_followup-no-action"
invisible="invoice_list != []"
id='no-action' role="alert">
<p>
<strong>
<field name="name"/>
</strong>
has no due amount.
</p>
</div>
<div invisible="invoice_list != []">
<group>
<field name="next_reminder_date"/>
</group>
<notebook colspan="4">
<page string="Invoice Details">
<field name="invoice_list"/>
</page>
<br/>
</notebook>
</div>
<group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total">
<field name="total_due" class="oe_subtotal_footer_separator" widget="monetary"
/>
<!-- <field name="total_due" class="oe_subtotal_footer_separator" widget="monetary"-->
<!-- options="{'currency_field': 'currency_id'}"/>-->
<div class="oe_subtotal_footer_separator oe_inline o_td_label">
<label for="total_overdue"/>
</div>
<field name="total_overdue" nolabel="1" class="oe_subtotal_footer_separator"
widget="monetary"/>
<!-- <field name="total_overdue" nolabel="1" class="oe_subtotal_footer_separator"-->
<!-- widget="monetary" options="{'currency_field': 'currency_id'}"/>-->
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
<div class="alert alert-warning o_account_reports_followup-no-action"
invisible="invoice_list != []"
id='no-action' role="alert">
<p>
<strong>
<field name="name"/>
</strong>
has no due amount.
</p>
</div>
</form>
</field>
</record>
<record id="customer_statements_tree_view" model="ir.ui.view">
<field name="name">customer.statements.tree</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<tree string="Follow-up Reports Tree View" create="false" import="false" delete="false">
<field name="currency_id" invisible="1"/>
<field name="name"/>
<field name="total_due" widget="monetary" options="{'currency_field': 'currency_id'}" sum="Total"/>
<field name="total_overdue" widget="monetary" options="{'currency_field': 'currency_id'}"
sum="Total"/>
<field name="followup_status"/>
</tree>
</field>
</record>
<div invisible="invoice_list != []">
<group>
<field name="next_reminder_date"/>
</group>
<notebook colspan="4">
<page string="Invoice Details">
<field name="invoice_list"/>
</page>
<record id="customer_statements_search_view" model="ir.ui.view">
<field name="name">customer.statements.search</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<filter name="supplier" position="after">
<separator/>
<filter string="Overdue Invoices"
name="filter_with_overdue_invoices"
domain="[('followup_status', '=', 'with_overdue_invoices')]"/>
<filter string="In need of action"
name="filter_in_need_of_action"
domain="[('followup_status', '=', 'in_need_of_action')]"/>
<filter string="No action needed"
name="filter_no_action_needed"
domain="[('followup_status', '=', 'no_action_needed')]"/>
<separator/>
</filter>
</field>
</record>
<record id="action_view_list_customer_statements" model="ir.actions.act_window">
<field name="name">Follow-up Reports</field>
<field name="res_model">res.partner</field>
<field name="view_mode">tree,form</field>
<field name="view_ids" eval="[(5, 0, 0),
</notebook>
</div>
<group class="oe_subtotal_footer oe_right" colspan="2"
name="sale_total">
<field name="total_due"
class="oe_subtotal_footer_separator"
widget="monetary"
/>
<div class="oe_subtotal_footer_separator oe_inline o_td_label">
<label for="total_overdue"/>
</div>
<field name="total_overdue" nolabel="1"
class="oe_subtotal_footer_separator"
widget="monetary"/>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record id="customer_statements_tree_view" model="ir.ui.view">
<field name="name">customer.statements.tree</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<tree string="Follow-up Reports Tree View" create="false"
import="false" delete="false">
<field name="currency_id" invisible="1"/>
<field name="name"/>
<field name="total_due" widget="monetary"
options="{'currency_field': 'currency_id'}" sum="Total"/>
<field name="total_overdue" widget="monetary"
options="{'currency_field': 'currency_id'}"
sum="Total"/>
<field name="followup_status"/>
</tree>
</field>
</record>
<record id="customer_statements_search_view" model="ir.ui.view">
<field name="name">customer.statements.search</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<filter name="supplier" position="after">
<separator/>
<filter string="Overdue Invoices"
name="filter_with_overdue_invoices"
domain="[('followup_status', '=', 'with_overdue_invoices')]"/>
<filter string="In need of action"
name="filter_in_need_of_action"
domain="[('followup_status', '=', 'in_need_of_action')]"/>
<filter string="No action needed"
name="filter_no_action_needed"
domain="[('followup_status', '=', 'no_action_needed')]"/>
<separator/>
</filter>
</field>
</record>
<record id="action_view_list_customer_statements"
model="ir.actions.act_window">
<field name="name">Follow-up Reports</field>
<field name="res_model">res.partner</field>
<field name="view_mode">tree,form</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('customer_statements_tree_view')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('customer_statements_form_view')})]"/>
<field name="context">{'search_default_filter_in_need_of_action':1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No follow-up to send!
</p>
</field>
</record>
<menuitem id="customer_statements_menu" name="Follow-up Reports"
parent="account.menu_finance_receivables"
action="action_view_list_customer_statements" sequence="20"
groups="account.group_account_user"/>
</data>
<field name="context">{'search_default_filter_in_need_of_action':1}
</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No follow-up to send!
</p>
</field>
</record>
<menuitem id="customer_statements_menu" name="Follow-up Reports"
parent="account.menu_finance_receivables"
action="action_view_list_customer_statements" sequence="20"
groups="account.group_account_user"/>
</odoo>

17
base_accounting_kit/views/multiple_invoice_form.xml

@ -3,31 +3,32 @@
<record id="multiple_invoice_view_form" model="ir.ui.view">
<field name="name">multiple.invoice.form.inherit.account.journal</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form" />
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<page name="advanced_settings" position="inside">
<group string="Multiple Invoice Copies" invisible="type not in ['sale', 'purchase']">
<group string="Multiple Invoice Copies"
invisible="type not in ['sale', 'purchase']">
<field name="multiple_invoice_type" style="width: 40%"/>
</group>
<group invisible="type not in ['sale', 'purchase']">
<div class="mt8">
<button name="%(base_accounting_kit.action_multiple_invoice_layout_configurator)d" string="Configure Copy Layout" type="action" class="oe_link" icon="fa-arrow-right"/>
<button name="%(base_accounting_kit.action_multiple_invoice_layout_configurator)d"
string="Configure Copy Layout" type="action"
class="oe_link" icon="fa-arrow-right"/>
</div>
</group>
<group>
<group invisible="type not in ['sale', 'purchase']">
<div>
<field name="multiple_invoice_ids" widget="one2many" nolabel="1">
<field name="multiple_invoice_ids" widget="one2many"
nolabel="1">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="copy_name" style="width: 75"/>
</tree>
</field>
</field>
</div>
</group>
</group>
</page>
</field>

78
base_accounting_kit/views/multiple_invoice_layout_view.xml

@ -1,42 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_multiple_invoice_layout" model="ir.ui.view">
<field name="name">Document Layout</field>
<field name="model">multiple.invoice.layout</field>
<field name="arch" type="xml">
<form class="o_document_layout">
<group>
<group class="o_document_layout_company">
<field name="company_id" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="multiple_invoice_type"/>
<field name="text_position" widget="selection"
invisible="multiple_invoice_type != 'text'"
/>
<field name="body_text_position" widget="radio"
invisible="multiple_invoice_type != 'text' or text_position != 'body'"/>
<field name="text_align" widget="radio" string="Text Align"
invisible="multiple_invoice_type != 'text' or text_position not in ['header', 'footer']"/>
</group>
<div>
<field name="preview" widget="iframe_wrapper" />
</div>
<record id="view_multiple_invoice_layout" model="ir.ui.view">
<field name="name">Document Layout</field>
<field name="model">multiple.invoice.layout</field>
<field name="arch" type="xml">
<form class="o_document_layout">
<group>
<group class="o_document_layout_company">
<field name="company_id" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="multiple_invoice_type"/>
<field name="text_position" widget="selection"
invisible="multiple_invoice_type != 'text'"
/>
<field name="body_text_position" widget="radio"
invisible="multiple_invoice_type != 'text' or text_position != 'body'"/>
<field name="text_align" widget="radio"
string="Text Align"
invisible="multiple_invoice_type != 'text' or text_position not in ['header', 'footer']"/>
</group>
<footer>
<button string="Save" class="btn-primary" type="object" name="document_layout_save"/>
<button special="cancel" string="Cancel" />
</footer>
</form>
</field>
</record>
<record id="action_multiple_invoice_layout_configurator" model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field>
<field name="name">Configure Copy layout</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="res_model">multiple.invoice.layout</field>
<field name="view_id" ref="base_accounting_kit.view_multiple_invoice_layout"/>
</record>
<div>
<field name="preview" widget="iframe_wrapper"/>
</div>
</group>
<footer>
<button string="Save" class="btn-primary" type="object"
name="document_layout_save"/>
<button special="cancel" string="Cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_multiple_invoice_layout_configurator"
model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field>
<field name="name">Configure Copy layout</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="res_model">multiple.invoice.layout</field>
<field name="view_id"
ref="base_accounting_kit.view_multiple_invoice_layout"/>
</record>
</odoo>

2
base_accounting_kit/views/product_template_views.xml

@ -14,4 +14,4 @@
</field>
</field>
</record>
</odoo>
</odoo>

2
base_accounting_kit/views/product_views.xml

@ -14,4 +14,4 @@
</field>
</field>
</record>
</odoo>
</odoo>

178
base_accounting_kit/views/recurring_payments_view.xml

@ -1,99 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<!--Recurring Templates Form view-->
<record id="account_recurring_payments_form_view" model="ir.ui.view">
<field name="name">Recurring Template</field>
<field name="model">account.recurring.payments</field>
<field name="arch" type="xml">
<form string="Recurring Template">
<header>
<field name="state" widget="statusbar" options="{'clickable': '1'}"/>
</header>
<sheet>
<!--Recurring Templates Form view-->
<record id="account_recurring_payments_form_view" model="ir.ui.view">
<field name="name">Recurring Template</field>
<field name="model">account.recurring.payments</field>
<field name="arch" type="xml">
<form string="Recurring Template">
<header>
<field name="state" widget="statusbar"
options="{'clickable': '1'}"/>
</header>
<sheet>
<group>
<group>
<group>
<field name="name"/>
<field name="pay_time"/>
</group>
<group>
<field name="recurring_period"/>
<field name="recurring_interval" class="o_address_zip"/>
</group>
<group>
<field name="partner_id" invisible="pay_time != 'pay_later'"/>
<field name="company_id" invisible="1"/>
</group>
<group>
<field name="date"/>
<field name="next_date"/>
<field name="amount"/>
</group>
<field name="name"/>
<field name="pay_time"/>
</group>
<group>
<field name="recurring_period"/>
<field name="recurring_interval"
class="o_address_zip"/>
</group>
<notebook>
<page name="accounting_info" string="Accounting Info">
<group>
<field name="partner_id"
invisible="pay_time != 'pay_later'"/>
<field name="company_id" invisible="1"/>
</group>
<group>
<field name="date"/>
<field name="next_date"/>
<field name="amount"/>
</group>
</group>
<notebook>
<page name="accounting_info" string="Accounting Info">
<group>
<group>
<group>
<field name="credit_account"/>
<field name="debit_account"/>
</group>
<group>
<field name="journal_id"/>
<field name="journal_state"/>
</group>
<field name="credit_account"/>
<field name="debit_account"/>
</group>
<group>
<group>
<field name="analytic_account_id"/>
</group>
<field name="journal_id"/>
<field name="journal_state"/>
</group>
</page>
<page name="other_info" string="Other Info">
</group>
<group>
<group>
<field name="description" placeholder="Description..." nolabel="1" colspan="4"/>
<field name="analytic_account_id"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<!--Recurring Templates Tree View-->
<record id="account_recurring_payments_tree_view" model="ir.ui.view">
<field name="name">Recurring Templates</field>
<field name="model">account.recurring.payments</field>
<field name="arch" type="xml">
<tree string="Recurring Templates">
<field name="name"/>
<field name="partner_id"/>
<field name="debit_account"/>
<field name="credit_account"/>
<field name="journal_id"/>
<field name="date"/>
<field name="amount"/>
<field name="state"/>
</tree>
</field>
</record>
<!--Action for Recurring Templates-->
<record id="action_account_recurring_payments_view" model="ir.actions.act_window">
<field name="name">Recurring Templates</field>
<field name="res_model">account.recurring.payments</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="account_recurring_payments_tree_view"/>
<field name="target">current</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Click to create new recurring payment template</p>
</field>
</record>
<menuitem id="account_recurring_payments_child1" name="Recurring Templates" groups="account.group_account_user"
action="action_account_recurring_payments_view" parent="account.root_payment_menu"/>
</data>
</group>
</page>
<page name="other_info" string="Other Info">
<group>
<field name="description"
placeholder="Description..." nolabel="1"
colspan="4"/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<!--Recurring Templates Tree View-->
<record id="account_recurring_payments_tree_view" model="ir.ui.view">
<field name="name">Recurring Templates</field>
<field name="model">account.recurring.payments</field>
<field name="arch" type="xml">
<tree string="Recurring Templates">
<field name="name"/>
<field name="partner_id"/>
<field name="debit_account"/>
<field name="credit_account"/>
<field name="journal_id"/>
<field name="date"/>
<field name="amount"/>
<field name="state"/>
</tree>
</field>
</record>
<!--Action for Recurring Templates-->
<record id="action_account_recurring_payments_view"
model="ir.actions.act_window">
<field name="name">Recurring Templates</field>
<field name="res_model">account.recurring.payments</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="account_recurring_payments_tree_view"/>
<field name="target">current</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Click to create new recurring
payment template
</p>
</field>
</record>
<menuitem id="account_recurring_payments_child1" name="Recurring Templates"
groups="account.group_account_user"
action="action_account_recurring_payments_view"
parent="account.root_payment_menu"/>
</odoo>

158
base_accounting_kit/views/reports_config_view.xml

@ -1,86 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Account Financial Report -->
<record id="view_account_financial_report_form" model="ir.ui.view">
<field name="name">account.financial.report.form</field>
<field name="model">account.financial.report</field>
<field name="arch" type="xml">
<form string="Account Report">
<group col="4">
<field name="name"/>
<field name="parent_id"/>
<field name="sequence"/>
<field name="type"/>
<field name="sign"/>
<field name="style_overwrite"/>
</group>
<notebook invisible="type not in ['accounts','account_type', 'account_report']">
<page string="Report">
<group>
<field name="display_detail"
invisible="type not in ['accounts','account_type']"/>
<field name="account_report_id"
invisible="type not in ['accounts','account_report']"/>
</group>
<field name="account_ids" invisible="type != 'accounts'"/>
<field name="account_type_ids" invisible="type != 'account_type'"/>
</page>
</notebook>
</form>
</field>
</record>
<record id="view_account_financial_report_tree" model="ir.ui.view">
<field name="name">account.financial.report.tree</field>
<field name="model">account.financial.report</field>
<field name="arch" type="xml">
<tree string="Account Report">
<!-- Account Financial Report -->
<record id="view_account_financial_report_form" model="ir.ui.view">
<field name="name">account.financial.report.form</field>
<field name="model">account.financial.report</field>
<field name="arch" type="xml">
<form string="Account Report">
<group col="4">
<field name="name"/>
<field name="parent_id" invisible="1"/>
<field name="parent_id"/>
<field name="sequence"/>
<field name="type"/>
<field name="account_report_id"/>
</tree>
</field>
</record>
<record id="view_account_financial_report_search" model="ir.ui.view">
<field name="name">account.financial.report.search</field>
<field name="model">account.financial.report</field>
<field name="arch" type="xml">
<search string="Account Report">
<field name="name" string="Account Report"/>
<field name="type"/>
<field name="account_report_id"/>
<group expand="0" string="Group By">
<filter string="Parent Report"
name="filter_parent_rep"
domain=""
context="{'group_by':'parent_id'}"/>
<filter string="Report Type"
name="filter_rep_type"
domain="[]"
context="{'group_by':'type'}"/>
</group>
</search>
</field>
</record>
<record id="action_account_financial_report_tree"
model="ir.actions.act_window">
<field name="name">Financial Reports</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.financial.report</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id"
ref="view_account_financial_report_search"/>
<field name="view_id" ref="view_account_financial_report_tree"/>
</record>
<menuitem id="menu_account_financial_reports_tree"
name="Account Reports" parent="account.account_account_menu"
action="action_account_financial_report_tree"
/>
</data>
<field name="sign"/>
<field name="style_overwrite"/>
</group>
<notebook
invisible="type not in ['accounts','account_type', 'account_report']">
<page string="Report">
<group>
<field name="display_detail"
invisible="type not in ['accounts','account_type']"/>
<field name="account_report_id"
invisible="type not in ['accounts','account_report']"/>
</group>
<field name="account_ids"
invisible="type != 'accounts'"/>
<field name="account_type_ids"
invisible="type != 'account_type'"/>
</page>
</notebook>
</form>
</field>
</record>
<record id="view_account_financial_report_tree" model="ir.ui.view">
<field name="name">account.financial.report.tree</field>
<field name="model">account.financial.report</field>
<field name="arch" type="xml">
<tree string="Account Report">
<field name="name"/>
<field name="parent_id" invisible="1"/>
<field name="type"/>
<field name="account_report_id"/>
</tree>
</field>
</record>
<record id="view_account_financial_report_search" model="ir.ui.view">
<field name="name">account.financial.report.search</field>
<field name="model">account.financial.report</field>
<field name="arch" type="xml">
<search string="Account Report">
<field name="name" string="Account Report"/>
<field name="type"/>
<field name="account_report_id"/>
<group expand="0" string="Group By">
<filter string="Parent Report"
name="filter_parent_rep"
domain=""
context="{'group_by':'parent_id'}"/>
<filter string="Report Type"
name="filter_rep_type"
domain="[]"
context="{'group_by':'type'}"/>
</group>
</search>
</field>
</record>
<record id="action_account_financial_report_tree"
model="ir.actions.act_window">
<field name="name">Financial Reports</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.financial.report</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id"
ref="view_account_financial_report_search"/>
<field name="view_id" ref="view_account_financial_report_tree"/>
</record>
<menuitem id="menu_account_financial_reports_tree"
name="Account Reports" parent="account.account_account_menu"
action="action_account_financial_report_tree"
/>
</odoo>

71
base_accounting_kit/views/res_config_view.xml

@ -1,43 +1,40 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<record id="es_config_settings_view_form_base_accounting_kit" model="ir.ui.view">
<field name="name">res.config.view.inherited.base.accounting.kit</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="30"/>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//block[@id='invoicing_settings']" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="customer_credit_limit" on_change="1"/>
</div>
<div class="o_setting_right_pane" id="snailmail_settings">
<label for="customer_credit_limit"/>
<div class="text-muted">
Enable credit limit for customers
</div>
</div>
<record id="es_config_settings_view_form_base_accounting_kit"
model="ir.ui.view">
<field name="name">res.config.view.inherited.base.accounting.kit</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="30"/>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//block[@id='invoicing_settings']" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="customer_credit_limit" on_change="1"/>
</div>
</xpath>
<!-- Remove the enterprise budget option -->
<xpath expr="//setting[@id='account_budget']" position="replace"/>
<xpath expr="//block[@id='bank_cash']" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="use_anglo_saxon_accounting"/>
<div class="o_setting_right_pane" id="snailmail_settings">
<label for="customer_credit_limit"/>
<div class="text-muted">
Enable credit limit for customers
</div>
<div class="o_setting_right_pane">
<label for="use_anglo_saxon_accounting"/>
<div class="text-muted">
It will record the cost of good sold.
</div>
</div>
</div>
</xpath>
<!-- Remove the enterprise budget option -->
<xpath expr="//setting[@id='account_budget']" position="replace"/>
<xpath expr="//block[@id='bank_cash']" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="use_anglo_saxon_accounting"/>
</div>
<div class="o_setting_right_pane">
<label for="use_anglo_saxon_accounting"/>
<div class="text-muted">
It will record the cost of good sold.
</div>
</div>
</xpath>
</field>
</record>
</data>
</div>
</xpath>
</field>
</record>
</odoo>

19
base_accounting_kit/wizard/account_bank_book_wizard.py

@ -20,7 +20,7 @@
#
#############################################################################
from datetime import date
from odoo import models, fields, api, _
from odoo import api, fields, models, _
from odoo.exceptions import UserError
@ -32,7 +32,8 @@ class BankBookWizard(models.TransientModel):
readonly=True,
default=lambda self: self.env.company)
target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries')], string='Target Moves', required=True,
('all', 'All Entries')],
string='Target Moves', required=True,
default='posted')
date_from = fields.Date(string='Start Date', default=date.today(),
required=True)
@ -43,19 +44,22 @@ class BankBookWizard(models.TransientModel):
('not_zero', 'With balance is not equal to 0')],
string='Display Accounts', required=True, default='movement')
sortby = fields.Selection(
[('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')],
[('sort_date', 'Date'), ('sort_journal_partner',
'Journal & Partner')],
string='Sort by',
required=True, default='sort_date')
initial_balance = fields.Boolean(string='Include Initial Balances',
help='If you selected date, this field allow you to add a row to display the amount of debit/credit/balance that precedes the filter you\'ve set.')
help='If you selected date, this field '
'allow you to add a row to display '
'the amount of debit/credit/balance that precedes the filter you\'ve set.')
def _get_default_account_ids(self):
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.append(
journal.company_id.account_journal_payment_credit_account_id.id)
return accounts
account_ids = fields.Many2many('account.account',
'account_report_bankbook_account_rel',
'report_id', 'account_id',
@ -75,7 +79,8 @@ class BankBookWizard(models.TransientModel):
[('type', '=', 'bank')])
accounts = []
for journal in journals:
accounts.append(journal.company_id.account_journal_payment_credit_account_id.id)
accounts.append(
journal.company_id.account_journal_payment_credit_account_id.id)
domain = {'account_ids': [('id', 'in', accounts)]}
return {'domain': domain}

80
base_accounting_kit/wizard/account_bank_book_wizard_view.xml

@ -1,43 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="account_bank_book_form_view" model="ir.ui.view">
<field name="name">account.bank.book.form.view</field>
<field name="model">account.bank.book.report</field>
<field name="arch" type="xml">
<form string="Bank Book Report">
<field name="company_id" invisible="1"/>
<group col="4">
<field name="target_move" widget="radio"/>
<field name="sortby" widget="radio"/>
<field name="initial_balance"/>
<newline/>
<newline/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="account_ids" widget="many2many_tags"/>
<field name="journal_ids" widget="many2many_tags" options="{'no_create': True}"/>
</group>
<footer>
<button name="check_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
<button string="Cancel" class="btn btn-default" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_account_bank_book_view" model="ir.actions.act_window">
<field name="name">Bank Book Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.bank.book.report</field>
<field name="view_id" ref="account_bank_book_form_view"/>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="account_bank_book_menu" name="Bank Book" action="action_account_bank_book_view"
parent="base_accounting_kit.account_reports_daily_reports"/>
</data>
<record id="account_bank_book_form_view" model="ir.ui.view">
<field name="name">account.bank.book.form.view</field>
<field name="model">account.bank.book.report</field>
<field name="arch" type="xml">
<form string="Bank Book Report">
<field name="company_id" invisible="1"/>
<group col="4">
<field name="target_move" widget="radio"/>
<field name="sortby" widget="radio"/>
<field name="initial_balance"/>
<newline/>
<newline/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="account_ids" widget="many2many_tags"/>
<field name="journal_ids" widget="many2many_tags"
options="{'no_create': True}"/>
</group>
<footer>
<button name="check_report" string="Print" type="object"
default_focus="1" class="oe_highlight"/>
<button string="Cancel" class="btn btn-default"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_account_bank_book_view" model="ir.actions.act_window">
<field name="name">Bank Book Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.bank.book.report</field>
<field name="view_id" ref="account_bank_book_form_view"/>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="account_bank_book_menu" name="Bank Book"
action="action_account_bank_book_view"
parent="base_accounting_kit.account_reports_daily_reports"/>
</odoo>

24
base_accounting_kit/wizard/account_cash_book_wizard.py

@ -20,8 +20,7 @@
#
#############################################################################
from datetime import date
from odoo import models, fields, api, _
from odoo import api, fields, models, _
from odoo.exceptions import UserError
@ -33,7 +32,8 @@ class CashBookWizard(models.TransientModel):
readonly=True,
default=lambda self: self.env.company)
target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries')], string='Target Moves', required=True,
('all', 'All Entries')],
string='Target Moves', required=True,
default='posted')
date_from = fields.Date(string='Start Date', default=date.today(),
required=True)
@ -48,13 +48,19 @@ class CashBookWizard(models.TransientModel):
string='Sort by',
required=True, default='sort_date')
initial_balance = fields.Boolean(string='Include Initial Balances',
help='If you selected date, this field allow you to add a row to display the amount of debit/credit/balance that precedes the filter you\'ve set.')
help='If you selected date, this field '
'allow you to add a row to display'
' the'
' amount of debit/credit/balance'
' that '
'precedes the filter you\'ve set.')
def _get_default_account_ids(self):
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.append(
journal.company_id.account_journal_payment_credit_account_id.id)
return accounts
account_ids = fields.Many2many('account.account',
@ -76,7 +82,8 @@ class CashBookWizard(models.TransientModel):
[('type', '=', 'cash')])
accounts = []
for journal in journals:
accounts.append(journal.company_id.account_journal_payment_credit_account_id.id)
accounts.append(
journal.company_id.account_journal_payment_credit_account_id.id)
domain = {'account_ids': [('id', 'in', accounts)]}
return {'domain': domain}
@ -107,5 +114,6 @@ class CashBookWizard(models.TransientModel):
lang=self.env.context.get(
'lang') or 'en_US')
return self.env.ref(
'base_accounting_kit.action_report_cash_book').report_action(self,
data=data)
'base_accounting_kit.action_report_cash_book').report_action(
self,
data=data)

82
base_accounting_kit/wizard/account_cash_book_wizard_view.xml

@ -1,43 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="account_cash_book_form_view" model="ir.ui.view">
<field name="name">account.cash.book.form.view</field>
<field name="model">account.cash.book.report</field>
<field name="arch" type="xml">
<form string="Cash Book Report">
<field name="company_id" invisible="1"/>
<group col="4">
<field name="target_move" widget="radio"/>
<field name="sortby" widget="radio"/>
<field name="initial_balance"/>
<newline/>
<newline/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="account_ids" widget="many2many_tags"/>
<field name="journal_ids" widget="many2many_tags" options="{'no_create': True}"/>
</group>
<footer>
<button name="check_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
<button string="Cancel" class="btn btn-default" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_account_cash_book_view" model="ir.actions.act_window">
<field name="name">Cash Book Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.cash.book.report</field>
<field name="view_id" ref="account_cash_book_form_view"/>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="account_cash_book_menu" name="Cash Book" action="action_account_cash_book_view"
parent="base_accounting_kit.account_reports_daily_reports"/>
</data>
</odoo>
<record id="account_cash_book_form_view" model="ir.ui.view">
<field name="name">account.cash.book.form.view</field>
<field name="model">account.cash.book.report</field>
<field name="arch" type="xml">
<form string="Cash Book Report">
<field name="company_id" invisible="1"/>
<group col="4">
<field name="target_move" widget="radio"/>
<field name="sortby" widget="radio"/>
<field name="initial_balance"/>
<newline/>
<newline/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="account_ids" widget="many2many_tags"/>
<field name="journal_ids" widget="many2many_tags"
options="{'no_create': True}"/>
</group>
<footer>
<button name="check_report" string="Print" type="object"
default_focus="1" class="oe_highlight"/>
<button string="Cancel" class="btn btn-default"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_account_cash_book_view" model="ir.actions.act_window">
<field name="name">Cash Book Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.cash.book.report</field>
<field name="view_id" ref="account_cash_book_form_view"/>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="account_cash_book_menu" name="Cash Book"
action="action_account_cash_book_view"
parent="base_accounting_kit.account_reports_daily_reports"/>
</odoo>

8
base_accounting_kit/wizard/account_day_book_wizard.py

@ -20,8 +20,7 @@
#
#############################################################################
from datetime import date
from odoo import models, fields
from odoo import fields, models
class DayBookWizard(models.TransientModel):
@ -36,14 +35,13 @@ class DayBookWizard(models.TransientModel):
default=lambda self: self.env[
'account.journal'].search([]))
target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries')], string='Target Moves', required=True,
('all', 'All Entries')],
string='Target Moves', required=True,
default='posted')
account_ids = fields.Many2many('account.account',
'account_report_daybook_account_rel',
'report_id', 'account_id',
'Accounts')
date_from = fields.Date(string='Start Date', default=date.today(),
required=True)
date_to = fields.Date(string='End Date', default=date.today(),

74
base_accounting_kit/wizard/account_day_book_wizard_view.xml

@ -1,40 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="account_day_book_form_view" model="ir.ui.view">
<field name="name">account.day.book.form.view</field>
<field name="model">account.day.book.report</field>
<field name="arch" type="xml">
<form string="Cash Book Report">
<field name="company_id" invisible="1"/>
<group col="4">
<field name="target_move" widget="radio"/>
<newline/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="account_ids" widget="many2many_tags"/>
<field name="journal_ids" widget="many2many_tags" options="{'no_create': True}"/>
</group>
<footer>
<button name="check_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
<button string="Cancel" class="btn btn-default" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_account_day_book_view" model="ir.actions.act_window">
<field name="name">Day Book Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.day.book.report</field>
<field name="view_id" ref="account_day_book_form_view"/>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="account_day_book_menu" name="Day Book" action="action_account_day_book_view"
parent="base_accounting_kit.account_reports_daily_reports"/>
</data>
<record id="account_day_book_form_view" model="ir.ui.view">
<field name="name">account.day.book.form.view</field>
<field name="model">account.day.book.report</field>
<field name="arch" type="xml">
<form string="Cash Book Report">
<field name="company_id" invisible="1"/>
<group col="4">
<field name="target_move" widget="radio"/>
<newline/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="account_ids" widget="many2many_tags"/>
<field name="journal_ids" widget="many2many_tags"
options="{'no_create': True}"/>
</group>
<footer>
<button name="check_report" string="Print" type="object"
default_focus="1" class="oe_highlight"/>
<button string="Cancel" class="btn btn-default"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_account_day_book_view" model="ir.actions.act_window">
<field name="name">Day Book Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.day.book.report</field>
<field name="view_id" ref="account_day_book_form_view"/>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="account_day_book_menu" name="Day Book"
action="action_account_day_book_view"
parent="base_accounting_kit.account_reports_daily_reports"/>
</odoo>

12
base_accounting_kit/wizard/account_lock_date.py

@ -30,12 +30,16 @@ class AccountUpdateLockDate(models.TransientModel):
company_id = fields.Many2one(comodel_name='res.company', string="Company",
required=True)
period_lock_date = fields.Date(string="Lock Date for Non-Advisers",
help="Only users with the 'Adviser' role can edit accounts prior to "
"and inclusive of this date. Use it for period locking inside an "
help="Only users with the 'Adviser' role "
"can edit accounts prior to "
"and inclusive of this date. Use it for"
" period locking inside an "
"open fiscal year, for example.")
fiscalyear_lock_date = fields.Date(string="Lock Date",
help="No users, including Advisers, can edit accounts prior to and "
"inclusive of this date. Use it for fiscal year locking for "
help="No users, including Advisers, can "
"edit accounts prior to and "
"inclusive of this date. Use it for "
"fiscal year locking for "
"example.")
@api.model

14
base_accounting_kit/wizard/account_lock_date.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="account_update_lock_date_form_view">
<field name="name">account.lock.date.form</field>
<field name="model">account.lock.date</field>
@ -12,25 +11,24 @@
<field name="fiscalyear_lock_date"/>
</group>
<footer>
<button string="Update" name="execute" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel"/>
<button string="Update" name="execute" type="object"
class="btn-primary"/>
<button string="Cancel" class="btn-default"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="account_update_lock_date_act_window">
<record model="ir.actions.act_window"
id="account_update_lock_date_act_window">
<field name="name">Lock your Fiscal Period</field>
<field name="res_model">account.lock.date</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem id="menu_lock_dates"
name="Lock Dates"
action="account_update_lock_date_act_window"
parent="account.menu_finance_entries_actions"
groups="account.group_account_manager"/>
</odoo>

23
base_accounting_kit/wizard/account_report_common_partner.py

@ -19,7 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import fields, models
from odoo.tools.misc import get_lang
@ -39,21 +38,23 @@ class AccountingCommonPartnerReport(models.TransientModel):
relation="account_common_parnter_report_section_rel",
column1="main_report_id",
column2="sub_report_id")
company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True,
company_id = fields.Many2one('res.company', string='Company',
required=True, readonly=True,
default=lambda self: self.env.company)
journal_ids = fields.Many2many(
comodel_name='account.journal',
string='Journals',
required=True,
default=lambda self: self.env['account.journal'].search([('company_id', '=', self.company_id.id)]),
default=lambda self: self.env['account.journal'].search(
[('company_id', '=', self.company_id.id)]),
domain="[('company_id', '=', company_id)]",
)
date_from = fields.Date(string='Start Date')
date_to = fields.Date(string='End Date')
target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries'),
], string='Target Moves', required=True, default='posted')
], string='Target Moves', required=True,
default='posted')
result_selection = fields.Selection([('customer', 'Receivable Accounts'),
('supplier', 'Payable Accounts'),
('customer_supplier',
@ -77,9 +78,12 @@ class AccountingCommonPartnerReport(models.TransientModel):
data = {}
data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move', 'company_id'])[0]
data['form'] = self.read(
['date_from', 'date_to', 'journal_ids', 'target_move',
'company_id'])[0]
used_context = self._build_contexts(data)
data['form']['used_context'] = dict(used_context, lang=get_lang(self.env).code)
data['form']['used_context'] = dict(used_context,
lang=get_lang(self.env).code)
return self.with_context(discard_logo_check=True)._print_report(data)
def _print_report(self, data):
@ -88,9 +92,8 @@ class AccountingCommonPartnerReport(models.TransientModel):
'account_report_id', 'enable_filter', 'label_filter',
'target_move'])[0])
return self.env.ref(
'base_accounting_kit.action_report_cash_flow').report_action(self,
data=data,
config=False)
'base_accounting_kit.action_report_cash_flow').report_action(
self, data=data, config=False)
def pre_print_report(self, data):
data['form'].update(self.read(['result_selection'])[0])

13
base_accounting_kit/wizard/aged_partner.py

@ -19,11 +19,8 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
import time
from dateutil.relativedelta import relativedelta
from odoo import fields, models, _
from odoo.exceptions import UserError
@ -43,9 +40,11 @@ class AccountAgedTrialBalance(models.TransientModel):
relation="account_aged_trail_report_section_rel",
column1="main_report_id",
column2="sub_report_id")
name = fields.Char(string="Account Aged Trial balance Report", default="Account Aged Trial balance Report", required=True, translate=True)
journal_ids = fields.Many2many('account.journal', string='Journals',
name = fields.Char(string="Account Aged Trial balance Report",
default="Account Aged Trial balance Report",
required=True, translate=True)
journal_ids = fields.Many2many('account.journal',
string='Journals',
required=True)
period_length = fields.Integer(string='Period Length (days)',
required=True, default=30)
@ -60,9 +59,7 @@ class AccountAgedTrialBalance(models.TransientModel):
raise UserError(_('You must set a period length greater than 0.'))
if not data['form']['date_from']:
raise UserError(_('You must set a start date.'))
start = data['form']['date_from']
for i in range(5)[::-1]:
stop = start - relativedelta(days=period_length - 1)
res[str(i)] = {

11
base_accounting_kit/wizard/aged_partner.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_aged_balance_view" model="ir.ui.view">
<field name="name">Aged Partner Balance</field>
<field name="model">account.aged.trial.balance</field>
@ -13,15 +12,15 @@
<field name="result_selection" widget="radio"/>
<field name="target_move" widget="radio"/>
</group>
<!-- <field name="journal_ids" required="0" invisible="1"/>-->
<footer>
<button name="check_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
<button string="Cancel" class="btn btn-default" special="cancel"/>
<button name="check_report" string="Print" type="object"
default_focus="1" class="oe_highlight"/>
<button string="Cancel" class="btn btn-default"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_account_aged_balance_view" model="ir.actions.act_window">
<field name="name">Aged Partner Balance</field>
<field name="res_model">account.aged.trial.balance</field>
@ -31,11 +30,9 @@
<field name="context">{}</field>
<field name="target">new</field>
</record>
<menuitem id="menu_aged_trial_balance"
name="Aged Partner Balance"
sequence="2"
action="action_account_aged_balance_view"
parent="account.menu_finance_reports"/>
</odoo>

21
base_accounting_kit/wizard/asset_depreciation_confirmation_wizard.py

@ -19,26 +19,33 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, fields, models, _
from odoo import fields, models, _
class AssetDepreciationConfirmationWizard(models.TransientModel):
_name = "asset.depreciation.confirmation.wizard"
_description = "asset.depreciation.confirmation.wizard"
date = fields.Date('Account Date', required=True, help="Choose the period for which you want to automatically post the depreciation lines of running assets", default=fields.Date.context_today)
date = fields.Date('Account Date', required=True,
help="Choose the period for which you want to "
"automatically post the depreciation lines of "
"running assets", default=fields.Date.context_today)
def asset_compute(self):
self.ensure_one()
context = self._context
created_move_ids = self.env['account.asset.asset'].compute_generated_entries(self.date, asset_type=context.get('asset_type'))
created_move_ids = (self.env['account.asset.asset'].
compute_generated_entries(self.date,
asset_type=context.get(
'asset_type')))
return {
'name': _('Created Asset Moves') if context.get('asset_type') == 'purchase' else _('Created Revenue Moves'),
'name': _('Created Asset Moves') if context.get('asset_type') ==
'purchase' else _(
'Created Revenue Moves'),
'view_mode': 'tree,form',
'res_model': 'account.move',
'view_id': False,
'domain': "[('id','in',[" + ','.join(str(id) for id in created_move_ids) + "])]",
'domain': "[('id','in',[" + ','.join(
str(id) for id in created_move_ids) + "])]",
'type': 'ir.actions.act_window',
}

35
base_accounting_kit/wizard/asset_depreciation_confirmation_wizard_views.xml

@ -7,32 +7,39 @@
<form string="Compute Asset">
<div>
<p>
This wizard will post installment/depreciation lines for the selected month.<br/>
This will generate journal entries for all related installment lines on this period of asset/revenue recognition as well.
</p>
This wizard will post installment/depreciation lines for
the selected month.
<br/>
This will generate journal entries for all related
installment lines on this period of asset/revenue
recognition as well.
</p>
</div>
<group>
<field name="date"/>
</group>
<footer>
<button string="Generate Entries" name="asset_compute" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel"/>
<button string="Generate Entries" name="asset_compute"
type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default"
special="cancel"/>
</footer>
</form>
</field>
</field>
</record>
<record id="action_asset_depreciation_confirmation_wizard" model="ir.actions.act_window">
<record id="action_asset_depreciation_confirmation_wizard"
model="ir.actions.act_window">
<field name="name">Post Depreciation Lines</field>
<field name="res_model">asset.depreciation.confirmation.wizard</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_asset_depreciation_confirmation_wizard"/>
<field name="view_id"
ref="view_asset_depreciation_confirmation_wizard"/>
<field name="target">new</field>
<field name="context">{'asset_type': 'purchase'}</field>
</record>
<menuitem name="Generate Assets Entries" action="action_asset_depreciation_confirmation_wizard"
id="menu_asset_depreciation_confirmation_wizard"
parent="account.menu_finance_entries_generate_entries" sequence="111" groups="base.group_no_one"/>
<menuitem name="Generate Assets Entries"
action="action_asset_depreciation_confirmation_wizard"
id="menu_asset_depreciation_confirmation_wizard"
parent="account.menu_finance_entries_generate_entries"
sequence="111" groups="base.group_no_one"/>
</odoo>

47
base_accounting_kit/wizard/asset_modify.py

@ -19,20 +19,8 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from lxml import etree
from odoo import api, fields, models, _
# from odoo.addons.base.models.ir_ui_view import (transfer_field_to_modifiers, transfer_node_to_modifiers, transfer_modifiers_to_node)
# def setup_modifiers(node, field=None, context=None, in_tree_view=False):
# modifiers = {}
# if field is not None:
# transfer_field_to_modifiers(field, modifiers)
# transfer_node_to_modifiers(
# node, modifiers, context=context)
# transfer_modifiers_to_node(modifiers, node)
class AssetModify(models.TransientModel):
@ -40,29 +28,37 @@ class AssetModify(models.TransientModel):
_description = 'Modify Asset'
name = fields.Text(string='Reason', required=True)
method_number = fields.Integer(string='Number of Depreciations', required=True)
method_number = fields.Integer(string='Number of Depreciations',
required=True)
method_period = fields.Integer(string='Period Length')
method_end = fields.Date(string='Ending date')
asset_method_time = fields.Char(compute='_get_asset_method_time', string='Asset Method Time', readonly=True)
asset_method_time = fields.Char(compute='_get_asset_method_time',
string='Asset Method Time', readonly=True)
def _get_asset_method_time(self):
if self.env.context.get('active_id'):
asset = self.env['account.asset.asset'].browse(self.env.context.get('active_id'))
asset = self.env['account.asset.asset'].browse(
self.env.context.get('active_id'))
self.asset_method_time = asset.method_time
@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
result = super(AssetModify, self).fields_view_get(view_id, view_type, toolbar=toolbar, submenu=submenu)
def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
submenu=False):
result = super(AssetModify, self).fields_view_get(view_id, view_type,
toolbar=toolbar,
submenu=submenu)
asset_id = self.env.context.get('active_id')
active_model = self.env.context.get('active_model')
if active_model == 'account.asset.asset' and asset_id:
asset = self.env['account.asset.asset'].browse(asset_id)
doc = etree.XML(result['arch'])
if asset.method_time == 'number' and doc.xpath("//field[@name='method_end']"):
if asset.method_time == 'number' and doc.xpath(
"//field[@name='method_end']"):
node = doc.xpath("//field[@name='method_end']")[0]
node.set('invisible', '1')
# setup_modifiers(node, result['fields']['method_end'])
elif asset.method_time == 'end' and doc.xpath("//field[@name='method_number']"):
elif asset.method_time == 'end' and doc.xpath(
"//field[@name='method_number']"):
node = doc.xpath("//field[@name='method_number']")[0]
node.set('invisible', '1')
# setup_modifiers(node, result['fields']['method_number'])
@ -83,7 +79,8 @@ class AssetModify(models.TransientModel):
if 'method_end' in fields and asset.method_time == 'end':
res.update({'method_end': asset.method_end})
if self.env.context.get('active_id'):
active_asset = self.env['account.asset.asset'].browse(self.env.context.get('active_id'))
active_asset = self.env['account.asset.asset'].browse(
self.env.context.get('active_id'))
res['asset_method_time'] = active_asset.method_time
return res
@ -105,8 +102,12 @@ class AssetModify(models.TransientModel):
}
asset.write(asset_vals)
asset.compute_depreciation_board()
tracked_fields = self.env['account.asset.asset'].fields_get(['method_number', 'method_period', 'method_end'])
changes, tracking_value_ids = asset._mail_track(tracked_fields, old_values)
tracked_fields = self.env['account.asset.asset'].fields_get(
['method_number', 'method_period', 'method_end'])
changes, tracking_value_ids = asset._mail_track(tracked_fields,
old_values)
if changes:
asset.message_post(subject=_('Depreciation board modified'), body=self.name, tracking_value_ids=tracking_value_ids)
asset.message_post(subject=_('Depreciation board modified'),
body=self.name,
tracking_value_ids=tracking_value_ids)
return {'type': 'ir.actions.act_window_close'}

36
base_accounting_kit/wizard/asset_modify_views.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="asset_modify_form">
<field name="name">wizard.asset.modify.form</field>
<field name="model">asset.modify</field>
@ -9,32 +8,35 @@
<field name="asset_method_time" invisible="1"/>
<group string="Asset Durations to Modify" col="4">
<group colspan="2" col="2">
<field name="name"/>
<field name="method_number" invisible="asset_method_time in 'end'"/>
<field name="name"/>
<field name="method_number"
invisible="asset_method_time in 'end'"/>
</group>
<group colspan="2" col="2">
<field name="method_end" invisible="asset_method_time in 'number'"/>
<field name="method_end"
invisible="asset_method_time in 'number'"/>
<label for="method_period"/>
<div>
<field name="method_period" class="oe_inline"/> months
</div>
<field name="method_period" class="oe_inline"/>
months
</div>
</group>
</group>
<footer>
<button name="modify" string="Modify" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel"/>
<button name="modify" string="Modify" type="object"
class="btn-primary"/>
<button string="Cancel" class="btn-default"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_asset_modify" model="ir.actions.act_window">
<field name="name">Modify Asset</field>
<field name="res_model">asset.modify</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="asset_modify_form"/>
<field name="target">new</field>
</record>
<field name="name">Modify Asset</field>
<field name="res_model">asset.modify</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="asset_modify_form"/>
<field name="target">new</field>
</record>
</odoo>

34
base_accounting_kit/wizard/cash_flow_report.py

@ -37,18 +37,23 @@ class AccountingReport(models.TransientModel):
relation="account_cash_flow_report_section_rel",
column1="main_report_id",
column2="sub_report_id")
name = fields.Char(string="Cash Flow Report", default="Cash Flow Report", required=True, translate=True)
name = fields.Char(string="Cash Flow Report", default="Cash Flow Report",
required=True, translate=True)
date_from = fields.Date(string='Start Date')
date_to = fields.Date(string='End Date')
company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, default=lambda self: self.env.company)
company_id = fields.Many2one('res.company', string='Company', required=True,
readonly=True,
default=lambda self: self.env.company)
target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries'),
], string='Target Moves', required=True, default='posted')
], string='Target Moves', required=True,
default='posted')
journal_ids = fields.Many2many(
comodel_name='account.journal',
string='Journals',
required=True,
default=lambda self: self.env['account.journal'].search([('company_id', '=', self.company_id.id)]),
default=lambda self: self.env['account.journal'].search(
[('company_id', '=', self.company_id.id)]),
domain="[('company_id', '=', company_id)]",
)
@ -68,7 +73,8 @@ class AccountingReport(models.TransientModel):
required=True,
default=_get_account_report)
label_filter = fields.Char(string='Column Label',
help="This label will be displayed on report to show the balance"
help="This label will be displayed on report "
"to show the balance"
" computed for the given comparison filter.")
filter_cmp = fields.Selection(
[('filter_no', 'No Filters'), ('filter_date', 'Date')],
@ -76,7 +82,11 @@ class AccountingReport(models.TransientModel):
date_from_cmp = fields.Date(string='Date Start')
date_to_cmp = fields.Date(string='Date End')
debit_credit = fields.Boolean(string='Display Debit/Credit Columns',
help="This option allows you to get more details about the way your balances are computed. Because it is space consuming, we do not allow to use it while doing a comparison.")
help="This option allows you to get more "
"details about the way your balances are"
" computed. Because it is space "
"consuming, we do not allow to use it "
"while doing a comparison.")
def _build_comparison_context(self, data):
result = {}
@ -92,8 +102,10 @@ class AccountingReport(models.TransientModel):
def _build_contexts(self, data):
result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or ''
result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][
'journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form'][
'target_move'] or ''
result['date_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False
result['strict_range'] = True if result['date_from'] else False
@ -123,6 +135,6 @@ class AccountingReport(models.TransientModel):
'account_report_id', 'enable_filter', 'label_filter',
'target_move'])[0])
return self.env.ref(
'base_accounting_kit.action_report_cash_flow').report_action(self,
data=data,
config=False)
'base_accounting_kit.action_report_cash_flow').report_action(
self, data=data,
config=False)

20
base_accounting_kit/wizard/cash_flow_report.xml

@ -3,11 +3,13 @@
<record id="cash_flow_report_view" model="ir.ui.view">
<field name="name">Cash Flow Statement</field>
<field name="model">cash.flow.report</field>
<field name="inherit_id" ref="base_accounting_kit.account_common_report_view"/>
<field name="inherit_id"
ref="base_accounting_kit.account_common_report_view"/>
<field name="arch" type="xml">
<field name="company_id" position="replace"/>
<field name="target_move" position="before">
<field name="account_report_id" domain="[('parent_id','=',False)]" readonly="1"/>
<field name="account_report_id"
domain="[('parent_id','=',False)]" readonly="1"/>
<field name="enable_filter"/>
</field>
<field name="target_move" position="after">
@ -20,12 +22,16 @@
<notebook tabpos="up" colspan="4" invisible="not enable_filter">
<page string="Comparison" name="comparison">
<group>
<field name="label_filter" required="enable_filter"/>
<field name="label_filter"
required="enable_filter"/>
<field name="filter_cmp"/>
</group>
<group string="Dates" invisible="filter_cmp != 'filter_date'">
<field name="date_from_cmp" required="filter_cmp in 'filter_date'"/>
<field name="date_to_cmp" required="filter_cmp in 'filter_date'"/>
<group string="Dates"
invisible="filter_cmp != 'filter_date'">
<field name="date_from_cmp"
required="filter_cmp in 'filter_date'"/>
<field name="date_to_cmp"
required="filter_cmp in 'filter_date'"/>
</group>
</page>
</notebook>
@ -33,7 +39,6 @@
<field name="journal_ids" position="replace"/>
</field>
</record>
<record id="action_cash_flow_report" model="ir.actions.act_window">
<field name="name">Cash Flow Statement</field>
<field name="res_model">cash.flow.report</field>
@ -49,5 +54,4 @@
sequence="5"
action="action_cash_flow_report"
parent="base_accounting_kit.account_reports_generic_statements"/>
</odoo>

74
base_accounting_kit/wizard/financial_report.py

@ -20,7 +20,6 @@
#
#############################################################################
import re
from odoo import api, models, fields
@ -39,11 +38,12 @@ class FinancialReport(models.TransientModel):
relation="account_financial_report_section_rel",
column1="main_report_id",
column2="sub_report_id")
name = fields.Char(string="Financial Report", default="Financial Report", required=True, translate=True)
name = fields.Char(string="Financial Report", default="Financial Report",
required=True, translate=True)
target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries'),
], string='Target Moves', required=True, default='posted')
], string='Target Moves', required=True,
default='posted')
view_format = fields.Selection([
('vertical', 'Vertical'),
@ -51,7 +51,6 @@ class FinancialReport(models.TransientModel):
default='vertical',
string="Format")
def _build_contexts(self, data):
result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][
@ -80,7 +79,6 @@ class FinancialReport(models.TransientModel):
'account.financial.report',
string='Account Reports',
required=True)
date_from = fields.Date(string='Start Date')
date_to = fields.Date(string='End Date')
debit_credit = fields.Boolean(
@ -114,7 +112,6 @@ class FinancialReport(models.TransientModel):
data['form']['used_context'] = dict(
used_context,
lang=self.env.context.get('lang') or 'en_US')
report_lines = self.get_account_lines(data['form'])
# find the journal items of these accounts
journal_items = self.find_journal_items(report_lines, data['form'])
@ -136,10 +133,6 @@ class FinancialReport(models.TransientModel):
item['balance'] = round(item['balance'], 2)
if not item['parent']:
item['level'] = 1
parent = item
report_name = item['name']
id = item['id']
report_id = item['r_id']
else:
item['level'] = set_report_level(item)
currency = self._get_currency()
@ -162,7 +155,6 @@ class FinancialReport(models.TransientModel):
'debit': "COALESCE(SUM(debit), 0) as debit",
'credit': "COALESCE(SUM(credit), 0) as credit",
}
res = {}
for account in accounts:
res[account.id] = dict((fn, 0.0)
@ -221,20 +213,25 @@ class FinancialReport(models.TransientModel):
])
if report.name == "Expenses":
accounts = self.env['account.account'].search([
('account_type', 'in', ["expense","expense_depreciation","expense_direct_cost"])
('account_type', 'in', ["expense",
"expense_depreciation",
"expense_direct_cost"])
])
if report.name == "Liability":
accounts = self.env['account.account'].search([
('account_type', 'in', ["liability_payable","equity","liability_current","liability_non_current"])
('account_type', 'in',
["liability_payable", "equity", "liability_current",
"liability_non_current"])
])
if report.name == "Assets":
accounts = self.env['account.account'].search([
('account_type', 'in', ["asset_receivable","asset_cash","asset_current","asset_non_current","asset_prepayments","asset_fixed"])
('account_type', 'in',
["asset_receivable", "asset_cash", "asset_current",
"asset_non_current", "asset_prepayments",
"asset_fixed"])
])
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)
@ -269,17 +266,13 @@ class FinancialReport(models.TransientModel):
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:
r_name = str(report.name)
# r_name = r_name.replace(" ", "-") + "-"
r_name = re.sub('[^0-9a-zA-Z]+', '', r_name)
if report.parent_id:
p_name = str(report.parent_id.name)
p_name = re.sub('[^0-9a-zA-Z]+', '', p_name) + str(
report.parent_id.id)
# p_name = p_name.replace(" ", "-") +
# "-" + str(report.parent_id.id)
else:
p_name = False
vals = {
@ -310,7 +303,6 @@ class FinancialReport(models.TransientModel):
# used to display the details of the
# financial report, so it's not needed here.
continue
if res[report.id].get('account'):
sub_lines = []
for account_id, value \
@ -327,7 +319,8 @@ class FinancialReport(models.TransientModel):
# new_r_name = new_r_name.replace(" ", "-") + "-"
vals = {
'account': account.id,
'a_id': account.code + re.sub('[^0-9a-zA-Z]+', 'acnt',
'a_id': account.code + re.sub('[^0-9a-zA-Z]+',
'acnt',
account.name) + str(
account.id),
'name': account.code + '-' + account.name,
@ -335,7 +328,8 @@ class FinancialReport(models.TransientModel):
'type': 'account',
'parent': r_name + str(report.id),
'level': (
report.display_detail == 'detail_with_hierarchy' and
report.display_detail ==
'detail_with_hierarchy' and
4),
'account_type': account.account_type,
}
@ -369,19 +363,24 @@ class FinancialReport(models.TransientModel):
if i['type'] == 'account':
account = i['account']
if form['target_move'] == 'posted':
search_query = "select aml.id, am.id as j_id, aml.account_id, aml.date," \
" aml.name as label, am.name, " \
+ "(aml.debit-aml.credit) as balance, aml.debit, aml.credit, aml.partner_id " \
+ " from account_move_line aml join account_move am " \
"on (aml.move_id=am.id and am.state=%s) " \
+ " where aml.account_id=%s"
search_query = ("select aml.id, am.id as j_id, "
"aml.account_id, aml.date, aml.name as "
"label, am.name, (aml.debit-aml.credit) as "
"balance, aml.debit, aml.credit, "
"aml.partner_id from "
"account_move_line aml "
"join account_move am on (aml.move_id=am.id"
" and am.state=%s) where aml.account_id=%s")
vals = [form['target_move']]
else:
search_query = "select aml.id, am.id as j_id, aml.account_id, aml.date, " \
"aml.name as label, am.name, " \
+ "(aml.debit-aml.credit) as balance, aml.debit, aml.credit, aml.partner_id " \
+ " from account_move_line aml join account_move am on (aml.move_id=am.id) " \
+ " where aml.account_id=%s"
search_query = ("select aml.id, am.id as j_id, "
"aml.account_id, aml.date, aml.name as "
"label, am.name, (aml.debit-aml.credit) as "
"balance, aml.debit, aml.credit, "
"aml.partner_id from account_move_line aml"
" join account_move am on "
"(aml.move_id=am.id) where "
"aml.account_id=%s")
vals = []
if form['date_from'] and form['date_to']:
search_query += " and aml.date>=%s and aml.date<=%s"
@ -396,10 +395,10 @@ class FinancialReport(models.TransientModel):
vals += [account]
cr.execute(search_query, tuple(vals))
items = cr.dictfetchall()
for j in items:
temp = j['id']
j['id'] = re.sub('[^0-9a-zA-Z]+', '', i['name']) + str(
j['id'] = re.sub('[^0-9a-zA-Z]+', '',
i['name']) + str(
temp)
j['p_id'] = str(i['a_id'])
j['type'] = 'journal_item'
@ -417,7 +416,6 @@ class FinancialReport(models.TransientModel):
class ProfitLossPdf(models.AbstractModel):
""" Abstract model for generating PDF report value and send to template """
_name = 'report.base_accounting_kit.report_financial'
_description = 'Financial Report'

115
base_accounting_kit/wizard/financial_report.xml

@ -1,65 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<!-- Financial report common form view -->
<record id="financial_report_wiz_modified" model="ir.ui.view">
<field name="name">financial.report.extended.wiz</field>
<field name="model">financial.report</field>
<field name="arch" type="xml">
<form>
<!-- Financial report common form view -->
<record id="financial_report_wiz_modified" model="ir.ui.view">
<field name="name">financial.report.extended.wiz</field>
<field name="model">financial.report</field>
<field name="arch" type="xml">
<form>
<group>
<group string="Dates">
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<group string="Dates">
<field name="date_from"/>
<field name="date_to"/>
</group>
<group>
<field name="target_move" widget="radio"/>
<field name="view_format" widget="radio" invisible="1"/>
<field name="enable_filter" invisible="1"/>
<field name="debit_credit"/>
<field name="company_id" invisible="1"/>
</group>
<field name="target_move" widget="radio"/>
<field name="view_format" widget="radio" invisible="1"/>
<field name="enable_filter" invisible="1"/>
<field name="debit_credit"/>
<field name="company_id" invisible="1"/>
</group>
</group>
<footer>
<button string="Print" name="view_report_pdf" type="object"
class="btn-primary"/>
<button string="Discard" class="btn-secondary"
special="cancel"/>
</footer>
</form>
</field>
</record>
<!-- Action for profit and loss -->
<record id="action_profit_and_loss_report" model="ir.actions.act_window">
<field name="name">Profit and Loss</field>
<field name="res_model">financial.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">form</field>
<field name="view_id" ref="financial_report_wiz_modified"/>
<field name="target">new</field>
<field name="context"
eval="{'default_account_report_id':ref('base_accounting_kit.account_financial_report_profitandloss0')}"/>
</record>
<!-- Action for balance sheet -->
<record id="action_balance_sheet_report" model="ir.actions.act_window">
<field name="name">Balance Sheet</field>
<field name="res_model">financial.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">form</field>
<field name="view_id" ref="financial_report_wiz_modified"/>
<field name="target">new</field>
<field name="context"
eval="{'default_account_report_id':ref('base_accounting_kit.account_financial_report_balancesheet0')}"/>
</record>
<menuitem id="account_financial_reports_profit_loss" sequence="1"
name="Profit and Loss" parent="base_accounting_kit.account_reports_generic_statements"
action="action_profit_and_loss_report"/>
<menuitem id="_account_financial_reports_balance_sheet" sequence="2"
name="Balance Sheet" parent="base_accounting_kit.account_reports_generic_statements"
action="action_balance_sheet_report"/>
</data>
<footer>
<button string="Print" name="view_report_pdf" type="object"
class="btn-primary"/>
<button string="Discard" class="btn-secondary"
special="cancel"/>
</footer>
</form>
</field>
</record>
<!-- Action for profit and loss -->
<record id="action_profit_and_loss_report" model="ir.actions.act_window">
<field name="name">Profit and Loss</field>
<field name="res_model">financial.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">form</field>
<field name="view_id" ref="financial_report_wiz_modified"/>
<field name="target">new</field>
<field name="context"
eval="{'default_account_report_id':ref('base_accounting_kit.account_financial_report_profitandloss0')}"/>
</record>
<!-- Action for balance sheet -->
<record id="action_balance_sheet_report" model="ir.actions.act_window">
<field name="name">Balance Sheet</field>
<field name="res_model">financial.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_mode">form</field>
<field name="view_id" ref="financial_report_wiz_modified"/>
<field name="target">new</field>
<field name="context"
eval="{'default_account_report_id':ref('base_accounting_kit.account_financial_report_balancesheet0')}"/>
</record>
<menuitem id="account_financial_reports_profit_loss" sequence="1"
name="Profit and Loss"
parent="base_accounting_kit.account_reports_generic_statements"
action="action_profit_and_loss_report"/>
<menuitem id="_account_financial_reports_balance_sheet" sequence="2"
name="Balance Sheet"
parent="base_accounting_kit.account_reports_generic_statements"
action="action_balance_sheet_report"/>
</odoo>

7
base_accounting_kit/wizard/general_ledger.py

@ -19,7 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import fields, models, _
from odoo.exceptions import UserError
@ -39,7 +38,8 @@ class AccountReportGeneralLedger(models.TransientModel):
relation="account_report_general_section_rel",
column1="main_report_id",
column2="sub_report_id")
name = fields.Char(string="General Ledger", default="General Ledger", required=True, translate=True)
name = fields.Char(string="General Ledger", default="General Ledger",
required=True, translate=True)
initial_balance = fields.Boolean(string='Include Initial Balances',
help='If you selected date, this field '
'allow you to add a row to display '
@ -47,7 +47,8 @@ class AccountReportGeneralLedger(models.TransientModel):
'that precedes the filter you\'ve '
'set.')
sortby = fields.Selection(
[('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')],
[('sort_date', 'Date'), ('sort_journal_partner',
'Journal & Partner')],
string='Sort by', required=True, default='sort_date')
journal_ids = fields.Many2many('account.journal',
'account_report_general_ledger_journal_rel',

6
base_accounting_kit/wizard/general_ledger.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<odoo>Z
<record id="account_report_general_ledger_view" model="ir.ui.view">
<field name="name">General Ledger</field>
<field name="model">account.report.general.ledger</field>
@ -16,7 +15,6 @@
</data>
</field>
</record>
<record id="action_account_general_ledger_menu" model="ir.actions.act_window">
<field name="name">General Ledger</field>
<field name="type">ir.actions.act_window</field>
@ -27,7 +25,6 @@
<field name="binding_model_id" ref="account.model_account_account"/>
<field name="binding_type">report</field>
</record>
<menuitem
id="menu_general_ledger"
name="General Ledger"
@ -36,5 +33,4 @@
action="action_account_general_ledger_menu"
groups="account.group_account_user,account.group_account_manager"
/>
</odoo>

4
base_accounting_kit/wizard/journal_audit.py

@ -19,7 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import fields, models
@ -38,7 +37,8 @@ class AccountPrintJournal(models.TransientModel):
relation="account_common_print_report_section_rel",
column1="main_report_id",
column2="sub_report_id")
name = fields.Char(string="Journal Audit", default="Journal Audit", required=True, translate=True)
name = fields.Char(string="Journal Audit", default="Journal Audit",
required=True, translate=True)
sort_selection = fields.Selection(
[('date', 'Date'), ('move_name', 'Journal Entry Number')],
'Entries Sorted by', required=True, default='move_name')

25
base_accounting_kit/wizard/journal_audit.xml

@ -1,22 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_report_print_journal_view" model="ir.ui.view">
<field name="name">Journals Audit</field>
<field name="model">account.print.journal</field>
<field name="inherit_id" ref="base_accounting_kit.account_common_report_view"/>
<field name="inherit_id"
ref="base_accounting_kit.account_common_report_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='target_move']" position="after">
<field name="amount_currency" groups="base.group_multi_currency"/>
<field name="sort_selection" widget="radio"/>
<newline/>
</xpath>
</data>
<data>
<xpath expr="//field[@name='target_move']" position="after">
<field name="amount_currency"
groups="base.group_multi_currency"/>
<field name="sort_selection" widget="radio"/>
<newline/>
</xpath>
</data>
</field>
</record>
<record id="action_account_print_journal_menu" model="ir.actions.act_window">
<record id="action_account_print_journal_menu"
model="ir.actions.act_window">
<field name="name">Journals Audit</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.print.journal</field>
@ -24,12 +25,10 @@
<field name="view_id" ref="account_report_print_journal_view"/>
<field name="target">new</field>
</record>
<menuitem id="menu_print_journal"
name="Journals Audit"
sequence="9"
action="action_account_print_journal_menu"
parent="base_accounting_kit.account_reports_audit"
groups="account.group_account_manager,account.group_account_user"/>
</odoo>

13
base_accounting_kit/wizard/partner_ledger.py

@ -19,7 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import fields, models
@ -38,11 +37,15 @@ class AccountPartnerLedger(models.TransientModel):
relation="account_report_partner_section_rel",
column1="main_report_id",
column2="sub_report_id")
name = fields.Char(string="Partner Ledger Report", default="Partner Ledger Report", required=True, translate=True)
name = fields.Char(string="Partner Ledger Report",
default="Partner Ledger Report", required=True,
translate=True)
amount_currency = fields.Boolean("With Currency",
help="It adds the currency column on report if the "
"currency differs from the company currency.")
reconciled = fields.Boolean('Reconciled Entries')
help="It adds the currency column on"
" report if the "
"currency differs from the "
"company currency.")
reconciled = fields.Boolean(string='Reconciled Entries')
def _print_report(self, data):
data = self.pre_print_report(data)

8
base_accounting_kit/wizard/partner_ledger.xml

@ -3,12 +3,14 @@
<record id="account_report_partner_ledger_view" model="ir.ui.view">
<field name="name">Partner Ledger</field>
<field name="model">account.report.partner.ledger</field>
<field name="inherit_id" ref="base_accounting_kit.account_common_report_view"/>
<field name="inherit_id"
ref="base_accounting_kit.account_common_report_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='target_move']" position="after">
<field name="result_selection"/>
<field name="amount_currency" groups="base.group_multi_currency"/>
<field name="amount_currency"
groups="base.group_multi_currency"/>
<newline/>
<field name="reconciled"/>
<newline/>
@ -16,7 +18,6 @@
</data>
</field>
</record>
<record id="action_partner_leadger" model="ir.actions.act_window">
<field name="name">Partner Ledger</field>
<field name="res_model">account.report.partner.ledger</field>
@ -25,7 +26,6 @@
<field name="view_id" ref="account_report_partner_ledger_view"/>
<field name="target">new</field>
</record>
<menuitem name="Partner Ledger"
id="menu_partner_ledger" sequence="1"
parent="base_accounting_kit.account_reports_partner"

26
base_accounting_kit/wizard/tax_report.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models,fields
from odoo import fields, models
from odoo.tools.misc import get_lang
@ -38,7 +38,10 @@ class AccountTaxReport(models.TransientModel):
relation="account_tax_report_section_rel",
column1="main_report_id",
column2="sub_report_id")
company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, default=lambda self: self.env.company)
company_id = fields.Many2one('res.company', string='Company',
required=True,
readonly=True,
default=lambda self: self.env.company)
name = fields.Char(string="Tax Report", default="Tax Report",
required=True, translate=True)
date_from = fields.Date(string='Start Date')
@ -47,17 +50,21 @@ class AccountTaxReport(models.TransientModel):
comodel_name='account.journal',
string='Journals',
required=True,
default=lambda self: self.env['account.journal'].search([('company_id', '=', self.company_id.id)]),
default=lambda self: self.env['account.journal'].search(
[('company_id', '=', self.company_id.id)]),
domain="[('company_id', '=', company_id)]",
)
target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries'),
], string='Target Moves', required=True, default='posted')
], string='Target Moves', required=True,
default='posted')
def _build_contexts(self, data):
result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or ''
result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][
'journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form'][
'target_move'] or ''
result['date_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False
result['strict_range'] = True if result['date_from'] else False
@ -69,9 +76,12 @@ class AccountTaxReport(models.TransientModel):
data = {}
data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move', 'company_id'])[0]
data['form'] = self.read(
['date_from', 'date_to', 'journal_ids', 'target_move',
'company_id'])[0]
used_context = self._build_contexts(data)
data['form']['used_context'] = dict(used_context, lang=get_lang(self.env).code)
data['form']['used_context'] = dict(used_context,
lang=get_lang(self.env).code)
return self.with_context(discard_logo_check=True)._print_report(data)
def pre_print_report(self, data):

7
base_accounting_kit/wizard/tax_report.xml

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="accounting_tax_report_view" model="ir.ui.view">
<field name="name">Tax Reports</field>
<field name="model">kit.account.tax.report</field>
<field name="inherit_id" ref="base_accounting_kit.account_common_report_view"/>
<field name="inherit_id"
ref="base_accounting_kit.account_common_report_view"/>
<field name="arch" type="xml">
<data>
<field name="journal_ids" position="replace"/>
@ -17,7 +17,6 @@
</data>
</field>
</record>
<record id="action_account_tax_report" model="ir.actions.act_window">
<field name="name">Tax Reports</field>
<field name="res_model">kit.account.tax.report</field>
@ -27,12 +26,10 @@
<field name="context">{}</field>
<field name="target">new</field>
</record>
<menuitem id="menu_tax_report"
name="Tax Report"
sequence="8"
action="action_account_tax_report"
parent="base_accounting_kit.account_reports_audit"
groups="account.group_account_manager,account.group_account_user"/>
</odoo>

9
base_accounting_kit/wizard/trial_balance.py

@ -19,8 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import fields, models, api ,_
from odoo import api, fields, models, _
class AccountBalanceReport(models.TransientModel):
@ -38,7 +37,8 @@ class AccountBalanceReport(models.TransientModel):
relation="account_balance_report_section_rel",
column1="sub_report_id",
column2="main_report_id")
name = fields.Char(string="Trial Balance", default="Trial Balance", required=True, translate=True)
name = fields.Char(string="Trial Balance", default="Trial Balance",
required=True, translate=True)
journal_ids = fields.Many2many('account.journal',
'account_balance_report_journal_rel',
'account_id', 'journal_id',
@ -48,7 +48,8 @@ class AccountBalanceReport(models.TransientModel):
@api.model
def _get_report_name(self):
period_id = self._get_selected_period_id()
return self.env['consolidation.period'].browse(period_id)['display_name'] or _("Trial Balance")
return self.env['consolidation.period'].browse(period_id)[
'display_name'] or _("Trial Balance")
def _print_report(self, data):
data = self.pre_print_report(data)

7
base_accounting_kit/wizard/trial_balance.xml

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_report_balance_view" model="ir.ui.view">
<field name="name">Trial Balance</field>
<field name="model">account.balance.report</field>
<field name="inherit_id" ref="base_accounting_kit.account_common_report_view"/>
<field name="inherit_id"
ref="base_accounting_kit.account_common_report_view"/>
<field name="arch" type="xml">
<data>
<field name="journal_ids" position="replace"/>
@ -15,7 +15,6 @@
</data>
</field>
</record>
<record id="action_account_balance_menu" model="ir.actions.act_window">
<field name="name">Trial Balance</field>
<field name="res_model">account.balance.report</field>
@ -25,11 +24,9 @@
<field name="target">new</field>
<field name="binding_model_id" ref="account.model_account_account"/>
</record>
<menuitem id="menu_Balance_report"
name="Trial Balance"
sequence="7"
action="action_account_balance_menu"
parent="base_accounting_kit.account_reports_audit"/>
</odoo>

Loading…
Cancel
Save