Skip to content

Commit

Permalink
Migrated sync module to v14
Browse files Browse the repository at this point in the history
  • Loading branch information
odoo-mvds committed Dec 8, 2020
1 parent 5952aa7 commit 981494c
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 160 deletions.
5 changes: 3 additions & 2 deletions mollie_account_sync/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
'name': 'Mollie Settlement Sync',
'version': '13.0.1.0',
'version': '14.0.1.1',
'description': '',
'summary': 'This module settlements from mollie',
'author': 'Mollie',
Expand All @@ -16,7 +16,8 @@
'views/account_journal.xml',
'views/bank_statement.xml',
'views/templates.xml',
'wizard/mollie_init_views.xml'
'wizard/mollie_init_views.xml',
'security/ir.model.access.csv'
],
"qweb": ['static/src/xml/*.xml'],
}
243 changes: 111 additions & 132 deletions mollie_account_sync/models/account_journal.py

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions mollie_account_sync/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_wiz_mollie_init,access_wiz_mollie_init,model_wiz_mollie_init,account.group_account_user,1,1,1,1
access_wiz_mollie_init_line,access_wiz_mollie_init_line,model_wiz_mollie_init_line,account.group_account_user,1,1,1,1
28 changes: 21 additions & 7 deletions mollie_account_sync/static/src/js/info_widget.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
odoo.define('drgl.payment_info.widget', function (require) {
"use strict";
odoo.define('drgl.payment_info.widget', function(require) {
"use strict";

var AbstractField = require('web.AbstractField');
var fieldRegistry = require('web.field_registry');
Expand All @@ -15,11 +15,24 @@ odoo.define('drgl.payment_info.widget', function (require) {
'click .d_more_info': '_onClickInfo',
}, AbstractField.prototype.events),

_renderReadonly: function () {
_renderReadonly: function() {
this._super();
this.$el.append('<button type="button" class="btn btn-sm fa fa-info d_more_info" title="Info"></button>');
if (this.value) {
var data = JSON.parse(this.value);
var content = '<button type="button" class="btn btn-sm fa fa-info d_more_info" title="Info"></button>';
if (data.MollieType == "Payment") {
content = _.str.sprintf('<button type="button" style="background-color: #d4e9de; " class="btn btn-sm py-0 %s d_more_info" title="Info"><i class="fa fa-info-circle"></i> %s</button>', 'text-success', data.MollieType);
} else if (data.MollieType == "Refund") {
content = _.str.sprintf('<button type="button" style="background-color: #eedada; " class="btn btn-sm py-0 %s d_more_info" title="Info"><i class="fa fa-info-circle"></i> %s</button>', 'text-danger', data.MollieType);
} else if (data.MollieType == "Capture") {
content = _.str.sprintf('<button type="button" style="color: #2196F3 !important; background-color: #d7e9fd;" class="btn btn-sm py-0 %s d_more_info" title="Info"><i class="fa fa-info-circle"></i> %s</button>', 'text-info', data.MollieType);
} else if (data.MollieType == "Chargeback") {
content = _.str.sprintf('<button type="button" style="background-color: #eedada;" class="btn btn-sm py-0 %s d_more_info" title="Info"><i class="fa fa-info-circle"></i> %s</button>', 'text-danger', data.MollieType);
}
this.$el.append(content);
}
},
_onClickInfo: function (ev) {
_onClickInfo: function(ev) {
ev.stopPropagation();
ev.preventDefault();
var self = this;
Expand All @@ -33,15 +46,15 @@ odoo.define('drgl.payment_info.widget', function (require) {
order_id: data.mollie_order_id,
journal_id: journal_id
},
}).then(function (result) {
}).then(function(result) {
self._openDialog(result);
});
} else {
this._openDialog(data);
}
}
},
_openDialog: function (data) {
_openDialog: function(data) {
function formatCamelCase(text) {
var result = text.replace(/([A-Z])/g, " $1");
return result.charAt(0).toUpperCase() + result.slice(1);
Expand All @@ -59,4 +72,5 @@ odoo.define('drgl.payment_info.widget', function (require) {

fieldRegistry.add('payment_info', PaymentInfo);

return PaymentInfo;
});
14 changes: 0 additions & 14 deletions mollie_account_sync/views/account_journal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
<xpath expr="//page[@name='bank_account']/group" position="inside">
<group string="Mollie Configuration " attrs="{'invisible': [('bank_statements_source', '!=', 'mollie_sync')]}">
<field name="mollie_api_key" />
<field name="mollie_transfer_id" string="Mollie transfer journal"/>
<field name="mollie_test" groups="base.group_no_one"/>
<field name="mollie_last_sync" readonly="1"/>
<button name="recheck_all_statements" class="btn btn-danger" type="object" string="Fix Old Statements" confirm="Are you sure you want to resync?" groups="base.group_no_one"/>
</group>
</xpath>
</field>
Expand All @@ -25,21 +23,9 @@
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.account_journal_dashboard_kanban_view"/>
<field name="arch" type="xml">
<field name="kanban_dashboard" position="after">
<!-- <field name="next_synchronization"/>
<field name="account_online_journal_id"/>
<field name="synchronization_status"/> -->
<field name="need_transfer_count"/>
</field>

<xpath expr='//div[@name="bank_journal_cta"]' position='inside'>
<t t-if="dashboard.bank_statements_source == 'mollie_sync'">
<button type="object" name="action_sync_mollie_statement" class="btn btn-primary">Sync Mollie</button>
<t t-if="record.need_transfer_count.raw_value">
<button type="object" name="action_open_transfers" class="btn btn-warning">
<t t-esc="record.need_transfer_count.raw_value"/> Transter to process
</button>
</t>
</t>
</xpath>

Expand Down
7 changes: 3 additions & 4 deletions mollie_account_sync/views/bank_statement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form"/>
<field name="arch" type="xml">
<field name="accounting_date" position="after">
<field name="date" position="after">
<field name="journal_sync_type" invisible="1"/>
<field name="mollie_internal_transfer_id" redonly="1" attrs="{'invisible': [('journal_sync_type', '!=', 'mollie_sync')]}"/>
</field>
<xpath expr="//field[@name='line_ids']/tree/field[@name='bank_account_id']" position="after">
<field name="mollie_json_info" widget="payment_info" string="Mollie Info" attrs="{'column_invisible': [('parent.journal_sync_type', '!=', 'mollie_sync')]}"/>
<field name="journal_id" invisible="1"/>
<xpath expr="//field[@name='line_ids']/tree/field[@name='amount']" position="after">
<field name="mollie_json_info" widget="payment_info" string=" " attrs="{'column_invisible': [('parent.journal_sync_type', '!=', 'mollie_sync')]}"/>
</xpath>
</field>
</record>
Expand Down
2 changes: 1 addition & 1 deletion mollie_account_sync/wizard/mollie_init_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<div class="my-5" attrs="{'invisible': [('settlement_lines', '!=', [])]}">

<div class="text-center text-beta">
<span class="fa fa-exclamation-triangle fa-5x"/>
<span class="fa fa-exclamation-triangle fa-5x" title="Warning"/>
</div>
<h1 class="text-center">
There are no new statement to sync.
Expand Down

0 comments on commit 981494c

Please sign in to comment.