[IMP] account: deploy small usability improvements with great impact
This commit is contained in:
@@ -121,6 +121,23 @@ class AccountAccount(models.Model):
|
||||
('code_company_uniq', 'unique (code,company_id)', 'The code of the account must be unique per company !')
|
||||
]
|
||||
|
||||
@api.model
|
||||
def default_get(self, default_fields):
|
||||
"""If we're creating a new account through a many2one, there are chances that we typed the account code
|
||||
instead of its name. In that case, switch both fields values.
|
||||
"""
|
||||
default_name = self._context.get('default_name')
|
||||
default_code = self._context.get('default_code')
|
||||
if default_name and not default_code:
|
||||
try:
|
||||
default_code = int(default_name)
|
||||
except ValueError:
|
||||
pass
|
||||
if default_code:
|
||||
default_name = False
|
||||
contextual_self = self.with_context(default_name=default_name, default_code=default_code)
|
||||
return super(AccountAccount, contextual_self).default_get(default_fields)
|
||||
|
||||
@api.model
|
||||
def name_search(self, name, args=None, operator='ilike', limit=100):
|
||||
args = args or []
|
||||
@@ -179,8 +196,14 @@ class AccountAccount(models.Model):
|
||||
|
||||
@api.multi
|
||||
def action_open_reconcile(self):
|
||||
self.ensure_one()
|
||||
# Open reconciliation view for this account
|
||||
action_context = {'show_mode_selector': False, 'account_ids': [self.id,]}
|
||||
if self.internal_type == 'payable':
|
||||
action_context = {'show_mode_selector': False, 'mode': 'suppliers'}
|
||||
elif self.internal_type == 'receivable':
|
||||
action_context = {'show_mode_selector': False, 'mode': 'customers'}
|
||||
else:
|
||||
action_context = {'show_mode_selector': False, 'account_ids': [self.id,]}
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'manual_reconciliation_view',
|
||||
|
||||
@@ -345,7 +345,7 @@ class AccountBankStatementLine(models.Model):
|
||||
_order = "statement_id desc, sequence"
|
||||
_inherit = ['ir.needaction_mixin']
|
||||
|
||||
name = fields.Char(string='Memo', required=True)
|
||||
name = fields.Char(string='Label', required=True)
|
||||
date = fields.Date(required=True, default=lambda self: self._context.get('date', fields.Date.context_today(self)))
|
||||
amount = fields.Monetary(digits=0, currency_field='journal_currency_id')
|
||||
journal_currency_id = fields.Many2one('res.currency', related='statement_id.currency_id',
|
||||
|
||||
@@ -438,3 +438,12 @@ class ResPartner(models.Model):
|
||||
return super(ResPartner, self)._commercial_fields() + \
|
||||
['debit_limit', 'property_account_payable_id', 'property_account_receivable_id', 'property_account_position_id',
|
||||
'property_payment_term_id', 'property_supplier_payment_term_id', 'last_time_entries_checked']
|
||||
|
||||
def open_partner_history(self):
|
||||
'''
|
||||
This function returns an action that display invoices/refunds made for the given partners.
|
||||
'''
|
||||
action = self.env.ref('account.action_invoice_refund_out_tree')
|
||||
result = action.read()[0]
|
||||
result['domain'] = "[('id','in',[" + ','.join(map(str, self.ids)) + "])]"
|
||||
return result
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="code" placeholder="code"/>
|
||||
<field name="name"/>
|
||||
<field name="user_type_id" widget="selection"/>
|
||||
<field name="tax_ids" widget="many2many_tags"/>
|
||||
<field name="tag_ids" widget="many2many_tags" domain="[('applicability', '!=', 'taxes')]" context="{'default_applicability': 'accounts'}" options="
|
||||
@@ -600,11 +600,11 @@
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="journal_entry_ids" invisible="1"/>
|
||||
<field name="date" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="ref" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="name" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="partner_id" domain="['|',('parent_id','=',False),('is_company','=',True)]"
|
||||
context="{'default_supplier': 1}"
|
||||
attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="name" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="ref" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }" groups="base.group_no_one"/>
|
||||
<field name="amount" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="journal_currency_id" invisible="1"/>
|
||||
<field name="amount_currency" invisible="1" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
@@ -1067,7 +1067,7 @@
|
||||
class="oe_link"
|
||||
type="object"
|
||||
string="-> View partially reconciled entries"
|
||||
attrs="{'invisible': ['|', ('reconciled', '=', True), '&', ('matched_debit_ids', '=', []),('matched_credit_ids', '=', [])]}">
|
||||
attrs="{'invisible': ['|', ('full_reconcile_id', '=', True), '&', ('matched_debit_ids', '=', []),('matched_credit_ids', '=', [])]}">
|
||||
</button>
|
||||
</div>
|
||||
</group>
|
||||
@@ -1128,7 +1128,7 @@
|
||||
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
|
||||
<separator colspan="4" string="Status"/>
|
||||
<newline/>
|
||||
<field name="reconciled"/>
|
||||
<field name="full_reconcile_id"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Analytic Lines" groups="analytic.group_analytic_accounting">
|
||||
@@ -1164,7 +1164,8 @@
|
||||
<field name="partner_id"/>
|
||||
<field name="account_id" options='{"no_open":True}' domain="[('company_id', '=', company_id)]"/>
|
||||
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="reconciled"/>
|
||||
<field name="reconciled" invisible="1"/>
|
||||
<field name="full_reconcile_id"/>
|
||||
<field name="debit" sum="Total Debit"/>
|
||||
<field name="credit" sum="Total Credit"/>
|
||||
<field name="amount_currency" readonly="True" groups="base.group_multi_currency"/>
|
||||
@@ -1208,7 +1209,7 @@
|
||||
<filter string="Unposted" domain="[('move_id.state','=','draft')]" help="Unposted Journal Items"/>
|
||||
<filter name="posted" string="Posted" domain="[('move_id.state','=','posted')]" help="Posted Journal Items"/>
|
||||
<separator/>
|
||||
<filter string="Unreconciled" domain="[('reconciled','=',False), ('account_id.reconcile','=',True)]" help="Unreconciled Journal Items" name="unreconciled"/>
|
||||
<filter string="Unreconciled" domain="[('full_reconcile_id','=',False), ('account_id.reconcile','=',True)]" help="Journal items where matching number isn't set" name="unreconciled"/>
|
||||
<separator/>
|
||||
<filter string="Payable" domain="[('account_id.internal_type', '=', 'payable')]" help="From Payable accounts" name="payable"/>
|
||||
<filter string="Receivable" domain="[('account_id.internal_type', '=', 'receivable')]" help="From Receivable accounts" name="receivable"/>
|
||||
@@ -2007,5 +2008,12 @@
|
||||
|
||||
<menuitem id="menu_account_report_tree_hierarchy" name="Account Reports Hierarchy" parent="menu_account_reports" action="action_account_report_tree_hierarchy"/>
|
||||
|
||||
<!-- Manual reconciliation -->
|
||||
<record id="action_manual_reconciliation" model="ir.actions.client">
|
||||
<field name="name">Manual Reconciliation</field>
|
||||
<field name="tag">manual_reconciliation_view</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_action_manual_reconciliation" name="Manual Payments & Invoices Matching" parent="menu_finance_entries" action="action_manual_reconciliation" sequence="25"/>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -96,11 +96,11 @@
|
||||
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button type="action"
|
||||
<button type="object"
|
||||
class="oe_stat_button"
|
||||
id="invoice_button"
|
||||
icon="fa-pencil-square-o"
|
||||
name="%(account.action_invoice_refund_out_tree)d"
|
||||
name="open_partner_history"
|
||||
attrs="{'invisible': [('customer', '=', False)]}"
|
||||
context="{'search_default_partner_id': active_id,'default_partner_id': active_id}">
|
||||
<div class="o_form_field o_stat_info">
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="tax_adjustments_form" model="ir.actions.act_window">
|
||||
<field name="name">Tax Adjustments</field>
|
||||
<field name="name">Make Manual Tax Adjustments</field>
|
||||
<field name="res_model">tax.adjustments.wizard</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
</record>
|
||||
<menuitem action="tax_adjustments_form" id="menu_action_tax_adjustment" parent="account.menu_finance_entries" sequence="20"/>
|
||||
<menuitem action="tax_adjustments_form" id="menu_action_tax_adjustment" parent="account.menu_finance_entries" sequence="30"/>
|
||||
</odoo>
|
||||
|
||||
@@ -25,17 +25,17 @@
|
||||
<group string="Journal Entries">
|
||||
<field name="journal_id"/>
|
||||
<div>
|
||||
<label for="account_asset_id" string="Depreciation Asset Account" attrs="{'invisible': [('type','!=','purchase')]}"/>
|
||||
<label for="account_asset_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
|
||||
<label for="account_asset_id" string="Deferred Revenue Account" attrs="{'invisible': [('type','!=','sale')]}"/>
|
||||
</div>
|
||||
<field name="account_asset_id" nolabel="1" attrs="{'invisible': [('type','=', False)]}"/>
|
||||
<div>
|
||||
<label for="account_depreciation_id" string="Depreciation Expense Account" attrs="{'invisible': [('type','!=','purchase')]}"/>
|
||||
<label for="account_depreciation_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
|
||||
<label for="account_depreciation_id" string="Recognition Account" attrs="{'invisible': [('type','!=','sale')]}"/>
|
||||
</div>
|
||||
<field name="account_depreciation_id" nolabel="1"/>
|
||||
<div>
|
||||
<label for="account_depreciation_expense_id" string="Depreciation Expense Account" attrs="{'invisible': [('type','!=','purchase')]}"/>
|
||||
<label for="account_depreciation_expense_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
|
||||
<label for="account_depreciation_expense_id" string="Recognition Income Account" attrs="{'invisible': [('type','!=','sale')]}"/>
|
||||
</div>
|
||||
<field name="account_depreciation_expense_id" nolabel="1"/>
|
||||
|
||||
Reference in New Issue
Block a user