summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwilliam <wan@odoo.com>2020-06-11 09:19:14 +0000
committerwilliam <wan@odoo.com>2020-06-12 13:28:40 +0000
commit394e9fa4aaafbb518b95f03d12a487e9759893a1 (patch)
tree20632c6f680234a21e43991d14f6b47d941c4537
parent2d10bcb9b0064f6a0e1320b63d9c474bbd58ad78 (diff)
[IMP] account: small improvements before 13.4
Task 2274998 1/ In the accounting dashboard, maximum one primary button per box 2/ In all boxes : "Sample data" must be removed. (Too obvious) 3/ In the configuration of Accounting Periods * Opening date and fiscal year end must be on a same line. * Remove the button "Configure your tax accounts". 4/ "Configure your tax accounts" is still available in the settings. * But also make it available while doing the Tax Report Entry, if an error message pops up. 5/ Chart of Account (list view) * Captital D for opening Debit/Credit * Rename "Name" into "Account Name" 6/ While génerating an Invoice * Rename "Post" button into "Confirm" * Check that the incremental number is added as a suffix of the name of the bill ; not as a prefix 7/ Vendor Bill (list view) * Status must appear as a Tag ; like it is already done in "Payment State" * Rename "Payment State" into "Payment Status" 8/ Bank journals * On the bank journal level, if bank feed is set to synchronization, then while selecting that journal from the accounting dashboard, then directly go to the statement lines rather than the bank statement itself. * In the bank statement's account moves, remove the button duplicate. It is enough to have it in the actions. closes odoo/odoo#52818 Related: odoo/enterprise#11081 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
-rw-r--r--addons/account/models/account_account.py35
-rw-r--r--addons/account/models/account_journal_dashboard.py31
-rw-r--r--addons/account/models/account_move.py2
-rw-r--r--addons/account/models/sequence_mixin.py4
-rw-r--r--addons/account/static/src/scss/account_journal_dashboard.scss4
-rw-r--r--addons/account/tests/test_account_move_entry.py2
-rw-r--r--addons/account/views/account_account_views.xml2
-rw-r--r--addons/account/views/account_bank_statement_views.xml14
-rw-r--r--addons/account/views/account_journal_dashboard_view.xml21
-rw-r--r--addons/account/views/account_move_views.xml12
-rw-r--r--addons/account/wizard/setup_wizards_view.xml8
-rw-r--r--odoo/addons/test_main_flows/static/tests/tours/main_flow.js6
12 files changed, 79 insertions, 62 deletions
diff --git a/addons/account/models/account_account.py b/addons/account/models/account_account.py
index d4d630bbc82..68a903b2760 100644
--- a/addons/account/models/account_account.py
+++ b/addons/account/models/account_account.py
@@ -54,7 +54,7 @@ class AccountAccount(models.Model):
('user_type_id', '=', data_unaffected_earnings.id)])
raise ValidationError(_('You cannot have more than one account with "Current Year Earnings" as type. (accounts: %s)') % [a.code for a in account_unaffected_earnings])
- name = fields.Char(required=True, index=True)
+ name = fields.Char(string="Account Name", required=True, index=True)
currency_id = fields.Many2one('res.currency', string='Account Currency',
help="Forces all moves for this account to have this account currency.")
code = fields.Char(size=64, required=True, index=True)
@@ -80,8 +80,9 @@ class AccountAccount(models.Model):
root_id = fields.Many2one('account.root', compute='_compute_account_root', store=True)
allowed_journal_ids = fields.Many2many('account.journal', string="Allowed Journals", help="Define in which journals this account can be used. If empty, can be used in all journals.")
- opening_debit = fields.Monetary(string="Opening debit", compute='_compute_opening_debit_credit', inverse='_set_opening_debit', help="Opening debit value for this account.")
- opening_credit = fields.Monetary(string="Opening credit", compute='_compute_opening_debit_credit', inverse='_set_opening_credit', help="Opening credit value for this account.")
+ opening_debit = fields.Monetary(string="Opening Debit", compute='_compute_opening_debit_credit', inverse='_set_opening_debit', help="Opening debit value for this account.")
+ opening_credit = fields.Monetary(string="Opening Credit", compute='_compute_opening_debit_credit', inverse='_set_opening_credit', help="Opening credit value for this account.")
+ opening_balance = fields.Monetary(string="Opening Balance", compute='_compute_opening_debit_credit', help="Opening balance value for this account.")
_sql_constraints = [
('code_company_uniq', 'unique (code,company_id)', 'The code of the account must be unique per company !')
@@ -220,17 +221,25 @@ class AccountAccount(models.Model):
raise UserError(_('Cannot generate an unused account code.'))
def _compute_opening_debit_credit(self):
+ if not self:
+ return
+ self.env.cr.execute("""
+ SELECT line.account_id,
+ SUM(line.balance) AS balance,
+ SUM(line.debit) AS debit,
+ SUM(line.credit) AS credit
+ FROM account_move_line line
+ JOIN res_company comp ON comp.id = line.company_id
+ WHERE line.move_id = comp.account_opening_move_id
+ AND line.account_id IN %s
+ GROUP BY line.account_id
+ """, [tuple(self.ids)])
+ result = {r['account_id']: r for r in self.env.cr.dictfetchall()}
for record in self:
- opening_debit = opening_credit = 0.0
- if record.company_id.account_opening_move_id:
- for line in self.env['account.move.line'].search([('account_id', '=', record.id),
- ('move_id','=', record.company_id.account_opening_move_id.id)]):
- if line.debit:
- opening_debit += line.debit
- elif line.credit:
- opening_credit += line.credit
- record.opening_debit = opening_debit
- record.opening_credit = opening_credit
+ res = result.get(record.id) or {'debit': 0, 'credit': 0, 'balance': 0}
+ record.opening_debit = res['debit']
+ record.opening_credit = res['credit']
+ record.opening_balance = res['balance']
def _set_opening_debit(self):
self._set_opening_debit_credit(self.opening_debit, 'debit')
diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py
index ff33c8db5de..8be1af1dcd6 100644
--- a/addons/account/models/account_journal_dashboard.py
+++ b/addons/account/models/account_journal_dashboard.py
@@ -435,22 +435,25 @@ class account_journal(models.Model):
statement_line_ids = self.env['account.move.line'].search(domain).mapped('statement_line_id')
return statement_line_ids
+ def _select_action_to_open(self):
+ self.ensure_one()
+ if self._context.get('action_name'):
+ return self._context.get('action_name')
+ elif self.type == 'bank':
+ return 'action_bank_statement_tree'
+ elif self.type == 'cash':
+ return 'action_view_bank_statement_tree'
+ elif self.type == 'sale':
+ return 'action_move_out_invoice_type'
+ elif self.type == 'purchase':
+ return 'action_move_in_invoice_type'
+ else:
+ return 'action_move_journal_line'
+
def open_action(self):
"""return action based on type for related journals"""
- action_name = self._context.get('action_name')
-
- # Find action based on journal.
- if not action_name:
- if self.type == 'bank':
- action_name = 'action_bank_statement_tree'
- elif self.type == 'cash':
- action_name = 'action_view_bank_statement_tree'
- elif self.type == 'sale':
- action_name = 'action_move_out_invoice_type'
- elif self.type == 'purchase':
- action_name = 'action_move_in_invoice_type'
- else:
- action_name = 'action_move_journal_line'
+ self.ensure_one()
+ action_name = self._select_action_to_open()
# Set 'account.' prefix if missing.
if '.' not in action_name:
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index fec803d28a9..e3f56107407 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -207,7 +207,7 @@ class AccountMove(models.Model):
('partial', 'Partially Paid'),
('reversed', 'Reversed'),
('invoicing_legacy', 'Invoicing App Legacy')],
- string="Payment State", store=True, readonly=True, copy=False, tracking=True,
+ string="Payment Status", store=True, readonly=True, copy=False, tracking=True,
compute='_compute_amount')
# ==== Cash basis feature fields ====
diff --git a/addons/account/models/sequence_mixin.py b/addons/account/models/sequence_mixin.py
index ad3fa371bfb..f6f4520661d 100644
--- a/addons/account/models/sequence_mixin.py
+++ b/addons/account/models/sequence_mixin.py
@@ -122,9 +122,9 @@ class SequenceMixin(models.AbstractModel):
sequence = re.match(self._sequence_fixed_regex, last_sequence)
value = ("{prefix}{seq:0%sd}{suffix}" % len(sequence.group('seq'))).format(
- prefix=sequence.group('prefix1'),
+ prefix=sequence.group('prefix1') if sequence.group('seq') else sequence.group('suffix'),
seq=int(sequence.group('seq') or 0) + 1,
- suffix=sequence.group('suffix'),
+ suffix=sequence.group('suffix') if sequence.group('seq') else "",
)
self[self._sequence_field] = value
self.flush([self._sequence_field])
diff --git a/addons/account/static/src/scss/account_journal_dashboard.scss b/addons/account/static/src/scss/account_journal_dashboard.scss
index 36d8dbfd171..6c36e61a0a3 100644
--- a/addons/account/static/src/scss/account_journal_dashboard.scss
+++ b/addons/account/static/src/scss/account_journal_dashboard.scss
@@ -40,10 +40,6 @@
}
}
- .o_sample_data_label {
- @include o-position-absolute($bottom: 25%, $right: 0);
- z-index: 1;
- }
.o_kanban_group {
&:not(.o_column_folded) {
width: 450px + 2*$o-kanban-group-padding;
diff --git a/addons/account/tests/test_account_move_entry.py b/addons/account/tests/test_account_move_entry.py
index b2f1c443a2d..cecb95f1c74 100644
--- a/addons/account/tests/test_account_move_entry.py
+++ b/addons/account/tests/test_account_move_entry.py
@@ -381,7 +381,7 @@ class TestAccountMove(AccountTestInvoicingCommon):
copy6 = copy5.copy()
copy6.post()
- self.assertEqual(copy6.name, '1N\'importe quoi?')
+ self.assertEqual(copy6.name, 'N\'importe quoi?1')
def test_journal_sequence_format(self):
"""Test different format of sequences and what it becomes on another period"""
diff --git a/addons/account/views/account_account_views.xml b/addons/account/views/account_account_views.xml
index aa6f9b2f77b..7dfed0fc2aa 100644
--- a/addons/account/views/account_account_views.xml
+++ b/addons/account/views/account_account_views.xml
@@ -63,7 +63,7 @@
<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" string="Open" aria-label="Open" class="float-right"/>
+ <button name="action_read_account" type="object" string="Setup" class="float-right"/>
</tree>
</field>
</record>
diff --git a/addons/account/views/account_bank_statement_views.xml b/addons/account/views/account_bank_statement_views.xml
index da0669f33f3..be075e890c8 100644
--- a/addons/account/views/account_bank_statement_views.xml
+++ b/addons/account/views/account_bank_statement_views.xml
@@ -326,16 +326,28 @@
<field name="sequence" readonly="1" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="journal_id" invisible="1" />
+ <field name="is_reconciled" invisible="1"/>
+ <field name="partner_bank_id" invisible="1"/>
+ <field name="currency_id" invisible="1"/>
<!-- Displayed fields -->
- <field name="statement_id" />
+ <field name="statement_id" optional="hide"/>
+ <field name="move_id"/>
<field name="date"/>
<field name="payment_ref"/>
<field name="ref" groups="base.group_no_one"/>
<field name="partner_id"/>
<field name="amount"/>
+ <field name="amount_currency" optional="hidden" groups="base.group_multi_currency"/>
+ <field name="foreign_currency_id" optional="hidden" groups="base.group_multi_currency"/>
+ <field name="account_number" optional="hidden"/>
<field name="transaction_type" optional="hidden"/>
<field name="narration" optional="hidden"/>
+
+ <!-- Buttons -->
+ <button name="button_undo_reconciliation" type="object"
+ attrs="{'invisible': [('is_reconciled', '=', False)]}"
+ string="Revert reconciliation" icon="fa-undo"/>
</tree>
</field>
</record>
diff --git a/addons/account/views/account_journal_dashboard_view.xml b/addons/account/views/account_journal_dashboard_view.xml
index 6b1d2c7296c..c317d68eee1 100644
--- a/addons/account/views/account_journal_dashboard_view.xml
+++ b/addons/account/views/account_journal_dashboard_view.xml
@@ -143,6 +143,11 @@
<span t-if="journal_type == 'purchase'">Refund</span>
</a>
</div>
+ <div t-if="journal_type == 'sale'">
+ <a class="o_button_upload_bill" journal_type="sale" groups="account.group_account_invoice">
+ <span>Upload Invoices</span>
+ </a>
+ </div>
</div>
<div class="col-4 o_kanban_card_manage_section o_kanban_manage_reports">
@@ -235,7 +240,7 @@
- If there are statements to reconcile, a link to reconcile them -->
<div id="dashboard_bank_cash_left" class="col-12 col-sm-5 mb-3 mb-sm-0 o_kanban_primary_left">
<t t-if="journal_type == 'bank'">
- <button t-if="dashboard.bank_statements_source == 'undefined'" name="action_configure_bank_journal" type="object" class="btn btn-primary" groups="account.group_account_invoice">Configure</button>
+ <a t-if="dashboard.bank_statements_source == 'undefined'" name="action_configure_bank_journal" type="object" class="oe_inline" groups="account.group_account_invoice">Connect</a>
<div name="bank_journal_cta" class="mt-3 mt-sm-0">
<div name="bank_statement_create_button" groups="account.group_account_invoice">
<a type="object" name="create_bank_statement" class="oe_inline">Create</a><span name="button_import_placeholder"/> Statements
@@ -278,24 +283,15 @@
</div>
</t>
</div>
- <div t-if="dashboard.is_sample_data">
- <span class="badge badge-warning text-uppercase o_sample_data_label">Sample data</span>
- </div>
</t>
<t t-name="JournalBodySalePurchase" id="account.JournalBodySalePurchase">
<div class="col-12 col-sm-5 mb-3 mb-sm-0 o_kanban_primary_left">
<t t-if="journal_type == 'sale'">
<button type="object" name="action_create_new" class="btn btn-primary o_invoice_new" groups="account.group_account_invoice">
- <span>New Invoice</span>
- </button>
- <button class="btn btn-primary o_button_upload_bill" journal_type="sale" groups="account.group_account_invoice">
- <span>Upload Invoices</span>
+ <span>Create Manually</span>
</button>
</t>
<t t-if="journal_type == 'purchase'">
- <button type="object" name="action_create_new" class="btn btn-primary o_invoice_new" groups="account.group_account_invoice">
- <span>New Bill</span>
- </button>
<button class="btn btn-primary o_button_upload_bill" journal_type="purchase" groups="account.group_account_invoice">
<span>Upload Bills</span>
</button>
@@ -340,9 +336,6 @@
</div>
</t>
</div>
- <div t-if="dashboard.is_sample_data">
- <span class="badge badge-warning text-uppercase o_sample_data_label">Sample data</span>
- </div>
</t>
<t t-name="JournalBodyGraph">
<field name="kanban_dashboard_graph" t-att-graph_type="_.contains(['cash','bank'],journal_type) ? 'line' : 'bar'" widget="dashboard_graph"/>
diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml
index ec2099ce835..ca50b0d889c 100644
--- a/addons/account/views/account_move_views.xml
+++ b/addons/account/views/account_move_views.xml
@@ -184,6 +184,8 @@
<field name="matching_number" string="Matching" optional="show"/>
<field name="reconcile_model_id" invisible="1"/>
<field name="date_maturity" optional="hide"/>
+ <field name="analytic_account_id" optional="hide" groups="analytic.group_analytic_accounting"/>
+ <field name="analytic_tag_ids" optional="hide" readonly="1" groups="analytic.group_analytic_tags"/>
<field name="debit" sum="Total Debit" readonly="1"/>
<field name="credit" sum="Total Credit" readonly="1"/>
<field name="balance" sum="Total Balance" readonly="1" optional="hide"/>
@@ -419,7 +421,7 @@
<field name="amount_residual_signed" string="Amount Due" sum="Amount Due" optional="hide"/>
<field name="currency_id" invisible="1"/>
<field name="company_currency_id" invisible="1"/>
- <field name="state" optional="hide"/>
+ <field name="state" optional="hide" decoration-success="state == 'posted'" decoration-info="state == 'draft'" widget="badge"/>
<field name="payment_state" decoration-success="payment_state == 'paid'" decoration-info="payment_state == 'partial' or payment_state == 'not_paid'" decoration-warning="payment_state == 'in_payment'" widget="badge"/>
<field name="move_type" invisible="context.get('default_move_type', True)"/>
</tree>
@@ -478,7 +480,10 @@
<!-- Post -->
<button name="action_post" string="Post" class="oe_highlight"
type="object" groups="account.group_account_invoice"
- attrs="{'invisible': [('state', '!=', 'draft')]}"/>
+ attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('move_type', '!=', 'entry')]}"/>
+ <button name="action_post" string="Validate" class="oe_highlight"
+ type="object" groups="account.group_account_invoice"
+ attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('move_type', '=', 'entry')]}"/>
<!-- Send (only invoices) -->
<button name="action_invoice_sent"
type="object"
@@ -508,9 +513,6 @@
<button name="action_reverse" string='Add Credit Note'
type='object' groups="account.group_account_invoice"
attrs="{'invisible': ['|', ('move_type', 'not in', ('out_invoice', 'in_invoice')), ('state', '!=', 'posted')]}"/>
- <!-- Duplicate -->
- <button name="action_duplicate" string="Duplicate" type="object" groups="account.group_account_invoice"
- attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
<!-- Cancel -->
<button name="button_cancel" string="Cancel Entry" type="object" groups="account.group_account_invoice"
attrs="{'invisible' : ['|', ('id', '=', False), ('state', '!=', 'draft')]}"/>
diff --git a/addons/account/wizard/setup_wizards_view.xml b/addons/account/wizard/setup_wizards_view.xml
index 169548b2ccb..fe698c92f75 100644
--- a/addons/account/wizard/setup_wizards_view.xml
+++ b/addons/account/wizard/setup_wizards_view.xml
@@ -15,8 +15,9 @@
<label for="fiscalyear_last_month" string="Fiscal Year End"/>
<div>
- <field name="fiscalyear_last_day"/>
- <field name="fiscalyear_last_month"/>
+ <field name="fiscalyear_last_day" class="oe_inline text-center" style="width: 20% !important;"/>
+ <span style="width: 5%; display: inline-block"/>
+ <field name="fiscalyear_last_month" class="oe_inline" style="width: 75% !important;"/>
</div>
</group>
</group>
@@ -82,10 +83,11 @@
<field name="reconcile" widget="boolean_toggle"/>
<field name="opening_debit"/>
<field name="opening_credit"/>
+ <field name="opening_balance" optional="hide"/>
<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" string="Open" aria-label="Open" class="float-right"/>
+ <button name="action_read_account" type="object" string="Setup" class="float-right"/>
</tree>
</field>
</record>
diff --git a/odoo/addons/test_main_flows/static/tests/tours/main_flow.js b/odoo/addons/test_main_flows/static/tests/tours/main_flow.js
index bb8f09fff9a..c3ff0d07c43 100644
--- a/odoo/addons/test_main_flows/static/tests/tours/main_flow.js
+++ b/odoo/addons/test_main_flows/static/tests/tours/main_flow.js
@@ -775,7 +775,7 @@ tour.stepUtils.openBuggerMenu("li.breadcrumb-item.active:contains('OP/')"),
position: 'bottom',
},
...tour.stepUtils.statusbarButtonsSteps('Create Bill', _t('go to Vendor Bills'), ".o_statusbar_status .btn.dropdown-toggle:contains('Purchase Order')"),
-...tour.stepUtils.statusbarButtonsSteps('Post', _t("Try to send it to email"), ".o_statusbar_status .btn.dropdown-toggle:contains('Draft')"),
+...tour.stepUtils.statusbarButtonsSteps('Validate', _t("Try to send it to email"), ".o_statusbar_status .btn.dropdown-toggle:contains('Draft')"),
...tour.stepUtils.statusbarButtonsSteps('Register Payment', _t("Register Payment"), ".o_statusbar_status .btn.dropdown-toggle:contains('Posted')"),
{
trigger: ".modal-footer .btn-primary",
@@ -942,7 +942,7 @@ tour.stepUtils.mobileModifier(tour.stepUtils.autoExpandMoreButtons('.o_control_p
content: _t("Create and View Invoices"),
position: "bottom",
},
-...tour.stepUtils.statusbarButtonsSteps('Post', _t("Validate"), ".breadcrumb-item.active:contains('Draft Invoice')"),
+...tour.stepUtils.statusbarButtonsSteps('Validate', _t("Validate"), ".breadcrumb-item.active:contains('Draft Invoice')"),
...tour.stepUtils.statusbarButtonsSteps('Register Payment', _t("Register Payment"), ".breadcrumb-item.active:contains('INV/')"),
{
trigger: ".modal-footer .btn-primary",
@@ -960,7 +960,7 @@ tour.stepUtils.mobileModifier(tour.stepUtils.autoExpandMoreButtons('.o_control_p
position: 'bottom',
}, {
edition: "enterprise",
- trigger: 'button[data-name=action_configure_bank_journal]',
+ trigger: 'a[data-name=action_configure_bank_journal]',
content: _t('Configure Bank Journal'),
position: 'bottom',
}, {