diff --git a/addons/account/__manifest__.py b/addons/account/__manifest__.py
index 522f7ca5ee9..fb08a1befc3 100644
--- a/addons/account/__manifest__.py
+++ b/addons/account/__manifest__.py
@@ -108,6 +108,7 @@ You could use this simplified accounting in case you work with an (external) acc
'account/static/src/js/tours/account.js',
'account/static/src/js/bills_upload.js',
'account/static/src/js/account_selection.js',
+ 'account/static/src/js/open_move_widget.js',
],
'web.assets_frontend': [
'account/static/src/js/account_portal_sidebar.js',
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index 06573243196..0954e379559 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -2223,15 +2223,7 @@ class AccountMove(models.Model):
def name_get(self):
result = []
for move in self:
- if self._context.get('name_groupby'):
- name = '**%s**, %s' % (format_date(self.env, move.date), move._get_move_display_name())
- if move.ref:
- name += ' (%s)' % move.ref
- if move.partner_id.name:
- name += ' - %s' % move.partner_id.name
- else:
- name = move._get_move_display_name(show_ref=True)
- result.append((move.id, name))
+ result.append((move.id, move._get_move_display_name(show_ref=True)))
return result
# -------------------------------------------------------------------------
@@ -3525,7 +3517,7 @@ class AccountMoveLine(models.Model):
index=True, required=True, readonly=True, auto_join=True, ondelete="cascade",
check_company=True,
help="The move of this entry line.")
- move_name = fields.Char(string='Number', related='move_id.name', store=True, index='trigram')
+ move_name = fields.Char(string='Number', related='move_id.name', store=True, index='btree')
date = fields.Date(related='move_id.date', store=True, readonly=True, index=True, copy=False, group_operator='min')
ref = fields.Char(related='move_id.ref', store=True, copy=False, index='trigram', readonly=True)
parent_state = fields.Selection(related='move_id.state', store=True, readonly=True)
@@ -3534,6 +3526,7 @@ class AccountMoveLine(models.Model):
company_currency_id = fields.Many2one(related='company_id.currency_id', string='Company Currency',
readonly=True, store=True,
help='Utility field to express amount currency')
+ is_same_currency = fields.Boolean(compute='_compute_same_currency')
is_storno = fields.Boolean(
related='move_id.is_storno',
string='Company Storno Accounting',
@@ -3640,6 +3633,7 @@ class AccountMoveLine(models.Model):
matched_credit_ids = fields.One2many('account.partial.reconcile', 'debit_move_id', string='Matched Credits',
help='Credit journal items that are matched with this journal item.', readonly=True)
matching_number = fields.Char(string="Matching #", compute='_compute_matching_number', store=True, help="Matching number for this line, 'P' if it is only partially reconcile, or the name of the full reconcile if it exists.")
+ is_account_reconcile = fields.Boolean(related='account_id.reconcile', string='Account Reconcile', help='Technical field for the matching link widget')
# ==== Analytic fields ====
analytic_line_ids = fields.One2many('account.analytic.line', 'move_id', string='Analytic lines')
@@ -4388,6 +4382,11 @@ class AccountMoveLine(models.Model):
record.tax_audit = audit_str
+ @api.depends('currency_id', 'company_currency_id')
+ def _compute_same_currency(self):
+ for record in self:
+ record.is_same_currency = record.currency_id == record.company_currency_id
+
# -------------------------------------------------------------------------
# CONSTRAINT METHODS
# -------------------------------------------------------------------------
@@ -5884,13 +5883,22 @@ class AccountMoveLine(models.Model):
return action
def open_move(self):
- return {
- 'type': 'ir.actions.act_window',
- 'res_model': 'account.move',
- 'view_mode': 'form',
- 'res_id': self.move_id.id,
- 'views': [(False, 'form')],
- }
+ if self.payment_id:
+ return {
+ 'type': 'ir.actions.act_window',
+ 'res_model': 'account.payment',
+ 'view_mode': 'form',
+ 'res_id': self.payment_id.id,
+ 'views': [(False, 'form')],
+ }
+ else:
+ return {
+ 'type': 'ir.actions.act_window',
+ 'res_model': 'account.move',
+ 'view_mode': 'form',
+ 'res_id': self.move_id.id,
+ 'views': [(False, 'form')],
+ }
def action_automatic_entry(self):
diff --git a/addons/account/static/src/js/open_move_widget.js b/addons/account/static/src/js/open_move_widget.js
new file mode 100644
index 00000000000..78901317e68
--- /dev/null
+++ b/addons/account/static/src/js/open_move_widget.js
@@ -0,0 +1,23 @@
+/** @odoo-module **/
+import fieldRegistry from 'web.field_registry';
+import { FieldChar } from 'web.basic_fields';
+
+const OpenMoveWidget = FieldChar.extend({
+ template: 'account.OpenMoveTemplate',
+ events: Object.assign({}, FieldChar.prototype.events, {
+ 'click': '_onOpenMove',
+ }),
+ _onOpenMove: function(ev) {
+ ev.preventDefault();
+ ev.stopPropagation();
+ var self = this;
+ this._rpc({
+ model: 'account.move.line',
+ method: 'open_move',
+ args: [this.res_id],
+ }).then(function (actionData){
+ return self.do_action(actionData);
+ });
+ },
+});
+fieldRegistry.add('open_move_widget', OpenMoveWidget);
diff --git a/addons/account/static/src/xml/grouped_view_widget.xml b/addons/account/static/src/xml/grouped_view_widget.xml
index 6852c036290..b187277418e 100644
--- a/addons/account/static/src/xml/grouped_view_widget.xml
+++ b/addons/account/static/src/xml/grouped_view_widget.xml
@@ -33,4 +33,8 @@
+
+
+
+
diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml
index 09fe23a2f66..f2c6088a1c1 100644
--- a/addons/account/views/account_move_views.xml
+++ b/addons/account/views/account_move_views.xml
@@ -150,100 +150,40 @@
account.move.line
-
+
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
- account.move.line.tree.grouped
- account.move.line
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -252,11 +192,10 @@
account.move.line.tree.grouped.sales.purchase
account.move.line
primary
-
+
hide
- hide
- show
+ hide
show
@@ -265,11 +204,10 @@
account.move.line.tree.grouped.bank.cash
account.move.line
primary
-
+
hide
- hide
- show
+ hide
@@ -277,10 +215,10 @@
account.move.line.tree.grouped.misc
account.move.line
primary
-
+
hide
- hide
+ hide
@@ -288,15 +226,11 @@
account.move.line.tree.grouped.misc
account.move.line
primary
-
+
-
- hide
-
+ hide
show
-
-
-
+ show
@@ -305,14 +239,12 @@
account.move.line.tree.grouped.partner
account.move.line
primary
-
+
hide
show
show
-
-
-
+ show
@@ -322,15 +254,12 @@
primary
-
+
-
-
-
- hide
+
hide
@@ -344,7 +273,7 @@
show
-
+
hide
@@ -398,8 +327,9 @@
-
-
+
+
+
@@ -407,15 +337,13 @@
-
-
-
+
-
+
@@ -1453,11 +1381,11 @@
- {'journal_type':'general', 'search_default_group_by_move': 1, 'search_default_posted':1, 'name_groupby':1, 'create':0}
+ {'journal_type':'general', 'search_default_group_by_move': 1, 'search_default_posted':1, 'create':0}
Journal Items
account.move.line
[('display_type', 'not in', ('line_section', 'line_note'))]
-
+
tree,pivot,graph,kanban
@@ -1466,12 +1394,12 @@
Journal Items
account.move.line
[('display_type', 'not in', ('line_section', 'line_note'))]
-
+
tree,pivot,graph,kanban
- {'journal_type':'sales', 'search_default_group_by_move': 1, 'search_default_posted':1, 'search_default_sales':1, 'name_groupby':1, 'expand': 1}
+ {'journal_type':'sales', 'search_default_group_by_move': 1, 'search_default_posted':1, 'search_default_sales':1, 'expand': 1}
Sales
account.move.line
[('display_type', 'not in', ('line_section', 'line_note'))]
@@ -1480,7 +1408,7 @@
- {'journal_type':'purchase', 'search_default_group_by_move': 1, 'search_default_posted':1, 'search_default_purchases':1, 'name_groupby':1, 'expand': 1}
+ {'journal_type':'purchase', 'search_default_group_by_move': 1, 'search_default_posted':1, 'search_default_purchases':1, 'expand': 1}
Purchases
account.move.line
[('display_type', 'not in', ('line_section', 'line_note'))]
@@ -1489,7 +1417,7 @@
- {'journal_type':'bank', 'search_default_group_by_move': 1, 'search_default_posted':1, 'search_default_bank':1, 'search_default_cash':1, 'name_groupby':1, 'expand': 1}
+ {'journal_type':'bank', 'search_default_group_by_move': 1, 'search_default_posted':1, 'search_default_bank':1, 'search_default_cash':1, 'expand': 1}
Bank and Cash
account.move.line
[('display_type', 'not in', ('line_section', 'line_note'))]
@@ -1498,7 +1426,7 @@
- {'journal_type':'general', 'search_default_group_by_move': 1, 'search_default_posted':1, 'search_default_misc_filter':1, 'name_groupby':1, 'expand': 1}
+ {'journal_type':'general', 'search_default_group_by_move': 1, 'search_default_posted':1, 'search_default_misc_filter':1, 'expand': 1}
Miscellaneous
account.move.line
[('display_type', 'not in', ('line_section', 'line_note'))]
diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py
index 6b722755687..a74b9657c0d 100644
--- a/addons/point_of_sale/models/pos_session.py
+++ b/addons/point_of_sale/models/pos_session.py
@@ -1415,13 +1415,12 @@ class PosSession(models.Model):
'type': 'ir.actions.act_window',
'res_model': 'account.move.line',
'view_mode': 'tree',
- 'view_id':self.env.ref('account.view_move_line_tree_grouped').id,
+ 'view_id':self.env.ref('account.view_move_line_tree').id,
'domain': [('id', 'in', all_related_moves.mapped('line_ids').ids)],
'context': {
'journal_type':'general',
'search_default_group_by_move': 1,
'group_by':'move_id', 'search_default_posted':1,
- 'name_groupby':1,
},
}