summaryrefslogtreecommitdiff
path: root/addons/account
diff options
context:
space:
mode:
authorFlorian Gilbert <flg@odoo.com>2019-10-11 14:04:44 +0000
committerFlorian Gilbert <flg@odoo.com>2019-12-04 13:47:28 +0000
commited26e9eafa31dd8bcaea491b2a6dcd1728a90bd0 (patch)
tree76e502d54192ef1c75d0704216ac844096e262e6 /addons/account
parent51d020e5fa82ca4d935fe2420711b8365b5e5621 (diff)
[IMP] account: Various usability improvements
List of improvements: Invoice/Bill - Hide "untaxed amount" section when there is no tax. - Remove tooltips for tax groups field. - Remove invoice_partner_icon and set this icon in "Vendor" (in a list view) Chart of Accounts - Same views for config bar and regulare one - By default don't show deprecated accounts and add filter to display them. - Add some optional fields in list view (taxes, tags, ...) Dashboard opening balance wizard - The opening move entry date equals to the opening date - 1 day. Bank Statements - Set default order for the list view (by date desc and name desc) Tax report configuration: Add 3 new columns for the list view (country_id, code, tag_name) Add 4 new searchs (name, tag_name, code, country_id) Task ID: 2048225 closes odoo/odoo#38694 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Diffstat (limited to 'addons/account')
-rw-r--r--addons/account/models/account.py4
-rw-r--r--addons/account/models/account_bank_statement.py2
-rw-r--r--addons/account/models/account_move.py12
-rw-r--r--addons/account/models/company.py7
-rw-r--r--addons/account/views/account_move_views.xml9
-rw-r--r--addons/account/views/account_tax_report_views.xml1
-rw-r--r--addons/account/views/account_view.xml9
-rw-r--r--addons/account/wizard/setup_wizards.py7
-rw-r--r--addons/account/wizard/setup_wizards_view.xml5
9 files changed, 31 insertions, 25 deletions
diff --git a/addons/account/models/account.py b/addons/account/models/account.py
index b4b5e8f6aec..2d684ff14c2 100644
--- a/addons/account/models/account.py
+++ b/addons/account/models/account.py
@@ -397,10 +397,10 @@ class AccountAccount(models.Model):
self._cr.execute("""
SELECT aml.id
FROM account_move_line aml
- WHERE aml.account_id in (%s)
+ WHERE aml.account_id in %s
AND EXISTS (SELECT 1 FROM account_account_account_journal_rel WHERE account_account_id = aml.account_id)
AND NOT EXISTS (SELECT 1 FROM account_account_account_journal_rel WHERE account_account_id = aml.account_id AND account_journal_id = aml.journal_id)
- """, tuple(self.ids))
+ """, [tuple(self.ids)])
ids = self._cr.fetchall()
if ids:
raise ValidationError(_('Some journal items already exist with this account but in other journals than the allowed ones.'))
diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py
index 454ef2c5331..61f392b0892 100644
--- a/addons/account/models/account_bank_statement.py
+++ b/addons/account/models/account_bank_statement.py
@@ -219,7 +219,7 @@ class AccountBankStatement(models.Model):
_name = "account.bank.statement"
_description = "Bank Statement"
- _order = "date desc, id desc"
+ _order = "date desc, name desc, id desc"
_inherit = ['mail.thread']
name = fields.Char(string='Reference', states={'open': [('readonly', False)]}, copy=False, readonly=True)
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index bb20f043e8b..61e4cd87d96 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -158,7 +158,8 @@ class AccountMove(models.Model):
amount_residual_signed = fields.Monetary(string='Amount Due Signed', store=True,
compute='_compute_amount', currency_field='company_currency_id')
amount_by_group = fields.Binary(string="Tax amount by group",
- compute='_compute_invoice_taxes_by_group')
+ compute='_compute_invoice_taxes_by_group',
+ help='Edit Tax amounts if you encounter rouding issues.')
# ==== Cash basis feature fields ====
tax_cash_basis_rec_id = fields.Many2one(
@@ -236,7 +237,6 @@ class AccountMove(models.Model):
help="Auto-complete from a past bill.")
invoice_source_email = fields.Char(string='Source Email', tracking=True)
invoice_partner_display_name = fields.Char(compute='_compute_invoice_partner_display_info', store=True)
- invoice_partner_icon = fields.Char(compute='_compute_invoice_partner_display_info', store=False, compute_sudo=True)
# ==== Cash rounding fields ====
invoice_cash_rounding_id = fields.Many2one('account.cash.rounding', string='Cash Rounding Method',
@@ -1088,13 +1088,9 @@ class AccountMove(models.Model):
vendor_display_name = move.partner_id.name
if not vendor_display_name:
if move.invoice_source_email:
- vendor_display_name = _('From: ') + move.invoice_source_email
- move.invoice_partner_icon = '@'
+ vendor_display_name = _('@From: ') + move.invoice_source_email
else:
- vendor_display_name = _('Created by: %s') % (move.sudo().create_uid.name or self.env.user.name)
- move.invoice_partner_icon = '#'
- else:
- move.invoice_partner_icon = False
+ vendor_display_name = _('#Created by: %s') % (move.sudo().create_uid.name or self.env.user.name)
move.invoice_partner_display_name = vendor_display_name
@api.depends('state', 'journal_id', 'invoice_date')
diff --git a/addons/account/models/company.py b/addons/account/models/company.py
index bfe981f362c..c7ca7fba0d1 100644
--- a/addons/account/models/company.py
+++ b/addons/account/models/company.py
@@ -79,7 +79,7 @@ class ResCompany(models.Model):
#Fields of the setup step for opening move
account_opening_move_id = fields.Many2one(string='Opening Journal Entry', comodel_name='account.move', help="The journal entry containing the initial balance of all this company's accounts.")
account_opening_journal_id = fields.Many2one(string='Opening Journal', comodel_name='account.journal', related='account_opening_move_id.journal_id', help="Journal where the opening entry of this company's accounting has been posted.", readonly=False)
- account_opening_date = fields.Date(string='Opening Date', related='account_opening_move_id.date', help="Date at which the opening entry of this company's accounting has been posted.", readonly=False)
+ account_opening_date = fields.Date(string='Opening Entry', default=lambda self: fields.Date.today().replace(month=1, day=1), required=True, help="That is the date of the opening entry.")
# Fields marking the completion of a setup step
# YTI FIXME : The selection should be factorize as a static list in base, like ONBOARDING_STEP_STATES
@@ -331,10 +331,7 @@ class ResCompany(models.Model):
if not default_journal:
raise UserError(_("Please install a chart of accounts or create a miscellaneous journal before proceeding."))
- today = datetime.today().date()
- opening_date = today.replace(month=int(self.fiscalyear_last_month), day=self.fiscalyear_last_day) + timedelta(days=1)
- if opening_date > today:
- opening_date = opening_date + relativedelta(years=-1)
+ opening_date = self.account_opening_date - timedelta(days=1)
self.account_opening_move_id = self.env['account.move'].create({
'ref': _('Opening Journal Entry'),
diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml
index d53179abd4a..a27c144afa0 100644
--- a/addons/account/views/account_move_views.xml
+++ b/addons/account/views/account_move_views.xml
@@ -391,7 +391,6 @@
<field name="name"/>
<field name="partner_id" invisible="1"/>
<field name="invoice_source_email" invisible="1"/>
- <field name="invoice_partner_icon" string=" "/>
<field name="invoice_partner_display_name" invisible="context.get('default_type') not in ('in_invoice', 'in_refund','in_receipt')" groups="base.group_user" string="Vendor" />
<field name="invoice_partner_display_name" invisible="context.get('default_type') not in ('out_invoice', 'out_refund','out_receipt')" groups="base.group_user" string="Customer" />
<field name="invoice_date" optional="show" invisible="context.get('default_type') not in ('in_invoice', 'in_refund','in_receipt')" string="Bill Date"/>
@@ -825,9 +824,11 @@
<group class="oe_right">
<group class="oe_subtotal_footer"
attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}">
- <field name="amount_untaxed"/>
- <field name="amount_by_group" widget="tax-group-custom-field" nolabel="1" colspan="2"/>
- <field name="amount_total" class="oe_subtotal_footer_separator"/>
+ <field name="amount_tax" invisible="1"/>
+ <field name="amount_untaxed" attrs="{'invisible': [('amount_tax', '=', 0)]}"/>
+ <field name="amount_by_group" widget="tax-group-custom-field" nolabel="1" colspan="2" attrs="{'invisible': [('amount_tax', '=', 0)]}"/>
+ <field name="amount_total" attrs="{'invisible': [('amount_tax', '!=', 0)]}"/>
+ <field name="amount_total" class="oe_subtotal_footer_separator" attrs="{'invisible': [('amount_tax', '=', 0)]}"/>
<field name="invoice_payments_widget" colspan="2" nolabel="1" widget="payment"/>
<field name="amount_residual" class="oe_subtotal_footer_separator" attrs="{'invisible': [('state', '=', 'draft')]}"/>
</group>
diff --git a/addons/account/views/account_tax_report_views.xml b/addons/account/views/account_tax_report_views.xml
index 49ead71fc0f..b09f1040655 100644
--- a/addons/account/views/account_tax_report_views.xml
+++ b/addons/account/views/account_tax_report_views.xml
@@ -118,7 +118,6 @@
<field name="view_id" ref="account_tax_report_tree"/>
</record>
-
<menuitem id="menu_configure_tax_report" name="Tax Report" parent="account.account_management_menu" action="account.action_configure_tax_report" groups="base.group_no_one"/>
</data>
diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml
index 0968754104d..04718071a24 100644
--- a/addons/account/views/account_view.xml
+++ b/addons/account/views/account_view.xml
@@ -50,12 +50,17 @@
<field name="name">account.account.list</field>
<field name="model">account.account</field>
<field name="arch" type="xml">
- <tree string="Chart of accounts">
+ <tree editable="top" create="1" delete="1" multi_edit="1" string="Chart of accounts">
<field name="code"/>
<field name="name"/>
<field name="user_type_id"/>
+ <field name="reconcile" widget="boolean_toggle"/>
+ <field name="tax_ids" optional="hide" widget="many2many_tags"/>
+ <field name="tag_ids" optional="hide" widget="many2many_tags"/>
+ <field name="allowed_journal_ids" optional="hide" widget="many2many_tags"/>
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
+ <button name="action_read_account" type="object" icon="fa-expand" title="Open" aria-label="Open" class="float-right"/>
</tree>
</field>
</record>
@@ -104,6 +109,7 @@
<filter string="Expenses" name="expensesacc" domain="[('internal_group','=', 'expense')]"/>
<separator/>
<filter string="Account with Entries" name="used" domain="[('used', '=', True)]"/>
+ <filter string="Active Account" name="activeacc" domain="[('deprecated', '=', False)]"/>
<separator/>
<field name="user_type_id"/>
<group expand="0" string="Group By">
@@ -134,6 +140,7 @@
to disclose a certain amount of information.
</p>
</field>
+ <field name="context">{'search_default_activeacc': True}</field>
</record>
<menuitem action="action_account_form" id="menu_action_account_form" parent="account.account_account_menu" groups="account.group_account_user" sequence="1"/>
diff --git a/addons/account/wizard/setup_wizards.py b/addons/account/wizard/setup_wizards.py
index e54f38a0ea8..1925d5f9750 100644
--- a/addons/account/wizard/setup_wizards.py
+++ b/addons/account/wizard/setup_wizards.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from datetime import date
+from datetime import date, timedelta
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
@@ -47,9 +47,12 @@ class FinancialYearOpeningWizard(models.TransientModel):
# one value at a time... so it is likely to fail.
for wiz in self:
wiz.company_id.write({
- 'account_opening_date': vals.get('opening_date') or wiz.company_id.account_opening_date,
'fiscalyear_last_day': vals.get('fiscalyear_last_day') or wiz.company_id.fiscalyear_last_day,
'fiscalyear_last_month': vals.get('fiscalyear_last_month') or wiz.company_id.fiscalyear_last_month,
+ 'account_opening_date': vals.get('opening_date'),
+ })
+ wiz.company_id.account_opening_move_id.write({
+ 'date': fields.Date.from_string(vals.get('opening_date')) - timedelta(days=1),
})
vals.pop('opening_date', None)
vals.pop('fiscalyear_last_day', None)
diff --git a/addons/account/wizard/setup_wizards_view.xml b/addons/account/wizard/setup_wizards_view.xml
index 9ae9c8d00da..8e6c02f1e28 100644
--- a/addons/account/wizard/setup_wizards_view.xml
+++ b/addons/account/wizard/setup_wizards_view.xml
@@ -73,13 +73,16 @@
<field name="name">account.setup.opening.move.line.tree</field>
<field name="model">account.account</field>
<field name="arch" type="xml">
- <tree editable="top" create="1" delete="1" decoration-muted="opening_debit == 0 and opening_credit == 0">
+ <tree editable="top" create="1" delete="1" multi_edit="1" decoration-muted="opening_debit == 0 and opening_credit == 0">
<field name="code"/>
<field name="name"/>
<field name="user_type_id"/>
<field name="reconcile" widget="boolean_toggle"/>
<field name="opening_debit"/>
<field name="opening_credit"/>
+ <field name="tax_ids" optional="hide" widget="many2many_tags"/>
+ <field name="tag_ids" optional="hide" widget="many2many_tags"/>
+ <field name="allowed_journal_ids" optional="hide" widget="many2many_tags"/>
<button name="action_read_account" type="object" icon="fa-expand" title="Open" aria-label="Open" class="float-right"/>
</tree>
</field>