odoo-addon-account-reconcile-oca 17.0.1.5.3__py3-none-any.whl → 17.0.1.5.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. odoo/addons/account_reconcile_oca/README.rst +1 -1
  2. odoo/addons/account_reconcile_oca/__manifest__.py +1 -1
  3. odoo/addons/account_reconcile_oca/i18n/account_reconcile_oca.pot +7 -0
  4. odoo/addons/account_reconcile_oca/i18n/es.po +8 -1
  5. odoo/addons/account_reconcile_oca/models/account_account_reconcile.py +21 -9
  6. odoo/addons/account_reconcile_oca/models/account_bank_statement_line.py +331 -52
  7. odoo/addons/account_reconcile_oca/models/account_reconcile_abstract.py +42 -14
  8. odoo/addons/account_reconcile_oca/static/description/index.html +1 -1
  9. odoo/addons/account_reconcile_oca/static/src/js/reconcile_move_line/reconcile_move_line_controller.esm.js +9 -0
  10. odoo/addons/account_reconcile_oca/static/src/js/reconcile_move_line/reconcile_move_line_view.esm.js +1 -0
  11. odoo/addons/account_reconcile_oca/static/src/js/widgets/reconcile_data_widget.esm.js +12 -0
  12. odoo/addons/account_reconcile_oca/static/src/js/widgets/reconcile_move_line_widget.esm.js +2 -1
  13. odoo/addons/account_reconcile_oca/static/src/xml/reconcile.xml +15 -1
  14. odoo/addons/account_reconcile_oca/tests/test_bank_account_reconcile.py +214 -47
  15. {odoo_addon_account_reconcile_oca-17.0.1.5.3.dist-info → odoo_addon_account_reconcile_oca-17.0.1.5.5.dist-info}/METADATA +2 -2
  16. {odoo_addon_account_reconcile_oca-17.0.1.5.3.dist-info → odoo_addon_account_reconcile_oca-17.0.1.5.5.dist-info}/RECORD +18 -18
  17. {odoo_addon_account_reconcile_oca-17.0.1.5.3.dist-info → odoo_addon_account_reconcile_oca-17.0.1.5.5.dist-info}/WHEEL +0 -0
  18. {odoo_addon_account_reconcile_oca-17.0.1.5.3.dist-info → odoo_addon_account_reconcile_oca-17.0.1.5.5.dist-info}/top_level.txt +0 -0
@@ -33,24 +33,46 @@ class AccountReconcileAbstract(models.AbstractModel):
33
33
  related="company_id.currency_id", string="Company Currency"
34
34
  )
35
35
 
36
+ def _get_reconcile_currency(self):
37
+ return self.currency_id or self.company_id._currency_id
38
+
36
39
  def _get_reconcile_line(
37
- self, line, kind, is_counterpart=False, max_amount=False, from_unreconcile=False
40
+ self,
41
+ line,
42
+ kind,
43
+ is_counterpart=False,
44
+ max_amount=False,
45
+ from_unreconcile=False,
46
+ move=False,
38
47
  ):
39
48
  date = self.date if "date" in self._fields else line.date
40
49
  original_amount = amount = net_amount = line.debit - line.credit
50
+ line_currency = line.currency_id
41
51
  if is_counterpart:
42
52
  currency_amount = -line.amount_residual_currency or line.amount_residual
43
53
  amount = -line.amount_residual
44
- currency = line.currency_id or self.company_id.currency_id
54
+ currency = line.currency_id or line.company_id.currency_id
45
55
  original_amount = net_amount = -line.amount_residual
46
56
  if max_amount:
47
- currency_max_amount = self.company_id.currency_id._convert(
48
- max_amount, currency, self.company_id, date
49
- )
57
+ dest_currency = self._get_reconcile_currency()
58
+ if currency == dest_currency:
59
+ real_currency_amount = currency_amount
60
+ elif self.company_id.currency_id == dest_currency:
61
+ real_currency_amount = amount
62
+ else:
63
+ real_currency_amount = self.company_id.currency_id._convert(
64
+ amount,
65
+ dest_currency,
66
+ self.company_id,
67
+ date,
68
+ )
50
69
  if (
51
- -currency_amount > currency_max_amount > 0
52
- or -currency_amount < currency_max_amount < 0
70
+ -real_currency_amount > max_amount > 0
71
+ or -real_currency_amount < max_amount < 0
53
72
  ):
