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', 'name': 'Odoo 17 Full Accounting Kit',
'version': '17.0.1.0.0', 'version': '17.0.1.0.1',
'category': 'Accounting', '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.""", Lock dates, Credit Limit, Follow Ups, Day-Bank-Cash book reports.""",
'description': """ Odoo 17 Accounting, The module used to manage the Full Account Features. 'description': """ Odoo 17 Accounting, The module used to manage the Full
that can manage the Account Reports,Journals Asset and Budget Management, Account Features that can manage the Account Reports,Journals Asset and
Accounting Reports, PDC, Lock dates, Credit Limit, Follow Ups, Budget Management, Accounting Reports, PDC, Lock dates, Credit Limit,
Day-Bank-Cash book report, odoo17, odoo17 accounting, odoo accounting, v17 accounting,Odoo 17 Accounting, odoo apps""", Follow Ups, Day-Bank-Cash book report, odoo17, odoo17 accounting,
odoo accounting, v17 accounting,Odoo 17 Accounting, odoo apps""",
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions',
'maintainer': '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="sign" eval="'-1'"/>
<field name="type">sum</field> <field name="type">sum</field>
</record> </record>
<record id="account_financial_report_income0" <record id="account_financial_report_income0"
model="account.financial.report"> model="account.financial.report">
<field name="name">Income</field> <field name="name">Income</field>
@ -29,7 +28,6 @@
<field name="type">account_type</field> <field name="type">account_type</field>
<field name="account_type_ids">income_other</field> <field name="account_type_ids">income_other</field>
</record> </record>
<record id="financial_report_gross_profit" <record id="financial_report_gross_profit"
model="account.financial.report"> model="account.financial.report">
<field name="name">Gross Profit</field> <field name="name">Gross Profit</field>
@ -39,7 +37,6 @@
<field name="type">sum</field> <field name="type">sum</field>
<field name="sequence">3</field> <field name="sequence">3</field>
</record> </record>
<record id="financial_report_cost_of_revenue" <record id="financial_report_cost_of_revenue"
model="account.financial.report"> model="account.financial.report">
<field name="name">Cost of Revenue</field> <field name="name">Cost of Revenue</field>
@ -50,7 +47,6 @@
<field name="type">account_type</field> <field name="type">account_type</field>
<field name="account_type_ids">expense_direct_cost</field> <field name="account_type_ids">expense_direct_cost</field>
</record> </record>
<record id="account_financial_report_operating_income0" <record id="account_financial_report_operating_income0"
model="account.financial.report"> model="account.financial.report">
<field name="name">Operating Income</field> <field name="name">Operating Income</field>
@ -61,7 +57,6 @@
<field name="type">account_type</field> <field name="type">account_type</field>
<field name="account_type_ids">income</field> <field name="account_type_ids">income</field>
</record> </record>
<record id="account_financial_report_expense0" <record id="account_financial_report_expense0"
model="account.financial.report"> model="account.financial.report">
<field name="name">Expense</field> <field name="name">Expense</field>
@ -73,13 +68,11 @@
<field name="type">account_type</field> <field name="type">account_type</field>
<field name="account_type_ids">expense</field> <field name="account_type_ids">expense</field>
</record> </record>
<record id="account_financial_report_balancesheet0" <record id="account_financial_report_balancesheet0"
model="account.financial.report"> model="account.financial.report">
<field name="name">Balance Sheet</field> <field name="name">Balance Sheet</field>
<field name="type">sum</field> <field name="type">sum</field>
</record> </record>
<record id="account_financial_report_assets0" <record id="account_financial_report_assets0"
model="account.financial.report"> model="account.financial.report">
<field name="name">Assets</field> <field name="name">Assets</field>
@ -89,7 +82,6 @@
<field name="type">account_type</field> <field name="type">account_type</field>
<field name="account_type_ids">income_other</field> <field name="account_type_ids">income_other</field>
</record> </record>
<record id="account_financial_report_liabilitysum0" <record id="account_financial_report_liabilitysum0"
model="account.financial.report"> model="account.financial.report">
<field name="name">Liability</field> <field name="name">Liability</field>
@ -99,7 +91,6 @@
<field name="display_detail">no_detail</field> <field name="display_detail">no_detail</field>
<field name="type">sum</field> <field name="type">sum</field>
</record> </record>
<record id="account_financial_report_liability0" <record id="account_financial_report_liability0"
model="account.financial.report"> model="account.financial.report">
<field name="name">Liability</field> <field name="name">Liability</field>
@ -109,7 +100,6 @@
<field name="type">account_type</field> <field name="type">account_type</field>
<field name="account_type_ids">income_other</field> <field name="account_type_ids">income_other</field>
</record> </record>
<record id="account_financial_report_profitloss_toreport0" <record id="account_financial_report_profitloss_toreport0"
model="account.financial.report"> model="account.financial.report">
<field name="name">Profit (Loss) to report</field> <field name="name">Profit (Loss) to report</field>
@ -120,7 +110,6 @@
<field name="account_report_id" <field name="account_report_id"
ref="account_financial_report_profitandloss0"/> ref="account_financial_report_profitandloss0"/>
</record> </record>
<record id="account_common_report_view" model="ir.ui.view"> <record id="account_common_report_view" model="ir.ui.view">
<field name="name">Common Report</field> <field name="name">Common Report</field>
<field name="model">account.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"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<data noupdate="1"> <data noupdate="1">
<!-- Account payment method--> <!-- Account payment method-->
<record id="account_payment_method_pdc_in" <record id="account_payment_method_pdc_in"
model="account.payment.method"> model="account.payment.method">
<field name="name">PDC</field> <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"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<data noupdate="1"> <data noupdate="1">
<!-- Records for the account.financial.report model--> <!-- Records for the account.financial.report model-->
<record id="account_financial_report_cash_flow0" model="account.financial.report"> <record id="account_financial_report_cash_flow0"
model="account.financial.report">
<field name="name">Cash Flow Statement</field> <field name="name">Cash Flow Statement</field>
<field name="type">sum</field> <field name="type">sum</field>
</record> </record>
<record id="account_financial_report_operation0"
<record id="account_financial_report_operation0" model="account.financial.report"> model="account.financial.report">
<field name="name">Operations</field> <field name="name">Operations</field>
<field name="sequence">1</field> <field name="sequence">1</field>
<field name="parent_id" ref="account_financial_report_cash_flow0"/> <field name="parent_id" ref="account_financial_report_cash_flow0"/>
<field name="display_detail">detail_with_hierarchy</field> <field name="display_detail">detail_with_hierarchy</field>
<field name="type">sum</field> <field name="type">sum</field>
</record> </record>
<record id="cash_in_from_operation0" model="account.financial.report"> <record id="cash_in_from_operation0" model="account.financial.report">
<field name="name">Cash In</field> <field name="name">Cash In</field>
<field name="sequence">1</field> <field name="sequence">1</field>
@ -22,7 +22,6 @@
<field name="display_detail">detail_with_hierarchy</field> <field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field> <field name="type">accounts</field>
</record> </record>
<record id="cash_out_operation1" model="account.financial.report"> <record id="cash_out_operation1" model="account.financial.report">
<field name="name">Cash Out</field> <field name="name">Cash Out</field>
<field name="sequence">2</field> <field name="sequence">2</field>
@ -30,46 +29,47 @@
<field name="display_detail">detail_with_hierarchy</field> <field name="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field> <field name="type">accounts</field>
</record> </record>
<record id="account_financial_report_investing_activity0"
<record id="account_financial_report_investing_activity0" model="account.financial.report"> model="account.financial.report">
<field name="name">Investing Activities</field> <field name="name">Investing Activities</field>
<field name="sequence">2</field> <field name="sequence">2</field>
<field name="parent_id" ref="account_financial_report_cash_flow0"/> <field name="parent_id" ref="account_financial_report_cash_flow0"/>
<field name="display_detail">detail_with_hierarchy</field> <field name="display_detail">detail_with_hierarchy</field>
<field name="type">sum</field> <field name="type">sum</field>
</record> </record>
<record id="cash_in_investing0" model="account.financial.report"> <record id="cash_in_investing0" model="account.financial.report">
<field name="name">Cash In</field> <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="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field> <field name="type">accounts</field>
</record> </record>
<record id="cash_out_investing1" model="account.financial.report"> <record id="cash_out_investing1" model="account.financial.report">
<field name="name">Cash Out</field> <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="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field> <field name="type">accounts</field>
</record> </record>
<record id="account_financial_report_financing_activity1"
<record id="account_financial_report_financing_activity1" model="account.financial.report"> model="account.financial.report">
<field name="name">Financing Activities</field> <field name="name">Financing Activities</field>
<field name="sequence">3</field> <field name="sequence">3</field>
<field name="parent_id" ref="account_financial_report_cash_flow0"/> <field name="parent_id" ref="account_financial_report_cash_flow0"/>
<field name="display_detail">detail_with_hierarchy</field> <field name="display_detail">detail_with_hierarchy</field>
<field name="type">sum</field> <field name="type">sum</field>
</record> </record>
<record id="cash_in_financial0" model="account.financial.report"> <record id="cash_in_financial0" model="account.financial.report">
<field name="name">Cash In</field> <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="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field> <field name="type">accounts</field>
</record> </record>
<record id="cash_out_financial1" model="account.financial.report"> <record id="cash_out_financial1" model="account.financial.report">
<field name="name">Cash Out</field> <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="display_detail">detail_with_hierarchy</field>
<field name="type">accounts</field> <field name="type">accounts</field>
</record> </record>

7
base_accounting_kit/data/followup_levels.xml

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<data noupdate="1"> <data noupdate="1">
<!-- Data file for the follow-up lines--> <!-- Data file for the follow-up lines-->
<record model="followup.line" id="followup_line_id" > <record model="followup.line" id="followup_line_id">
<field name="name">Reminder</field> <field name="name">Reminder</field>
<field name="delay">5</field> <field name="delay">5</field>
</record> </record>
<record model="account.followup" id="followup"> <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> </record>
</data> </data>
</odoo> </odoo>

2
base_accounting_kit/data/multiple_invoice_data.xml

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

