-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
account_bank_statement_product_dimension
- Loading branch information
1 parent
7e661de
commit c8ad695
Showing
8 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png | ||
:target: https://www.gnu.org/licenses/agpl | ||
:alt: License: AGPL-3 | ||
|
||
====================================================== | ||
Add product field to the Bank Statement reconciliation | ||
====================================================== |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2009-2019 Noviat. | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
'name': 'Add product field to the Bank Statement reconciliation', | ||
'version': '11.0.1.0.0', | ||
'license': 'AGPL-3', | ||
'author': 'Noviat', | ||
'website': 'http://www.noviat.com', | ||
'category': 'Accounting & Finance', | ||
'depends': [ | ||
'account', | ||
], | ||
'data': [ | ||
'views/assets_backend.xml', | ||
'views/account_move_views.xml', | ||
'views/account_move_line_views.xml', | ||
], | ||
'qweb': [ | ||
'static/src/xml/account_reconciliation.xml', | ||
], | ||
'installable': True, | ||
} |
59 changes: 59 additions & 0 deletions
59
account_bank_statement_product_dimension/static/src/js/abs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
Copyright 2009-2019 Noviat. | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
*/ | ||
odoo.define('account_bank_statement_product_dimension.abs', function (require) { | ||
"use strict"; | ||
|
||
var core = require('web.core'); | ||
var relational_fields = require('web.relational_fields'); | ||
var ReconciliationRenderer = require('account.ReconciliationRenderer'); | ||
var ReconciliationModel = require('account.ReconciliationModel'); | ||
var _t = core._t; | ||
|
||
ReconciliationModel.StatementModel.include({ | ||
|
||
init: function (parent, options) { | ||
this._super.apply(this, arguments); | ||
this.extra_field_names = ['product_id']; | ||
this.extra_fields = [{ | ||
relation: 'product.product', | ||
type: 'many2one', | ||
name: 'product_id', | ||
}]; | ||
this.extra_fieldInfo = { | ||
product_id: { string: _t("Product") }, | ||
}; | ||
this.quickCreateFields = this.quickCreateFields.concat(this.extra_field_names); | ||
}, | ||
|
||
makeRecord: function (model, fields, fieldInfo) { | ||
var self = this; | ||
if (model === 'account.bank.statement.line' && fields.length === 6) { | ||
fields = fields.concat(this.extra_fields); | ||
_.extend(fieldInfo, this.extra_fieldInfo); | ||
}; | ||
return this._super(model, fields, fieldInfo); | ||
}, | ||
|
||
_formatToProcessReconciliation: function (line, prop) { | ||
var result = this._super(line, prop); | ||
if (prop.product_id) result.product_id = prop.product_id.id; | ||
return result; | ||
}, | ||
|
||
}); | ||
|
||
ReconciliationRenderer.LineRenderer.include({ | ||
|
||
_renderCreate: function (state) { | ||
this._super(state); | ||
var record = this.model.get(this.handleCreateRecord); | ||
this.fields.product_id = new relational_fields.FieldMany2One(this, | ||
'product_id', record, { mode: 'edit' }); | ||
this.fields.product_id.appendTo(this.$el.find('.create_product_id .o_td_field')); | ||
}, | ||
|
||
}); | ||
|
||
}); |
15 changes: 15 additions & 0 deletions
15
account_bank_statement_product_dimension/static/src/xml/account_reconciliation.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<templates> | ||
|
||
<t t-extend="reconciliation.line.create"> | ||
|
||
<t t-jquery="tr[class='create_amount']" t-operation="append"> | ||
<tr class="create_product_id"> | ||
<td class="o_td_label">Product</td> | ||
<td class="o_td_field"></td> | ||
</tr> | ||
</t> | ||
|
||
</t> | ||
|
||
</templates> |
15 changes: 15 additions & 0 deletions
15
account_bank_statement_product_dimension/views/account_move_line_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="view_move_line_form" model="ir.ui.view"> | ||
<field name="name">account.move.line.form</field> | ||
<field name="model">account.move.line</field> | ||
<field name="inherit_id" ref="account.view_move_line_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="quantity" position="before"> | ||
<field name="product_id"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
15 changes: 15 additions & 0 deletions
15
account_bank_statement_product_dimension/views/account_move_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="view_move_form" model="ir.ui.view"> | ||
<field name="name">account.move.form</field> | ||
<field name="model">account.move</field> | ||
<field name="inherit_id" ref="account.view_move_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//notebook//field[@name='line_ids']/tree/field[@name='account_id']" position="before"> | ||
<field name="product_id"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
10 changes: 10 additions & 0 deletions
10
account_bank_statement_product_dimension/views/assets_backend.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<template id="assets_backend" name="account assets" inherit_id="account.assets_backend"> | ||
<xpath expr="." position="inside"> | ||
<script type="text/javascript" src="/account_bank_statement_product_dimension/static/src/js/abs.js"></script> | ||
</xpath> | ||
</template> | ||
|
||
</odoo> |