diff --git a/addons/account/__manifest__.py b/addons/account/__manifest__.py index 1ec5bdde556..0ebd0cac36f 100644 --- a/addons/account/__manifest__.py +++ b/addons/account/__manifest__.py @@ -23,7 +23,7 @@ You could use this simplified accounting in case you work with an (external) acc 'data/account_data.xml', 'data/digest_data.xml', 'views/account_payment_view.xml', - 'wizard/account_accrual_accounting_view.xml', + 'wizard/account_automatic_entry_wizard_views.xml', 'wizard/account_unreconcile_view.xml', 'wizard/account_move_reversal_view.xml', 'wizard/account_resequence_views.xml', @@ -74,7 +74,6 @@ You could use this simplified accounting in case you work with an (external) acc 'wizard/account_invoice_send_views.xml', 'views/account_tax_report_views.xml', 'report/account_hash_integrity_templates.xml', - 'wizard/account_transfer_wizard.xml', 'views/res_currency.xml', 'views/account_menuitem.xml', 'views/account_analytic_default_view.xml', diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 621cbb22b23..fccccb49ae6 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2750,6 +2750,7 @@ class AccountMoveLine(models.Model): check_company=True, tracking=True) account_internal_type = fields.Selection(related='account_id.user_type_id.type', string="Internal Type", readonly=True) + account_internal_group = fields.Selection(related='account_id.user_type_id.internal_group', string="Internal Group", readonly=True) account_root_id = fields.Many2one(related='account_id.root_id', string="Account Root", store=True, readonly=True) sequence = fields.Integer(default=10) name = fields.Text(string='Label', tracking=True) @@ -4693,8 +4694,8 @@ class AccountMoveLine(models.Model): action['domain'] = [('id', 'in', ids)] return action - def action_accrual_entry(self): - [action] = self.env.ref('account.account_accrual_accounting_wizard_action').read() + def action_automatic_entry(self): + [action] = self.env.ref('account.account_automatic_entry_wizard_action').read() action['context'] = self.env.context return action @@ -4706,20 +4707,6 @@ class AccountMoveLine(models.Model): ('statement_line_id', '!=', False), ] - def action_transfer_accounts_wizard(self): - wizard = self.env['account.transfer.wizard'].create({}) - - return { - 'name': _("Transfer Entries"), - 'type': 'ir.actions.act_window', - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': 'account.transfer.wizard', - 'res_id': wizard.id, - 'target': 'new', - 'context': self.env.context, - } - def _get_attachment_domains(self): self.ensure_one() domains = [[('res_model', '=', 'account.move'), ('res_id', '=', self.move_id.id)]] diff --git a/addons/account/models/company.py b/addons/account/models/company.py index acebbb209bf..2f3f1e5864c 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -103,11 +103,11 @@ class ResCompany(models.Model): # Accrual Accounting expense_accrual_account_id = fields.Many2one('account.account', help="Account used to move the period of an expense", - domain="[('internal_group', '=', 'liability'), ('internal_type', 'not in', ('receivable', 'payable')), ('reconcile', '=', True), ('company_id', '=', id)]") + domain="[('internal_group', '=', 'liability'), ('internal_type', 'not in', ('receivable', 'payable')), ('company_id', '=', id)]") revenue_accrual_account_id = fields.Many2one('account.account', help="Account used to move the period of a revenue", - domain="[('internal_group', '=', 'asset'), ('internal_type', 'not in', ('receivable', 'payable')), ('reconcile', '=', True), ('company_id', '=', id)]") - accrual_default_journal_id = fields.Many2one('account.journal', help="Journal used by default for moving the period of an entry", domain="[('type', '=', 'general')]") + domain="[('internal_group', '=', 'asset'), ('internal_type', 'not in', ('receivable', 'payable')), ('company_id', '=', id)]") + automatic_entry_default_journal_id = fields.Many2one('account.journal', help="Journal used by default for moving the period of an entry", domain="[('type', '=', 'general')]") # Technical field to hide country specific fields in company form view country_code = fields.Char(related='country_id.code') diff --git a/addons/account/security/ir.model.access.csv b/addons/account/security/ir.model.access.csv index 4725df73507..8020b7d06ec 100644 --- a/addons/account/security/ir.model.access.csv +++ b/addons/account/security/ir.model.access.csv @@ -125,7 +125,7 @@ access_account_payment,account.payment,model_account_payment,account.group_accou access_account_payment_register,access.account.payment.register,model_account_payment_register,account.group_account_invoice,1,1,1,0 access_account_bank_statement_closebalance,access.account.bank.statement.closebalance,model_account_bank_statement_closebalance,account.group_account_user,1,1,1,0 -access_account_accrual_accounting_wizard,access.account.accrual.accounting.wizard,model_account_accrual_accounting_wizard,account.group_account_user,1,1,1,0 +access_account_automatic_entry_wizard,access.account.automatic.entry.wizard,model_account_automatic_entry_wizard,account.group_account_user,1,1,1,0 access_account_unreconcile,access.account.unreconcile,model_account_unreconcile,account.group_account_user,1,1,1,0 access_account_resequence,access.account.resequence.wizard,model_account_resequence_wizard,account.group_account_user,1,1,1,0 access_validate_account_move,access.validate.account.move,model_validate_account_move,account.group_account_invoice,1,1,1,0 @@ -138,7 +138,6 @@ access_account_financial_year_op,access.account.financial.year.op,model_account_ access_account_setup_bank_manual_config,access.account.setup.bank.manual.config,model_account_setup_bank_manual_config,account.group_account_manager,1,1,1,0 access_tax_adjustments_wizard,access.tax.adjustments.wizard,model_tax_adjustments_wizard,account.group_account_user,1,1,1,0 access_account_invoice_send,access.account.invoice.send,model_account_invoice_send,account.group_account_invoice,1,1,1,0 -access_account_transfer_wizard,access.account.transfer.wizard,model_account_transfer_wizard,account.group_account_user,1,1,1,0 access_account_analytic_default,account.analytic.default,model_account_analytic_default,account.group_account_readonly,1,0,0,0 access_account_analytic_default_analytic,account.analytic.default analytic,model_account_analytic_default,analytic.group_analytic_accounting,1,0,0,0 diff --git a/addons/account/tests/test_account_move_in_invoice.py b/addons/account/tests/test_account_move_in_invoice.py index 69c85523809..bd8e9a09b42 100644 --- a/addons/account/tests/test_account_move_in_invoice.py +++ b/addons/account/tests/test_account_move_in_invoice.py @@ -1653,8 +1653,9 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon): }) move.action_post() - wizard = self.env['account.accrual.accounting.wizard']\ + wizard = self.env['account.automatic.entry.wizard']\ .with_context(active_model='account.move.line', active_ids=move.invoice_line_ids.ids).create({ + 'action': 'change_period', 'date': '2018-01-01', 'percentage': 60, 'journal_id': self.company_data['default_journal_misc'].id, @@ -1671,7 +1672,7 @@ class TestAccountMoveInInvoiceOnchanges(AccountTestInvoicingCommon): 'reconcile': True, }).id, }) - wizard_res = wizard.amend_entries() + wizard_res = wizard.do_action() self.assertInvoiceValues(move, [ { diff --git a/addons/account/tests/test_account_move_out_invoice.py b/addons/account/tests/test_account_move_out_invoice.py index b18edefe04e..e77eff26027 100644 --- a/addons/account/tests/test_account_move_out_invoice.py +++ b/addons/account/tests/test_account_move_out_invoice.py @@ -2330,8 +2330,9 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon): }) move.action_post() - wizard = self.env['account.accrual.accounting.wizard']\ + wizard = self.env['account.automatic.entry.wizard']\ .with_context(active_model='account.move.line', active_ids=move.invoice_line_ids.ids).create({ + 'action': 'change_period', 'date': '2018-01-01', 'percentage': 60, 'journal_id': self.company_data['default_journal_misc'].id, @@ -2348,7 +2349,7 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon): 'reconcile': True, }).id, }) - wizard_res = wizard.amend_entries() + wizard_res = wizard.do_action() self.assertInvoiceValues(move, [ { diff --git a/addons/account/tests/test_transfer_wizard.py b/addons/account/tests/test_transfer_wizard.py index 76a393f790d..03b76235398 100644 --- a/addons/account/tests/test_transfer_wizard.py +++ b/addons/account/tests/test_transfer_wizard.py @@ -196,12 +196,13 @@ class TestTransferWizard(AccountTestInvoicingCommon): # We use a form to pass the context properly to the depends_context move_line_ids field context = {'active_model': 'account.move.line', 'active_ids': active_move_lines.ids} - with Form(self.env['account.transfer.wizard'].with_context(context)) as wizard_form: + with Form(self.env['account.automatic.entry.wizard'].with_context(context)) as wizard_form: + wizard_form.action = 'change_account' wizard_form.destination_account_id = self.receivable_account wizard_form.journal_id = self.journal wizard = wizard_form.save() - transfer_move_id = wizard.button_transfer()['res_id'] + transfer_move_id = wizard.do_action()['res_id'] transfer_move = self.env['account.move'].browse(transfer_move_id) payable_transfer = transfer_move.line_ids.filtered(lambda x: x.account_id == self.payable_account) @@ -221,12 +222,13 @@ class TestTransferWizard(AccountTestInvoicingCommon): # We use a form to pass the context properly to the depends_context move_line_ids field context = {'active_model': 'account.move.line', 'active_ids': active_move_lines.ids} - with Form(self.env['account.transfer.wizard'].with_context(context)) as wizard_form: + with Form(self.env['account.automatic.entry.wizard'].with_context(context)) as wizard_form: + wizard_form.action = 'change_account' wizard_form.destination_account_id = self.accounts[4] wizard_form.journal_id = self.journal wizard = wizard_form.save() - transfer_move_id = wizard.button_transfer()['res_id'] + transfer_move_id = wizard.do_action()['res_id'] transfer_move = self.env['account.move'].browse(transfer_move_id) groups = {} @@ -251,12 +253,13 @@ class TestTransferWizard(AccountTestInvoicingCommon): # We use a form to pass the context properly to the depends_context move_line_ids field context = {'active_model': 'account.move.line', 'active_ids': active_move_lines.ids} - with Form(self.env['account.transfer.wizard'].with_context(context)) as wizard_form: + with Form(self.env['account.automatic.entry.wizard'].with_context(context)) as wizard_form: + wizard_form.action = 'change_account' wizard_form.destination_account_id = self.test_currency_account wizard_form.journal_id = self.journal wizard = wizard_form.save() - transfer_move_id = wizard.button_transfer()['res_id'] + transfer_move_id = wizard.do_action()['res_id'] transfer_move = self.env['account.move'].browse(transfer_move_id) destination_line = transfer_move.line_ids.filtered(lambda x: x.account_id == self.test_currency_account) @@ -273,12 +276,13 @@ class TestTransferWizard(AccountTestInvoicingCommon): # We use a form to pass the context properly to the depends_context move_line_ids field context = {'active_model': 'account.move.line', 'active_ids': active_move_lines.ids} - with Form(self.env['account.transfer.wizard'].with_context(context)) as wizard_form: + with Form(self.env['account.automatic.entry.wizard'].with_context(context)) as wizard_form: + wizard_form.action = 'change_account' wizard_form.destination_account_id = self.receivable_account wizard_form.journal_id = self.journal wizard = wizard_form.save() - transfer_move_id = wizard.button_transfer()['res_id'] + transfer_move_id = wizard.do_action()['res_id'] transfer_move = self.env['account.move'].browse(transfer_move_id) destination_lines = transfer_move.line_ids.filtered(lambda x: x.account_id == self.receivable_account) diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index 09f700adb78..8738b921ce7 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -758,6 +758,7 @@ + @@ -837,6 +838,7 @@ +
@@ -949,6 +951,16 @@ + +