2
base_accounting_kit/data/recurring_entry_cron.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding='UTF-8'?> <?xml version="1.0" encoding='UTF-8'?>
<odoo> <odoo>
<data noupdate="1"> <data noupdate="1">
<!-- The schedular action for Recurring Entries--> <!-- The schedular action for Recurring Entries-->
<record id="recurring_template_cron" model="ir.cron"> <record id="recurring_template_cron" model="ir.cron">
<field name="name">Generate Recurring Entries</field> <field name="name">Generate Recurring Entries</field>
<field name="model_id" ref="model_account_recurring_payments"/> <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> ## Module <base_accounting_kit>
#### 06.11.2022 #### 06.11.2023
#### Version 16.0.1.0.0 #### Version 17.0.1.0.0
#### ADD #### ADD
- Initial commit for Odoo 17 Full Accounting Kit - 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): def get_cash_flow_ids(self):
"""Returns a list of cashflows for the account""" """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: if cash_flow_id:
return [('parent_id.id', '=', cash_flow_id.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') @api.onchange('cash_flow_type')
def onchange_cash_flow_type(self): def onchange_cash_flow_type(self):
@ -63,7 +66,8 @@ class AccountCommonReport(models.Model):
comodel_name='account.journal', comodel_name='account.journal',
string='Journals', string='Journals',
required=True, 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)]") domain="[('company_id', '=', company_id)]")
date_from = fields.Date(string='Start Date') date_from = fields.Date(string='Start Date')
date_to = fields.Date(string='End Date') date_to = fields.Date(string='End Date')
@ -84,8 +88,10 @@ class AccountCommonReport(models.Model):
def _build_contexts(self, data): def _build_contexts(self, data):
"""Builds the context information for the given data""" """Builds the context information for the given data"""
result = {} result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' '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_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False result['date_to'] = data['form']['date_to'] or False
result['strict_range'] = True if result['date_from'] else False result['strict_range'] = True if result['date_from'] else False
@ -103,9 +109,12 @@ class AccountCommonReport(models.Model):
data = {} data = {}
data['ids'] = self.env.context.get('active_ids', []) data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu') 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) 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) return self.with_context(discard_logo_check=True)._print_report(data)
@ -152,16 +161,21 @@ class AccountCommonJournalReport(models.TransientModel):
data = {} data = {}
data['ids'] = self.env.context.get('active_ids', []) data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu') 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) 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) return self.with_context(discard_logo_check=True)._print_report(data)
def _build_contexts(self, data): def _build_contexts(self, data):
"""Builds the context information for the given data""" """Builds the context information for the given data"""
result = {} result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' '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_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False result['date_to'] = data['form']['date_to'] or False
result['strict_range'] = True if result['date_from'] else 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 import calendar
from datetime import date, datetime from datetime import date, datetime
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, _ from odoo import api, fields, models, _
from odoo.exceptions import UserError, ValidationError from odoo.exceptions import UserError, ValidationError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
@ -47,48 +45,82 @@ class AccountAssetCategory(models.Model):
readonly=True, hide=True) readonly=True, hide=True)
account_analytic_id = fields.Many2one('account.analytic.account', account_analytic_id = fields.Many2one('account.analytic.account',
string='Analytic Account', string='Analytic Account',
domain="[('company_id', '=', company_id)]") domain="[('company_id', '=', "
"company_id)]")
account_asset_id = fields.Many2one('account.account', account_asset_id = fields.Many2one('account.account',
string='Asset Account', required=True, 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)]", domain="[('account_type', '!=', "
help="Account used to record the purchase of the asset at its original price.") "'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_depreciation_id = fields.Many2one(
'account.account', string='Depreciation Account', 'account.account', string='Depreciation Account',
required=True, 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)]", domain="[('account_type', '!=', 'asset_receivable'),('account_type',"
help="Account used in the depreciation entries, to decrease the asset value.") " '!=', '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_depreciation_expense_id = fields.Many2one(
'account.account', string='Expense Account', 'account.account', string='Expense Account',
required=True, 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)]", domain="[('account_type', '!=', 'asset_receivable'),"
help="Account used in the periodical entries, to record a part of the asset as expense.") "('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', journal_id = fields.Many2one('account.journal', string='Journal',
required=True) required=True)
method = fields.Selection( method = fields.Selection(
[('linear', 'Linear'), ('degressive', 'Degressive')], [('linear', 'Linear'), ('degressive', 'Degressive')],
string='Computation Method', required=True, default='linear', string='Computation Method', required=True, default='linear',
help="Choose the method to use to compute the amount of depreciation lines.\n" help="Choose the method to use to compute the amount of "
" * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n" "depreciation lines.\n"
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor") " * 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, 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, 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) required=True)
method_progress_factor = fields.Float('Degressive Factor', default=0.3) method_progress_factor = fields.Float('Degressive Factor', default=0.3)
method_time = fields.Selection( method_time = fields.Selection(
[('number', 'Number of Entries'), ('end', 'Ending Date')], [('number', 'Number of Entries'), ('end', 'Ending Date')],
string='Time Method', required=True, default='number', string='Time Method', required=True, default='number',
help="Choose the method to use to compute the dates and number of entries.\n" help="Choose the method to use to compute the dates and number of "
" * Number of Entries: Fix the number of entries and the time between 2 depreciations.\n" "entries.\n"
" * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond.") " * 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') method_end = fields.Date('Ending date')
prorata = fields.Boolean(string='Prorata Temporis', 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', 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', 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'), type = fields.Selection([('sale', 'Sale: Revenue Recognition'),
('purchase', 'Purchase: Asset')], required=True, ('purchase', 'Purchase: Asset')], required=True,
index=True, default='purchase') index=True, default='purchase')
@ -127,57 +159,76 @@ class AccountAssetAsset(models.Model):
digits=0) digits=0)
currency_id = fields.Many2one('res.currency', string='Currency', currency_id = fields.Many2one('res.currency', string='Currency',
required=True, readonly=True, 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', company_id = fields.Many2one('res.company', string='Company',
required=True, readonly=True, required=True, readonly=True,
default=lambda self: self.env.company) default=lambda self: self.env.company)
note = fields.Text() 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, required=True, change_default=True,
readonly=True,) readonly=True, )
date = fields.Date(string='Date', required=True, readonly=True, date = fields.Date(string='Date', required=True, readonly=True,
default=fields.Date.context_today) default=fields.Date.context_today)
state = fields.Selection( state = fields.Selection(
[('draft', 'Draft'), ('open', 'Running'), ('close', 'Close')], [('draft', 'Draft'), ('open', 'Running'), ('close', 'Close')],
'Status', required=True, copy=False, default='draft', 'Status', required=True, copy=False, default='draft',
help="When an asset is created, the status is 'Draft'.\n" 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" "If the asset is confirmed, the status goes in 'Running' and the "
"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.") "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) active = fields.Boolean(default=True)
partner_id = fields.Many2one('res.partner', string='Partner', partner_id = fields.Many2one('res.partner', string='Partner',
readonly=True) readonly=True)
method = fields.Selection( method = fields.Selection(
[('linear', 'Linear'), ('degressive', 'Degressive')], [('linear', 'Linear'), ('degressive', 'Degressive')],
string='Computation Method', required=True, readonly=True, default='linear', string='Computation Method', required=True, readonly=True,
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" default='linear',
" * 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', method_number = fields.Integer(string='Number of Depreciations',
readonly=True, readonly=True,
default=5, 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', method_period = fields.Integer(string='Number of Months in a Period',
required=True, readonly=True, default=12, required=True, readonly=True, default=12,
help="The amount of time between two depreciations, in months") help="The amount of time between two "
method_end = fields.Date(string='Ending Date', readonly=True,) "depreciations, in months")
method_end = fields.Date(string='Ending Date', readonly=True, )
method_progress_factor = fields.Float(string='Degressive Factor', 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', value_residual = fields.Float(compute='_amount_residual',
digits=0, string='Residual Value') digits=0, string='Residual Value')
method_time = fields.Selection( method_time = fields.Selection(
[('number', 'Number of Entries'), ('end', 'Ending Date')], [('number', 'Number of Entries'), ('end', 'Ending Date')],
string='Time Method', required=True, readonly=True, default='number', string='Time Method', required=True, readonly=True, default='number',
help="Choose the method to use to compute the dates and number of entries.\n" help="Choose the method to use to compute the dates and number of "
" * Number of Entries: Fix the number of entries and the time between 2 depreciations.\n" "entries.\n"
" * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond.") " * 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, 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') help='Indicates that the first depreciation entry '
depreciation_line_ids = fields.One2many('account.asset.depreciation.line', 'for this asset have to be done from the '
'asset_id', 'purchase date instead of the first '
string='Depreciation Lines', 'January / Start date of fiscal year')
readonly=True,) 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, salvage_value = fields.Float(string='Salvage Value', digits=0,
readonly=True, 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', invoice_id = fields.Many2one('account.move', string='Invoice',
copy=False) copy=False)
type = fields.Selection(related="category_id.type", string='Type', 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: for depreciation_line in asset.depreciation_line_ids:
if depreciation_line.move_id: if depreciation_line.move_id:
raise UserError(_( 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() return super(AccountAssetAsset, self).unlink()
def _get_last_depreciation_date(self): def _get_last_depreciation_date(self):
""" """
@param id: ids of a account.asset.asset objects @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(""" self.env.cr.execute("""
SELECT a.id as id, COALESCE(MAX(m.date),a.date) AS date SELECT a.id as id, COALESCE(MAX(m.date),a.date) AS date
FROM account_asset_asset a 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) LEFT JOIN account_move m ON (rel.move_id = m.id)
WHERE a.id IN %s WHERE a.id IN %s
GROUP BY a.id, m.date """, (tuple(self.ids),)) GROUP BY a.id, m.date """, (tuple(self.ids),))
@ -219,7 +274,8 @@ class AccountAssetAsset(models.Model):
@api.model @api.model
def compute_generated_entries(self, date, asset_type=None): 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 = [] created_move_ids = []
type_domain = [] type_domain = []
if asset_type: if asset_type:
@ -228,8 +284,8 @@ class AccountAssetAsset(models.Model):
ungrouped_assets = self.env['account.asset.asset'].search( ungrouped_assets = self.env['account.asset.asset'].search(
type_domain + [('state', '=', 'open'), type_domain + [('state', '=', 'open'),
('category_id.group_entries', '=', False)]) ('category_id.group_entries', '=', False)])
created_move_ids += ungrouped_assets._compute_entries(date, created_move_ids += (ungrouped_assets.
group_entries=False) _compute_entries(date, group_entries=False))
for grouped_category in self.env['account.asset.category'].search( for grouped_category in self.env['account.asset.category'].search(
type_domain + [('group_entries', '=', True)]): type_domain + [('group_entries', '=', True)]):
@ -260,14 +316,16 @@ class AccountAssetAsset(models.Model):
month_days = \ month_days = \
calendar.monthrange(date.year, date.month)[1] calendar.monthrange(date.year, date.month)[1]
days = month_days - date.day + 1 days = month_days - date.day + 1
amount = ( amount = ((amount_to_depr / self.method_number)
amount_to_depr / self.method_number) / month_days * days / month_days * days)
else: else:
days = (self.company_id.compute_fiscalyear_dates( days = (self.company_id.compute_fiscalyear_dates(
depreciation_date)[ depreciation_date)[
'date_to'] - depreciation_date).days + 1 'date_to'] - depreciation_date).days + 1
amount = ( amount = ((
amount_to_depr / self.method_number) / total_days * days amount_to_depr /
self.method_number) /
total_days * days)
elif self.method == 'degressive': elif self.method == 'degressive':
amount = residual_amount * self.method_progress_factor amount = residual_amount * self.method_progress_factor
if self.prorata: if self.prorata:
@ -278,14 +336,18 @@ class AccountAssetAsset(models.Model):
month_days = \ month_days = \
calendar.monthrange(date.year, date.month)[1] calendar.monthrange(date.year, date.month)[1]
days = month_days - date.day + 1 days = month_days - date.day + 1
amount = ( amount = ((
residual_amount * self.method_progress_factor) / month_days * days residual_amount *
self.method_progress_factor) /
month_days * days)
else: else:
days = (self.company_id.compute_fiscalyear_dates( days = (self.company_id.compute_fiscalyear_dates(
depreciation_date)[ depreciation_date)[
'date_to'] - depreciation_date).days + 1 'date_to'] - depreciation_date).days + 1
amount = ( amount = ((
residual_amount * self.method_progress_factor) / total_days * days residual_amount *
self.method_progress_factor) /
total_days * days)
return amount return amount
def _compute_board_undone_dotation_nb(self, depreciation_date, total_days): 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( unposted_depreciation_line_ids = self.depreciation_line_ids.filtered(
lambda x: not x.move_check) 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 commands = [(2, line_id.id, False) for line_id in
unposted_depreciation_line_ids] unposted_depreciation_line_ids]
if self.value_residual != 0.0: if self.value_residual != 0.0:
amount_to_depr = residual_amount = self.value_residual amount_to_depr = residual_amount = self.value_residual
if self.prorata: 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 \ if posted_depreciation_line_ids and \
posted_depreciation_line_ids[-1].depreciation_date: posted_depreciation_line_ids[-1].depreciation_date:
last_depreciation_date = datetime.strptime( last_depreciation_date = datetime.strptime(
@ -330,25 +394,29 @@ class AccountAssetAsset(models.Model):
str(self._get_last_depreciation_date()[self.id]), str(self._get_last_depreciation_date()[self.id]),
DF).date() DF).date()
else: 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 # purchase month in other cases
if self.method_period >= 12: if self.method_period >= 12:
if self.company_id.fiscalyear_last_month: if self.company_id.fiscalyear_last_month:
asset_date = date(year=int(self.date.year), asset_date = (date(year=int(self.date.year),
month=int( month=int(
self.company_id.fiscalyear_last_month), self.company_id.fiscalyear_last_month),
day=int( day=int(
self.company_id.fiscalyear_last_day)) + relativedelta( self.company_id.
days=1) + \ fiscalyear_last_day)) +
relativedelta(year=int( relativedelta(days=1) + relativedelta(
self.date.year)) # e.g. 2018-12-31 +1 -> 2019 year=int(
self.date.year)))
# e.g. 2018-12-31 +1 -> 2019
else: else:
asset_date = datetime.strptime( asset_date = datetime.strptime(
str(self.date)[:4] + '-01-01', DF).date() str(self.date)[:4] + '-01-01', DF).date()
else: else:
asset_date = datetime.strptime(str(self.date)[:7] + '-01', asset_date = datetime.strptime(str(self.date)[:7] + '-01',
DF).date() 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 \ if posted_depreciation_line_ids and \
posted_depreciation_line_ids[-1].depreciation_date: posted_depreciation_line_ids[-1].depreciation_date:
last_depreciation_date = datetime.strptime(str( last_depreciation_date = datetime.strptime(str(
@ -386,7 +454,8 @@ class AccountAssetAsset(models.Model):
'asset_id': self.id, 'asset_id': self.id,
'sequence': sequence, 'sequence': sequence,
'name': (self.code or '') + '/' + str(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 - ( 'depreciated_value': self.value - (
self.salvage_value + residual_amount), self.salvage_value + residual_amount),
'depreciation_date': depreciation_date.strftime(DF), 'depreciation_date': depreciation_date.strftime(DF),
@ -433,8 +502,9 @@ class AccountAssetAsset(models.Model):
def _get_disposal_moves(self): def _get_disposal_moves(self):
move_ids = [] move_ids = []
for asset in self: for asset in self:
unposted_depreciation_line_ids = asset.depreciation_line_ids.filtered( unposted_depreciation_line_ids = (
lambda x: not x.move_check) asset.depreciation_line_ids.filtered(
lambda x: not x.move_check))
if unposted_depreciation_line_ids: if unposted_depreciation_line_ids:
old_values = { old_values = {
'method_end': asset.method_end, 'method_end': asset.method_end,
@ -469,7 +539,8 @@ class AccountAssetAsset(models.Model):
tracked_fields, old_values) tracked_fields, old_values)
if changes: if changes:
asset.message_post(subject=_( 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) tracking_value_ids=tracking_value_ids)
move_ids += asset.depreciation_line_ids[-1].create_move( move_ids += asset.depreciation_line_ids[-1].create_move(
post_move=False) post_move=False)
@ -498,7 +569,8 @@ class AccountAssetAsset(models.Model):
def set_to_draft(self): def set_to_draft(self):
self.write({'state': 'draft'}) 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') 'depreciation_line_ids.amount')
def _amount_residual(self): def _amount_residual(self):
for record in self: for record in self:
@ -506,7 +578,8 @@ class AccountAssetAsset(models.Model):
for line in record.depreciation_line_ids: for line in record.depreciation_line_ids:
if line.move_check: if line.move_check:
total_amount += line.amount 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') @api.onchange('company_id')
def onchange_company_id(self): def onchange_company_id(self):
@ -523,7 +596,8 @@ class AccountAssetAsset(models.Model):
def _check_prorata(self): def _check_prorata(self):
if self.prorata and self.method_time != 'number': if self.prorata and self.method_time != 'number':
raise ValidationError(_( 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') @api.onchange('category_id')
def onchange_category_id(self): def onchange_category_id(self):
@ -614,7 +688,8 @@ class AccountAssetDepreciationLine(models.Model):
depreciated_value = fields.Float(string='Cumulative Depreciation', depreciated_value = fields.Float(string='Cumulative Depreciation',
required=True) required=True)
depreciation_date = fields.Date('Depreciation Date', index=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', move_check = fields.Boolean(compute='_get_move_check', string='Linked',
store=True) store=True)
move_posted_check = fields.Boolean(compute='_get_move_posted_check', move_posted_check = fields.Boolean(compute='_get_move_posted_check',
@ -628,61 +703,79 @@ class AccountAssetDepreciationLine(models.Model):
@api.depends('move_id.state') @api.depends('move_id.state')
def _get_move_posted_check(self): def _get_move_posted_check(self):
for line in 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): def create_move(self, post_move=True):
created_moves = self.env['account.move'] created_moves = self.env['account.move']
prec = self.env['decimal.precision'].precision_get('Account') prec = self.env['decimal.precision'].precision_get('Account')
if self.mapped('move_id'): if self.mapped('move_id'):
raise UserError(_( 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: for line in self:
category_id = line.asset_id.category_id category_id = line.asset_id.category_id
depreciation_date = self.env.context.get( depreciation_date = (self.env.context.get(
'depreciation_date') or line.depreciation_date or fields.Date.context_today( 'depreciation_date') or line.depreciation_date or
self) fields.Date.context_today(
self))
company_currency = line.asset_id.company_id.currency_id company_currency = line.asset_id.company_id.currency_id
current_currency = line.asset_id.currency_id current_currency = line.asset_id.currency_id
amount = current_currency.with_context( amount = current_currency.with_context(
date=depreciation_date).compute(line.amount, company_currency) 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)) asset_name = line.asset_id.name + ' (%s/%s)' % (
partner = self.env['res.partner']._find_accounting_partner(line.asset_id.partner_id) 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 = { move_line_1 = {
'name': asset_name, 'name': asset_name,
'account_id': category_id.account_depreciation_id.id, 'account_id': category_id.account_depreciation_id.id,
'debit': 0.0 if float_compare(amount, 0.0, '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, '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, 'journal_id': category_id.journal_id.id,
'partner_id': partner.id, 'partner_id': partner.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
'currency_id': company_currency != current_currency and current_currency.id or company_currency.id, # category_id.type == 'sale' else False,
'amount_currency': company_currency != current_currency and - 1.0 * line.amount or 0.0, '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 = { move_line_2 = {
'name': asset_name, 'name': asset_name,
'account_id': category_id.account_depreciation_expense_id.id, 'account_id': category_id.account_depreciation_expense_id.id,
'credit': 0.0 if float_compare(amount, 0.0, '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, '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, 'journal_id': category_id.journal_id.id,
'partner_id': partner.id, 'partner_id': partner.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
'currency_id': company_currency != current_currency and current_currency.id or company_currency.id, # if category_id.type == 'purchase' else False,
'amount_currency': company_currency != current_currency and line.amount or 0.0, '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, { line_ids = [(0, 0, {
'account_id': category_id.account_depreciation_id.id, 'account_id': category_id.account_depreciation_id.id,
'partner_id': partner.id, 'partner_id': partner.id,
'credit': amount if float_compare(amount, 0.0, 'credit': amount if float_compare(amount, 0.0,
precision_digits=prec) > 0 else 0.0, precision_digits=prec) > 0
else 0.0,
}), (0, 0, { }), (0, 0, {
'account_id': category_id.account_depreciation_expense_id.id, 'account_id': category_id.account_depreciation_expense_id.id,
'partner_id': partner.id, 'partner_id': partner.id,
'debit': amount if float_compare(amount, 0.0, '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({ move = self.env['account.move'].create({
'ref': line.asset_id.code, 'ref': line.asset_id.code,
@ -703,7 +796,6 @@ class AccountAssetDepreciationLine(models.Model):
lambda x: x.name == 'Automatic Balancing Line').unlink() lambda x: x.name == 'Automatic Balancing Line').unlink()
line.write({'move_id': move.id, 'move_check': True}) line.write({'move_id': move.id, 'move_check': True})
created_moves |= move created_moves |= move
if post_move and created_moves: if post_move and created_moves:
created_moves.filtered(lambda m: any( created_moves.filtered(lambda m: any(
m.asset_depreciation_ids.mapped( m.asset_depreciation_ids.mapped(
@ -713,10 +805,10 @@ class AccountAssetDepreciationLine(models.Model):
def create_grouped_move(self, post_move=True): def create_grouped_move(self, post_move=True):
if not self.exists(): if not self.exists():
return [] return []
created_moves = self.env['account.move'] created_moves = self.env['account.move']
category_id = self[ 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 = self.env.context.get(
'depreciation_date') or fields.Date.context_today(self) 'depreciation_date') or fields.Date.context_today(self)
amount = 0.0 amount = 0.0
@ -725,7 +817,6 @@ class AccountAssetDepreciationLine(models.Model):
company_currency = line.asset_id.company_id.currency_id company_currency = line.asset_id.company_id.currency_id
current_currency = line.asset_id.currency_id current_currency = line.asset_id.currency_id
amount += current_currency.compute(line.amount, company_currency) amount += current_currency.compute(line.amount, company_currency)
name = category_id.name + _(' (grouped)') name = category_id.name + _(' (grouped)')
move_line_1 = { move_line_1 = {
'name': name, 'name': name,
@ -733,7 +824,8 @@ class AccountAssetDepreciationLine(models.Model):
'debit': 0.0, 'debit': 0.0,
'credit': amount, 'credit': amount,
'journal_id': category_id.journal_id.id, '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 = { move_line_2 = {
'name': name, 'name': name,
@ -741,7 +833,8 @@ class AccountAssetDepreciationLine(models.Model):
'credit': 0.0, 'credit': 0.0,
'debit': amount, 'debit': amount,
'journal_id': category_id.journal_id.id, '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 = { move_vals = {
'ref': category_id.name, 'ref': category_id.name,
@ -752,7 +845,6 @@ class AccountAssetDepreciationLine(models.Model):
move = self.env['account.move'].create(move_vals) move = self.env['account.move'].create(move_vals)
self.write({'move_id': move.id, 'move_check': True}) self.write({'move_id': move.id, 'move_check': True})
created_moves |= move created_moves |= move
if post_move and created_moves: if post_move and created_moves:
self.post_lines_and_close_asset() self.post_lines_and_close_asset()
created_moves.post() created_moves.post()
@ -762,7 +854,8 @@ class AccountAssetDepreciationLine(models.Model):
# we re-evaluate the assets to determine whether we can close them # we re-evaluate the assets to determine whether we can close them
# `message_post` invalidates the (whole) cache # `message_post` invalidates the (whole) cache
# preprocess the assets and lines in which a message should be posted, # 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'] assets_to_close = self.env['account.asset.asset']
for line in self: for line in self:
asset = line.asset_id asset = line.asset_id
@ -782,10 +875,10 @@ class AccountAssetDepreciationLine(models.Model):
message += '<div> &nbsp; &nbsp; &bull; <b>%s</b>: ' % name message += '<div> &nbsp; &nbsp; &bull; <b>%s</b>: ' % name
message += '%s</div>' % values message += '%s</div>' % values
return message return message
# `message_post` invalidates the (whole) cache # `message_post` invalidates the (whole) cache
# preprocess the assets in which messages should be posted, # 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 = {} assets_to_post = {}
for line in self: for line in self:
if line.move_id and line.move_id.state == 'draft': 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/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import fields, models from odoo import fields, models
@ -28,7 +27,8 @@ class Followup(models.Model):
_description = 'Account Follow-up' _description = 'Account Follow-up'
_rec_name = 'name' _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) 'Follow-up', copy=True)
company_id = fields.Many2one('res.company', 'Company', company_id = fields.Many2one('res.company', 'Company',
default=lambda self: self.env.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) name = fields.Char('Follow-Up Action', required=True, translate=True)
sequence = fields.Integer( 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, 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." " to wait before sending the reminder."
" Could be negative if you want to send a polite alert beforehand.") " Could be negative if you want to send a "
followup_id = fields.Many2one('account.followup', 'Follow Ups', "polite alert beforehand.")
followup_id = fields.Many2one('account.followup',
'Follow Ups',
ondelete="cascade") ondelete="cascade")

23
base_accounting_kit/models/account_journal.py

@ -27,29 +27,6 @@ class AccountJournal(models.Model):
journal""" journal"""
_inherit = "account.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): def action_open_reconcile(self):
"""Function to open reconciliation view for bank statements """Function to open reconciliation view for bank statements
belonging to this journal""" belonging to this journal"""

64
base_accounting_kit/models/account_move.py

@ -32,9 +32,10 @@ class AccountMove(models.Model):
field to the account""" field to the account"""
_inherit = 'account.move' _inherit = 'account.move'
asset_depreciation_ids = fields.One2many('account.asset.depreciation.line', asset_depreciation_ids = fields.One2many(
'move_id', 'account.asset.depreciation.line',
string='Assets Depreciation Lines') 'move_id',
string='Assets Depreciation Lines')
def button_cancel(self): def button_cancel(self):
"""Button action to cancel the transfer""" """Button action to cancel the transfer"""
@ -108,7 +109,8 @@ class AccountInvoiceLine(models.Model):
if cat: if cat:
if cat.method_number == 0 or cat.method_period == 0: if cat.method_number == 0 or cat.method_period == 0:
raise UserError(_( 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 months = cat.method_number * cat.method_period
if record.move_id in ['out_invoice', 'out_refund']: if record.move_id in ['out_invoice', 'out_refund']:
record.asset_mrr = record.price_subtotal_signed / months record.asset_mrr = record.price_subtotal_signed / months
@ -167,9 +169,12 @@ class AccountInvoiceLine(models.Model):
vals = super(AccountInvoiceLine, self)._compute_price_unit() vals = super(AccountInvoiceLine, self)._compute_price_unit()
if self.product_id: if self.product_id:
if self.move_id.move_type == 'out_invoice': 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': 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 return vals
def _set_additional_fields(self, invoice): def _set_additional_fields(self, invoice):
@ -177,9 +182,12 @@ class AccountInvoiceLine(models.Model):
move types""" move types"""
if not self.asset_category_id: if not self.asset_category_id:
if invoice.type == 'out_invoice': 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': 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() self.onchange_asset_category_id()
super(AccountInvoiceLine, self)._set_additional_fields(invoice) super(AccountInvoiceLine, self)._set_additional_fields(invoice)
@ -193,12 +201,10 @@ class AccountInvoiceLine(models.Model):
def _query_get(self, domain=None): def _query_get(self, domain=None):
"""Used to add domain constraints to the query""" """Used to add domain constraints to the query"""
self.check_access_rights('read') self.check_access_rights('read')
context = dict(self._context or {}) context = dict(self._context or {})
domain = domain or [] domain = domain or []
if not isinstance(domain, (list, tuple)): if not isinstance(domain, (list, tuple)):
domain = ast.literal_eval(domain) domain = ast.literal_eval(domain)
date_field = 'date' date_field = 'date'
if context.get('aged_balance'): if context.get('aged_balance'):
date_field = 'date_maturity' date_field = 'date_maturity'
@ -212,55 +218,49 @@ class AccountInvoiceLine(models.Model):
domain += [(date_field, '<', context['date_from'])] domain += [(date_field, '<', context['date_from'])]
else: else:
domain += [(date_field, '>=', context['date_from'])] domain += [(date_field, '>=', context['date_from'])]
if context.get('journal_ids'): if context.get('journal_ids'):
domain += [('journal_id', 'in', context['journal_ids'])] domain += [('journal_id', 'in', context['journal_ids'])]
state = context.get('state') state = context.get('state')
if state and state.lower() != 'all': if state and state.lower() != 'all':
domain += [('parent_state', '=', state)] domain += [('parent_state', '=', state)]
if context.get('company_id'): if context.get('company_id'):
domain += [('company_id', '=', context['company_id'])] domain += [('company_id', '=', context['company_id'])]
elif context.get('allowed_company_ids'): elif context.get('allowed_company_ids'):
domain += [('company_id', 'in', self.env.companies.ids)] domain += [('company_id', 'in', self.env.companies.ids)]
else: else:
domain += [('company_id', '=', self.env.company.id)] domain += [('company_id', '=', self.env.company.id)]
if context.get('reconcile_date'): if context.get('reconcile_date'):
domain += ['|', ('reconciled', '=', False), '|', domain += ['|', ('reconciled', '=', False), '|',
('matched_debit_ids.max_date', '>', context['reconcile_date']), ('matched_debit_ids.max_date', '>',
('matched_credit_ids.max_date', '>', context['reconcile_date'])] context['reconcile_date']),
('matched_credit_ids.max_date', '>',
context['reconcile_date'])]
if context.get('account_tag_ids'): 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'): if context.get('account_ids'):
domain += [('account_id', 'in', context['account_ids'].ids)] domain += [('account_id', 'in', context['account_ids'].ids)]
if context.get('analytic_tag_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'): 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'): if context.get('partner_ids'):
domain += [('partner_id', 'in', context['partner_ids'].ids)] domain += [('partner_id', 'in', context['partner_ids'].ids)]
if context.get('partner_categories'): 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 = ""
where_clause_params = [] where_clause_params = []
tables = '' tables = ''
if domain: 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')) domain.append(('parent_state', '!=', 'cancel'))
query = self._where_calc(domain) query = self._where_calc(domain)
# Wrap the query with 'company_id IN (...)' to avoid bypassing
# Wrap the query with 'company_id IN (...)' to avoid bypassing company access rights. # company access rights.
self._apply_ir_rules(query) self._apply_ir_rules(query)
tables, where_clause, where_clause_params = query.get_sql() tables, where_clause, where_clause_params = query.get_sql()
return tables, where_clause, where_clause_params 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/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import api, fields, models
from odoo import models, fields, api
from odoo.exceptions import UserError from odoo.exceptions import UserError
from odoo.tools.translate import _ 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') sequence = fields.Integer(string='Sequence No')
copy_name = fields.Char(string='Invoice Copy Name') 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): 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 [('id', '=', self.env.context.get('active_id'))]).id
company_id = fields.Many2one( 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") 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) required=True, default=_get_default_journal)
multiple_invoice_type = fields.Selection( multiple_invoice_type = fields.Selection(
related='journal_id.multiple_invoice_type', readonly=False, related='journal_id.multiple_invoice_type', readonly=False,
@ -67,7 +69,8 @@ class MultipleInvoiceLayout(models.TransientModel):
strip_style=False, strip_style=False,
strip_classes=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') 'text_align')
def _compute_preview(self): def _compute_preview(self):
""" compute a qweb based preview to display on the wizard """ """ compute a qweb based preview to display on the wizard """
@ -123,7 +126,8 @@ class MultipleInvoiceLayout(models.TransientModel):
precision = 8 precision = 8
output_style = 'expanded' output_style = 'expanded'
bootstrap_path = get_resource_path('web', 'static', 'lib', 'bootstrap', bootstrap_path = get_resource_path('web', 'static',
'lib', 'bootstrap',
'scss') 'scss')
try: try:
return libsass.compile( 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""" """Inherited the model for adding new fields and functions"""
_inherit = 'product.template' _inherit = 'product.template'
asset_category_id = fields.Many2one('account.asset.category', string='Asset Type', company_dependent=True, ondelete="restrict") asset_category_id = fields.Many2one(
deferred_revenue_category_id = fields.Many2one('account.asset.category', string='Deferred Revenue Type', company_dependent=True, ondelete="restrict") '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): def _get_asset_accounts(self):
res = super(ProductTemplate, self)._get_asset_accounts() 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 datetime import datetime, date
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from odoo import api, models, fields from odoo import api, fields, models
class FilterRecurringEntries(models.Model): class FilterRecurringEntries(models.Model):
@ -55,19 +55,24 @@ class RecurringPayments(models.Model):
self.next_date = start_date.date() self.next_date = start_date.date()
name = fields.Char(string='Name') name = fields.Char(string='Name')
debit_account = fields.Many2one('account.account', 'Debit Account', debit_account = fields.Many2one('account.account',
'Debit Account',
required=True, required=True,
domain="['|', ('company_id', '=', False), " domain="['|', ('company_id', '=', False), "
"('company_id', '=', company_id)]") "('company_id', '=', company_id)]")
credit_account = fields.Many2one('account.account', 'Credit Account', credit_account = fields.Many2one('account.account',
'Credit Account',
required=True, required=True,
domain="['|', ('company_id', '=', False), " domain="['|', ('company_id', '=', False), "
"('company_id', '=', company_id)]") "('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_id = fields.Many2one('account.analytic.account',
'Analytic Account') 'Analytic Account')
date = fields.Date('Starting Date', required=True, default=date.today()) date = fields.Date('Starting Date', required=True,
next_date = fields.Date('Next Schedule', compute=_get_next_schedule, default=date.today())
next_date = fields.Date('Next Schedule',
compute=_get_next_schedule,
readonly=True, copy=False) readonly=True, copy=False)
recurring_period = fields.Selection(selection=[('days', 'Days'), recurring_period = fields.Selection(selection=[('days', 'Days'),
('weeks', 'Weeks'), ('weeks', 'Weeks'),
@ -90,7 +95,8 @@ class RecurringPayments(models.Model):
store=True, required=True) store=True, required=True)
company_id = fields.Many2one('res.company', company_id = fields.Many2one('res.company',
default=lambda l: l.env.company.id) 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') @api.onchange('partner_id')
def onchange_partner_id(self): def onchange_partner_id(self):
@ -115,7 +121,8 @@ class RecurringPayments(models.Model):
for line in data: for line in data:
if line.date: if line.date:
recurr_dates = [] 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: while start_date <= today:
recurr_dates.append(str(start_date.date())) recurr_dates.append(str(start_date.date()))
if line.recurring_period == 'days': if line.recurring_period == 'days':
@ -175,6 +182,7 @@ class GetAllRecurringEntries(models.TransientModel):
date = fields.Date('Date') date = fields.Date('Date')
template_name = fields.Char('Name') template_name = fields.Char('Name')
amount = fields.Float('Amount') 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/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import models, _
from datetime import date, timedelta from odoo.exceptions import RedirectWarning
from odoo import fields, models,_
from odoo.exceptions import UserError, ValidationError, AccessError, RedirectWarning
class ResCompany(models.Model): class ResCompany(models.Model):
@ -31,44 +28,51 @@ class ResCompany(models.Model):
def _validate_fiscalyear_lock(self, values): def _validate_fiscalyear_lock(self, values):
if values.get('fiscalyear_lock_date'): if values.get('fiscalyear_lock_date'):
draft_entries = self.env['account.move'].search([ draft_entries = self.env['account.move'].search([
('company_id', 'in', self.ids), ('company_id', 'in', self.ids),
('state', '=', 'draft'), ('state', '=', 'draft'),
('date', '<=', values['fiscalyear_lock_date'])]) ('date', '<=', values['fiscalyear_lock_date'])])
if draft_entries: 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 = { action_error = {
'view_mode': 'tree', 'view_mode': 'tree',
'name': 'Unposted Entries', 'name': 'Unposted Entries',
'res_model': 'account.move', 'res_model': 'account.move',
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'domain': [('id', 'in', draft_entries.ids)], 'domain': [('id', 'in', draft_entries.ids)],
'search_view_id': [self.env.ref('account.view_account_move_filter').id, 'search'], 'search_view_id': [self.env.ref(
'views': [[self.env.ref('account.view_move_tree').id, 'list'], [self.env.ref('account.view_move_form').id, 'form']], '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')) raise RedirectWarning(error_msg, action_error,
_('Show unposted entries'))
unreconciled_statement_lines = self.env['account.bank.statement.line'].search([ unreconciled_statement_lines = self.env[
'account.bank.statement.line'].search([
('company_id', 'in', self.ids), ('company_id', 'in', self.ids),
('is_reconciled', '=', False), ('is_reconciled', '=', False),
('date', '<=', values['fiscalyear_lock_date']), ('date', '<=', values['fiscalyear_lock_date']),
('move_id.state', 'in', ('draft', 'posted')), ('move_id.state', 'in', ('draft', 'posted')),
]) ])
if unreconciled_statement_lines: if unreconciled_statement_lines:
error_msg = _("There are still unreconciled bank statement lines in the period you want to lock." error_msg = _(
"You should either reconcile or delete them.") "There are still unreconciled bank statement lines in the "
"period you want to lock."
"You should either reconcile or delete them.")
action_error = { action_error = {
'view_mode': 'tree', 'view_mode': 'tree',
'name': 'Unreconciled Transactions', 'name': 'Unreconciled Transactions',
'res_model': 'account.bank.statement.line', 'res_model': 'account.bank.statement.line',
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'domain': [('id', 'in', unreconciled_statement_lines.ids)], 'domain': [('id', 'in', unreconciled_statement_lines.ids)],
# 'search_view_id': [self.env.ref('account.view_account_move_filter').id, 'search'], 'views': [[self.env.ref(
'views': [[self.env.ref('base_accounting_kit.view_bank_statement_line_tree').id, 'list']] 'base_accounting_kit.view_bank_statement_line_tree').id,
# [self.env.ref('account.view_move_form').id, 'form']], 'list']]
} }
# action_error = self._get_fiscalyear_lock_statement_lines_redirect_action(unreconciled_statement_lines) raise RedirectWarning(error_msg, action_error,
raise RedirectWarning(error_msg, action_error, _('Show Unreconciled Bank Statement Line')) _('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/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import api, fields, models
from odoo import models, fields, api
class ResConfigSettings(models.TransientModel): class ResConfigSettings(models.TransientModel):
@ -28,8 +27,9 @@ class ResConfigSettings(models.TransientModel):
customer_credit_limit = fields.Boolean(string="Customer Credit Limit") customer_credit_limit = fields.Boolean(string="Customer Credit Limit")
use_anglo_saxon_accounting = fields.Boolean(string="Use Anglo-Saxon accounting", readonly=False, use_anglo_saxon_accounting = fields.Boolean(
related='company_id.anglo_saxon_accounting') string="Use Anglo-Saxon accounting", readonly=False,
related='company_id.anglo_saxon_accounting')
@api.model @api.model
def get_values(self): def get_values(self):

13
base_accounting_kit/models/res_partner.py

@ -19,16 +19,15 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from datetime import date, timedelta from datetime import date, timedelta
from odoo import fields, models from odoo import fields, models
class ResPartner(models.Model): class ResPartner(models.Model):
_inherit = "res.partner" _inherit = "res.partner"
invoice_list = fields.One2many('account.move', 'partner_id', invoice_list = fields.One2many('account.move',
'partner_id',
string="Invoice Details", string="Invoice Details",
readonly=True, readonly=True,
domain=( domain=(
@ -49,7 +48,8 @@ class ResPartner(models.Model):
def _compute_for_followup(self): 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: for record in self:
total_due = 0 total_due = 0
@ -60,7 +60,8 @@ class ResPartner(models.Model):
amount = am.amount_residual amount = am.amount_residual
total_due += amount 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: if is_overdue:
total_overdue += amount or 0 total_overdue += amount or 0
min_date = record.get_min_date() min_date = record.get_min_date()
@ -99,14 +100,12 @@ class ResPartner(models.Model):
order by delay limit 1""" order by delay limit 1"""
self._cr.execute(delay, [self.env.company.id]) self._cr.execute(delay, [self.env.company.id])
record = self._cr.dictfetchall() record = self._cr.dictfetchall()
return record return record
def action_after(self): def action_after(self):
lines = self.env['followup.line'].search([( lines = self.env['followup.line'].search([(
'followup_id.company_id', '=', self.env.company.id)]) 'followup_id.company_id', '=', self.env.company.id)])
if lines: if lines:
record = self.get_delay() record = self.get_delay()
for i in record: 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/>. # 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): class AssetAssetReport(models.Model):
@ -30,19 +30,29 @@ class AssetAssetReport(models.Model):
name = fields.Char(string='Year', required=False, readonly=True) name = fields.Char(string='Year', required=False, readonly=True)
date = fields.Date(readonly=True) date = fields.Date(readonly=True)
depreciation_date = fields.Date(string='Depreciation Date', readonly=True) depreciation_date = fields.Date(string='Depreciation Date', readonly=True)
asset_id = fields.Many2one('account.asset.asset', string='Asset', readonly=True) asset_id = fields.Many2one('account.asset.asset',
asset_category_id = fields.Many2one('account.asset.category', string='Asset category', readonly=True) string='Asset', readonly=True)
partner_id = fields.Many2one('res.partner', string='Partner', readonly=True) asset_category_id = fields.Many2one('account.asset.category',
state = fields.Selection([('draft', 'Draft'), ('open', 'Running'), ('close', 'Close')], string='Status', readonly=True) string='Asset category', readonly=True)
depreciation_value = fields.Float(string='Amount of Depreciation Lines', readonly=True) partner_id = fields.Many2one('res.partner', string='Partner',
installment_value = fields.Float(string='Amount of Installment Lines', readonly=True) 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) move_check = fields.Boolean(string='Posted', readonly=True)
installment_nbr = fields.Integer(string='# of Installment Lines', readonly=True) installment_nbr = fields.Integer(string='# of Installment Lines',
depreciation_nbr = fields.Integer(string='# of Depreciation Lines', readonly=True) readonly=True)
depreciation_nbr = fields.Integer(string='# of Depreciation Lines',
readonly=True)
gross_value = fields.Float(string='Gross Amount', readonly=True) gross_value = fields.Float(string='Gross Amount', readonly=True)
posted_value = fields.Float(string='Posted Amount', readonly=True) posted_value = fields.Float(string='Posted Amount', readonly=True)
unposted_value = fields.Float(string='Unposted 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): def init(self):
tools.drop_view_if_exists(self._cr, 'asset_asset_report') tools.drop_view_if_exists(self._cr, 'asset_asset_report')
@ -77,10 +87,14 @@ class AssetAssetReport(models.Model):
a.company_id as company_id a.company_id as company_id
from account_asset_depreciation_line dl from account_asset_depreciation_line dl
left join account_asset_asset a on (dl.asset_id=a.id) 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 where a.active is true
group by group by
dl.amount,dl.asset_id,dl.depreciation_date,dl.name, 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 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"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record model="ir.ui.view" id="action_account_asset_report_pivot"> <record model="ir.ui.view" id="action_account_asset_report_pivot">
<field name="name">asset.asset.report.pivot</field> <field name="name">asset.asset.report.pivot</field>
<field name="model">asset.asset.report</field> <field name="model">asset.asset.report</field>
@ -23,7 +22,6 @@
</graph> </graph>
</field> </field>
</record> </record>
<record id="view_asset_asset_report_search" model="ir.ui.view"> <record id="view_asset_asset_report_search" model="ir.ui.view">
<field name="name">asset.asset.report.search</field> <field name="name">asset.asset.report.search</field>
<field name="model">asset.asset.report</field> <field name="model">asset.asset.report</field>
@ -31,46 +29,62 @@
<search string="Assets Analysis"> <search string="Assets Analysis">
<field name="date"/> <field name="date"/>
<field name="depreciation_date"/> <field name="depreciation_date"/>
<filter string="Draft" name="draft" domain="[('state','=','draft')]" help="Assets in draft state"/> <filter string="Draft" name="draft"
<filter string="Running" name="running" domain="[('state','=','open')]" help="Assets in running state"/> domain="[('state','=','draft')]"
<filter string="Not archived" name="only_active" domain="[('asset_id.active','=', True)]"/> 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/> <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_id"/>
<field name="asset_category_id"/> <field name="asset_category_id"/>
<group expand="0" string="Extended Filters..."> <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"/> <field name="company_id" groups="base.group_multi_company"/>
</group> </group>
<group expand="1" string="Group By"> <group expand="1" string="Group By">
<filter string="Asset" name="asset" context="{'group_by':'asset_id'}"/> <filter string="Asset" name="asset"
<filter string="Asset Category" name="asset_category" context="{'group_by':'asset_category_id'}"/> context="{'group_by':'asset_id'}"/>
<filter string="Company" name="company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/> <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/> <separator/>
<filter string="Purchase Month" name="purchase_month" help="Date of asset purchase" <filter string="Purchase Month" name="purchase_month"
context="{'group_by':'date:month'}"/> help="Date of asset purchase"
<filter string="Depreciation Month" name="deprecation_month" help="Date of depreciation" context="{'group_by':'date:month'}"/>
context="{'group_by':'depreciation_date:month'}"/> <filter string="Depreciation Month" name="deprecation_month"
help="Date of depreciation"
context="{'group_by':'depreciation_date:month'}"/>
</group> </group>
</search> </search>
</field> </field>
</record> </record>
<record model="ir.actions.act_window" id="action_asset_asset_report"> <record model="ir.actions.act_window" id="action_asset_asset_report">
<field name="name">Assets Analysis</field> <field name="name">Assets Analysis</field>
<field name="res_model">asset.asset.report</field> <field name="res_model">asset.asset.report</field>
<field name="view_mode">graph,pivot</field> <field name="view_mode">graph,pivot</field>
<field name="search_view_id" ref="view_asset_asset_report_search"/> <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="context">{'search_default_only_active': 1}</field>
<field name="help" type="html"> <field name="help" type="html">
<p> <p>
From this report, you can have an overview on all depreciations. The From this report, you can have an overview on all depreciations.
search bar can also be used to personalize your assets depreciation reporting. The
</p> search bar can also be used to personalize your assets
depreciation reporting.
</p>
</field> </field>
</record> </record>
<menuitem name="Assets" action="action_asset_asset_report" <menuitem name="Assets" action="action_asset_asset_report"
id="menu_action_asset_asset_report" id="menu_action_asset_asset_report"
parent="account.account_reports_management_menu" sequence="21"/> 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 cr = self.env.cr
move_line = self.env['account.move.line'] move_line = self.env['account.move.line']
move_lines = {x: [] for x in accounts.ids} move_lines = {x: [] for x in accounts.ids}
# Prepare initial sql query and Get the initial move lines # Prepare initial sql query and Get the initial move lines
if init_balance: if init_balance:
init_tables, init_where_clause, init_where_params = move_line.with_context( init_tables, init_where_clause, init_where_params = (
date_from=self.env.context.get('date_from'), date_to=False, move_line.with_context(
initial_bal=True)._query_get() date_from=self.env.context.get('date_from'), date_to=False,
initial_bal=True)._query_get())
init_wheres = [""] init_wheres = [""]
if init_where_clause.strip(): if init_where_clause.strip():
init_wheres.append(init_where_clause.strip()) init_wheres.append(init_where_clause.strip())
init_filters = " AND ".join(init_wheres) init_filters = " AND ".join(init_wheres)
filters = init_filters.replace('account_move_line__move_id', filters = init_filters.replace('account_move_line__move_id',
'm').replace('account_move_line', 'm').replace(
'l') 'account_move_line', 'l')
sql = ("""SELECT 0 AS lid, l.account_id AS account_id, \ sql = ("""SELECT 0 AS lid, l.account_id AS account_id, \
'' AS ldate, '' AS lcode, 0.0 AS amount_currency, \ '' AS ldate, '' AS lcode, 0.0 AS amount_currency, \
'' AS lref, 'Initial Balance' AS lname, \ '' AS lref, 'Initial Balance' AS lname, \
@ -78,7 +78,8 @@ class ReportBankBook(models.AbstractModel):
if where_clause.strip(): if where_clause.strip():
wheres.append(where_clause.strip()) wheres.append(where_clause.strip())
filters = " AND ".join(wheres) 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') 'account_move_line', 'l')
# Get move lines base on sql query and Calculate the total # 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( if display_account == 'not_zero' and not currency.is_zero(
res['balance']): res['balance']):
account_res.append(res) account_res.append(res)
return account_res return account_res
@api.model @api.model
@ -139,7 +139,6 @@ class ReportBankBook(models.AbstractModel):
if not data.get('form') or not self.env.context.get('active_model'): if not data.get('form') or not self.env.context.get('active_model'):
raise UserError( raise UserError(
_("Form content is missing, this report cannot be printed.")) _("Form content is missing, this report cannot be printed."))
model = self.env.context.get('active_model') model = self.env.context.get('active_model')
docs = self.env[model].browse(self.env.context.get('active_ids', [])) docs = self.env[model].browse(self.env.context.get('active_ids', []))
init_balance = data['form'].get('initial_balance', True) init_balance = data['form'].get('initial_balance', True)
@ -154,13 +153,17 @@ class ReportBankBook(models.AbstractModel):
accounts = self.env['account.account'].search( accounts = self.env['account.account'].search(
[('id', 'in', account_ids)]) [('id', 'in', account_ids)])
if not accounts: if not accounts:
journals = self.env['account.journal'].search([('type', '=', 'bank')]) journals = self.env['account.journal'].search(
[('type', '=', 'bank')])
accounts = [] accounts = []
for journal in journals: for journal in journals:
accounts.append(journal.company_id.account_journal_payment_credit_account_id.id) accounts.append(
accounts = self.env['account.account'].search([('id', 'in', accounts)]) journal.company_id.
account_journal_payment_credit_account_id.id)
accounts_res = self.with_context(data['form'].get('used_context', {}))._get_account_move_entry( accounts = self.env['account.account'].search(
[('id', 'in', accounts)])
accounts_res = self.with_context(
data['form'].get('used_context', {}))._get_account_move_entry(
accounts, accounts,
init_balance, init_balance,
sortby, 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_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/> <t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/> <t t-set="data_report_dpi" t-value="110"/>
<t t-call="web.internal_layout"> <t t-call="web.internal_layout">
<div class="page"> <div class="page">
<h2><span t-esc="env.company.name"/>: Bank Book Report <h2><span t-esc="env.company.name"/>: Bank Book Report
</h2> </h2>
<div class="row"> <div class="row">
<div class="col-xs-4" style="width:40%;"> <div class="col-xs-4" style="width:40%;">
<strong>Journals:</strong> <strong>Journals:</strong>
@ -19,15 +17,24 @@
<div class="col-xs-4" style="width:30%;"> <div class="col-xs-4" style="width:30%;">
<strong>Display Account</strong> <strong>Display Account</strong>
<p> <p>
<span t-if="data['display_account'] == 'all'">All accounts'</span> <span t-if="data['display_account'] == 'all'">
<span t-if="data['display_account'] == 'movement'">With movements</span> All accounts'
<span t-if="data['display_account'] == 'not_zero'">With balance not equal to zero</span> </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> </p>
</div> </div>
<div class="col-xs-4" style="width:30%;"> <div class="col-xs-4" style="width:30%;">
<strong>Target Moves:</strong> <strong>Target Moves:</strong>
<p t-if="data['target_move'] == 'all'">All Entries</p> <p t-if="data['target_move'] == 'all'">All Entries
<p t-if="data['target_move'] == 'posted'">All Posted Entries</p> </p>
<p t-if="data['target_move'] == 'posted'">All Posted
Entries
</p>
</div> </div>
</div> </div>
<br/> <br/>
@ -35,7 +42,9 @@
<div style="width:70%;"> <div style="width:70%;">
<strong>Sorted By:</strong> <strong>Sorted By:</strong>
<p t-if="data['sortby'] == 'sort_date'">Date</p> <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>
<div style="width:30%;"> <div style="width:30%;">
<t t-if="data['date_from']"> <t t-if="data['date_from']">
@ -52,7 +61,7 @@
<br/> <br/>
<table class="table table-condensed"> <table class="table table-condensed">
<thead> <thead>
<tr class="text-center"> <tr class="text-centre">
<th>Date</th> <th>Date</th>
<th>JRNL</th> <th>JRNL</th>
<th>Partner</th> <th>Partner</th>
@ -62,14 +71,17 @@
<th>Debit</th> <th>Debit</th>
<th>Credit</th> <th>Credit</th>
<th>Balance</th> <th>Balance</th>
<th groups="base.group_multi_currency">Currency</th> <th groups="base.group_multi_currency">
Currency
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<t t-foreach="Accounts" t-as="account"> <t t-foreach="Accounts" t-as="account">
<tr style="font-weight: bold;"> <tr style="font-weight: bold;">
<td colspan="6"> <td colspan="6">
<span style="color: white;" t-esc="'..'"/> <span style="color: white;"
t-esc="'..'"/>
<span t-esc="account['code']"/> <span t-esc="account['code']"/>
<span t-esc="account['name']"/> <span t-esc="account['name']"/>
</td> </td>
@ -87,7 +99,8 @@
</td> </td>
<td groups="base.group_multi_currency"/> <td groups="base.group_multi_currency"/>
</tr> </tr>
<tr t-foreach="account['move_lines']" t-as="line"> <tr t-foreach="account['move_lines']"
t-as="line">
<td> <td>
<span t-esc="line['ldate']"/> <span t-esc="line['ldate']"/>
</td> </td>
@ -98,7 +111,8 @@
<span t-esc="line['partner_name']"/> <span t-esc="line['partner_name']"/>
</td> </td>
<td> <td>
<span t-if="line['lref']" t-esc="line['lref']"/> <span t-if="line['lref']"
t-esc="line['lref']"/>
</td> </td>
<td> <td>
<span t-esc="line['move_name']"/> <span t-esc="line['move_name']"/>
@ -116,12 +130,17 @@
</td> </td>
<td class="text-right"> <td class="text-right">
<span t-esc="line['balance']" <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>
<td t-if="line['amount_currency']" class="text-right" groups="base.group_multi_currency"> <td t-if="line['amount_currency']"
<span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/> class="text-right"
<span t-esc="line['currency_code'] if line['amount_currency'] > 0.00 else ''"/> 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> </td>
</tr> </tr>
</t> </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, def _get_account_move_entry(self, accounts, init_balance, sortby,
display_account): display_account):
cr = self.env.cr cr = self.env.cr
move_line = self.env['account.move.line'] move_line = self.env['account.move.line']
move_lines = {x: [] for x in accounts.ids} move_lines = {x: [] for x in accounts.ids}
# Prepare initial sql query and Get the initial move lines # Prepare initial sql query and Get the initial move lines
if init_balance: 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, date_from=self.env.context.get('date_from'), date_to=False,
initial_bal=True)._query_get() initial_bal=True)._query_get())
init_wheres = [""] init_wheres = [""]
if init_where_clause.strip(): if init_where_clause.strip():
init_wheres.append(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', filters = init_filters.replace('account_move_line__move_id',
'm').replace('account_move_line', 'm').replace('account_move_line',
'l') '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,\ '' AS move_name, '' AS mmove_id, '' AS currency_code,\
NULL AS currency_id,\ NULL AS currency_id,\
'' AS invoice_id, '' AS invoice_type, '' AS invoice_number,\ '' 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_currency c ON (l.currency_id=c.id)\
LEFT JOIN res_partner p ON (l.partner_id=p.id)\ LEFT JOIN res_partner p ON (l.partner_id=p.id)\
JOIN account_journal j ON (l.journal_id=j.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) params = (tuple(accounts.ids),) + tuple(init_where_params)
cr.execute(sql, params) cr.execute(sql, params)
for row in cr.dictfetchall(): for row in cr.dictfetchall():
@ -73,39 +77,48 @@ class ReportCashBook(models.AbstractModel):
if where_clause.strip(): if where_clause.strip():
wheres.append(where_clause.strip()) wheres.append(where_clause.strip())
filters = " AND ".join(wheres) 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') 'account_move_line', 'l')
if not accounts: if not accounts:
journals = self.env['account.journal'].search([('type', '=', 'cash')]) journals = self.env['account.journal'].search(
[('type', '=', 'cash')])
accounts = [] accounts = []
for journal in journals: for journal in journals:
accounts.append(journal.company_id.account_journal_payment_credit_account_id.id) accounts.append(
accounts = self.env['account.account'].search([('id','in',accounts)]) 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 # Get move lines base on sql query and Calculate the total balance of
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,\ # move lines
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\ FROM account_move_line l\
JOIN account_move m ON (l.move_id=m.id)\ JOIN account_move m ON (l.move_id=m.id)\
LEFT JOIN res_currency c ON (l.currency_id=c.id)\ LEFT JOIN res_currency c ON (l.currency_id=c.id)\
LEFT JOIN res_partner p ON (l.partner_id=p.id)\ LEFT JOIN res_partner p ON (l.partner_id=p.id)\
JOIN account_journal j ON (l.journal_id=j.id)\ JOIN account_journal j ON (l.journal_id=j.id)\
JOIN account_account acc ON (l.account_id = acc.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) params = (tuple(accounts.ids),) + tuple(where_params)
cr.execute(sql, params) cr.execute(sql, params)
for row in cr.dictfetchall(): for row in cr.dictfetchall():
balance = 0 balance = 0
for line in move_lines.get(row['account_id']): for line in move_lines.get(row['account_id']):
balance += line['debit'] - line['credit'] balance += line['debit'] - line['credit']
row['balance'] += balance row['balance'] += balance
move_lines[row.pop('account_id')].append(row) move_lines[row.pop('account_id')].append(row)
# Calculate the debit, credit and balance for Accounts # Calculate the debit, credit and balance for Accounts
account_res = [] account_res = []
for account in accounts: 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 = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance'])
res['code'] = account.code res['code'] = account.code
res['name'] = account.name res['name'] = account.name
@ -121,7 +134,6 @@ class ReportCashBook(models.AbstractModel):
if display_account == 'not_zero' and not currency.is_zero( if display_account == 'not_zero' and not currency.is_zero(
res['balance']): res['balance']):
account_res.append(res) account_res.append(res)
return account_res return account_res
@api.model @api.model
@ -129,7 +141,6 @@ class ReportCashBook(models.AbstractModel):
if not data.get('form') or not self.env.context.get('active_model'): if not data.get('form') or not self.env.context.get('active_model'):
raise UserError( raise UserError(
_("Form content is missing, this report cannot be printed.")) _("Form content is missing, this report cannot be printed."))
model = self.env.context.get('active_model') model = self.env.context.get('active_model')
docs = self.env[model].browse( docs = self.env[model].browse(
self.env.context.get('active_ids', [])) self.env.context.get('active_ids', []))
@ -145,11 +156,15 @@ class ReportCashBook(models.AbstractModel):
accounts = self.env['account.account'].search( accounts = self.env['account.account'].search(
[('id', 'in', account_ids)]) [('id', 'in', account_ids)])
if not accounts: if not accounts:
journals = self.env['account.journal'].search([('type', '=', 'cash')]) journals = self.env['account.journal'].search(
[('type', '=', 'cash')])
accounts = [] accounts = []
for journal in journals: for journal in journals:
accounts.append(journal.company_id.account_journal_payment_credit_account_id.id) accounts.append(
accounts = self.env['account.account'].search([('id', 'in', accounts)]) journal.
company_id.account_journal_payment_credit_account_id.id)
accounts = self.env['account.account'].search(
[('id', 'in', accounts)])
accounts_res = self.with_context( accounts_res = self.with_context(
data['form'].get('used_context', {}))._get_account_move_entry( data['form'].get('used_context', {}))._get_account_move_entry(
accounts, accounts,

261
base_accounting_kit/report/account_cash_book_view.xml

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

22
base_accounting_kit/report/account_day_book.py

@ -42,19 +42,25 @@ class DayBookPdfReport(models.AbstractModel):
else: else:
target_move = '' target_move = ''
sql = (''' 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, SELECT l.id AS lid, acc.name as accname, l.account_id AS
l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, account_id, l.date AS ldate, j.code AS lcode, l.currency_id,
COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance, l.amount_currency, l.ref AS lref, l.name AS lname,
m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name 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 FROM account_move_line l
JOIN account_move m ON (l.move_id=m.id) JOIN account_move m ON (l.move_id=m.id)
LEFT JOIN res_currency c ON (l.currency_id=c.id) LEFT JOIN res_currency c ON (l.currency_id=c.id)
LEFT JOIN res_partner p ON (l.partner_id=p.id) LEFT JOIN res_partner p ON (l.partner_id=p.id)
JOIN account_journal j ON (l.journal_id=j.id) JOIN account_journal j ON (l.journal_id=j.id)
JOIN account_account acc ON (l.account_id = acc.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, 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 ORDER BY l.date DESC
''') ''')
params = ( params = (
@ -78,7 +84,6 @@ class DayBookPdfReport(models.AbstractModel):
if not data.get('form') or not self.env.context.get('active_model'): if not data.get('form') or not self.env.context.get('active_model'):
raise UserError( raise UserError(
_("Form content is missing, this report cannot be printed.")) _("Form content is missing, this report cannot be printed."))
model = self.env.context.get('active_model') model = self.env.context.get('active_model')
docs = self.env[model].browse( docs = self.env[model].browse(
self.env.context.get('active_ids', [])) self.env.context.get('active_ids', []))
@ -95,7 +100,8 @@ class DayBookPdfReport(models.AbstractModel):
date_start = datetime.strptime(form_data['date_from'], date_start = datetime.strptime(form_data['date_from'],
'%Y-%m-%d').date() '%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 days = date_end - date_start
dates = [] dates = []
record = [] 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="row mt32" style="margin-bottom:3%;">
<div class="col-7"> <div class="col-7">
<strong>Journals:</strong> <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>
<div class="col-2"> <div class="col-2">
<strong>Target Moves:</strong> <strong>Target Moves:</strong>
<p t-if="data['target_move'] == 'all'">All Entries</p> <p t-if="data['target_move'] == 'all'">
<p t-if="data['target_move'] == 'posted'">All Posted Entries</p> All Entries</p>
<p t-if="data['target_move'] == 'posted'">
All Posted Entries</p>
</div> </div>
<div class="col-3"> <div class="col-3">
<t t-if="data['date_from']"> <t t-if="data['date_from']">
@ -31,10 +34,9 @@
</t> </t>
</div> </div>
</div> </div>
<table class="table table-condensed"> <table class="table table-condensed">
<thead> <thead>
<tr class="text-center"> <tr class="text-left">
<th>Date</th> <th>Date</th>
<th>JRNL</th> <th>JRNL</th>
<th>Partner</th> <th>Partner</th>
@ -49,26 +51,34 @@
</thead> </thead>
<tbody> <tbody>
<t t-foreach="Accounts" t-as="account"> <t t-foreach="Accounts" t-as="account">
<tr style="font-weight: bold;background: #ededed;"> <tr style="font-weight: bold;background:
#ededed;">
<td colspan="6"> <td colspan="6">
<span style="color: white;" t-esc="'..'"/> <span style="color: white;" t-esc="'..'"/>
<span t-esc="account['date']"/> <span t-esc="account['date']"/>
</td> </td>
<td class="text-right"> <td class="text-right">
<span t-esc="account['debit']" <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>
<td class="text-right"> <td class="text-right">
<span t-esc="account['credit']" <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>
<td class="text-right"> <td class="text-right">
<span t-esc="account['balance']" <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>
<td groups="base.group_multi_currency"/> <td groups="base.group_multi_currency"/>
</tr> </tr>
<tr t-foreach="account['child_lines']" t-as="line"> <tr t-foreach="account['child_lines']"
t-as="line">
<td> <td>
<span t-esc="line['ldate']"/> <span t-esc="line['ldate']"/>
</td> </td>
@ -79,7 +89,8 @@
<span t-esc="line['partner_name']"/> <span t-esc="line['partner_name']"/>
</td> </td>
<td> <td>
<span t-if="line['lref']" t-esc="line['lref']"/> <span t-if="line['lref']"
t-esc="line['lref']"/>
</td> </td>
<td> <td>
<span t-esc="line['move_name']"/> <span t-esc="line['move_name']"/>
@ -89,19 +100,31 @@
</td> </td>
<td class="text-right"> <td class="text-right">
<span t-esc="line['debit']" <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>
<td class="text-right"> <td class="text-right">
<span t-esc="line['credit']" <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>
<td class="text-right"> <td class="text-right">
<span t-esc="line['balance']" <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>
<td t-if="line['amount_currency']" class="text-right" groups="base.group_multi_currency"> <td t-if="line['amount_currency']"
<span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/> class="text-right"
<span t-esc="line['currency_code'] if line['amount_currency'] > 0.00 else ''"/> 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> </td>
</tr> </tr>
</t> </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') string='Display Accounts', required=True, default='movement')
target_move = fields.Selection([('posted', 'All Posted Entries'), target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All 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_from = fields.Date(string='Start Date')
date_to = fields.Date(string='End 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) default=lambda self: self.env.company)
def _build_contexts(self, data): def _build_contexts(self, data):
result = {} result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' '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_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False result['date_to'] = data['form']['date_to'] or False
result['strict_range'] = True if result['date_from'] else False result['strict_range'] = True if result['date_from'] else False
@ -69,9 +74,12 @@ class AccountCommonAccountReport(models.TransientModel):
data = {} data = {}
data['ids'] = self.env.context.get('active_ids', []) data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu') 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) 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) return self.with_context(discard_logo_check=True)._print_report(data)
def pre_print_report(self, 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): def _compute_account_balance(self, accounts):
mapping = { 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", 'debit': "COALESCE(SUM(debit), 0) as debit",
'credit': "COALESCE(SUM(credit), 0) as credit", 'credit': "COALESCE(SUM(credit), 0) as credit",
} }
res = {} res = {}
for account in accounts: for account in accounts:
res[account.id] = dict.fromkeys(mapping, 0.0) res[account.id] = dict.fromkeys(mapping, 0.0)
@ -83,10 +83,12 @@ class ReportFinancial(models.AbstractModel):
'base_accounting_kit.cash_in_investing0') 'base_accounting_kit.cash_in_investing0')
cash_out_investing = self.env.ref( cash_out_investing = self.env.ref(
'base_accounting_kit.cash_out_investing1') '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]['debit'] += value['debit']
res[report.id]['balance'] += 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]['credit'] += value['credit']
res[report.id]['balance'] += -(value['credit']) res[report.id]['balance'] += -(value['credit'])
elif report.type == 'account_type': elif report.type == 'account_type':
@ -105,7 +107,6 @@ class ReportFinancial(models.AbstractModel):
for value in res[report.id]['account'].values(): for value in res[report.id]['account'].values():
for field in fields: for field in fields:
res[report.id][field] += value.get(field) res[report.id][field] += value.get(field)
elif report.type == 'sum': elif report.type == 'sum':
# it's the sum of the linked accounts # it's the sum of the linked accounts
res[report.id]['account'] = self._compute_account_balance( 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( for account_id, val in comparison_res[report_id].get(
'account').items(): 'account').items():
report_acc[account_id]['comp_bal'] = val['balance'] report_acc[account_id]['comp_bal'] = val['balance']
for report in child_reports: for report in child_reports:
vals = { vals = {
'name': report.name, 'name': report.name,
@ -147,39 +147,40 @@ class ReportFinancial(models.AbstractModel):
if data['debit_credit']: if data['debit_credit']:
vals['debit'] = res[report.id]['debit'] vals['debit'] = res[report.id]['debit']
vals['credit'] = res[report.id]['credit'] vals['credit'] = res[report.id]['credit']
if data['enable_filter']: if data['enable_filter']:
vals['balance_cmp'] = res[report.id]['comp_bal'] * int( vals['balance_cmp'] = res[report.id]['comp_bal'] * int(
report.sign) report.sign)
lines.append(vals) lines.append(vals)
if report.display_detail == 'no_detail': 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 continue
if res[report.id].get('account'): if res[report.id].get('account'):
# if res[report.id].get('debit'): # if res[report.id].get('debit'):
sub_lines = [] sub_lines = []
for account_id, value in res[report.id]['account'].items(): 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 # if there are accounts to display, we add them to the
# the COA + 1 (to avoid having them with a too low level that would conflicts with the level of data # 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...) # financial reports for Assets, liabilities...)
flag = False flag = False
account = self.env['account.account'].browse(account_id) account = self.env['account.account'].browse(account_id)
vals = { vals = {
'name': account.code + ' ' + account.name, 'name': account.code + ' ' + account.name,
'balance': value['balance'] * int(report.sign) or 0.0, 'balance': value['balance'] * int(report.sign) or 0.0,
'type': 'account', '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, 'account_type': account.internal_type,
} }
if data['debit_credit']: if data['debit_credit']:
vals['debit'] = value['debit'] vals['debit'] = value['debit']
vals['credit'] = value['credit'] vals['credit'] = value['credit']
if not account.company_id.currency_id.is_zero( if (not account.company_id.currency_id.is_zero(
vals[ vals[
'debit']) or not account.company_id.currency_id.is_zero( 'debit']) or not account.company_id.
vals['credit']): currency_id.is_zero(vals['credit'])):
flag = True flag = True
if not account.company_id.currency_id.is_zero( if not account.company_id.currency_id.is_zero(
vals['balance']): vals['balance']):

79
base_accounting_kit/report/cash_flow_report.xml

@ -6,13 +6,16 @@
<t t-call="web.internal_layout"> <t t-call="web.internal_layout">
<div class="page"> <div class="page">
<h2 t-esc="data['account_report_id'][1]"/> <h2 t-esc="data['account_report_id'][1]"/>
<div class="row mt32 mb32"> <div class="row mt32 mb32">
<div class="col-4"> <div class="col-4">
<strong>Target Moves:</strong> <strong>Target Moves:</strong>
<p> <p>
<span t-if="data['target_move'] == 'all'">All Entries</span> <span t-if="data['target_move'] == 'all'">
<span t-if="data['target_move'] == 'posted'">All Posted Entries</span> All Entries
</span>
<span t-if="data['target_move'] == 'posted'">
All Posted Entries
</span>
</p> </p>
</div> </div>
<div class="col-4"> <div class="col-4">
@ -27,20 +30,23 @@
</div> </div>
<table class="table table-sm table-reports"> <table class="table table-sm table-reports">
<thead> <thead>
<tr> <tr class="text-left">
<th> <th>
<strong>Name</strong> <strong>Name</strong>
</th> </th>
<th class="text-right" t-if="data['debit_credit']"> <th
t-if="data['debit_credit']">
<strong>Debit</strong> <strong>Debit</strong>
</th> </th>
<th class="text-right" t-if="data['debit_credit']"> <th
t-if="data['debit_credit']">
<strong>Credit</strong> <strong>Credit</strong>
</th> </th>
<th class="text-right"> <th>
<strong>Balance</strong> <strong>Balance</strong>
</th> </th>
<th class="text-right" t-if="data['enable_filter']"> <th
t-if="data['enable_filter']">
<strong t-esc="data['label_filter']"/> <strong t-esc="data['label_filter']"/>
</th> </th>
</tr> </tr>
@ -49,32 +55,59 @@
<tr t-foreach="get_account_lines" t-as="a"> <tr t-foreach="get_account_lines" t-as="a">
<t t-if="a['level'] != 0"> <t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3"> <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 t-if="not a.get('level') &gt; 3"> <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> </t>
<td> <td>
<span style="color: white;" t-esc="'..' * a.get('level', 0)"/> <span style="color: white;"
<span t-att-style="style" t-esc="a.get('name')"/> t-esc="'..' * a.get('level',
0)"/>
<span t-att-style="style"
t-esc="a.get('name')"/>
</td> </td>
<td t-if="data['debit_credit']" class="text-right" style="white-space: text-nowrap;"> <td t-if="data['debit_credit']"
<span t-att-style="style" t-esc="a.get('debit')" t-if="data['debit_credit']" class="text-right"
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> 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>
<td t-if="data['debit_credit']" class="text-right" style="white-space: text-nowrap;"> <td t-if="data['debit_credit']"
<span t-att-style="style" t-esc="a.get('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-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>
<td class="text-right" style="white-space: text-nowrap;"> <td class="text-right"
<span t-att-style="style" t-esc="a.get('balance')" style="white-space: text-nowrap;">
t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> <span t-att-style="style"
t-esc="a.get('balance')"
t-options="{'widget':
'monetary',
'display_currency':
env.company.currency_id}"/>
</td> </td>
<td class="text-right"> <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-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> </td>
</t> </t>
</tr> </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 # Prepare initial sql query and Get the initial move lines
if init_balance: 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, date_from=self.env.context.get('date_from'), date_to=False,
initial_bal=True)._query_get() initial_bal=True)._query_get())
init_wheres = [""] init_wheres = [""]
if init_where_clause.strip(): if init_where_clause.strip():
init_wheres.append(init_where_clause.strip()) init_wheres.append(init_where_clause.strip())
init_filters = " AND ".join(init_wheres) init_filters = " AND ".join(init_wheres)
filters = init_filters.replace('account_move_line__move_id', filters = init_filters.replace('account_move_line__move_id',
'm').replace('account_move_line', 'm').replace(
'account_move_line',
'l') '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,\ '' AS move_name, '' AS mmove_id, '' AS currency_code,\
NULL AS currency_id,\ NULL AS currency_id,\
'' AS invoice_id, '' AS invoice_type, '' AS invoice_number,\ '' 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 res_partner p ON (l.partner_id=p.id)\
LEFT JOIN account_move i ON (m.id =i.id)\ LEFT JOIN account_move i ON (m.id =i.id)\
JOIN account_journal j ON (l.journal_id=j.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) params = (tuple(accounts.ids),) + tuple(init_where_params)
cr.execute(sql, params) cr.execute(sql, params)
for row in cr.dictfetchall(): for row in cr.dictfetchall():
@ -92,19 +99,27 @@ class ReportGeneralLedger(models.AbstractModel):
if where_clause.strip(): if where_clause.strip():
wheres.append(where_clause.strip()) wheres.append(where_clause.strip())
filters = " AND ".join(wheres) 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') 'account_move_line', 'l')
# Get move lines base on sql query and Calculate the total balance of move lines # 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,\ sql = ('''SELECT l.id AS lid, l.account_id AS account_id,
m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name\ 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\ FROM account_move_line l\
JOIN account_move m ON (l.move_id=m.id)\ JOIN account_move m ON (l.move_id=m.id)\
LEFT JOIN res_currency c ON (l.currency_id=c.id)\ LEFT JOIN res_currency c ON (l.currency_id=c.id)\
LEFT JOIN res_partner p ON (l.partner_id=p.id)\ LEFT JOIN res_partner p ON (l.partner_id=p.id)\
JOIN account_journal j ON (l.journal_id=j.id)\ JOIN account_journal j ON (l.journal_id=j.id)\
JOIN account_account acc ON (l.account_id = acc.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) params = (tuple(accounts.ids),) + tuple(where_params)
cr.execute(sql, params) cr.execute(sql, params)
@ -118,7 +133,8 @@ class ReportGeneralLedger(models.AbstractModel):
# Calculate the debit, credit and balance for Accounts # Calculate the debit, credit and balance for Accounts
account_res = [] account_res = []
for account in accounts: 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 = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance'])
res['code'] = account.code res['code'] = account.code
res['name'] = account.name res['name'] = account.name
@ -134,7 +150,6 @@ class ReportGeneralLedger(models.AbstractModel):
if display_account == 'not_zero' and not currency.is_zero( if display_account == 'not_zero' and not currency.is_zero(
res['balance']): res['balance']):
account_res.append(res) account_res.append(res)
return account_res return account_res
@api.model @api.model
@ -142,11 +157,9 @@ class ReportGeneralLedger(models.AbstractModel):
if not data.get('form') or not self.env.context.get('active_model'): if not data.get('form') or not self.env.context.get('active_model'):
raise UserError( raise UserError(
_("Form content is missing, this report cannot be printed.")) _("Form content is missing, this report cannot be printed."))
model = self.env.context.get('active_model') model = self.env.context.get('active_model')
docs = self.env[model].browse( docs = self.env[model].browse(
self.env.context.get('active_ids', [])) self.env.context.get('active_ids', []))
init_balance = data['form'].get('initial_balance', True) init_balance = data['form'].get('initial_balance', True)
sortby = data['form'].get('sortby', 'sort_date') sortby = data['form'].get('sortby', 'sort_date')
display_account = data['form']['display_account'] display_account = data['form']['display_account']
@ -155,7 +168,6 @@ class ReportGeneralLedger(models.AbstractModel):
codes = [journal.code for journal in codes = [journal.code for journal in
self.env['account.journal'].search( self.env['account.journal'].search(
[('id', 'in', data['form']['journal_ids'])])] [('id', 'in', data['form']['journal_ids'])])]
accounts = docs if model == 'account.account' else self.env[ accounts = docs if model == 'account.account' else self.env[
'account.account'].search([]) 'account.account'].search([])
accounts_res = self.with_context( 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-set="data_report_dpi" t-value="110"/>
<t t-call="web.internal_layout"> <t t-call="web.internal_layout">
<div class="page"> <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="row mt32">
<div class="col-4"> <div class="col-4">
<strong>Journals:</strong> <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>
<div class="col-4"> <div class="col-4">
<strong>Display Account</strong> <strong>Display Account</strong>
<p> <p>
<span t-if="data['display_account'] == 'all'">All accounts'</span> <span t-if="data['display_account'] == 'all'">
<span t-if="data['display_account'] == 'movement'">With movements</span> All accounts'
<span t-if="data['display_account'] == 'not_zero'">With balance not equal to zero</span> </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> </p>
</div> </div>
<div class="col-4"> <div class="col-4">
<strong>Target Moves:</strong> <strong>Target Moves:</strong>
<p t-if="data['target_move'] == 'all'">All Entries</p> <p t-if="data['target_move'] == 'all'">All Entries
<p t-if="data['target_move'] == 'posted'">All Posted Entries</p> </p>
<p t-if="data['target_move'] == 'posted'">All Posted
Entries
</p>
</div> </div>
</div> </div>
<div class="row mb32"> <div class="row mb32">
<div class="col-4"> <div class="col-4">
<strong>Sorted By:</strong> <strong>Sorted By:</strong>
<p t-if="data['sortby'] == 'sort_date'">Date</p> <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>
<div class="col-4"> <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_from']">
<t t-if="data['date_to']"><strong>Date to :</strong> <span t-esc="data['date_to']"/></t> <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> </div>
<table class="table table-sm table-reports"> <table class="table table-sm table-reports">
<thead> <thead>
<tr class="text-center"> <tr class="text-left">
<th>Date</th> <th>Date</th>
<th>JRNL</th> <th>JRNL</th>
<th>Partner</th> <th>Partner</th>
@ -52,48 +72,88 @@
<th>Debit</th> <th>Debit</th>
<th>Credit</th> <th>Credit</th>
<th>Balance</th> <th>Balance</th>
<th groups="base.group_multi_currency">Currency</th> <th groups="base.group_multi_currency">
Currency
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<t t-foreach="Accounts" t-as="account"> <t t-foreach="Accounts" t-as="account">
<tr style="font-weight: bold;"> <tr style="font-weight: bold;">
<td colspan="6"> <td colspan="6">
<span style="color: white;" t-esc="'..'"/> <span style="color: white;"
t-esc="'..'"/>
<span t-esc="account['code']"/> <span t-esc="account['code']"/>
<span t-esc="account['name']"/> <span t-esc="account['name']"/>
</td> </td>
<td class="text-right"> <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>
<td class="text-right"> <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>
<td class="text-right"> <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>
<td groups="base.group_multi_currency"/> <td groups="base.group_multi_currency"/>
</tr> </tr>
<tr t-foreach="account['move_lines']" t-as="line"> <tr t-foreach="account['move_lines']"
<td><span t-esc="line['ldate']"/></td> t-as="line">
<td><span t-esc="line['lcode']"/></td> <td>
<td><span t-esc="line['partner_name']"/></td> <span t-esc="line['ldate']"/>
<td><span t-if="line['lref']" t-esc="line['lref']"/></td> </td>
<td><span t-esc="line['move_name']"/></td> <td>
<td><span t-esc="line['lname']"/></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"> <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>
<td class="text-right"> <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>
<td class="text-right"> <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> </td>
<t t-if="line['amount_currency']"> <t t-if="line['amount_currency']">
<td class="text-right" groups="base.group_multi_currency"> <td class="text-right"
<span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/> groups="base.group_multi_currency">
<span t-esc="line['currency_code'] if line['amount_currency'] > 0.00 else ''"/> <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> </td>
</t> </t>
</tr> </tr>

786
base_accounting_kit/report/multiple_invoice_layouts.xml

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

12
base_accounting_kit/report/multiple_invoice_report.py

@ -19,8 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import api, models
from odoo import models, api
class ReportInvoiceMultiple(models.AbstractModel): class ReportInvoiceMultiple(models.AbstractModel):
@ -31,28 +30,21 @@ class ReportInvoiceMultiple(models.AbstractModel):
@api.model @api.model
def _get_report_values(self, docids, data=None): def _get_report_values(self, docids, data=None):
rslt = super()._get_report_values(docids, data) rslt = super()._get_report_values(docids, data)
inv = rslt['docs'] inv = rslt['docs']
layout = inv.journal_id.company_id.external_report_layout_id.key layout = inv.journal_id.company_id.external_report_layout_id.key
if layout == 'web.external_layout_boxed': if layout == 'web.external_layout_boxed':
new_layout = 'base_accounting_kit.boxed' new_layout = 'base_accounting_kit.boxed'
elif layout == 'web.external_layout_bold': elif layout == 'web.external_layout_bold':
new_layout = 'base_accounting_kit.bold' new_layout = 'base_accounting_kit.bold'
elif layout == 'web.external_layout_striped': elif layout == 'web.external_layout_striped':
new_layout = 'base_accounting_kit.striped' new_layout = 'base_accounting_kit.striped'
else: else:
new_layout = 'base_accounting_kit.standard' new_layout = 'base_accounting_kit.standard'
rslt['mi_type'] = inv.journal_id.multiple_invoice_type rslt['mi_type'] = inv.journal_id.multiple_invoice_type
rslt['mi_ids'] = inv.journal_id.multiple_invoice_ids rslt['mi_ids'] = inv.journal_id.multiple_invoice_ids
rslt['txt_position'] = inv.journal_id.text_position rslt['txt_position'] = inv.journal_id.text_position
rslt['body_txt_position'] = inv.journal_id.body_text_position rslt['body_txt_position'] = inv.journal_id.body_text_position
rslt['txt_align'] = inv.journal_id.text_align rslt['txt_align'] = inv.journal_id.text_align
rslt['layout'] = new_layout rslt['layout'] = new_layout
rslt['report_type'] = data.get('report_type') if data else '' 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> <odoo>
<template id="report_multiple_invoice_new"> <template id="report_multiple_invoice_new">
<t t-call="base_accounting_kit.new_external_layout"> <t t-call="base_accounting_kit.new_external_layout">
<t t-set="o" t-value="o.with_context(lang=lang)" /> <t t-set="o" t-value="o.with_context(lang=lang)"/>
<t t-set="address">
<t t-set="address"> <address t-field="o.partner_id"
<address t-field="o.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/>
<div t-if="o.partner_id.vat" class="mt16"> <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-if="o.company_id.country_id.vat_label"
<t t-else="">Tax ID</t>: <span t-field="o.partner_id.vat"/></div> t-esc="o.company_id.country_id.vat_label"
id="inv_tax_id_label"/>
<t t-else="">Tax ID</t>:
<span t-field="o.partner_id.vat"/>
</div>
</t>
<div class="page">
<t t-set="txt_style"
t-value="'font-size:25px; text-align:center;top:0px;
left:15px; position:absolute; z-index:99;'"/>
<t t-if="body_txt_position == 'tr'">
<t t-set="txt_style"
t-value="'font-size:25px; text-align:center;top:0px;
right:15px; position:absolute; z-index:99;'"/>
</t> </t>
<div class="page"> <t t-if="body_txt_position == 'br'">
<t t-set="txt_style"
<t t-set="txt_style" t-value="'font-size:25px; text-align:center;top:0px; left:15px; position:absolute; z-index:99;'"/> t-value="'font-size:25px; text-align:right;'"/>
<t t-if="body_txt_position == 'tr'"> </t>
<t t-set="txt_style" t-value="'font-size:25px; text-align:center;top:0px; right:15px; position:absolute; z-index:99;'"/> <t t-if="body_txt_position == 'bl'">
</t> <t t-set="txt_style"
<t t-if="body_txt_position == 'br'"> t-value="'font-size:25px; text-align:left;'"/>
<t t-set="txt_style" t-value="'font-size:25px; text-align:right;'"/> </t>
</t> <h2>
<t t-if="body_txt_position == 'bl'"> <span t-if="o.move_type == 'out_invoice'
<t t-set="txt_style" t-value="'font-size:25px; text-align:left;'"/> and o.state == 'posted'">
</t> Invoice
</span>
<h2> <span t-if="o.move_type == 'out_invoice' and
<span t-if="o.move_type == 'out_invoice' and o.state == 'posted'">Invoice</span> o.state == 'draft'">
<span t-if="o.move_type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span> Draft Invoice
<span t-if="o.move_type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span> </span>
<span t-if="o.move_type == 'out_refund'">Credit Note</span> <span t-if="o.move_type == 'out_invoice'
<span t-if="o.move_type == 'in_refund'">Vendor Credit Note</span> and o.state == 'cancel'">
<span t-if="o.move_type == 'in_invoice'">Vendor Bill</span> Cancelled Invoice
<span t-if="o.name != '/'" t-field="o.name"/> </span>
</h2> <span t-if="o.move_type == 'out_refund'">Credit Note</span>
<span t-if="o.move_type == 'in_refund'">Vendor Credit Note
<div id="informations" class="row mt32 mb32"> </span>
<div class="col-auto col-3 mw-100 mb-2" t-if="o.invoice_date" name="invoice_date"> <span t-if="o.move_type == 'in_invoice'">Vendor Bill</span>
<strong>Invoice Date:</strong> <span t-if="o.name != '/'" t-field="o.name"/>
<p class="m-0" t-field="o.invoice_date"/> </h2>
</div> <div id="informations" class="row mt32 mb32">
<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"> <div class="col-auto col-3 mw-100 mb-2"
<strong>Due Date:</strong> t-if="o.invoice_date" name="invoice_date">
<p class="m-0" t-field="o.invoice_date_due"/> <strong>Invoice Date:</strong>
</div> <p class="m-0" t-field="o.invoice_date"/>
<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> </div>
<div class="col-auto col-3 mw-100 mb-2"
<t t-set="display_discount" t-value="any(l.discount for l in o.invoice_line_ids)"/> t-if="o.invoice_date_due and o.move_type ==
'out_invoice' and o.state == 'posted'"
<table class="table table-sm o_main_table" name="invoice_line_table"> name="due_date">
<thead> <strong>Due Date:</strong>
<tr> <p class="m-0" t-field="o.invoice_date_due"/>
<th name="th_description" class="text-left"><span>Description</span></th> </div>
<th name="th_quantity" class="text-right"><span>Quantity</span></th> <div class="col-auto col-3 mw-100 mb-2"
<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> t-if="o.invoice_origin" name="origin">
<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 '' }}"> <strong>Source:</strong>
<span>Disc.%</span> <p class="m-0" t-field="o.invoice_origin"/>
</th> </div>
<th name="th_taxes" t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"><span>Taxes</span></th> <div class="col-auto col-3 mw-100 mb-2"
<th name="th_subtotal" class="text-right"> t-if="o.partner_id.ref" name="customer_code">
<span groups="account.group_show_line_subtotals_tax_excluded">Amount</span> <strong>Customer Code:</strong>
<span groups="account.group_show_line_subtotals_tax_included">Total Price</span> <p class="m-0" t-field="o.partner_id.ref"/>
</th> </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> </tr>
</thead> <t t-if="current_section and (line_last or
<tbody class="invoice_tbody"> lines[line_index+1].display_type == 'line_section')">
<t t-set="current_subtotal" t-value="0"/> <tr class="is-subtotal text-right">
<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)"/> <td colspan="99">
<t t-esc="lines"/> <strong class="mr16">Subtotal</strong>
<t t-foreach="lines" t-as="line"> <span
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
<tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
<t t-if="not line.display_type" name="account_invoice_line_accountable">
<td name="account_invoice_line_name"><span t-field="line.name" t-options="{'widget': 'text'}"/></td>
<td class="text-right">
<span t-field="line.quantity"/>
<span t-field="line.product_uom_id" groups="uom.group_uom"/>
</td>
<td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span class="text-nowrap" t-field="line.price_unit"/>
</td>
<td t-if="display_discount" t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span class="text-nowrap" t-field="line.discount"/>
</td>
<td t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_ids))" id="line_tax_ids"/>
</td>
<td class="text-right o_price_total">
<span class="text-nowrap" t-field="line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<span class="text-nowrap" t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
</td>
</t>
<t t-if="line.display_type == 'line_section'">
<td colspan="99">
<span t-field="line.name" t-options="{'widget': 'text'}"/>
</td>
<t t-set="current_section" t-value="line"/>
<t t-set="current_subtotal" t-value="0"/>
</t>
<t t-if="line.display_type == 'line_note'">
<td colspan="99">
<span t-field="line.name" t-options="{'widget': 'text'}"/>
</td>
</t>
</tr>
<t t-if="current_section and (line_last or lines[line_index+1].display_type == 'line_section')">
<tr class="is-subtotal text-right">
<td colspan="99">
<strong class="mr16">Subtotal</strong>
<span
t-esc="current_subtotal" t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": o.currency_id}' t-options='{"widget":
/> "monetary", "display_currency":
</td> o.currency_id}'
</tr> />
</t> </td>
</tr>
</t> </t>
</tbody> </t>
</table> </tbody>
</table>
<div class="clearfix"> <div class="clearfix">
<div id="total" class="row"> <div id="total" class="row">
<div t-attf-class="#{'col-6' if report_type != 'html' else 'col-sm-7 col-md-6'} ml-auto"> <div t-attf-class="#{'col-6' if report_type != 'html'
<table class="table table-sm" style="page-break-inside: avoid;"> else 'col-sm-7 col-md-6'} ml-auto">
<tr class="border-black o_subtotal" style=""> <table class="table table-sm"
<td><strong>Subtotal</strong></td> style="page-break-inside: avoid;">
<td class="text-right"> <tr class="border-black o_subtotal" style="">
<span t-field="o.amount_untaxed"/> <td>
</td> <strong>Subtotal</strong>
</tr> </td>
<t t-foreach="o.tax_totals['groups_by_subtotal'][subtotal_to_show]" t-as="amount_by_group"> <td class="text-right">
<tr style=""> <span t-field="o.amount_untaxed"/>
<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>
<td><span class="text-nowrap" t-esc="amount_by_group[0]"/></td> </tr>
<td class="text-right o_price_total"> <t t-foreach="o.tax_totals['groups_by_subtotal']
<span class="text-nowrap" t-esc="amount_by_group[3]" /> [subtotal_to_show]"
</td> t-as="amount_by_group">
</t> <tr style="">
<t t-else=""> <t t-if="len(o.line_ids.filtered(
<td> lambda line: line.tax_line_id)) in
<span t-esc="amount_by_group[0]"/> [0, 1] and o.amount_untaxed ==
<span class="text-nowrap"> on amount_by_group[2]">
<t t-esc="amount_by_group[4]"/> <td>
</span> <span class="text-nowrap"
</td> t-esc="amount_by_group[0]"/>
<td class="text-right o_price_total"> </td>
<span class="text-nowrap" t-esc="amount_by_group[3]"/> <td class="text-right o_price_total">
</td> <span class="text-nowrap"
</t> t-esc="amount_by_group[3]"/>
</tr> </td>
</t> </t>
<tr class="border-black o_total"> <t t-else="">
<td><strong>Total</strong></td> <td>
<td class="text-right"> <span t-esc="amount_by_group[0]"/>
<span class="text-nowrap" t-field="o.amount_total"/> <span class="text-nowrap">on
</td> <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> </tr>
<!-- <t t-if="print_with_payments">--> </t>
<!-- <t t-if="o.payment_state != 'invoicing_legacy'">--> <tr class="border-black o_total">
<!-- <t t-set="payments_vals" t-value="o.sudo()._get_reconciled_info_JSON_values()"/>--> <td>
<!-- <t t-foreach="payments_vals" t-as="payment_vals">--> <strong>Total</strong>
<!-- <tr>--> </td>
<!-- <td>--> <td class="text-right">
<!-- <i class="oe_form_field text-right oe_payment_label">Paid on <t t-esc="payment_vals['date']" t-options='{"widget": "date"}'/></i>--> <span class="text-nowrap"
<!-- </td>--> t-field="o.amount_total"/>
<!-- <td class="text-right">--> </td>
<!-- <span t-esc="payment_vals['amount']" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>--> </tr>
<!-- </td>--> </table>
<!-- </tr>-->
<!-- </t>-->
<!-- <t t-if="len(payments_vals) > 0">-->
<!-- <tr class="border-black">-->
<!-- <td><strong>Amount Due</strong></td>-->
<!-- <td class="text-right">-->
<!-- <span t-field="o.amount_residual"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- </t>-->
<!-- </t>-->
<!-- </t>-->
</table>
</div>
</div> </div>
</div> </div>
<p t-if="o.move_type in ('out_invoice', 'in_refund') and o.payment_reference" name="payment_communication"> </div>
Please use the following communication for your payment : <b><span t-field="o.payment_reference"/></b> <p t-if="o.move_type in ('out_invoice', 'in_refund') and o.payment_reference"
</p> name="payment_communication">
Please use the following communication for your payment :
<p t-if="o.invoice_payment_term_id" name="payment_term"> <b>
<span t-field="o.invoice_payment_term_id.note"/> <span t-field="o.payment_reference"/>
</p> </b>
</p>
<p t-if="o.narration" name="comment"> <p t-if="o.invoice_payment_term_id" name="payment_term">
<span t-field="o.narration"/> <span t-field="o.invoice_payment_term_id.note"/>
</p> </p>
<p t-if="o.fiscal_position_id.note" name="note"> <p t-if="o.narration" name="comment">
<span t-field="o.fiscal_position_id.note"/> <span t-field="o.narration"/>
</p> </p>
<p t-if="o.invoice_incoterm_id" name="incoterm"> <p t-if="o.fiscal_position_id.note" name="note">
<strong>Incoterm: </strong><span t-field="o.invoice_incoterm_id.code"/> - <span t-field="o.invoice_incoterm_id.name"/> <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> </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> </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>
<template id="report_multiple_invoice"> <template id="report_multiple_invoice">
<t t-call="web.html_container"> <t t-call="web.html_container">
<t t-foreach="docs" t-as="o"> <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-set="print_with_payments" t-value="True"/>
<t t-if="o._get_name_invoice_report() == 'account.report_invoice_document'" <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-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> </t>
</t> </t>
</template> </template>
<record id="report_multiple_invoice_copies" model="ir.actions.report"> <record id="report_multiple_invoice_copies" model="ir.actions.report">
<field name="name">Multiple Invoice Copies</field> <field name="name">Multiple Invoice Copies</field>
<field name="model">account.move</field> <field name="model">account.move</field>
@ -256,5 +332,4 @@
<field name="binding_model_id" ref="account.model_account_move"/> <field name="binding_model_id" ref="account.model_account_move"/>
<field name="binding_type">report</field> <field name="binding_type">report</field>
</record> </record>
</odoo>
</odoo>

148
base_accounting_kit/report/report.xml

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

47
base_accounting_kit/report/report_aged_partner.py

@ -19,12 +19,9 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
import time import time
from datetime import datetime from datetime import datetime
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from odoo import api, models, _ from odoo import api, models, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
from odoo.tools import float_is_zero 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, def _get_partner_move_lines(self, account_type, date_from, target_move,
period_length): period_length):
# This method can receive the context key 'include_nullified_amount' {Boolean} # This method can receive the context key 'include_nullified_amount'
# Do an invoice and a payment and unreconcile. The amount will be nullified # {Boolean}
# Do an invoice and a payment and unreconcile. The amount will be
# nullified
# By default, the partner wouldn't appear in this report. # By default, the partner wouldn't appear in this report.
# The context key allow it to appear # 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 # Name Stop Start
# 1 - 30 : 2019-02-07 - 2019-01-09 # 1 - 30 : 2019-02-07 - 2019-01-09
# 31 - 60 : 2019-01-08 - 2018-12-10 # 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': (i != 0 and stop.strftime('%Y-%m-%d') or False),
} }
start = stop start = stop
res = [] res = []
total = [] total = []
cr = self.env.cr cr = self.env.cr
@ -78,20 +77,20 @@ class ReportAgedPartnerBalance(models.AbstractModel):
# build the reconciliation clause to see what partner needs to be printed # build the reconciliation clause to see what partner needs to be printed
reconciliation_clause = '(l.reconciled IS FALSE)' reconciliation_clause = '(l.reconciled IS FALSE)'
cr.execute( 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,)) (date_from,))
reconciled_after_date = [] reconciled_after_date = []
for row in cr.fetchall(): for row in cr.fetchall():
reconciled_after_date += [row[0], row[1]] reconciled_after_date += [row[0], row[1]]
if reconciled_after_date: if reconciled_after_date:
reconciliation_clause = '(l.reconciled IS FALSE OR l.id IN %s)' reconciliation_clause = '(l.reconciled IS FALSE OR l.id IN %s)'
arg_list += (tuple(reconciled_after_date),) arg_list += (tuple(reconciled_after_date),)
arg_list += (date_from, tuple(company_ids)) arg_list += (date_from, tuple(company_ids))
query = ''' query = '''
SELECT DISTINCT l.partner_id, UPPER(res_partner.name) 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) WHERE (l.account_id = account_account.id)
AND (l.move_id = am.id) AND (l.move_id = am.id)
AND (am.state IN %s) AND (am.state IN %s)
@ -101,12 +100,10 @@ class ReportAgedPartnerBalance(models.AbstractModel):
AND l.company_id IN %s AND l.company_id IN %s
ORDER BY UPPER(res_partner.name)''' ORDER BY UPPER(res_partner.name)'''
cr.execute(query, arg_list) cr.execute(query, arg_list)
partners = cr.dictfetchall() partners = cr.dictfetchall()
# put a total of 0 # put a total of 0
for i in range(7): for i in range(7):
total.append(0) total.append(0)
# Build a string like (1,2,3) for easy use in SQL query # Build a string like (1,2,3) for easy use in SQL query
partner_ids = [partner['partner_id'] for partner in partners if partner_ids = [partner['partner_id'] for partner in partners if
partner['partner_id']] partner['partner_id']]
@ -114,7 +111,6 @@ class ReportAgedPartnerBalance(models.AbstractModel):
(partner['partner_id'] or False, []) for partner in partners) (partner['partner_id'] or False, []) for partner in partners)
if not partner_ids: if not partner_ids:
return [], [], {} return [], [], {}
# This dictionary will store the not due amount of all partners # This dictionary will store the not due amount of all partners
undue_amounts = {} undue_amounts = {}
query = '''SELECT l.id query = '''SELECT l.id
@ -177,7 +173,8 @@ class ReportAgedPartnerBalance(models.AbstractModel):
args_list += (date_from, tuple(company_ids)) args_list += (date_from, tuple(company_ids))
query = '''SELECT l.id query = '''SELECT l.id
FROM account_move_line AS l, account_account, account_move am 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 (am.state IN %s)
AND (account_account.account_type IN %s) AND (account_account.account_type IN %s)
AND ((l.partner_id IN %s) OR (l.partner_id IS NULL)) 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 partner_id = line.partner_id.id or False
if partner_id not in partners_amount: if partner_id not in partners_amount:
partners_amount[partner_id] = 0.0 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) user_currency, line.balance)
if user_currency.is_zero(line_amount): if user_currency.is_zero(line_amount):
continue continue
@ -206,7 +204,6 @@ class ReportAgedPartnerBalance(models.AbstractModel):
line_amount -= ResCurrency._get_conversion_rate( line_amount -= ResCurrency._get_conversion_rate(
partial_line.company_id.currency_id, user_currency, partial_line.company_id.currency_id, user_currency,
partial_line.amount) partial_line.amount)
if not self.env.company.currency_id.is_zero( if not self.env.company.currency_id.is_zero(
line_amount): line_amount):
partners_amount[partner_id] += line_amount partners_amount[partner_id] += line_amount
@ -223,15 +220,14 @@ class ReportAgedPartnerBalance(models.AbstractModel):
values = {} values = {}
undue_amt = 0.0 undue_amt = 0.0
if partner[ 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']] undue_amt = undue_amounts[partner['partner_id']]
total[6] = total[6] + undue_amt total[6] = total[6] + undue_amt
values['direction'] = undue_amt values['direction'] = undue_amt
if not float_is_zero(values['direction'], if not float_is_zero(values['direction'],
precision_rounding=self.env.company.currency_id.rounding): precision_rounding=self.env.company.currency_id.rounding):
at_least_one_amount = True at_least_one_amount = True
for i in range(5): for i in range(5):
during = False during = False
if partner['partner_id'] in history[i]: 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) total[(i)] = total[(i)] + (during and during[0] or 0)
values[str(i)] = during and during[0] or 0.0 values[str(i)] = during and during[0] or 0.0
if not float_is_zero(values[str(i)], 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 at_least_one_amount = True
values['total'] = sum( values['total'] = sum(
[values['direction']] + [values[str(i)] for i in range(5)]) [values['direction']] + [values[str(i)] for i in range(5)])
@ -257,7 +254,6 @@ class ReportAgedPartnerBalance(models.AbstractModel):
else: else:
values['name'] = _('Unknown Partner') values['name'] = _('Unknown Partner')
values['trust'] = False values['trust'] = False
if at_least_one_amount or ( if at_least_one_amount or (
self._context.get('include_nullified_amount') and lines[ self._context.get('include_nullified_amount') and lines[
partner['partner_id']]): partner['partner_id']]):
@ -270,8 +266,6 @@ class ReportAgedPartnerBalance(models.AbstractModel):
'active_model') or not self.env.context.get('active_id'): 'active_model') or not self.env.context.get('active_id'):
raise UserError( raise UserError(
_("Form content is missing, this report cannot be printed.")) _("Form content is missing, this report cannot be printed."))
total = []
model = self.env.context.get('active_model') model = self.env.context.get('active_model')
docs = self.env[model].browse(self.env.context.get('active_id')) docs = self.env[model].browse(self.env.context.get('active_id'))
@ -284,11 +278,12 @@ class ReportAgedPartnerBalance(models.AbstractModel):
account_type = ['liability_payable'] account_type = ['liability_payable']
else: else:
account_type = ['liability_payable', 'asset_receivable'] account_type = ['liability_payable', 'asset_receivable']
movelines, total, dummy = self._get_partner_move_lines(account_type, movelines, total, dummy = self._get_partner_move_lines(account_type,
date_from, date_from,
target_move, target_move,
data['form']['period_length']) data['form']
['period_length']
)
return { return {
'doc_ids': self.ids, 'doc_ids': self.ids,
'doc_model': model, 'doc_model': model,

113
base_accounting_kit/report/report_aged_partner.xml

@ -8,7 +8,6 @@
<t t-call="web.internal_layout"> <t t-call="web.internal_layout">
<div class="page"> <div class="page">
<h2>Aged Partner Balance</h2> <h2>Aged Partner Balance</h2>
<div class="row mt32"> <div class="row mt32">
<div class="col-3"> <div class="col-3">
<strong>Start Date:</strong> <strong>Start Date:</strong>
@ -23,43 +22,90 @@
<div class="col-3"> <div class="col-3">
<strong>Partner's:</strong> <strong>Partner's:</strong>
<p> <p>
<span t-if="data['result_selection'] == 'customer'">Receivable Accounts</span> <span t-if="data['result_selection'] ==
<span t-if="data['result_selection'] == 'supplier'">Payable Accounts</span> 'customer'">
<span t-if="data['result_selection'] == 'customer_supplier'">Receivable and Payable Accounts</span> 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> </p>
</div> </div>
<div class="col-3"> <div class="col-3">
<strong>Target Moves:</strong> <strong>Target Moves:</strong>
<p> <p>
<span t-if="data['target_move'] == 'all'">All Entries</span> <span t-if="data['target_move'] == 'all'">All
<span t-if="data['target_move'] == 'posted'">All Posted Entries</span> Entries
</span>
<span t-if="data['target_move'] == 'posted'">All
Posted Entries
</span>
</p> </p>
</div> </div>
</div> </div>
<table class="table table-sm table-reports"> <table class="table table-sm table-reports">
<thead> <thead>
<tr> <tr class="text-left">
<th>Partners</th> <th>Partners</th>
<th class="text-right"> <th>
<span>Not due</span> <span>Not due</span>
</th> </th>
<th class="text-right"><span t-esc="data['4']['name']"/></th> <th>
<th class="text-right"><span t-esc="data['3']['name']"/></th> <span t-esc="data['4']['name']"/>
<th class="text-right"><span t-esc="data['2']['name']"/></th> </th>
<th class="text-right"><span t-esc="data['1']['name']"/></th> <th>
<th class="text-right"><span t-esc="data['0']['name']"/></th> <span t-esc="data['3']['name']"/>
<th class="text-right">Total</th> </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>
<tr t-if="get_partner_lines"> <tr t-if="get_partner_lines" class="text-centre">
<th>Account Total</th> <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>
<th class="text-right"><span t-esc="get_direction[4]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th> <span t-esc="get_direction[6]"
<th class="text-right"><span t-esc="get_direction[3]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th> t-options="{'widget':
<th class="text-right"><span t-esc="get_direction[2]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th> 'monetary', 'display_currency':
<th class="text-right"><span t-esc="get_direction[1]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th> env.company.currency_id}"/>
<th class="text-right"><span t-esc="get_direction[0]" t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/></th> </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[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> </tr>
</thead> </thead>
<tbody> <tbody>
@ -68,25 +114,32 @@
<span t-esc="partner['name']"/> <span t-esc="partner['name']"/>
</td> </td>
<td class="text-right"> <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>
<td class="text-right"> <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>
<td class="text-right"> <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>
<td class="text-right"> <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>
<td class="text-right"> <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>
<td class="text-right"> <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>
<td class="text-right"> <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> </td>
</tr> </tr>
</tbody> </tbody>

20
base_accounting_kit/report/report_financial.py

@ -35,8 +35,9 @@ class AccountTypes(models.Model):
('payable', 'Payable'), ('payable', 'Payable'),
('liquidity', 'Liquidity'), ('liquidity', 'Liquidity'),
], required=True, default='other', ], required=True, default='other',
help="The 'Internal Type' is used for features available on " \ help="The 'Internal Type' is used for features available on "
"different types of accounts: liquidity type is for cash or bank accounts" \ "different types of accounts: liquidity type is for cash or "
"bank accounts" \
", payable/receivable is for vendor/customer accounts.") ", payable/receivable is for vendor/customer accounts.")
@ -68,13 +69,15 @@ class AccountFinancialReport(models.Model):
return res return res
name = fields.Char('Report Name', required=True, translate=True) 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( children_ids = fields.One2many(
'account.financial.report', 'account.financial.report',
'parent_id', 'parent_id',
'Account Report') 'Account Report')
sequence = fields.Integer('Sequence') 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( type = fields.Selection(
[('sum', 'View'), [('sum', 'View'),
('accounts', 'Accounts'), ('accounts', 'Accounts'),
@ -116,15 +119,10 @@ class AccountFinancialReport(models.Model):
("off_balance", "Off-Balance Sheet"), ("off_balance", "Off-Balance Sheet"),
], ],
string="Type", 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." "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( sign = fields.Selection(
[("-1", 'Reverse balance sign'), ("1", 'Preserve balance sign')], [("-1", 'Reverse balance sign'), ("1", 'Preserve balance sign')],
'Sign on Reports', required=True, default="1", '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"/> <t t-set="data_report_dpi" t-value="110"/>
<div class="page"> <div class="page">
<h2 t-esc="data['form']['account_report_id'][1]"/> <h2 t-esc="data['form']['account_report_id'][1]"/>
<div class="row mt32 mb32"> <div class="row mt32 mb32">
<div class="col-4"> <div class="col-4">
<strong>Target Moves:</strong> <strong>Target Moves:</strong>
<p> <p>
<span t-if="data['form']['target_move'] == 'all'">All Entries</span> <span t-if="data['form']['target_move'] == 'all'">
<span t-if="data['form']['target_move'] == 'posted'">All Posted Entries</span> All Entries
</span>
<span t-if="data['form']['target_move'] == 'posted'">
All Posted Entries
</span>
</p> </p>
</div> </div>
<div class="col-4"> <div class="col-4">
@ -31,47 +34,56 @@
</p> </p>
</div> </div>
</div> </div>
<table class="table table-sm table-reports"
<table class="table table-sm table-reports" t-if="data['form']['debit_credit'] == 1"> t-if="data['form']['debit_credit'] == 1">
<thead> <thead>
<tr> <tr class="text-left">
<th>Name</th> <th>Name</th>
<th class="text-right">Debit</th> <th>Debit</th>
<th class="text-right">Credit</th> <th>Credit</th>
<th class="text-right">Balance</th> <th>Balance</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr t-foreach="report_lines" t-as="a"> <tr t-foreach="report_lines" t-as="a">
<t t-if="a['level'] != 0"> <t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3"> <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 t-if="not a.get('level') &gt; 3"> <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> </t>
<td> <td>
<span style="color: white;" t-esc="'..' * a.get('level', 0)"/> <span style="color: white;"
<span t-att-style="style" t-esc="a.get('name')"/> t-esc="'..' * a.get('level', 0)"/>
<span t-att-style="style"
t-esc="a.get('name')"/>
</td> </td>
<td class="text-right" style="white-space: text-nowrap;"> <td class="text-right"
<span t-att-style="style" t-esc="a.get('debit')" 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}"/> t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td> </td>
<td class="text-right" style="white-space: text-nowrap;"> <td class="text-right"
<span t-att-style="style" t-esc="a.get('credit')" 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}"/> t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td> </td>
<td class="text-right" style="white-space: text-nowrap;"> <td class="text-right"
<span t-att-style="style" t-esc="a.get('balance')" 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}"/> t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td> </td>
</t> </t>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<table class="table table-sm table-reports" <table class="table table-sm table-reports"
t-if="not data['form']['enable_filter'] and not data['form']['debit_credit']"> t-if="not data['form']['enable_filter'] and not data['form']['debit_credit']">
<thead> <thead>
@ -84,25 +96,29 @@
<tr t-foreach="report_lines" t-as="a"> <tr t-foreach="report_lines" t-as="a">
<t t-if="a['level'] != 0"> <t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3"> <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 t-if="not a.get('level') &gt; 3"> <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> </t>
<td> <td>
<span style="color: white;" t-esc="'..' * a.get('level', 0)"/> <span style="color: white;"
<span t-att-style="style" t-esc="a.get('name')"/> t-esc="'..' * a.get('level', 0)"/>
<span t-att-style="style"
t-esc="a.get('name')"/>
</td> </td>
<td class="text-right"> <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}"/> t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td> </td>
</t> </t>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<table class="table table-sm table-reports" <table class="table table-sm table-reports"
t-if="data['form']['enable_filter'] == 1 and not data['form']['debit_credit']"> t-if="data['form']['enable_filter'] == 1 and not data['form']['debit_credit']">
<thead> <thead>
@ -110,7 +126,6 @@
<th>Name</th> <th>Name</th>
<th class="text-right">Balance</th> <th class="text-right">Balance</th>
<th class="text-right"> <th class="text-right">
<!-- <span t-esc="data['form']['label_filter']"/>-->
<span>Comp</span> <span>Comp</span>
</th> </th>
</tr> </tr>
@ -119,21 +134,27 @@
<tr t-foreach="report_lines" t-as="a"> <tr t-foreach="report_lines" t-as="a">
<t t-if="a['level'] != 0"> <t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3"> <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 t-if="not a.get('level') &gt; 3"> <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> </t>
<td> <td>
<span style="color: white;" t-esc="'..'"/> <span style="color: white;"
<span t-att-style="style" t-esc="a.get('name')"/> t-esc="'..'"/>
<span t-att-style="style"
t-esc="a.get('name')"/>
</td> </td>
<td class="text-right"> <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}"/> t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
</td> </td>
<td class="text-right"> <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> </td>
</t> </t>
</tr> </tr>
@ -143,4 +164,4 @@
</t> </t>
</t> </t>
</template> </template>
</odoo> </odoo>

