From def8817d727a392d76f18b654ffa01be99135ace Mon Sep 17 00:00:00 2001
From: "Benjamin Frantzen (bfr)"
Date: Thu, 5 Mar 2020 13:16:43 +0000
Subject: [PATCH] [IMP] accounting : several misc improvements
- open accounts in a full view instead of a modal
- ability to reverse entries at their own accounting date
- don't create draft closing entries and reminder if no configuration for tax groups
- reordered account menus
- improved invoice form view
Task ID : 2209497
closes odoo/odoo#48355
Related: odoo/upgrade#1001
Related: odoo/enterprise#9485
Signed-off-by: oco-odoo
---
addons/account/__manifest__.py | 2 +-
addons/account/models/account.py | 8 +-
.../report/account_invoice_report_view.xml | 2 -
.../account/views/account_analytic_view.xml | 25 ----
.../views/account_cash_rounding_view.xml | 3 -
.../account/views/account_incoterms_view.xml | 2 -
.../views/account_journal_dashboard_view.xml | 1 -
addons/account/views/account_menuitem.xml | 54 ++++++-
addons/account/views/account_move_views.xml | 141 ++++--------------
addons/account/views/account_payment_view.xml | 3 -
.../views/account_tax_report_views.xml | 2 -
addons/account/views/account_view.xml | 30 ----
addons/account/views/partner_view.xml | 5 -
.../views/res_config_settings_views.xml | 2 -
addons/account/views/tax_adjustments.xml | 1 -
.../account/wizard/account_move_reversal.py | 13 +-
.../wizard/account_move_reversal_view.xml | 5 +-
.../views/account_analytic_default_view.xml | 4 +-
18 files changed, 94 insertions(+), 209 deletions(-)
diff --git a/addons/account/__manifest__.py b/addons/account/__manifest__.py
index 7c3a6b642dd..203a93617cb 100644
--- a/addons/account/__manifest__.py
+++ b/addons/account/__manifest__.py
@@ -22,7 +22,6 @@ You could use this simplified accounting in case you work with an (external) acc
'data/data_account_type.xml',
'data/account_data.xml',
'data/digest_data.xml',
- 'views/account_menuitem.xml',
'views/account_payment_view.xml',
'wizard/account_accrual_accounting_view.xml',
'wizard/account_unreconcile_view.xml',
@@ -66,6 +65,7 @@ You could use this simplified accounting in case you work with an (external) acc
'report/account_hash_integrity_templates.xml',
'wizard/account_transfer_wizard.xml',
'views/res_currency.xml',
+ 'views/account_menuitem.xml',
],
'demo': [
'demo/account_demo.xml',
diff --git a/addons/account/models/account.py b/addons/account/models/account.py
index c8365d3f535..011b193e12f 100644
--- a/addons/account/models/account.py
+++ b/addons/account/models/account.py
@@ -715,7 +715,6 @@ class AccountAccount(models.Model):
'view_mode': 'form',
'res_model': 'account.account',
'res_id': self.id,
- 'target': 'new',
}
def action_duplicate_accounts(self):
@@ -1430,6 +1429,13 @@ class AccountTaxGroup(models.Model):
property_tax_receivable_account_id = fields.Many2one('account.account', company_dependent=True, string='Tax current account (receivable)')
property_advance_tax_payment_account_id = fields.Many2one('account.account', company_dependent=True, string='Advance Tax payment account')
+ def _any_is_configured(self, company_id):
+ domain = expression.OR([[('property_tax_payable_account_id', '!=', False)],
+ [('property_tax_receivable_account_id', '!=', False)],
+ [('property_advance_tax_payment_account_id', '!=', False)]])
+ group_with_config = self.with_company(company_id).search_count(domain)
+ return group_with_config > 0
+
class AccountTax(models.Model):
_name = 'account.tax'
diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml
index ce9f4b59310..e8851a8ad6c 100644
--- a/addons/account/report/account_invoice_report_view.xml
+++ b/addons/account/report/account_invoice_report_view.xml
@@ -125,7 +125,5 @@
From this report, you can have an overview of the amount invoiced to your customers. The search tool can also be used to personalise your Invoices reports and so, match this analysis to your needs.
-
-
diff --git a/addons/account/views/account_analytic_view.xml b/addons/account/views/account_analytic_view.xml
index 8e3dd456e13..c91e6070079 100644
--- a/addons/account/views/account_analytic_view.xml
+++ b/addons/account/views/account_analytic_view.xml
@@ -69,30 +69,5 @@
-
-
-
-
-
-
-
diff --git a/addons/account/views/account_cash_rounding_view.xml b/addons/account/views/account_cash_rounding_view.xml
index e6bae7df5c5..de794b64b5d 100644
--- a/addons/account/views/account_cash_rounding_view.xml
+++ b/addons/account/views/account_cash_rounding_view.xml
@@ -58,8 +58,5 @@
-
-
diff --git a/addons/account/views/account_incoterms_view.xml b/addons/account/views/account_incoterms_view.xml
index ddb8b637dbe..9e33bae573a 100644
--- a/addons/account/views/account_incoterms_view.xml
+++ b/addons/account/views/account_incoterms_view.xml
@@ -57,7 +57,5 @@
-
diff --git a/addons/account/views/account_journal_dashboard_view.xml b/addons/account/views/account_journal_dashboard_view.xml
index 8b31b018e72..c15fe61be4b 100644
--- a/addons/account/views/account_journal_dashboard_view.xml
+++ b/addons/account/views/account_journal_dashboard_view.xml
@@ -372,5 +372,4 @@
-
diff --git a/addons/account/views/account_menuitem.xml b/addons/account/views/account_menuitem.xml
index 2c8b746ba1f..8375abc214e 100644
--- a/addons/account/views/account_menuitem.xml
+++ b/addons/account/views/account_menuitem.xml
@@ -9,30 +9,70 @@
web_icon="account,static/description/icon.png"
sequence="40"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml
index 5778e008d34..0ea18cd3a3e 100644
--- a/addons/account/views/account_move_views.xml
+++ b/addons/account/views/account_move_views.xml
@@ -608,7 +608,13 @@
options='{"always_reload": True, "no_quick_create": True}'
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}"/>
-
+
+
+
+
+
-
-
- or
+ attrs="{'invisible': [('invoice_payment_term_id', '!=', False)]}"/>
+ or
+
+
+
@@ -977,8 +988,13 @@
name="sale_info_group"
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))]}">
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml
index 60765496d67..337cfde0f8a 100644
--- a/addons/account/views/account_payment_view.xml
+++ b/addons/account/views/account_payment_view.xml
@@ -316,9 +316,6 @@
-
-
-
account.payment.invoice.form
account.payment
diff --git a/addons/account/views/account_tax_report_views.xml b/addons/account/views/account_tax_report_views.xml
index b09f1040655..e45fc83f89b 100644
--- a/addons/account/views/account_tax_report_views.xml
+++ b/addons/account/views/account_tax_report_views.xml
@@ -118,7 +118,5 @@
-
-
diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml
index 9efba01c734..5d7691b4097 100644
--- a/addons/account/views/account_view.xml
+++ b/addons/account/views/account_view.xml
@@ -146,8 +146,6 @@
{'search_default_activeacc': True}
-
-
Duplicate
@@ -370,8 +368,6 @@ action = model.setting_init_bank_account_action()
-
-
Journals
account.journal
@@ -389,7 +385,6 @@ action = model.setting_init_bank_account_action()
-
Journal Groups
@@ -402,7 +397,6 @@ action = model.setting_init_bank_account_action()
-
@@ -984,15 +978,6 @@ action = model.setting_init_bank_account_action()
-
-
-
@@ -1229,7 +1214,6 @@ action = model.setting_init_bank_account_action()
-
@@ -1403,8 +1387,6 @@ action = model.setting_init_bank_account_action()
-
@@ -1740,10 +1722,6 @@ action = model.setting_init_bank_account_action()
-
-
product.template.tree
product.template
@@ -1787,14 +1765,6 @@ action = model.setting_init_bank_account_action()
-
-
-
-
-
-
account.group.form
account.group
diff --git a/addons/account/views/partner_view.xml b/addons/account/views/partner_view.xml
index 84319c68130..98e968e18c5 100644
--- a/addons/account/views/partner_view.xml
+++ b/addons/account/views/partner_view.xml
@@ -135,11 +135,6 @@
-
-
diff --git a/addons/account/views/res_config_settings_views.xml b/addons/account/views/res_config_settings_views.xml
index e8f0143a44a..9e2b8869f3c 100644
--- a/addons/account/views/res_config_settings_views.xml
+++ b/addons/account/views/res_config_settings_views.xml
@@ -588,7 +588,5 @@
{'module' : 'account'}
-
diff --git a/addons/account/views/tax_adjustments.xml b/addons/account/views/tax_adjustments.xml
index 43555087d80..e1c8f41e4a1 100644
--- a/addons/account/views/tax_adjustments.xml
+++ b/addons/account/views/tax_adjustments.xml
@@ -6,5 +6,4 @@
form
new
-
diff --git a/addons/account/wizard/account_move_reversal.py b/addons/account/wizard/account_move_reversal.py
index 836aad6e4ab..e7c51be9aaf 100644
--- a/addons/account/wizard/account_move_reversal.py
+++ b/addons/account/wizard/account_move_reversal.py
@@ -14,7 +14,11 @@ class AccountMoveReversal(models.TransientModel):
move_ids = fields.Many2many('account.move', 'account_move_reversal_move', 'reversal_id', 'move_id', domain=[('state', '=', 'posted')])
new_move_ids = fields.Many2many('account.move', 'account_move_reversal_new_move', 'reversal_id', 'new_move_id')
- date = fields.Date(string='Reversal date', default=fields.Date.context_today, required=True)
+ date_mode = fields.Selection(selection=[
+ ('custom', 'Specific'),
+ ('entry', 'Journal Entry Date')
+ ], required=True, default='custom')
+ date = fields.Date(string='Reversal date', default=fields.Date.context_today)
reason = fields.Char(string='Reason')
refund_method = fields.Selection(selection=[
('refund', 'Partial Refund'),
@@ -51,14 +55,15 @@ class AccountMoveReversal(models.TransientModel):
record.move_type = move_ids.move_type if len(move_ids) == 1 else (any(move.move_type in ('in_invoice', 'out_invoice') for move in move_ids) and 'some_invoice' or False)
def _prepare_default_reversal(self, move):
+ reverse_date = self.date if self.date_mode == 'custom' else move.date
return {
'ref': _('Reversal of: %s, %s') % (move.name, self.reason) if self.reason else _('Reversal of: %s') % (move.name),
- 'date': self.date or move.date,
+ 'date': reverse_date,
'invoice_date': move.is_invoice(include_receipts=True) and (self.date or move.date) or False,
'journal_id': self.journal_id and self.journal_id.id or move.journal_id.id,
'invoice_payment_term_id': None,
- 'auto_post': True if self.date > fields.Date.context_today(self) else False,
'invoice_user_id': move.invoice_user_id.id,
+ 'auto_post': True if reverse_date > fields.Date.context_today(self) else False,
}
def reverse_moves(self):
@@ -81,7 +86,7 @@ class AccountMoveReversal(models.TransientModel):
moves_vals_list = []
for move in moves.with_context(include_business_fields=True):
moves_vals_list.append(move.copy_data({
- 'date': self.date or move.date,
+ 'date': self.date if self.date_mode == 'custom' else move.date,
})[0])
new_moves = self.env['account.move'].create(moves_vals_list)
elif self.refund_method == 'refund':
diff --git a/addons/account/wizard/account_move_reversal_view.xml b/addons/account/wizard/account_move_reversal_view.xml
index 674348ec6ca..6f47a8b1cbc 100644
--- a/addons/account/wizard/account_move_reversal_view.xml
+++ b/addons/account/wizard/account_move_reversal_view.xml
@@ -31,11 +31,12 @@
-
-
+
+
+