73
+ currency_max_amount = self._get_reconcile_currency()._convert(
74
+ max_amount, currency, self.company_id, date
75
+ )
54
76
  amount = currency_max_amount
55
77
  net_amount = -max_amount
56
78
  currency_amount = -amount
@@ -61,8 +83,11 @@ class AccountReconcileAbstract(models.AbstractModel):
61
83
  date,
62
84
  )
63
85
  else:
64
- currency_amount = line.amount_currency
86
+ currency_amount = self.amount_currency or self.amount
87
+ line_currency = self._get_reconcile_currency()
65
88
  vals = {
89
+ "move_id": move and line.move_id.id,
90
+ "move": move and line.move_id.name,
66
91
  "reference": "account.move.line;%s" % line.id,
67
92
  "id": line.id,
68
93
  "account_id": [line.account_id.id, line.account_id.display_name],
@@ -76,7 +101,7 @@ class AccountReconcileAbstract(models.AbstractModel):
76
101
  "amount": amount,
77
102
  "net_amount": amount - net_amount,
78
103
  "currency_id": self.company_id.currency_id.id,
79
- "line_currency_id": line.currency_id.id,
104
+ "line_currency_id": line_currency.id,
80
105
  "currency_amount": currency_amount,
81
106
  "analytic_distribution": line.analytic_distribution,
82
107
  "kind": kind,
@@ -84,11 +109,11 @@ class AccountReconcileAbstract(models.AbstractModel):
84
109
  if from_unreconcile:
85
110
  vals.update(
86
111
  {
87
- "id": False,
88
- "counterpart_line_ids": (
89
- line.matched_debit_ids.mapped("debit_move_id")
90
- | line.matched_credit_ids.mapped("credit_move_id")
91
- ).ids,
112
+ "credit": vals["debit"] and from_unreconcile["debit"],
113
+ "debit": vals["credit"] and from_unreconcile["credit"],
114
+ "amount": from_unreconcile["amount"],
115
+ "net_amount": from_unreconcile["amount"],
116
+ "currency_amount": from_unreconcile["currency_amount"],
92
117
  }
93
118
  )
94
119
  if not float_is_zero(
@@ -99,3 +124,6 @@ class AccountReconcileAbstract(models.AbstractModel):
99
124
  if is_counterpart:
100
125
  vals["counterpart_line_ids"] = line.ids
101
126
  return [vals]
127
+
128
+ def add_multiple_lines(self, domain):
129
+ self.ensure_one()
@@ -367,7 +367,7 @@ ul.auto-toc {
367
367
  !! This file is generated by oca-gen-addon-readme !!
368
368
  !! changes will be overwritten. !!
369
369
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
- !! source digest: sha256:25a85af43d834abf67306c2d7fa108d6ecc44f76300ab92e54cc982f8cfe9334
370
+ !! source digest: sha256:cf0d778067ac722c5a6d7f65f8fa4b0766076829ba9c9c147cc3718782cc85b0
371
371
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
372
  <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-reconcile/tree/17.0/account_reconcile_oca"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-reconcile-17-0/account-reconcile-17-0-account_reconcile_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-reconcile&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
373
  <p>This addon allows to reconcile bank statements and account marked as
@@ -8,6 +8,15 @@ export class ReconcileMoveLineController extends ListController {
8
8
  data[this.props.parentField] = [record.resId, record.display_name];
9
9
  this.props.parentRecord.update(data);
10
10
  }
11
+ async clickAddAll() {
12
+ await this.props.parentRecord.save();
13
+ await this.orm.call(this.props.parentRecord.resModel, "add_multiple_lines", [
14
+ this.props.parentRecord.resIds,
15
+ this.model.root.domain,
16
+ ]);
17
+ await this.props.parentRecord.load();
18
+ this.props.parentRecord.model.notify();
19
+ }
11
20
  }
12
21
 
13
22
  ReconcileMoveLineController.template = `account_reconcile_oca.ReconcileMoveLineController`;
@@ -10,6 +10,7 @@ export const ReconcileMoveLineView = {
10
10
  ...listView,
11
11
  Controller: ReconcileMoveLineController,
12
12
  Renderer: ReconcileMoveLineRenderer,
13
+ buttonTemplate: "reconcile_move_line.ListView.Buttons",
13
14
  };
14
15
 
15
16
  registry.category("views").add("reconcile_move_line", ReconcileMoveLineView);
@@ -2,12 +2,15 @@
2
2
  import {formatDate, parseDate} from "@web/core/l10n/dates";
3
3
  import {formatMonetary} from "@web/views/fields/formatters";
4
4
  import {registry} from "@web/core/registry";
5
+ import {useService} from "@web/core/utils/hooks";
5
6
 
6
7
  const {Component} = owl;
7
8
 
8
9
  export class AccountReconcileDataWidget extends Component {
9
10
  setup() {
10
11
  super.setup(...arguments);
12
+ this.orm = useService("orm");
13
+ this.action = useService("action");
11
14
  this.foreignCurrency =
12
15
  this.props &&
13
16
  this.props.record &&
@@ -70,6 +73,15 @@ export class AccountReconcileDataWidget extends Component {
70
73
  });
71
74
  this.env.bus.trigger("RECONCILE_PAGE_NAVIGATE", triggerEv);
72
75
  }
76
+ async openMove(ev, moveId) {
77
+ ev.preventDefault();
78
+ ev.stopPropagation();
79
+ console.log(moveId);
80
+ const action = await this.orm.call("account.move", "get_formview_action", [
81
+ [moveId],
82
+ ]);
83
+ this.action.doAction(action);
84
+ }
73
85
  }
74
86
  AccountReconcileDataWidget.template = "account_reconcile_oca.ReconcileDataWidget";
75
87
 
@@ -31,7 +31,7 @@ export class AccountReconcileMatchWidget extends Component {
31
31
  controlPanel: {
32
32
  // Hiding the control panel buttons
33
33
  "top-left": false,
34
- "bottom-left": false,
34
+ "bottom-left": true,
35
35
  layoutActions: false,
36
36
  },
37
37
  },
@@ -49,6 +49,7 @@ export class AccountReconcileMatchWidget extends Component {
49
49
  searchViewId: false,
50
50
  parentRecord: this.props.record,
51
51
  parentField: this.props.name,
52
+ showButtons: false,
52
53
  };
53
54
  }