26
base_accounting_kit/report/report_journal_audit.py

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

39
base_accounting_kit/report/report_journal_audit.xml

@ -14,36 +14,37 @@
<t t-esc="o.name"/> <t t-esc="o.name"/>
Journal Journal
</h2> </h2>
<div class="row mt32"> <div class="row mt32">
<div class="col-3"> <div class="col-3">
<strong>Company:</strong> <strong>Company:</strong>
<p t-esc="env.company.name"/> <p t-esc="env.company.name"/>
</div> </div>
<div class="col-3"> <div class="col-3">
<strong>Journal:</strong> <strong>Journal:</strong>
<p t-esc="o.name"/> <p t-esc="o.name"/>
</div> </div>
<div class="col-3"> <div class="col-3">
<strong>Entries Sorted By:</strong> <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'">
<p t-if="data['form'].get('sort_selection') == 'l.date'">Date</p> Journal Entry Number
</p>
<p t-if="data['form'].get('sort_selection') == 'l.date'">
Date
</p>
</div> </div>
<div class="col-3"> <div class="col-3">
<strong>Target Moves:</strong> <strong>Target Moves:</strong>
<p t-if="data['form']['target_move'] == 'all'">All Entries</p> <p t-if="data['form']['target_move'] == 'all'">
<p t-if="data['form']['target_move'] == 'posted'">All Posted Entries</p> All Entries
</p>
<p t-if="data['form']['target_move'] == 'posted'">
All Posted Entries
</p>
</div> </div>
</div> </div>
<table class="table table-sm"> <table class="table table-sm">
<thead> <thead>
<tr> <tr class="text-left">
<th>Move</th> <th>Move</th>
<th>Date</th> <th>Date</th>
<th>Account</th> <th>Account</th>
@ -51,10 +52,11 @@
<th>Label</th> <th>Label</th>
<th>Debit</th> <th>Debit</th>
<th>Credit</th> <th>Credit</th>
<th t-if="data['form']['amount_currency']">Currency</th> <th t-if="data['form']['amount_currency']">
Currency
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr t-foreach="lines[o.id]" t-as="aml"> <tr t-foreach="lines[o.id]" t-as="aml">
<td> <td>
@ -87,7 +89,6 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="row"> <div class="row">
<div class="col-4 pull-right"> <div class="col-4 pull-right">
<table class="table table-sm"> <table class="table table-sm">
@ -107,13 +108,14 @@
</table> </table>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-4">
<table class="table table-sm table-reports"> <table class="table table-sm table-reports">
<thead> <thead>
<tr> <tr>
<th colspan="3">Tax Declaration</th> <th colspan="3">Tax
Declaration
</th>
</tr> </tr>
<tr> <tr>
<th>Name</th> <th>Name</th>
@ -122,7 +124,8 @@
</tr> </tr>
</thead> </thead>
<tbody> <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"> <tr t-foreach="taxes" t-as="tax">
<td> <td>
<span t-esc="tax.name"/> <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/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
import time import time
from odoo import api, models, _ from odoo import api, models, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
@ -41,7 +39,12 @@ class ReportPartnerLedger(models.AbstractModel):
tuple(data['computed']['account_ids'])] + \ tuple(data['computed']['account_ids'])] + \
query_get_data[2] query_get_data[2]
query = """ 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] + """ FROM """ + query_get_data[0] + """
LEFT JOIN account_journal j ON ("account_move_line".journal_id = j.id) 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) 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() data['form'].get('used_context', {}))._query_get()
reconcile_clause = "" if data['form'][ reconcile_clause = "" if data['form'][
'reconciled'] else ' AND "account_move_line".full_reconcile_id IS NULL ' 'reconciled'] else ' AND "account_move_line".full_reconcile_id IS NULL '
params = [partner.id, tuple(data['computed']['move_state']), params = [partner.id, tuple(data['computed']['move_state']),
tuple(data['computed']['account_ids'])] + \ tuple(data['computed']['account_ids'])] + \
query_get_data[2] query_get_data[2]
@ -102,9 +104,7 @@ class ReportPartnerLedger(models.AbstractModel):
if not data.get('form'): if not data.get('form'):
raise UserError( raise UserError(
_("Form content is missing, this report cannot be printed.")) _("Form content is missing, this report cannot be printed."))
data['computed'] = {} data['computed'] = {}
obj_partner = self.env['res.partner'] obj_partner = self.env['res.partner']
query_get_data = self.env['account.move.line'].with_context( query_get_data = self.env['account.move.line'].with_context(
data['form'].get('used_context', {}))._query_get() data['form'].get('used_context', {}))._query_get()
@ -118,7 +118,6 @@ class ReportPartnerLedger(models.AbstractModel):
data['computed']['ACCOUNT_TYPE'] = ['asset_receivable'] data['computed']['ACCOUNT_TYPE'] = ['asset_receivable']
else: else:
data['computed']['ACCOUNT_TYPE'] = ['liability_payable', 'asset_receivable'] data['computed']['ACCOUNT_TYPE'] = ['liability_payable', 'asset_receivable']
self.env.cr.execute(""" self.env.cr.execute("""
SELECT a.id SELECT a.id
FROM account_account a FROM account_account a

33
base_accounting_kit/report/report_partner_ledger.xml

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

14
base_accounting_kit/report/report_tax.py

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

29
base_accounting_kit/report/report_tax.xml

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

19
base_accounting_kit/report/report_trial_balance.py

@ -19,9 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
import time import time
from odoo import api, models, _ from odoo import api, models, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
@ -34,8 +32,10 @@ class ReportTrialBalance(models.AbstractModel):
""" compute the balance, debit and credit for the provided accounts """ compute the balance, debit and credit for the provided accounts
:Arguments: :Arguments:
`accounts`: list of accounts record, `accounts`: list of accounts record,
`display_account`: it's used to display either all accounts or those accounts which balance is > 0 `display_account`: it's used to display either all accounts or
:Returns a list of dictionary of Accounts with following key and value those accounts which balance is > 0
:Returns a list of dictionary of Accounts with following key
and value
`name`: Account name, `name`: Account name,
`code`: Account code, `code`: Account code,
`credit`: total amount of credit, `credit`: total amount of credit,
@ -56,8 +56,11 @@ class ReportTrialBalance(models.AbstractModel):
filters = " AND ".join(wheres) filters = " AND ".join(wheres)
# compute the balance, debit and credit for the provided accounts # compute the balance, debit and credit for the provided accounts
request = ( request = (
"SELECT account_id AS id, SUM(debit) AS debit, SUM(credit) AS credit, (SUM(debit) - SUM(credit)) AS balance" + \ "SELECT account_id AS id, SUM(debit) AS debit, "
" FROM " + tables + " WHERE account_id IN %s " + filters + " GROUP BY account_id") "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) params = (tuple(accounts.ids),) + tuple(where_params)
self.env.cr.execute(request, params) self.env.cr.execute(request, params)
for row in self.env.cr.dictfetchall(): for row in self.env.cr.dictfetchall():
@ -66,7 +69,8 @@ class ReportTrialBalance(models.AbstractModel):
account_res = [] account_res = []
for account in accounts: for account in accounts:
res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance']) 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['code'] = account.code
res['name'] = account.name res['name'] = account.name
if account.id in account_result: 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'): if not data.get('form') or not self.env.context.get('active_model'):
raise UserError( raise UserError(
_("Form content is missing, this report cannot be printed.")) _("Form content is missing, this report cannot be printed."))
model = self.env.context.get('active_model') model = self.env.context.get('active_model')
docs = self.env[model].browse( docs = self.env[model].browse(
self.env.context.get('active_ids', [])) 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-set="data_report_dpi" t-value="110"/>
<t t-call="web.internal_layout"> <t t-call="web.internal_layout">
<div class="page"> <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="row mt32">
<div class="col-4"> <div class="col-4">
<strong>Display Account:</strong> <strong>Display Account:</strong>
<p> <p>
<span t-if="data['display_account'] == 'all'">All accounts</span> <span t-if="data['display_account'] == 'all'">
<span t-if="data['display_account'] == 'movement'">With movements</span> All accounts
<span t-if="data['display_account'] == 'not_zero'">With balance not equal to zero</span> </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> </p>
</div> </div>
<div class="col-4"> <div class="col-4">
<p> <p>
<t t-if="data['date_from']"><strong>Date from :</strong> <span t-esc="data['date_from']"/><br/></t> <t t-if="data['date_from']">
<t t-if="data['date_to']"><strong>Date to :</strong> <span t-esc="data['date_to']"/></t> <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> </p>
</div> </div>
<div class="col-4"> <div class="col-4">
<strong>Target Moves:</strong> <strong>Target Moves:</strong>
<p> <p>
<span t-if="data['target_move'] == 'all'">All Entries</span> <span t-if="data['target_move'] == 'all'">All
<span t-if="data['target_move'] == 'posted'">All Posted Entries</span> Entries
</span>
<span t-if="data['target_move'] == 'posted'">All
Posted Entries
</span>
</p> </p>
</div> </div>
</div> </div>
<table class="table table-sm table-reports"> <table class="table table-sm table-reports">
<thead> <thead>
<tr> <tr class="text-left">
<th>Code</th> <th>Code</th>
<th>Account</th> <th>Account</th>
<th class="text-right">Debit</th> <th class="text-right">Debit</th>
@ -46,20 +62,31 @@
<tbody> <tbody>
<tr t-foreach="Accounts" t-as="account"> <tr t-foreach="Accounts" t-as="account">
<td> <td>
<span t-att-style="style" t-esc="account['code']"/> <span t-att-style="style"
t-esc="account['code']"/>
</td> </td>
<td> <td>
<span style="color: white;" t-esc="'..'"/> <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>
<td class="text-right"> <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>
<td class="text-right"> <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>
<td class="text-right"> <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> </td>
</tr> </tr>
</tbody> </tbody>

28
base_accounting_kit/security/security.xml

@ -4,45 +4,37 @@
<record model="res.groups" id="group_account_dashboard"> <record model="res.groups" id="group_account_dashboard">
<field name="name">Access to Accounting Dashboard</field> <field name="name">Access to Accounting Dashboard</field>
</record> </record>
<record id="account_asset_category_multi_company_rule" model="ir.rule"> <record id="account_asset_category_multi_company_rule" model="ir.rule">
<field name="name">Account Asset Category multi-company</field> <field name="name">Account Asset Category multi-company</field>
<field ref="model_account_asset_category" name="model_id"/> <field ref="model_account_asset_category" name="model_id"/>
<field eval="True" name="global"/> <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> </field>
</record> </record>
<record id="account_asset_asset_multi_company_rule" model="ir.rule"> <record id="account_asset_asset_multi_company_rule" model="ir.rule">
<field name="name">Account Asset multi-company</field> <field name="name">Account Asset multi-company</field>
<field ref="model_account_asset_asset" name="model_id"/> <field ref="model_account_asset_asset" name="model_id"/>
<field eval="True" name="global"/> <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> </field>
</record> </record>
<!-- Rename user group as Accountant --> <!-- Rename user group as Accountant -->
<record id="account.group_account_user" model="res.groups"> <record id="account.group_account_user" model="res.groups">
<field name="name">Accountant</field> <field name="name">Accountant</field>
<field name="implied_ids" eval="[(4, ref('account.group_account_invoice'))]"/> <field name="implied_ids"
<field name="category_id" ref="base.module_category_accounting_accounting"/> eval="[(4, ref('account.group_account_invoice'))]"/>
<field name="category_id"
ref="base.module_category_accounting_accounting"/>
</record> </record>
<!-- Rename user group as Chief Accountant --> <!-- Rename user group as Chief Accountant -->
<record id="account.group_account_manager" model="res.groups"> <record id="account.group_account_manager" model="res.groups">
<field name="name">Chief Accountant</field> <field name="name">Chief Accountant</field>
<field name="implied_ids" <field name="implied_ids"
eval="[(3, ref('account.group_account_invoice')), (4, ref('account.group_account_user'))]"/> 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>
<!-- <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> </data>
</odoo> </odoo>

249
base_accounting_kit/views/account_asset_views.xml

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

4
base_accounting_kit/views/account_configuration.xml

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

220
base_accounting_kit/views/account_followup.xml

@ -1,113 +1,123 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<odoo> <odoo>
<data> <record id="view_account_followup_followup_line_tree"
<record id="view_account_followup_followup_line_tree" model="ir.ui.view"> model="ir.ui.view">
<field name="name">followup.line.tree</field> <field name="name">followup.line.tree</field>
<field name="model">followup.line</field> <field name="model">followup.line</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Follow-up Steps" > <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="name"/>
<field name="delay"/> </h1>
</tree> <div class="oe_inline">
</field> After
</record> <field name="delay" class="oe_inline"/>
days overdue, do the following actions:
<record id="view_account_followup_followup_line_form" model="ir.ui.view"> </div>
<field name="name">followup.line.form</field> </form>
<field name="model">followup.line</field> </field>
<field name="arch" type="xml"> </record>
<form string="Follow-up Steps"> <record id="view_account_followup_followup_form" model="ir.ui.view">
<label for="name" class="oe_edit_only"/> <field name="name">account.followup.form</field>
<h1><field name="name"/></h1> <field name="model">account.followup</field>
<div class="oe_inline"> <field name="arch" type="xml">
After <field name="delay" class="oe_inline"/> days overdue, do the following actions: <form string="Follow-up">
</div> <h1>
</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>
<field name="name"/> <field name="name"/>
<templates> </h1>
<t t-name="kanban-box"> <label for="company_id" groups="base.group_multi_company"/>
<div t-attf-class="oe_kanban_global_click"> <field name="company_id" options="{'no_create': True}"
<div> class="oe_inline" groups="base.group_multi_company"/>
<strong><i class="fa fa-building" role="img" aria-label="Enterprise"/> <t t-esc="record.name.value"/></strong> <p class="oe_grey">
</div> 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> </div>
</t> </div>
</templates> </t>
</kanban> </templates>
</field> </kanban>
</record> </field>
</record>
<record id="action_account_followup_definition_form" model="ir.actions.act_window"> <record id="action_account_followup_definition_form"
<field name="name">Payment Follow-ups</field> model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field> <field name="name">Payment Follow-ups</field>
<field name="res_model">account.followup</field> <field name="type">ir.actions.act_window</field>
<field name="search_view_id" ref="view_account_followup_filter"/> <field name="res_model">account.followup</field>
<field name="view_mode">tree,kanban,form</field> <field name="search_view_id" ref="view_account_followup_filter"/>
<field name="help" type="html"> <field name="view_mode">tree,kanban,form</field>
<p class="o_view_nocontent_smiling_face"> <field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Define follow-up levels and their related actions Define follow-up levels and their related actions
</p><p> </p>
For each step, specify the actions to be taken and delay in days. It is <p>
possible to use print and e-mail templates to send specific messages to 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. the customer.
</p> </p>
</field> </field>
</record> </record>
<menuitem action="action_account_followup_definition_form"
<menuitem action="action_account_followup_definition_form" id="account_followup_menu" id="account_followup_menu"
parent="account.account_management_menu" name="Follow-up Levels" parent="account.account_management_menu"
groups="account.group_account_manager" sequence="2"/> name="Follow-up Levels"
groups="account.group_account_manager" sequence="2"/>
</data>
</odoo> </odoo>

23
base_accounting_kit/views/account_group.xml

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

18
base_accounting_kit/views/account_move_views.xml

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

21
base_accounting_kit/views/account_payment_view.xml

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

40
base_accounting_kit/views/accounting_menu.xml

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

145
base_accounting_kit/views/credit_limit_view.xml

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

244
base_accounting_kit/views/followup_report.xml

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

17
base_accounting_kit/views/multiple_invoice_form.xml

@ -3,31 +3,32 @@
<record id="multiple_invoice_view_form" model="ir.ui.view"> <record id="multiple_invoice_view_form" model="ir.ui.view">
<field name="name">multiple.invoice.form.inherit.account.journal</field> <field name="name">multiple.invoice.form.inherit.account.journal</field>
<field name="model">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"> <field name="arch" type="xml">
<page name="advanced_settings" position="inside"> <page name="advanced_settings" position="inside">
<group string="Multiple Invoice Copies"
<group string="Multiple Invoice Copies" invisible="type not in ['sale', 'purchase']"> invisible="type not in ['sale', 'purchase']">
<field name="multiple_invoice_type" style="width: 40%"/> <field name="multiple_invoice_type" style="width: 40%"/>
</group> </group>
<group invisible="type not in ['sale', 'purchase']"> <group invisible="type not in ['sale', 'purchase']">
<div class="mt8"> <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> </div>
</group> </group>
<group> <group>
<group invisible="type not in ['sale', 'purchase']"> <group invisible="type not in ['sale', 'purchase']">
<div> <div>
<field name="multiple_invoice_ids" widget="one2many" nolabel="1"> <field name="multiple_invoice_ids" widget="one2many"
nolabel="1">
<tree editable="bottom"> <tree editable="bottom">
<field name="sequence" widget="handle"/> <field name="sequence" widget="handle"/>
<field name="copy_name" style="width: 75"/> <field name="copy_name" style="width: 75"/>
</tree> </tree>
</field> </field>
</div> </div>
</group> </group>
</group> </group>
</page> </page>
</field> </field>

78
base_accounting_kit/views/multiple_invoice_layout_view.xml

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

2
base_accounting_kit/views/product_template_views.xml

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

2
base_accounting_kit/views/product_views.xml

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

178
base_accounting_kit/views/recurring_payments_view.xml

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

158
base_accounting_kit/views/reports_config_view.xml

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

71
base_accounting_kit/views/res_config_view.xml

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

19
base_accounting_kit/wizard/account_bank_book_wizard.py

@ -20,7 +20,7 @@
# #
############################################################################# #############################################################################
from datetime import date from datetime import date
from odoo import models, fields, api, _ from odoo import api, fields, models, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
@ -32,7 +32,8 @@ class BankBookWizard(models.TransientModel):
readonly=True, readonly=True,
default=lambda self: self.env.company) default=lambda self: self.env.company)
target_move = fields.Selection([('posted', 'All Posted Entries'), 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') default='posted')
date_from = fields.Date(string='Start Date', default=date.today(), date_from = fields.Date(string='Start Date', default=date.today(),
required=True) required=True)
@ -43,19 +44,22 @@ class BankBookWizard(models.TransientModel):
('not_zero', 'With balance is not equal to 0')], ('not_zero', 'With balance is not equal to 0')],
string='Display Accounts', required=True, default='movement') string='Display Accounts', required=True, default='movement')
sortby = fields.Selection( sortby = fields.Selection(
[('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], [('sort_date', 'Date'), ('sort_journal_partner',
'Journal & Partner')],
string='Sort by', string='Sort by',
required=True, default='sort_date') required=True, default='sort_date')
initial_balance = fields.Boolean(string='Include Initial Balances', 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): def _get_default_account_ids(self):
journals = self.env['account.journal'].search([('type', '=', 'bank')]) journals = self.env['account.journal'].search([('type', '=', 'bank')])
accounts = [] accounts = []
for journal in journals: 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 return accounts
account_ids = fields.Many2many('account.account', account_ids = fields.Many2many('account.account',
'account_report_bankbook_account_rel', 'account_report_bankbook_account_rel',
'report_id', 'account_id', 'report_id', 'account_id',
@ -75,7 +79,8 @@ class BankBookWizard(models.TransientModel):
[('type', '=', 'bank')]) [('type', '=', 'bank')])
accounts = [] accounts = []
for journal in journals: 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)]} domain = {'account_ids': [('id', 'in', accounts)]}
return {'domain': domain} 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"?> <?xml version="1.0" encoding="UTF-8"?>
<odoo> <odoo>
<data> <record id="account_bank_book_form_view" model="ir.ui.view">
<record id="account_bank_book_form_view" model="ir.ui.view"> <field name="name">account.bank.book.form.view</field>
<field name="name">account.bank.book.form.view</field> <field name="model">account.bank.book.report</field>
<field name="model">account.bank.book.report</field> <field name="arch" type="xml">
<field name="arch" type="xml"> <form string="Bank Book Report">
<form string="Bank Book Report"> <field name="company_id" invisible="1"/>
<field name="company_id" invisible="1"/> <group col="4">
<group col="4"> <field name="target_move" widget="radio"/>
<field name="target_move" widget="radio"/> <field name="sortby" widget="radio"/>
<field name="sortby" widget="radio"/> <field name="initial_balance"/>
<field name="initial_balance"/> <newline/>
<newline/> <newline/>
<newline/> <field name="date_from"/>
<field name="date_from"/> <field name="date_to"/>
<field name="date_to"/> </group>
</group> <group>
<group> <field name="account_ids" widget="many2many_tags"/>
<field name="account_ids" widget="many2many_tags"/> <field name="journal_ids" widget="many2many_tags"
<field name="journal_ids" widget="many2many_tags" options="{'no_create': True}"/> options="{'no_create': True}"/>
</group> </group>
<footer> <footer>
<button name="check_report" string="Print" type="object" default_focus="1" class="oe_highlight"/> <button name="check_report" string="Print" type="object"
<button string="Cancel" class="btn btn-default" special="cancel" /> default_focus="1" class="oe_highlight"/>
</footer> <button string="Cancel" class="btn btn-default"
</form> special="cancel"/>
</field> </footer>
</record> </form>
</field>
<record id="action_account_bank_book_view" model="ir.actions.act_window"> </record>
<field name="name">Bank Book Report</field> <record id="action_account_bank_book_view" model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field> <field name="name">Bank Book Report</field>
<field name="res_model">account.bank.book.report</field> <field name="type">ir.actions.act_window</field>
<field name="view_id" ref="account_bank_book_form_view"/> <field name="res_model">account.bank.book.report</field>
<field name="view_mode">form</field> <field name="view_id" ref="account_bank_book_form_view"/>
<field name="target">new</field> <field name="view_mode">form</field>
</record> <field name="target">new</field>
</record>
<menuitem id="account_bank_book_menu" name="Bank Book" action="action_account_bank_book_view" <menuitem id="account_bank_book_menu" name="Bank Book"
parent="base_accounting_kit.account_reports_daily_reports"/> action="action_account_bank_book_view"
</data> parent="base_accounting_kit.account_reports_daily_reports"/>
</odoo> </odoo>

