[IMP] account: improve the onboarding

Task 2031686

* Change some labels on the dashboard
* Move the action "Take money In/Out" to a button because it was also dsplayed in bank journals and we only want it for cash journals
* Add reconciliation param on the first account config list, as well as a button to go to the form (it is an editable list)
* Add an action to duplicate accounts in batch
* Smartly detect when a cash statement can be extended instead of creating a new one, making it more obvious to the user that he may need to validate his previous statement(s)

closes odoo/odoo#35137

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
This commit is contained in:
wan
2019-08-19 10:17:47 +00:00
parent dc066a54f1
commit 646a6d5a73
9 changed files with 63 additions and 29 deletions
+1 -1
View File
@@ -28,12 +28,12 @@ You could use this simplified accounting in case you work with an (external) acc
'wizard/account_move_reversal_view.xml',
'views/account_move_views.xml',
'wizard/setup_wizards_view.xml',
'wizard/pos_box.xml',
'views/account_view.xml',
'views/report_statement.xml',
'views/account_report.xml',
'data/mail_template_data.xml',
'wizard/account_validate_move_view.xml',
'wizard/pos_box.xml',
'views/account_end_fy.xml',
'views/partner_view.xml',
'views/product_view.xml',
+16
View File
@@ -476,6 +476,22 @@ class AccountAccount(models.Model):
'context': action_context,
}
def action_read_account(self):
self.ensure_one()
return {
'name': self.display_name,
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'account.account',
'res_id': self.id,
'target': 'new',
}
def action_duplicate_accounts(self):
for account in self.browse(self.env.context['active_ids']):
account.copy()
class AccountGroup(models.Model):
_name = "account.group"
@@ -135,14 +135,14 @@ class account_journal(models.Model):
def get_bar_graph_datas(self):
data = []
today = fields.Datetime.now(self)
data.append({'label': _('Past'), 'value':0.0, 'type': 'past'})
data.append({'label': _('Due'), 'value':0.0, 'type': 'past'})
day_of_week = int(format_datetime(today, 'e', locale=self._context.get('lang') or 'en_US'))
first_day_of_week = today + timedelta(days=-day_of_week+1)
for i in range(-1,4):
if i==0:
label = _('This Week')
elif i==3:
label = _('Future')
label = _('Not Due')
else:
start_week = first_day_of_week + timedelta(days=i*7)
end_week = start_week + timedelta(days=6)
@@ -391,13 +391,25 @@ class account_journal(models.Model):
def create_cash_statement(self):
ctx = self._context.copy()
ctx.update({'journal_id': self.id, 'default_journal_id': self.id, 'default_journal_type': 'cash'})
return {
open_statements = self.env['account.bank.statement'].search([('journal_id', '=', self.id), ('state', '=', 'open')])
action = {
'name': _('Create cash statement'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'account.bank.statement',
'context': ctx,
}
if len(open_statements) == 1:
action.update({
'view_mode': 'form',
'res_id': open_statements.id,
})
elif len(open_statements) > 1:
action.update({
'view_mode': 'tree,form',
'domain': [('id', 'in', open_statements.ids)],
})
return action
def action_open_reconcile(self):
if self.type in ['bank', 'cash']:
+1 -1
View File
@@ -320,7 +320,7 @@ Best Regards,'''))
return {
'type': 'ir.actions.act_window',
'name': _('Fiscal Year'),
'name': _('Accounting Periods'),
'view_mode': 'form',
'res_model': 'account.financial.year.op',
'target': 'new',
@@ -39,8 +39,8 @@
</template>
<template id="onboarding_fiscal_year_step">
<t t-call="base.onboarding_step">
<t t-set="title">Fiscal Year</t>
<t t-set="description">Define your fiscal years opening &amp; closing dates.</t>
<t t-set="title">Accounting Periods</t>
<t t-set="description">Define your fiscal years &amp; tax returns periodicity.</t>
<t t-set="btn_text">Configure</t>
<t t-set="done_text">Step Completed!</t>
<t t-set="method" t-value="'setting_init_fiscal_year_action'" />
+12
View File
@@ -121,6 +121,17 @@
<menuitem action="action_account_form" id="menu_action_account_form" parent="account.account_account_menu" groups="account.group_account_user" sequence="2"/>
<record id="action_duplicate_account" model="ir.actions.server">
<field name="name">Duplicate</field>
<field name="model_id" ref="model_account_account"/>
<field name="binding_model_id" ref="account.model_account_account"/>
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">
action = model.action_duplicate_accounts()
</field>
</record>
<!-- Account Journal -->
<record id="view_account_journal_tree" model="ir.ui.view">
<field name="name">account.journal.tree</field>
@@ -554,6 +565,7 @@ action = model.setting_init_bank_account_action()
<field name="all_lines_reconciled" invisible="1" />
<button name="action_bank_reconcile_bank_statements" string="Reconcile" type="object" class="oe_highlight" attrs="{'invisible':['|','|',('all_lines_reconciled','=',True),('line_ids','=',[]),('state', '!=', 'open')]}"/>
<button name="check_confirm_bank" string="Validate" type="object" class="oe_highlight" attrs="{'invisible':['|','|',('all_lines_reconciled','=',False),('line_ids','=',[]),('state', '!=', 'open')]}"/>
<button name="%(action_cash_box_out)d" string="Take Money In/Out" type="action" class="oe_highlight" attrs="{'invisible': [('journal_type','!=','cash')]}"/>
<field name="state" widget="statusbar" statusbar_visible="open,confirm"/>
</header>
<sheet>
-1
View File
@@ -23,7 +23,6 @@
<act_window
name="Take Money In/Out"
res_model="cash.box.out"
binding_model="account.bank.statement"
view_mode="form"
target="new"
id="action_cash_box_out" />
+1 -1
View File
@@ -14,7 +14,7 @@ class FinancialYearOpeningWizard(models.TransientModel):
company_id = fields.Many2one(comodel_name='res.company', required=True)
opening_move_posted = fields.Boolean(string='Opening Move Posted', compute='_compute_opening_move_posted')
opening_date = fields.Date(string='Opening Date', required=True, related='company_id.account_opening_date', help="Date from which the accounting is managed in Odoo. It is the date of the opening entry.", readonly=False)
fiscalyear_last_day = fields.Integer(related="company_id.fiscalyear_last_day", required=True,
fiscalyear_last_day = fields.Integer(related="company_id.fiscalyear_last_day", required=True, readonly=False,
help="The last day of the month will be used if the chosen day doesn't exist.")
fiscalyear_last_month = fields.Selection(selection=[(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')],
related="company_id.fiscalyear_last_month", readonly=False,
+15 -20
View File
@@ -7,27 +7,20 @@
<field name="model">account.financial.year.op</field>
<field name="arch" type="xml">
<form>
<div class="row">
<div class="col-2">
<label for="opening_date"/>
</div>
<div class="col-3">
<field name="opening_move_posted" invisible="1"/>
<field name="opening_date" attrs="{'readonly': [('opening_move_posted', '=', True)]}"/>
</div>
</div>
<sheet>
<group>
<group string="Fiscal Years">
<field name="opening_move_posted" invisible="1"/>
<field name="opening_date" attrs="{'readonly': [('opening_move_posted', '=', True)]}"/>
<div class="row">
<div class="col-2">
<strong>Fiscal Year End</strong>
</div>
<div class="col-1">
<field name="fiscalyear_last_day"/>
</div>
<div class="col-2">
<field name="fiscalyear_last_month"/>
</div>
</div>
<label for="fiscalyear_last_month" string="Fiscal Year End"/>
<div>
<field name="fiscalyear_last_day"/>
<field name="fiscalyear_last_month"/>
</div>
</group>
</group>
</sheet>
<footer>
<button name="action_save_onboarding_fiscal_year" string="Apply"
class="oe_highlight" type="object" />
@@ -84,8 +77,10 @@
<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"/>
<button name="action_read_account" type="object" icon="fa-expand" title="Open" aria-label="Open" class="float-right"/>
</tree>
</field>
</record>