diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 15e25f1d9fb..69782d2ea58 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -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', diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 9a4e7d7a907..a23e1d12b5c 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -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', diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 17a8b70d63e..7272a77345e 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -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 diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index 19fbd7fe0aa..23021226ace 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -13,8 +13,8 @@ - + - + - + @@ -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', '=', [])]}"> @@ -1128,7 +1128,7 @@ - + @@ -1164,7 +1164,8 @@ - + + @@ -1208,7 +1209,7 @@ - + @@ -2007,5 +2008,12 @@ + + + Manual Reconciliation + manual_reconciliation_view + + + diff --git a/addons/account/views/partner_view.xml b/addons/account/views/partner_view.xml index 640541dc9f9..beda8f4797c 100644 --- a/addons/account/views/partner_view.xml +++ b/addons/account/views/partner_view.xml @@ -96,11 +96,11 @@
-