24
base_accounting_kit/wizard/account_cash_book_wizard.py

@ -20,8 +20,7 @@
# #
############################################################################# #############################################################################
from datetime import date from datetime import date
from odoo import api, fields, models, _
from odoo import models, fields, api, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
@ -33,7 +32,8 @@ class CashBookWizard(models.TransientModel):
readonly=True, readonly=True,
default=lambda self: self.env.company) default=lambda self: self.env.company)
target_move = fields.Selection([('posted', 'All Posted Entries'), 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') default='posted')
date_from = fields.Date(string='Start Date', default=date.today(), date_from = fields.Date(string='Start Date', default=date.today(),
required=True) required=True)
@ -48,13 +48,19 @@ class CashBookWizard(models.TransientModel):
string='Sort by', string='Sort by',
required=True, default='sort_date') required=True, default='sort_date')
initial_balance = fields.Boolean(string='Include Initial Balances', 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): def _get_default_account_ids(self):
journals = self.env['account.journal'].search([('type', '=', 'cash')]) journals = self.env['account.journal'].search([('type', '=', 'cash')])
accounts = [] accounts = []
for journal in journals: 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 return accounts
account_ids = fields.Many2many('account.account', account_ids = fields.Many2many('account.account',
@ -76,7 +82,8 @@ class CashBookWizard(models.TransientModel):
[('type', '=', 'cash')]) [('type', '=', 'cash')])
accounts = [] accounts = []
for journal in journals: 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)]} domain = {'account_ids': [('id', 'in', accounts)]}
return {'domain': domain} return {'domain': domain}
@ -107,5 +114,6 @@ class CashBookWizard(models.TransientModel):
lang=self.env.context.get( lang=self.env.context.get(
'lang') or 'en_US') 'lang') or 'en_US')
return self.env.ref( return self.env.ref(
'base_accounting_kit.action_report_cash_book').report_action(self, 'base_accounting_kit.action_report_cash_book').report_action(
data=data) 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"?> <?xml version="1.0" encoding="UTF-8"?>
<odoo> <odoo>
<data> <record id="account_cash_book_form_view" model="ir.ui.view">
<record id="account_cash_book_form_view" model="ir.ui.view"> <field name="name">account.cash.book.form.view</field>
<field name="name">account.cash.book.form.view</field> <field name="model">account.cash.book.report</field>
<field name="model">account.cash.book.report</field> <field name="arch" type="xml">
<field name="arch" type="xml"> <form string="Cash Book Report">
<form string="Cash Book Report"> <field name="company_id" invisible="1"/>
<field name="company_id" invisible="1"/> <group col="4">
<group col="4"> <field name="target_move" widget="radio"/>
<field name="target_move" widget="radio"/> <field name="sortby" widget="radio"/>
<field name="sortby" widget="radio"/> <field name="initial_balance"/>
<field name="initial_balance"/> <newline/>
<newline/> <newline/>
<newline/> <field name="date_from"/>
<field name="date_from"/> <field name="date_to"/>
<field name="date_to"/> </group>
</group> <group>
<group> <field name="account_ids" widget="many2many_tags"/>
<field name="account_ids" widget="many2many_tags"/> <field name="journal_ids" widget="many2many_tags"
<field name="journal_ids" widget="many2many_tags" options="{'no_create': True}"/> options="{'no_create': True}"/>
</group> </group>
<footer> <footer>
<button name="check_report" string="Print" type="object" default_focus="1" class="oe_highlight"/> <button name="check_report" string="Print" type="object"
<button string="Cancel" class="btn btn-default" special="cancel" /> default_focus="1" class="oe_highlight"/>
</footer> <button string="Cancel" class="btn btn-default"
</form> special="cancel"/>
</field> </footer>
</record> </form>
</field>
<record id="action_account_cash_book_view" model="ir.actions.act_window"> </record>
<field name="name">Cash Book Report</field> <record id="action_account_cash_book_view" model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field> <field name="name">Cash Book Report</field>
<field name="res_model">account.cash.book.report</field> <field name="type">ir.actions.act_window</field>
<field name="view_id" ref="account_cash_book_form_view"/> <field name="res_model">account.cash.book.report</field>
<field name="view_mode">form</field> <field name="view_id" ref="account_cash_book_form_view"/>
<field name="target">new</field> <field name="view_mode">form</field>
</record> <field name="target">new</field>
</record>
<menuitem id="account_cash_book_menu" name="Cash Book" action="action_account_cash_book_view" <menuitem id="account_cash_book_menu" name="Cash Book"
parent="base_accounting_kit.account_reports_daily_reports"/> action="action_account_cash_book_view"
</data> parent="base_accounting_kit.account_reports_daily_reports"/>
</odoo> </odoo>

8
base_accounting_kit/wizard/account_day_book_wizard.py

@ -20,8 +20,7 @@
# #
############################################################################# #############################################################################
from datetime import date from datetime import date
from odoo import fields, models
from odoo import models, fields
class DayBookWizard(models.TransientModel): class DayBookWizard(models.TransientModel):
@ -36,14 +35,13 @@ class DayBookWizard(models.TransientModel):
default=lambda self: self.env[ default=lambda self: self.env[
'account.journal'].search([])) 'account.journal'].search([]))
target_move = fields.Selection([('posted', 'All Posted Entries'), 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') default='posted')
account_ids = fields.Many2many('account.account', account_ids = fields.Many2many('account.account',
'account_report_daybook_account_rel', 'account_report_daybook_account_rel',
'report_id', 'account_id', 'report_id', 'account_id',
'Accounts') 'Accounts')
date_from = fields.Date(string='Start Date', default=date.today(), date_from = fields.Date(string='Start Date', default=date.today(),
required=True) required=True)
date_to = fields.Date(string='End Date', default=date.today(), 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"?> <?xml version="1.0" encoding="UTF-8"?>
<odoo> <odoo>
<data> <record id="account_day_book_form_view" model="ir.ui.view">
<record id="account_day_book_form_view" model="ir.ui.view"> <field name="name">account.day.book.form.view</field>
<field name="name">account.day.book.form.view</field> <field name="model">account.day.book.report</field>
<field name="model">account.day.book.report</field> <field name="arch" type="xml">
<field name="arch" type="xml"> <form string="Cash Book Report">
<form string="Cash Book Report"> <field name="company_id" invisible="1"/>
<field name="company_id" invisible="1"/> <group col="4">
<group col="4"> <field name="target_move" widget="radio"/>
<field name="target_move" widget="radio"/> <newline/>
<newline/> <field name="date_from"/>
<field name="date_from"/> <field name="date_to"/>
<field name="date_to"/> </group>
</group> <group>
<group> <field name="account_ids" widget="many2many_tags"/>
<field name="account_ids" widget="many2many_tags"/> <field name="journal_ids" widget="many2many_tags"
<field name="journal_ids" widget="many2many_tags" options="{'no_create': True}"/> options="{'no_create': True}"/>
</group> </group>
<footer> <footer>
<button name="check_report" string="Print" type="object" default_focus="1" class="oe_highlight"/> <button name="check_report" string="Print" type="object"
<button string="Cancel" class="btn btn-default" special="cancel" /> default_focus="1" class="oe_highlight"/>
</footer> <button string="Cancel" class="btn btn-default"
</form> special="cancel"/>
</field> </footer>
</record> </form>
</field>
<record id="action_account_day_book_view" model="ir.actions.act_window"> </record>
<field name="name">Day Book Report</field> <record id="action_account_day_book_view" model="ir.actions.act_window">
<field name="type">ir.actions.act_window</field> <field name="name">Day Book Report</field>
<field name="res_model">account.day.book.report</field> <field name="type">ir.actions.act_window</field>
<field name="view_id" ref="account_day_book_form_view"/> <field name="res_model">account.day.book.report</field>
<field name="view_mode">form</field> <field name="view_id" ref="account_day_book_form_view"/>
<field name="target">new</field> <field name="view_mode">form</field>
</record> <field name="target">new</field>
</record>
<menuitem id="account_day_book_menu" name="Day Book" action="action_account_day_book_view" <menuitem id="account_day_book_menu" name="Day Book"
parent="base_accounting_kit.account_reports_daily_reports"/> action="action_account_day_book_view"
</data> parent="base_accounting_kit.account_reports_daily_reports"/>
</odoo> </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", company_id = fields.Many2one(comodel_name='res.company', string="Company",
required=True) required=True)
period_lock_date = fields.Date(string="Lock Date for Non-Advisers", period_lock_date = fields.Date(string="Lock Date for Non-Advisers",
help="Only users with the 'Adviser' role can edit accounts prior to " help="Only users with the 'Adviser' role "
"and inclusive of this date. Use it for period locking inside an " "can edit accounts prior to "
"and inclusive of this date. Use it for"
" period locking inside an "
"open fiscal year, for example.") "open fiscal year, for example.")
fiscalyear_lock_date = fields.Date(string="Lock Date", fiscalyear_lock_date = fields.Date(string="Lock Date",
help="No users, including Advisers, can edit accounts prior to and " help="No users, including Advisers, can "
"inclusive of this date. Use it for fiscal year locking for " "edit accounts prior to and "
"inclusive of this date. Use it for "
"fiscal year locking for "
"example.") "example.")
@api.model @api.model

14
base_accounting_kit/wizard/account_lock_date.xml

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

23
base_accounting_kit/wizard/account_report_common_partner.py

@ -19,7 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import fields, models from odoo import fields, models
from odoo.tools.misc import get_lang from odoo.tools.misc import get_lang
@ -39,21 +38,23 @@ class AccountingCommonPartnerReport(models.TransientModel):
relation="account_common_parnter_report_section_rel", relation="account_common_parnter_report_section_rel",
column1="main_report_id", column1="main_report_id",
column2="sub_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) default=lambda self: self.env.company)
journal_ids = fields.Many2many( journal_ids = fields.Many2many(
comodel_name='account.journal', comodel_name='account.journal',
string='Journals', string='Journals',
required=True, 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)]", domain="[('company_id', '=', company_id)]",
) )
date_from = fields.Date(string='Start Date') date_from = fields.Date(string='Start Date')
date_to = fields.Date(string='End Date') date_to = fields.Date(string='End Date')
target_move = fields.Selection([('posted', 'All Posted Entries'), target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All 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'), result_selection = fields.Selection([('customer', 'Receivable Accounts'),
('supplier', 'Payable Accounts'), ('supplier', 'Payable Accounts'),
('customer_supplier', ('customer_supplier',
@ -77,9 +78,12 @@ class AccountingCommonPartnerReport(models.TransientModel):
data = {} data = {}
data['ids'] = self.env.context.get('active_ids', []) data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu') 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) 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) return self.with_context(discard_logo_check=True)._print_report(data)
def _print_report(self, data): def _print_report(self, data):
@ -88,9 +92,8 @@ class AccountingCommonPartnerReport(models.TransientModel):
'account_report_id', 'enable_filter', 'label_filter', 'account_report_id', 'enable_filter', 'label_filter',
'target_move'])[0]) 'target_move'])[0])
return self.env.ref( return self.env.ref(
'base_accounting_kit.action_report_cash_flow').report_action(self, 'base_accounting_kit.action_report_cash_flow').report_action(
data=data, self, data=data, config=False)
config=False)
def pre_print_report(self, data): def pre_print_report(self, data):
data['form'].update(self.read(['result_selection'])[0]) 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/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
import time import time
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from odoo import fields, models, _ from odoo import fields, models, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
@ -43,9 +40,11 @@ class AccountAgedTrialBalance(models.TransientModel):
relation="account_aged_trail_report_section_rel", relation="account_aged_trail_report_section_rel",
column1="main_report_id", column1="main_report_id",
column2="sub_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) name = fields.Char(string="Account Aged Trial balance Report",
default="Account Aged Trial balance Report",
journal_ids = fields.Many2many('account.journal', string='Journals', required=True, translate=True)
journal_ids = fields.Many2many('account.journal',
string='Journals',
required=True) required=True)
period_length = fields.Integer(string='Period Length (days)', period_length = fields.Integer(string='Period Length (days)',
required=True, default=30) required=True, default=30)
@ -60,9 +59,7 @@ class AccountAgedTrialBalance(models.TransientModel):
raise UserError(_('You must set a period length greater than 0.')) raise UserError(_('You must set a period length greater than 0.'))
if not data['form']['date_from']: if not data['form']['date_from']:
raise UserError(_('You must set a start date.')) raise UserError(_('You must set a start date.'))
start = data['form']['date_from'] start = data['form']['date_from']
for i in range(5)[::-1]: for i in range(5)[::-1]:
stop = start - relativedelta(days=period_length - 1) stop = start - relativedelta(days=period_length - 1)
res[str(i)] = { res[str(i)] = {

11
base_accounting_kit/wizard/aged_partner.xml

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

21
base_accounting_kit/wizard/asset_depreciation_confirmation_wizard.py

@ -19,26 +19,33 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import fields, models, _
from odoo import api, fields, models, _
class AssetDepreciationConfirmationWizard(models.TransientModel): class AssetDepreciationConfirmationWizard(models.TransientModel):
_name = "asset.depreciation.confirmation.wizard" _name = "asset.depreciation.confirmation.wizard"
_description = "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): def asset_compute(self):
self.ensure_one() self.ensure_one()
context = self._context 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 { 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', 'view_mode': 'tree,form',
'res_model': 'account.move', 'res_model': 'account.move',
'view_id': False, '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', 'type': 'ir.actions.act_window',
} }

35
base_accounting_kit/wizard/asset_depreciation_confirmation_wizard_views.xml

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

47
base_accounting_kit/wizard/asset_modify.py

@ -19,20 +19,8 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from lxml import etree from lxml import etree
from odoo import api, fields, models, _ 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): class AssetModify(models.TransientModel):
@ -40,29 +28,37 @@ class AssetModify(models.TransientModel):
_description = 'Modify Asset' _description = 'Modify Asset'
name = fields.Text(string='Reason', required=True) 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_period = fields.Integer(string='Period Length')
method_end = fields.Date(string='Ending date') 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): def _get_asset_method_time(self):
if self.env.context.get('active_id'): 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 self.asset_method_time = asset.method_time
@api.model @api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False): def fields_view_get(self, view_id=None, view_type='form', toolbar=False,
result = super(AssetModify, self).fields_view_get(view_id, view_type, toolbar=toolbar, submenu=submenu) 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') asset_id = self.env.context.get('active_id')
active_model = self.env.context.get('active_model') active_model = self.env.context.get('active_model')
if active_model == 'account.asset.asset' and asset_id: if active_model == 'account.asset.asset' and asset_id:
asset = self.env['account.asset.asset'].browse(asset_id) asset = self.env['account.asset.asset'].browse(asset_id)
doc = etree.XML(result['arch']) 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 = doc.xpath("//field[@name='method_end']")[0]
node.set('invisible', '1') node.set('invisible', '1')
# setup_modifiers(node, result['fields']['method_end']) # 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 = doc.xpath("//field[@name='method_number']")[0]
node.set('invisible', '1') node.set('invisible', '1')
# setup_modifiers(node, result['fields']['method_number']) # 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': if 'method_end' in fields and asset.method_time == 'end':
res.update({'method_end': asset.method_end}) res.update({'method_end': asset.method_end})
if self.env.context.get('active_id'): 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 res['asset_method_time'] = active_asset.method_time
return res return res
@ -105,8 +102,12 @@ class AssetModify(models.TransientModel):
} }
asset.write(asset_vals) asset.write(asset_vals)
asset.compute_depreciation_board() asset.compute_depreciation_board()
tracked_fields = self.env['account.asset.asset'].fields_get(['method_number', 'method_period', 'method_end']) tracked_fields = self.env['account.asset.asset'].fields_get(
changes, tracking_value_ids = asset._mail_track(tracked_fields, old_values) ['method_number', 'method_period', 'method_end'])
changes, tracking_value_ids = asset._mail_track(tracked_fields,
old_values)
if changes: 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'} 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"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record model="ir.ui.view" id="asset_modify_form"> <record model="ir.ui.view" id="asset_modify_form">
<field name="name">wizard.asset.modify.form</field> <field name="name">wizard.asset.modify.form</field>
<field name="model">asset.modify</field> <field name="model">asset.modify</field>
@ -9,32 +8,35 @@
<field name="asset_method_time" invisible="1"/> <field name="asset_method_time" invisible="1"/>
<group string="Asset Durations to Modify" col="4"> <group string="Asset Durations to Modify" col="4">
<group colspan="2" col="2"> <group colspan="2" col="2">
<field name="name"/> <field name="name"/>
<field name="method_number" invisible="asset_method_time in 'end'"/> <field name="method_number"
invisible="asset_method_time in 'end'"/>
</group> </group>
<group colspan="2" col="2"> <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"/> <label for="method_period"/>
<div> <div>
<field name="method_period" class="oe_inline"/> months <field name="method_period" class="oe_inline"/>
</div> months
</div>
</group> </group>
</group> </group>
<footer> <footer>
<button name="modify" string="Modify" type="object" class="btn-primary"/> <button name="modify" string="Modify" type="object"
<button string="Cancel" class="btn-default" special="cancel"/> class="btn-primary"/>
<button string="Cancel" class="btn-default"
special="cancel"/>
</footer> </footer>
</form> </form>
</field> </field>
</record> </record>
<record id="action_asset_modify" model="ir.actions.act_window"> <record id="action_asset_modify" model="ir.actions.act_window">
<field name="name">Modify Asset</field> <field name="name">Modify Asset</field>
<field name="res_model">asset.modify</field> <field name="res_model">asset.modify</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="view_id" ref="asset_modify_form"/> <field name="view_id" ref="asset_modify_form"/>
<field name="target">new</field> <field name="target">new</field>
</record> </record>
</odoo> </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", relation="account_cash_flow_report_section_rel",
column1="main_report_id", column1="main_report_id",
column2="sub_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_from = fields.Date(string='Start Date')
date_to = fields.Date(string='End 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'), target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries'), ('all', 'All Entries'),
], string='Target Moves', required=True, default='posted') ], string='Target Moves', required=True,
default='posted')
journal_ids = fields.Many2many( journal_ids = fields.Many2many(
comodel_name='account.journal', comodel_name='account.journal',
string='Journals', string='Journals',
required=True, 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)]", domain="[('company_id', '=', company_id)]",
) )
@ -68,7 +73,8 @@ class AccountingReport(models.TransientModel):
required=True, required=True,
default=_get_account_report) default=_get_account_report)
label_filter = fields.Char(string='Column Label', 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.") " computed for the given comparison filter.")
filter_cmp = fields.Selection( filter_cmp = fields.Selection(
[('filter_no', 'No Filters'), ('filter_date', 'Date')], [('filter_no', 'No Filters'), ('filter_date', 'Date')],
@ -76,7 +82,11 @@ class AccountingReport(models.TransientModel):
date_from_cmp = fields.Date(string='Date Start') date_from_cmp = fields.Date(string='Date Start')
date_to_cmp = fields.Date(string='Date End') date_to_cmp = fields.Date(string='Date End')
debit_credit = fields.Boolean(string='Display Debit/Credit Columns', 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): def _build_comparison_context(self, data):
result = {} result = {}
@ -92,8 +102,10 @@ class AccountingReport(models.TransientModel):
def _build_contexts(self, data): def _build_contexts(self, data):
result = {} result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' '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_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False result['date_to'] = data['form']['date_to'] or False
result['strict_range'] = True if result['date_from'] else 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', 'account_report_id', 'enable_filter', 'label_filter',
'target_move'])[0]) 'target_move'])[0])
return self.env.ref( return self.env.ref(
'base_accounting_kit.action_report_cash_flow').report_action(self, 'base_accounting_kit.action_report_cash_flow').report_action(
data=data, self, data=data,
config=False) 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"> <record id="cash_flow_report_view" model="ir.ui.view">
<field name="name">Cash Flow Statement</field> <field name="name">Cash Flow Statement</field>
<field name="model">cash.flow.report</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="arch" type="xml">
<field name="company_id" position="replace"/> <field name="company_id" position="replace"/>
<field name="target_move" position="before"> <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 name="enable_filter"/>
</field> </field>
<field name="target_move" position="after"> <field name="target_move" position="after">
@ -20,12 +22,16 @@
<notebook tabpos="up" colspan="4" invisible="not enable_filter"> <notebook tabpos="up" colspan="4" invisible="not enable_filter">
<page string="Comparison" name="comparison"> <page string="Comparison" name="comparison">
<group> <group>
<field name="label_filter" required="enable_filter"/> <field name="label_filter"
required="enable_filter"/>
<field name="filter_cmp"/> <field name="filter_cmp"/>
</group> </group>
<group string="Dates" invisible="filter_cmp != 'filter_date'"> <group string="Dates"
<field name="date_from_cmp" required="filter_cmp in 'filter_date'"/> invisible="filter_cmp != 'filter_date'">
<field name="date_to_cmp" required="filter_cmp in '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> </group>
</page> </page>
</notebook> </notebook>
@ -33,7 +39,6 @@
<field name="journal_ids" position="replace"/> <field name="journal_ids" position="replace"/>
</field> </field>
</record> </record>
<record id="action_cash_flow_report" model="ir.actions.act_window"> <record id="action_cash_flow_report" model="ir.actions.act_window">
<field name="name">Cash Flow Statement</field> <field name="name">Cash Flow Statement</field>
<field name="res_model">cash.flow.report</field> <field name="res_model">cash.flow.report</field>
@ -49,5 +54,4 @@
sequence="5" sequence="5"
action="action_cash_flow_report" action="action_cash_flow_report"
parent="base_accounting_kit.account_reports_generic_statements"/> parent="base_accounting_kit.account_reports_generic_statements"/>
</odoo> </odoo>

74
base_accounting_kit/wizard/financial_report.py

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

115
base_accounting_kit/wizard/financial_report.xml

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

7
base_accounting_kit/wizard/general_ledger.py

@ -19,7 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import fields, models, _ from odoo import fields, models, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
@ -39,7 +38,8 @@ class AccountReportGeneralLedger(models.TransientModel):
relation="account_report_general_section_rel", relation="account_report_general_section_rel",
column1="main_report_id", column1="main_report_id",
column2="sub_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', initial_balance = fields.Boolean(string='Include Initial Balances',
help='If you selected date, this field ' help='If you selected date, this field '
'allow you to add a row to display ' 'allow you to add a row to display '
@ -47,7 +47,8 @@ class AccountReportGeneralLedger(models.TransientModel):
'that precedes the filter you\'ve ' 'that precedes the filter you\'ve '
'set.') 'set.')
sortby = fields.Selection( 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') string='Sort by', required=True, default='sort_date')
journal_ids = fields.Many2many('account.journal', journal_ids = fields.Many2many('account.journal',
'account_report_general_ledger_journal_rel', '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"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>Z
<record id="account_report_general_ledger_view" model="ir.ui.view"> <record id="account_report_general_ledger_view" model="ir.ui.view">
<field name="name">General Ledger</field> <field name="name">General Ledger</field>
<field name="model">account.report.general.ledger</field> <field name="model">account.report.general.ledger</field>
@ -16,7 +15,6 @@
</data> </data>
</field> </field>
</record> </record>
<record id="action_account_general_ledger_menu" model="ir.actions.act_window"> <record id="action_account_general_ledger_menu" model="ir.actions.act_window">
<field name="name">General Ledger</field> <field name="name">General Ledger</field>
<field name="type">ir.actions.act_window</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_model_id" ref="account.model_account_account"/>
<field name="binding_type">report</field> <field name="binding_type">report</field>
</record> </record>
<menuitem <menuitem
id="menu_general_ledger" id="menu_general_ledger"
name="General Ledger" name="General Ledger"
@ -36,5 +33,4 @@
action="action_account_general_ledger_menu" action="action_account_general_ledger_menu"
groups="account.group_account_user,account.group_account_manager" groups="account.group_account_user,account.group_account_manager"
/> />
</odoo> </odoo>

4
base_accounting_kit/wizard/journal_audit.py

@ -19,7 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import fields, models from odoo import fields, models
@ -38,7 +37,8 @@ class AccountPrintJournal(models.TransientModel):
relation="account_common_print_report_section_rel", relation="account_common_print_report_section_rel",
column1="main_report_id", column1="main_report_id",
column2="sub_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( sort_selection = fields.Selection(
[('date', 'Date'), ('move_name', 'Journal Entry Number')], [('date', 'Date'), ('move_name', 'Journal Entry Number')],
'Entries Sorted by', required=True, default='move_name') '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"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record id="account_report_print_journal_view" model="ir.ui.view"> <record id="account_report_print_journal_view" model="ir.ui.view">
<field name="name">Journals Audit</field> <field name="name">Journals Audit</field>
<field name="model">account.print.journal</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"> <field name="arch" type="xml">
<data> <data>
<xpath expr="//field[@name='target_move']" position="after"> <xpath expr="//field[@name='target_move']" position="after">
<field name="amount_currency" groups="base.group_multi_currency"/> <field name="amount_currency"
<field name="sort_selection" widget="radio"/> groups="base.group_multi_currency"/>
<newline/> <field name="sort_selection" widget="radio"/>
</xpath> <newline/>
</data> </xpath>
</data>
</field> </field>
</record> </record>
<record id="action_account_print_journal_menu"
<record id="action_account_print_journal_menu" model="ir.actions.act_window"> model="ir.actions.act_window">
<field name="name">Journals Audit</field> <field name="name">Journals Audit</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">account.print.journal</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="view_id" ref="account_report_print_journal_view"/>
<field name="target">new</field> <field name="target">new</field>
</record> </record>
<menuitem id="menu_print_journal" <menuitem id="menu_print_journal"
name="Journals Audit" name="Journals Audit"
sequence="9" sequence="9"
action="action_account_print_journal_menu" action="action_account_print_journal_menu"
parent="base_accounting_kit.account_reports_audit" parent="base_accounting_kit.account_reports_audit"
groups="account.group_account_manager,account.group_account_user"/> groups="account.group_account_manager,account.group_account_user"/>
</odoo> </odoo>

13
base_accounting_kit/wizard/partner_ledger.py

@ -19,7 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import fields, models from odoo import fields, models
@ -38,11 +37,15 @@ class AccountPartnerLedger(models.TransientModel):
relation="account_report_partner_section_rel", relation="account_report_partner_section_rel",
column1="main_report_id", column1="main_report_id",
column2="sub_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", amount_currency = fields.Boolean("With Currency",
help="It adds the currency column on report if the " help="It adds the currency column on"
"currency differs from the company currency.") " report if the "
reconciled = fields.Boolean('Reconciled Entries') "currency differs from the "
"company currency.")
reconciled = fields.Boolean(string='Reconciled Entries')
def _print_report(self, data): def _print_report(self, data):
data = self.pre_print_report(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"> <record id="account_report_partner_ledger_view" model="ir.ui.view">
<field name="name">Partner Ledger</field> <field name="name">Partner Ledger</field>
<field name="model">account.report.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"> <field name="arch" type="xml">
<data> <data>
<xpath expr="//field[@name='target_move']" position="after"> <xpath expr="//field[@name='target_move']" position="after">
<field name="result_selection"/> <field name="result_selection"/>
<field name="amount_currency" groups="base.group_multi_currency"/> <field name="amount_currency"
groups="base.group_multi_currency"/>
<newline/> <newline/>
<field name="reconciled"/> <field name="reconciled"/>
<newline/> <newline/>
@ -16,7 +18,6 @@
</data> </data>
</field> </field>
</record> </record>
<record id="action_partner_leadger" model="ir.actions.act_window"> <record id="action_partner_leadger" model="ir.actions.act_window">
<field name="name">Partner Ledger</field> <field name="name">Partner Ledger</field>
<field name="res_model">account.report.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="view_id" ref="account_report_partner_ledger_view"/>
<field name="target">new</field> <field name="target">new</field>
</record> </record>
<menuitem name="Partner Ledger" <menuitem name="Partner Ledger"
id="menu_partner_ledger" sequence="1" id="menu_partner_ledger" sequence="1"
parent="base_accounting_kit.account_reports_partner" 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/>. # 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 from odoo.tools.misc import get_lang
@ -38,7 +38,10 @@ class AccountTaxReport(models.TransientModel):
relation="account_tax_report_section_rel", relation="account_tax_report_section_rel",
column1="main_report_id", column1="main_report_id",
column2="sub_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", name = fields.Char(string="Tax Report", default="Tax Report",
required=True, translate=True) required=True, translate=True)
date_from = fields.Date(string='Start Date') date_from = fields.Date(string='Start Date')
@ -47,17 +50,21 @@ class AccountTaxReport(models.TransientModel):
comodel_name='account.journal', comodel_name='account.journal',
string='Journals', string='Journals',
required=True, 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)]", domain="[('company_id', '=', company_id)]",
) )
target_move = fields.Selection([('posted', 'All Posted Entries'), target_move = fields.Selection([('posted', 'All Posted Entries'),
('all', 'All Entries'), ('all', 'All Entries'),
], string='Target Moves', required=True, default='posted') ], string='Target Moves', required=True,
default='posted')
def _build_contexts(self, data): def _build_contexts(self, data):
result = {} result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False result['journal_ids'] = 'journal_ids' in data['form'] and data['form'][
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' '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_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False result['date_to'] = data['form']['date_to'] or False
result['strict_range'] = True if result['date_from'] else False result['strict_range'] = True if result['date_from'] else False
@ -69,9 +76,12 @@ class AccountTaxReport(models.TransientModel):
data = {} data = {}
data['ids'] = self.env.context.get('active_ids', []) data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu') 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) 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) return self.with_context(discard_logo_check=True)._print_report(data)
def pre_print_report(self, 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"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record id="accounting_tax_report_view" model="ir.ui.view"> <record id="accounting_tax_report_view" model="ir.ui.view">
<field name="name">Tax Reports</field> <field name="name">Tax Reports</field>
<field name="model">kit.account.tax.report</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"> <field name="arch" type="xml">
<data> <data>
<field name="journal_ids" position="replace"/> <field name="journal_ids" position="replace"/>
@ -17,7 +17,6 @@
</data> </data>
</field> </field>
</record> </record>
<record id="action_account_tax_report" model="ir.actions.act_window"> <record id="action_account_tax_report" model="ir.actions.act_window">
<field name="name">Tax Reports</field> <field name="name">Tax Reports</field>
<field name="res_model">kit.account.tax.report</field> <field name="res_model">kit.account.tax.report</field>
@ -27,12 +26,10 @@
<field name="context">{}</field> <field name="context">{}</field>
<field name="target">new</field> <field name="target">new</field>
</record> </record>
<menuitem id="menu_tax_report" <menuitem id="menu_tax_report"
name="Tax Report" name="Tax Report"
sequence="8" sequence="8"
action="action_account_tax_report" action="action_account_tax_report"
parent="base_accounting_kit.account_reports_audit" parent="base_accounting_kit.account_reports_audit"
groups="account.group_account_manager,account.group_account_user"/> groups="account.group_account_manager,account.group_account_user"/>
</odoo> </odoo>

9
base_accounting_kit/wizard/trial_balance.py

@ -19,8 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from odoo import api, fields, models, _
from odoo import fields, models, api ,_
class AccountBalanceReport(models.TransientModel): class AccountBalanceReport(models.TransientModel):
@ -38,7 +37,8 @@ class AccountBalanceReport(models.TransientModel):
relation="account_balance_report_section_rel", relation="account_balance_report_section_rel",
column1="sub_report_id", column1="sub_report_id",
column2="main_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', journal_ids = fields.Many2many('account.journal',
'account_balance_report_journal_rel', 'account_balance_report_journal_rel',
'account_id', 'journal_id', 'account_id', 'journal_id',
@ -48,7 +48,8 @@ class AccountBalanceReport(models.TransientModel):
@api.model @api.model
def _get_report_name(self): def _get_report_name(self):
period_id = self._get_selected_period_id() 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): def _print_report(self, data):
data = self.pre_print_report(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"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record id="account_report_balance_view" model="ir.ui.view"> <record id="account_report_balance_view" model="ir.ui.view">
<field name="name">Trial Balance</field> <field name="name">Trial Balance</field>
<field name="model">account.balance.report</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"> <field name="arch" type="xml">
<data> <data>
<field name="journal_ids" position="replace"/> <field name="journal_ids" position="replace"/>
@ -15,7 +15,6 @@
</data> </data>
</field> </field>
</record> </record>
<record id="action_account_balance_menu" model="ir.actions.act_window"> <record id="action_account_balance_menu" model="ir.actions.act_window">
<field name="name">Trial Balance</field> <field name="name">Trial Balance</field>
<field name="res_model">account.balance.report</field> <field name="res_model">account.balance.report</field>
@ -25,11 +24,9 @@
<field name="target">new</field> <field name="target">new</field>
<field name="binding_model_id" ref="account.model_account_account"/> <field name="binding_model_id" ref="account.model_account_account"/>
</record> </record>
<menuitem id="menu_Balance_report" <menuitem id="menu_Balance_report"
name="Trial Balance" name="Trial Balance"
sequence="7" sequence="7"
action="action_account_balance_menu" action="action_account_balance_menu"
parent="base_accounting_kit.account_reports_audit"/> parent="base_accounting_kit.account_reports_audit"/>
</odoo> </odoo>

Loading…
Cancel
Save