summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwan <wan@odoo.com>2020-09-04 14:10:39 +0000
committerwan <wan@odoo.com>2020-09-10 14:52:46 +0000
commit960e61e7451ef8dacd3aaa70bb148240762ab461 (patch)
tree427ade8bb51cfa3830ff451764144388554cf66d
parent01d25e87c358f0afbe76301c64db5ce21c59c806 (diff)
[FIX] account: saas-13.5 release fixes
Task 2327599 * The date is not copied on duplicate of account.move * Do not throw traceback if we remove the invoice date of an invoice/bill * Add extra triggers in account_tour to ensure it is done in the right view * Update the position of some tour indicators * Move the Product Categories in the Management menu * The accounting onboarding is only visible on customer invoices list view * Switch the position of banc and bic closes odoo/odoo#57107 Related: odoo/enterprise#12967 Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
-rw-r--r--addons/account/i18n/account.pot6
-rw-r--r--addons/account/models/account_move.py12
-rw-r--r--addons/account/static/src/js/tours/account.js19
-rw-r--r--addons/account/tests/test_account_move_entry.py24
-rw-r--r--addons/account/views/account_menuitem.xml2
-rw-r--r--addons/account/views/account_move_views.xml17
-rw-r--r--addons/account/wizard/setup_wizards_view.xml2
-rw-r--r--odoo/addons/test_main_flows/static/tests/tours/main_flow.js4
8 files changed, 62 insertions, 24 deletions
diff --git a/addons/account/i18n/account.pot b/addons/account/i18n/account.pot
index 1b47e230bd3..9006617eec4 100644
--- a/addons/account/i18n/account.pot
+++ b/addons/account/i18n/account.pot
@@ -12981,11 +12981,15 @@ msgstr ""
#. module: account
#: model_terms:ir.ui.view,arch_db:account.view_bank_statement_form
-#: model_terms:ir.ui.view,arch_db:account.view_move_form
msgid "Validate"
msgstr ""
#. module: account
+#: model_terms:ir.ui.view,arch_db:account.view_move_form
+msgid "Confirm"
+msgstr ""
+
+#. module: account
#: model:ir.model,name:account.model_validate_account_move
msgid "Validate Account Move"
msgstr ""
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index 601111cb487..20ad5fa5602 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -123,9 +123,15 @@ class AccountMove(models.Model):
name = fields.Char(string='Number', copy=False, compute='_compute_name', readonly=False, store=True, index=True, tracking=True)
highest_name = fields.Char(compute='_compute_highest_name')
show_name_warning = fields.Boolean(store=False)
- date = fields.Date(string='Date', required=True, index=True, readonly=True,
+ date = fields.Date(
+ string='Date',
+ required=True,
+ index=True,
+ readonly=True,
states={'draft': [('readonly', False)]},
- default=fields.Date.context_today)
+ copy=False,
+ default=fields.Date.context_today
+ )
ref = fields.Char(string='Reference', copy=False, tracking=True)
narration = fields.Text(string='Terms and Conditions')
state = fields.Selection(selection=[
@@ -3166,7 +3172,7 @@ class AccountMoveLine(models.Model):
sign = 1
amount_currency = price_subtotal * sign
- balance = currency._convert(amount_currency, company.currency_id, company, date)
+ balance = currency._convert(amount_currency, company.currency_id, company, date or fields.Date.context_today(self))
return {
'amount_currency': amount_currency,
'currency_id': currency.id,
diff --git a/addons/account/static/src/js/tours/account.js b/addons/account/static/src/js/tours/account.js
index e2d08c2dd60..a025e6ef9a6 100644
--- a/addons/account/static/src/js/tours/account.js
+++ b/addons/account/static/src/js/tours/account.js
@@ -13,60 +13,77 @@ tour.register('account_tour', {
{
trigger: "a.o_onboarding_step_action[data-method=action_open_base_onboarding_company]",
content: _t("Start by checking your company's data."),
+ position: "bottom",
}, {
trigger: "button[name=action_save_onboarding_company_step]",
+ extra_trigger: "a.o_onboarding_step_action[data-method=action_open_base_onboarding_company]",
content: _t("Looks good. Let's continue."),
}, {
trigger: "a.o_onboarding_step_action[data-method=action_open_base_document_layout]",
content: _t("Customize your layout."),
+ position: "bottom",
}, {
trigger: "button[name=document_layout_save]",
+ extra_trigger: "a.o_onboarding_step_action[data-method=action_open_base_document_layout]",
content: _t("Once everything is as you want it, validate."),
}, {
trigger: "a.o_onboarding_step_action[data-method=action_open_account_onboarding_create_invoice]",
content: _t("Now, we'll create a your first invoice."),
+ position: "bottom",
}, {
trigger: "input[name=name]",
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
content: _t("Customize the prefix and number to fit your needs."),
run: 'text SALE/0000000001'
}, {
trigger: "div[name=partner_id] input",
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
content: _t("Write a company name to <b>create one</b> or <b>see suggestions</b>."),
position: "bottom",
}, {
trigger: ".o_m2o_dropdown_option a:contains('Create')",
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
content: _t("Select first partner"),
auto: true,
}, {
trigger: ".modal-content button.btn-primary",
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
content: _t("Once everything is set, you are good to continue. You will be able to edit this later in the <b>Customers</b> menu."),
}, {
trigger: "div[name=invoice_line_ids] .o_field_x2many_list_row_add a:not([data-context])",
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
content: _t("Add a line to your invoice"),
}, {
trigger: "div[name=invoice_line_ids] textarea[name=name]",
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
content: _t("Fill in the details of the line.<br><i>Tip: all the details can be set automatically if you configure your <b>products</b>.</i>"),
position: "bottom",
}, {
trigger: "div[name=invoice_line_ids] input[name=price_unit]",
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
content: _t("Set a price"),
position: "bottom",
run: 'text 100',
}, {
trigger: "button[name=action_post]",
- content: _t("Once your invoice is ready, validate."),
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
+ content: _t("Once your invoice is ready, press CONFIRM."),
}, {
trigger: "button[name=action_invoice_sent]",
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
content: _t("Send the invoice and check what the customer will receive."),
}, {
trigger: "input[name=email]",
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
content: _t("Write here <b>your own email address</b> to test the flow."),
run: 'text customer@example.com',
}, {
trigger: ".modal-content button.btn-primary",
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
content: _t("Validate."),
}, {
trigger: "button[name=send_and_print_action]",
+ extra_trigger: "[name=move_type][raw-value=out_invoice]",
content: _t("Let's send the invoice."),
}
]);
diff --git a/addons/account/tests/test_account_move_entry.py b/addons/account/tests/test_account_move_entry.py
index 8c7483132a1..9cd3bb71419 100644
--- a/addons/account/tests/test_account_move_entry.py
+++ b/addons/account/tests/test_account_move_entry.py
@@ -246,7 +246,7 @@ class TestAccountMove(AccountTestInvoicingCommon):
with self.assertRaises(UserError), self.cr.savepoint():
self.test_move.button_draft()
- copy_move = self.test_move.copy()
+ copy_move = self.test_move.copy({'date': self.test_move.date})
# /!\ The date is changed automatically to the next available one during the post.
copy_move.action_post()
@@ -366,12 +366,12 @@ class TestAccountMove(AccountTestInvoicingCommon):
self.test_move.action_post()
self.assertEqual(self.test_move.name, 'MISC/2016/01/0001')
- copy1 = self.test_move.copy()
+ copy1 = self.test_move.copy({'date': self.test_move.date})
self.assertEqual(copy1.name, '/')
copy1.action_post()
self.assertEqual(copy1.name, 'MISC/2016/01/0002')
- copy2 = self.test_move.copy()
+ copy2 = self.test_move.copy({'date': self.test_move.date})
new_journal = self.test_move.journal_id.copy()
new_journal.code = "MISC2"
copy2.journal_id = new_journal
@@ -381,7 +381,7 @@ class TestAccountMove(AccountTestInvoicingCommon):
copy2.action_post()
self.assertEqual(copy2.name, 'MyMISC/2099/0001')
- copy3 = copy2.copy()
+ copy3 = copy2.copy({'date': copy2.date})
self.assertEqual(copy3.name, '/')
with self.assertRaises(AssertionError):
with Form(copy2) as move_form: # It is not editable in the form
@@ -390,17 +390,17 @@ class TestAccountMove(AccountTestInvoicingCommon):
self.assertEqual(copy3.name, 'MyMISC/2099/0002')
copy3.name = 'MISC2/2016/00002'
- copy4 = copy2.copy()
+ copy4 = copy2.copy({'date': copy2.date})
copy4.action_post()
self.assertEqual(copy4.name, 'MISC2/2016/00003')
- copy5 = copy2.copy()
+ copy5 = copy2.copy({'date': copy2.date})
copy5.date = '2021-02-02'
copy5.action_post()
self.assertEqual(copy5.name, 'MISC2/2021/00001')
copy5.name = 'N\'importe quoi?'
- copy6 = copy5.copy()
+ copy6 = copy5.copy({'date': copy5.date})
copy6.action_post()
self.assertEqual(copy6.name, 'N\'importe quoi?1')
@@ -443,13 +443,13 @@ class TestAccountMove(AccountTestInvoicingCommon):
prefix = "TEST_ORDER/2016/"
self.test_move.name = f"{prefix}1"
for c in range(2, 25):
- copy = self.test_move.copy()
+ copy = self.test_move.copy({'date': self.test_move.date})
copy.name = "/"
copy.action_post()
self.assertEqual(copy.name, f"{prefix}{c}")
def test_journal_sequence_multiple_type(self):
- entry, entry2, invoice, invoice2, refund, refund2 = (self.test_move.copy() for i in range(6))
+ entry, entry2, invoice, invoice2, refund, refund2 = (self.test_move.copy({'date': self.test_move.date}) for i in range(6))
(invoice + invoice2 + refund + refund2).write({
'journal_id': self.company_data['default_journal_sale'],
'partner_id': 1,
@@ -471,7 +471,7 @@ class TestAccountMove(AccountTestInvoicingCommon):
other_moves = self.env['account.move'].search([('journal_id', '=', self.test_move.journal_id.id)]) - self.test_move
other_moves.unlink() # Do not interfere when trying to get the highest name for new periods
self.test_move.name = '00000876-G 0002/2020'
- next = self.test_move.copy()
+ next = self.test_move.copy({'date': self.test_move.date})
next.action_post()
self.assertEqual(next.name, '00000876-G 0002/2021') # Wait, I didn't want this!
@@ -480,14 +480,14 @@ class TestAccountMove(AccountTestInvoicingCommon):
next._compute_name()
self.assertEqual(next.name, '00000877-G 0002/2020') # Pfew, better!
- next = next = self.test_move.copy()
+ next = next = self.test_move.copy({'date': self.test_move.date})
next.date = "2017-05-02"
next.action_post()
self.assertEqual(next.name, '00000001-G 0002/2017')
def test_journal_sequence_ordering(self):
self.test_move.name = 'XMISC/2016/00001'
- copies = reduce((lambda x, y: x+y), [self.test_move.copy() for i in range(6)])
+ copies = reduce((lambda x, y: x+y), [self.test_move.copy({'date': self.test_move.date}) for i in range(6)])
copies[0].date = '2019-03-05'
copies[1].date = '2019-03-06'
diff --git a/addons/account/views/account_menuitem.xml b/addons/account/views/account_menuitem.xml
index 939984aaa58..abcab09c903 100644
--- a/addons/account/views/account_menuitem.xml
+++ b/addons/account/views/account_menuitem.xml
@@ -64,7 +64,6 @@
<menuitem id="menu_action_account_form" action="action_account_form" groups="account.group_account_readonly" sequence="1"/>
<menuitem id="menu_action_tax_form" action="action_tax_form" sequence="2"/>
<menuitem id="menu_action_account_journal_form" action="action_account_journal_form" groups="account.group_account_manager" sequence="3"/>
- <menuitem id="menu_product_product_categories" action="product.product_category_action_form" sequence="3"/>
<menuitem id="account_report_folder" name="Reporting" groups="account.group_account_readonly" sequence="4"/>
<menuitem id="menu_action_currency_form" action="base.action_currency_form" name="Currencies" groups="base.group_multi_currency" sequence="4"/>
<menuitem id="menu_action_account_fiscal_position_form" action="action_account_fiscal_position_form" sequence="5"/>
@@ -72,6 +71,7 @@
</menuitem>
<menuitem id="root_payment_menu" name="Payments" groups="account.group_account_manager" sequence="4"/>
<menuitem id="account_management_menu" name="Management" groups="account.group_account_manager" sequence="5">
+ <menuitem id="menu_product_product_categories" action="product.product_category_action_form" sequence="3"/>
<menuitem id="menu_action_rounding_form_view" action="rounding_list_action" groups="account.group_cash_rounding" sequence="4"/>
<menuitem id="menu_configure_tax_report" name="Tax Report" action="account.action_configure_tax_report" groups="base.group_no_one" sequence="5"/>
<menuitem id="menu_action_analytic_lines_tree" name="Analytic Items" action="analytic.account_analytic_line_action_entries" groups="analytic.group_analytic_accounting" sequence="35"/>
diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml
index 3af822b4d36..27381a5e04f 100644
--- a/addons/account/views/account_move_views.xml
+++ b/addons/account/views/account_move_views.xml
@@ -399,7 +399,6 @@
<field name="model">account.move</field>
<field name="arch" type="xml">
<tree string="Invoices"
- banner_route="/account/account_invoice_onboarding"
js_class="account_tree"
sample="1">
<header>
@@ -434,6 +433,18 @@
</field>
</record>
+ <record id="view_out_invoice_tree" model="ir.ui.view">
+ <field name="name">account.out.invoice.tree</field>
+ <field name="model">account.move</field>
+ <field name="inherit_id" ref="account.view_invoice_tree"/>
+ <field name="mode">primary</field>
+ <field name="arch" type="xml">
+ <xpath expr="//tree" position="attributes">
+ <attribute name="banner_route">/account/account_invoice_onboarding</attribute>
+ </xpath>
+ </field>
+ </record>
+
<record id="view_account_move_kanban" model="ir.ui.view">
<field name="name">account.move.kanban</field>
<field name="model">account.move</field>
@@ -487,7 +498,7 @@
<button name="action_post" string="Post" class="oe_highlight"
type="object" groups="account.group_account_invoice"
attrs="{'invisible': ['|', '|', ('state', '!=', 'draft'), ('auto_post', '=', True), ('move_type', '!=', 'entry')]}"/>
- <button name="action_post" string="Validate" class="oe_highlight"
+ <button name="action_post" string="Confirm" class="oe_highlight"
type="object" groups="account.group_account_invoice"
attrs="{'invisible': ['|', '|', ('state', '!=', 'draft'), ('auto_post', '=', True), ('move_type', '=', 'entry')]}"/>
<!-- Send (only invoices) -->
@@ -1295,7 +1306,7 @@
<field name="name">Invoices</field>
<field name="res_model">account.move</field>
<field name="view_mode">tree,kanban,form</field>
- <field name="view_id" ref="view_invoice_tree"/>
+ <field name="view_id" ref="view_out_invoice_tree"/>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="domain">[('move_type', '=', 'out_invoice')]</field>
<field name="context">{'default_move_type': 'out_invoice'}</field>
diff --git a/addons/account/wizard/setup_wizards_view.xml b/addons/account/wizard/setup_wizards_view.xml
index 7f4792f32a5..3ae4ae67636 100644
--- a/addons/account/wizard/setup_wizards_view.xml
+++ b/addons/account/wizard/setup_wizards_view.xml
@@ -44,8 +44,8 @@
<group>
<group>
<field name="acc_number" placeholder="e.g BE15001559627230"/>
- <field name="bank_bic" placeholder="e.g GEBABEBB" string="Bank Identifier Code"/>
<field name="bank_id" placeholder="e.g Bank of America"/>
+ <field name="bank_bic" placeholder="e.g GEBABEBB" string="Bank Identifier Code"/>
</group>
</group>
<group attrs="{'invisible': [('num_journals_without_account', '=', 0)]}">
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 322e46483b4..5cb4dd71ea2 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('Validate', _t("Try to send it to email"), ".o_statusbar_status .btn.dropdown-toggle:contains('Draft')"),
+...tour.stepUtils.statusbarButtonsSteps('Confirm', _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",
@@ -940,7 +940,7 @@ tour.stepUtils.mobileModifier(tour.stepUtils.autoExpandMoreButtons('.o_control_p
content: _t("Create and View Invoices"),
position: "bottom",
},
-...tour.stepUtils.statusbarButtonsSteps('Validate', _t("Validate"), ".breadcrumb-item.active:contains('Draft Invoice')"),
+...tour.stepUtils.statusbarButtonsSteps('Confirm', _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",