diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index fef8868f80f..e7763356e96 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -19,7 +19,7 @@ from lxml import etree class AccountMove(models.Model): _name = "account.move" _description = "Journal Entries" - _order = 'date desc, id desc' + _order = 'date desc, name desc, id desc' _inherit = ['mail.thread', 'mail.activity.mixin'] @api.model @@ -34,10 +34,11 @@ class AccountMove(models.Model): def name_get(self): result = [] for move in self: + name = move.name + if self.env.context.get('name_groupby'): + name = "**{date}**, {name} {partner}".format(date=format_date(self.env, move.date), name=move.name, partner=move.partner_id.name or "") if move.state == 'draft': name = '* ' + str(move.id) - else: - name = move.name result.append((move.id, name)) return result @@ -510,7 +511,7 @@ class AccountMove(models.Model): class AccountMoveLine(models.Model): _name = "account.move.line" _description = "Journal Item" - _order = "date desc, id desc" + _order = "date desc, move_name desc, id desc" @api.onchange('debit', 'credit', 'tax_ids', 'analytic_account_id', 'analytic_tag_ids') def onchange_tax_ids_create_aml(self): @@ -614,6 +615,7 @@ class AccountMoveLine(models.Model): record.parent_state = record.move_id.state name = fields.Char(string="Label") + move_name = fields.Char(string='Number', related='move_id.name', store=True, index=True) quantity = fields.Float(digits=dp.get_precision('Product Unit of Measure'), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very useful for some reports.") product_uom_id = fields.Many2one('uom.uom', string='Unit of Measure') @@ -1532,7 +1534,7 @@ class AccountMoveLine(models.Model): @api.multi def open_reconcile_view(self): - [action] = self.env.ref('account.action_account_moves_all_a').read() + [action] = self.env.ref('account.action_account_moves_all').read() ids = [] for aml in self: if aml.account_id.reconcile: diff --git a/addons/account/tests/test_payment.py b/addons/account/tests/test_payment.py index 808393d89a5..1556bb14628 100644 --- a/addons/account/tests/test_payment.py +++ b/addons/account/tests/test_payment.py @@ -129,11 +129,10 @@ class TestPayment(AccountingTestCase): }) payment.post() self.assertRecordValues(payment.move_line_ids, [ + {'account_id': self.account_usd.id, 'debit': 0.0, 'credit': 32.70, 'amount_currency': -50, 'currency_id': self.currency_usd_id}, + {'account_id': self.transfer_account.id, 'debit': 32.70, 'credit': 0.0, 'amount_currency': 50, 'currency_id': self.currency_usd_id}, {'account_id': self.transfer_account.id, 'debit': 0.0, 'credit': 32.70, 'amount_currency': -50, 'currency_id': self.currency_usd_id}, {'account_id': self.account_eur.id, 'debit': 32.70, 'credit': 0.0, 'amount_currency': 0, 'currency_id': False}, - {'account_id': self.account_usd.id, 'debit': 0.0, 'credit': 32.70, 'amount_currency': -50, 'currency_id': self.currency_usd_id}, - {'account_id': self.transfer_account.id, 'debit': 32.70, 'credit': 0.0, 'amount_currency': 50, - 'currency_id': self.currency_usd_id}, ]) def test_payment_chf_journal_usd(self): diff --git a/addons/account/views/account_analytic_view.xml b/addons/account/views/account_analytic_view.xml index e3c773b1ce7..7f8164329b7 100644 --- a/addons/account/views/account_analytic_view.xml +++ b/addons/account/views/account_analytic_view.xml @@ -68,7 +68,7 @@ - + - + + domain="[('type_tax_use','=','purchase'),('company_id', '=', parent.company_id)]"/> @@ -539,10 +539,9 @@ - + + domain="[('type_tax_use','=','sale'),('company_id', '=', parent.company_id)]"/> diff --git a/addons/account/views/account_menuitem.xml b/addons/account/views/account_menuitem.xml index 14f667247ad..e1a8b60121e 100644 --- a/addons/account/views/account_menuitem.xml +++ b/addons/account/views/account_menuitem.xml @@ -13,9 +13,11 @@ - + + + - + @@ -34,4 +36,3 @@ - diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index aa2e1a35123..6f3dd3c1f27 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -131,7 +131,7 @@ account.move.line.tree account.move.line - + @@ -154,17 +154,111 @@ + + + + + + account.move.line.tree.grouped + account.move.line + + + + + + + + + + + + + + + + + + + + + + + -