54
55
  }
@@ -114,7 +114,18 @@
114
114
  t-on-click="(ev) => this.selectReconcileLine(ev, reconcile_line)"
115
115
  t-att-class="'o_reconcile_widget_line ' + reconcile_line.kind + (props.record.data.manual_reference == reconcile_line.reference ? ' selected ' : ' ')"
116
116
  >
117
- <td t-esc="reconcile_line.account_id[1]" />
117
+ <td>
118
+ <div t-esc="reconcile_line.account_id[1]" />
119
+ <div t-if="reconcile_line.move_id">
120
+ <a
121
+ t-att-href="'/web#id=' + reconcile_line.move_id + '&amp;view_type=form&amp;model=account.move'"
122
+ class="o_form_uri"
123
+ t-on-click="(ev) => this.openMove(ev, reconcile_line.move_id)"
124
+ >
125
+ <small t-esc="reconcile_line.move" />
126
+ </a>
127
+ </div>
128
+ </td>
118
129
  <td>
119
130
  <span
120
131
  t-esc="reconcile_line.partner_id[1]"
@@ -189,4 +200,7 @@
189
200
  <attribute name="parentField">props.parentField</attribute>
190
201
  </xpath>
191
202
  </t>
203
+ <t t-name="reconcile_move_line.ListView.Buttons">
204
+ <button class="btn btn-primary" t-on-click="clickAddAll">Add all</button>
205
+ </t>
192
206
  </templates>