Merge lp:~openerp-dev/openobject-addons/trunk-bank-reconciliation-ama into lp:openobject-addons
- trunk-bank-reconciliation-ama
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~openerp-dev/openobject-addons/trunk-bank-reconciliation-ama |
Merge into: | lp:openobject-addons |
Diff against target: |
5080 lines (+3418/-810) 38 files modified
account/__openerp__.py (+3/-0) account/account.py (+5/-0) account/account_bank_statement.py (+370/-197) account/account_invoice.py (+1/-1) account/account_move_line.py (+7/-5) account/account_unit_test.xml (+2/-2) account/account_view.xml (+126/-42) account/demo/account_bank_statement.xml (+85/-0) account/demo/account_invoice_demo.xml (+130/-0) account/security/ir.model.access.csv (+101/-100) account/static/src/css/account_bank_statement_reconciliation.css (+264/-0) account/static/src/css/account_bank_statement_reconciliation.scss (+447/-0) account/static/src/js/account_widgets.js (+1468/-0) account/static/src/xml/account_bank_statement_reconciliation.xml (+194/-0) account/views/account.xml (+2/-1) account/wizard/__init__.py (+2/-4) account/wizard/account_statement_from_invoice.py (+4/-43) account/wizard/pos_box.py (+0/-2) account_analytic_plans/__openerp__.py (+1/-0) account_analytic_plans/account_analytic_plans_view.xml (+20/-52) account_analytic_plans/static/src/js/account_bank_reconciliation.js (+35/-0) account_analytic_plans/views/account_analytic_plans.xml (+12/-0) account_bank_statement_extensions/account_bank_statement_view.xml (+2/-10) account_payment/wizard/account_payment_populate_statement.py (+0/-3) account_voucher/__init__.py (+0/-1) account_voucher/__openerp__.py (+0/-1) account_voucher/account_voucher.py (+0/-110) account_voucher/account_voucher_view.xml (+1/-53) account_voucher/wizard/__init__.py (+0/-24) l10n_be_coda/__openerp__.py (+29/-29) l10n_be_coda/l10n_be_coda_demo.xml (+36/-0) l10n_be_coda/l10n_be_coda_view.xml (+1/-9) l10n_be_coda/l10n_be_coda_wizard.xml (+0/-1) l10n_be_coda/wizard/account_coda_import.py (+51/-77) point_of_sale/point_of_sale.py (+1/-19) point_of_sale/point_of_sale_view.xml (+0/-7) point_of_sale/test/account_statement_reports.yml (+16/-15) stock/stock.py (+2/-2) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-addons/trunk-bank-reconciliation-ama |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+218970@code.launchpad.net |
Commit message
Description of the change
- 9282. By Arthur Maniet
-
[FIX] reconciliation persistance logic
- 9283. By Arthur Maniet
-
[MERGE] with trunk
- 9284. By Arthur Maniet
-
[IMP] the form in bankStatementRe
conciliationLin e is now fully extensible - 9285. By Arthur Maniet
-
[add] partial reconciliation
- 9286. By Arthur Maniet
-
[ADD] to account_
analytic_ plans files to extend account. bankStatementRe conciliationLin e widget
[FIX] temporary account in coda import wizard removed
[IMP] move lines unicity in reconciliation more gracefully enforced - 9287. By Arthur Maniet
-
merged with self, somehow
- 9288. By Arthur Maniet
-
a
- 9289. By Arthur Maniet
-
[IMP] fields in the create line form can be hidden depending on group ; account_
analytic_ plans correctly updates the form - 9290. By Arthur Maniet
-
[FIX] bank statement can be closed
[FIX] tests depending on bank statement (line) - 9291. By Arthur Maniet
-
[FIX] point_of_
sale/test/ account_ statement_ reports. yml - 9292. By Arthur Maniet
-
idem
- 9293. By Arthur Maniet
-
bis repetita
- 9294. By Arthur Maniet
-
ad nauseam
- 9295. By Arthur Maniet
-
nauseam
- 9296. By Arthur Maniet
-
a
- 9297. By Arthur Maniet
-
a
- 9298. By Arthur Maniet
-
a
- 9299. By Arthur Maniet
-
a
- 9300. By Arthur Maniet
-
a
- 9301. By Arthur Maniet
-
a
- 9302. By Arthur Maniet
-
[IMP] first batch of reconciliations now fetched in one request
- 9303. By Arthur Maniet
-
a
- 9304. By Arthur Maniet
-
a
- 9305. By Arthur Maniet
-
[FIX] point_of_
sale/test/ account_ statement_ reports. yml seems to be ok now, finally - 9306. By Arthur Maniet
-
a
- 9307. By Arthur Maniet
-
a
- 9308. By Arthur Maniet
-
a
- 9309. By Arthur Maniet
-
[FIX] partner change went buggy
- 9310. By Arthur Maniet
-
[FIX] field Analytic Distribution added to reconciliation widget by account_
analytic_ plan - 9311. By Arthur Maniet
-
[IMP] progress bar includes previous reconciliations
- 9312. By Arthur Maniet
-
[ADD] class account_
bank_reconcilia tion_move_ preset
[IMP] form to create line and presets are totally extensible - 9313. By Arthur Maniet
-
[ADD] Tax on a created line now appears as a separate line
- 9314. By Arthur Maniet
-
[ADD]ed a menu to edit presets ; accessible with technical features
- 9315. By Arthur Maniet
-
[IMP] needaction badge updated whichever menu item is selected
[ADD] multicurrency fields to bank statement lines form
[FIX] javascript float precision === 0 fail
[FIX] widget consistency about no_match - 9316. By Arthur Maniet
-
[IMP] account_
bank_reconcilia tion_move_ preset and many misc improvements - 9317. By Arthur Maniet
-
[IMP] account.
bank.reconcilia tion.move. preset usage - 9318. By Arthur Maniet
-
[ADD] access rights
[FIX] bak.statement.move.preset renamed in statement. operation. template - 9319. By Arthur Maniet
-
[IMP] account_
statement_ operation_ template' s form view
[FIX] misc - 9320. By Arthur Maniet
-
[ADD] demo data
- 9321. By Quentin (OpenERP) <email address hidden>
-
[MERGE] trunk
- 9322. By Quentin (OpenERP) <email address hidden>
-
[FIX/IMP] fixes/improvements made during the code review
- 9323. By Arthur Maniet
-
[FIX] small stuff
- 9324. By Quentin (OpenERP) <email address hidden>
-
[FIX] fixed error in statement form view
- 9325. By Quentin (OpenERP) <email address hidden>
-
[FIX] import invoice button in bank statement
- 9326. By Quentin (OpenERP) <email address hidden>
-
[REF] moved the wizard to import invoices on bank statements in account from account_voucher because it doesn't need the vouchers anymore for the reconciliation process
- 9327. By Quentin (OpenERP) <email address hidden>
-
[REF] merged account_
move_reconcilia tion.js and account_ bank_statement_ reconciliation. js into accont_widgets.js as they both were defining openerp.account (which lead to overriding and only the last was succesfully loaded) - 9328. By Quentin (OpenERP) <email address hidden>
-
[FIX] installation of account module
- 9329. By Quentin (OpenERP) <email address hidden>
-
[IMP] account: invoice order improved
- 9330. By Quentin (OpenERP) <email address hidden>
-
[FIX] account: error in unit_test data
- 9331. By Quentin (OpenERP) <email address hidden>
-
[REF] account: reordered demo data + fixed error in bank statement balance
- 9332. By Quentin (OpenERP) <email address hidden>
-
[FIX] account: set the good group on analytic field
- 9333. By Quentin (OpenERP) <email address hidden>
-
[IMP] account: formated the monetary field accordingly to the currency symbol and position for initial and counterpart lines (created and open balance lines are still to do)
- 9334. By Quentin (OpenERP) <email address hidden>
-
[FIX] account, bank statement reconciliation: display the amount of proposed counterparts in the statement currency
- 9335. By Quentin (OpenERP) <email address hidden>
-
[REF] account, bank statement reconciliation: refactoring on accounting entries creation
- 9336. By Quentin (OpenERP) <email address hidden>
-
[REF] account: removed uneeded code
- 9337. By Quentin (OpenERP) <email address hidden>
-
[IMP] l10n_be_coda: added demo data in order to be able to import the coda test file embedded in the module
- 9338. By Arthur Maniet
-
[FIX] currency format in the widget
- 9339. By Quentin (OpenERP) <email address hidden>
-
[FIX] account: tax computation doesn't accept context (hu?)
- 9340. By Quentin (OpenERP) <email address hidden>
-
[FIX] account: mising arguments
- 9341. By Arthur Maniet
-
[IMP] success message
- 9342. By Quentin (OpenERP) <email address hidden>
-
[FIX] account, reconciliation on bank statement process: accounting entries creation in multi-currency + do not filter lines created by previous bank statement
- 9343. By Arthur Maniet
-
[FIX] partial reconciliation showing when there are created lines
- 9344. By Arthur Maniet
-
[FIX] stupidity
- 9345. By Quentin (OpenERP) <email address hidden>
-
[IMP] account
- 9346. By Quentin (OpenERP) <email address hidden>
-
[FIX] account: bug introduced in previous revision
- 9347. By Arthur Maniet
-
[FIX] popover (hopefully) don't stay freezed when their originator is destroyed
amount formatting
use correct account for tax move lines
(probably fixed) : open balance rounding error - 9348. By Arthur Maniet
-
[FIX] event handlers on UI that went buggy when the UI was not up to date to the model because of async calls (tested on raspberry pi ; experienced pain).
- 9349. By Arthur Maniet
-
[FIX] do not use a value where a list is expected
removed empty account_bank_statement_ reconciliation. js
can't validate a reconciliation while changing the partner - 9350. By Arthur Maniet
-
[FIX] when changing a reconciliation line's partner, the move lines selected weren't freed for other reconciliations
- 9351. By Quentin (OpenERP) <email address hidden>
-
[FIX] account: preserve sign of amounts when applying presets
- 9352. By Quentin (OpenERP) <email address hidden>
-
[IMP] account: usabiltiy in bank statement form view
- 9353. By Quentin (OpenERP) <email address hidden>
-
[FIX] account, bank statement reconciliation: multi currency issue fixed
- 9354. By Quentin (OpenERP) <email address hidden>
-
[FIX] account, bank statement reconciliation: fixed filter on change partner field
- 9355. By Quentin (OpenERP) <email address hidden>
-
[IMP] account, bank statement reconciliation: improved demo data for operation templates
- 9356. By Quentin (OpenERP) <email address hidden>
-
[FIX] account, bank statement reconciliation: display only one of the lines that are already partially reconciled together
- 9357. By Quentin (OpenERP) <email address hidden>
-
[FIX] account, bank statement reconciliation: hopefully, the last fix related to muli-currency issues
Unmerged revisions
- 9357. By Quentin (OpenERP) <email address hidden>
-
[FIX] account, bank statement reconciliation: hopefully, the last fix related to muli-currency issues
- 9356. By Quentin (OpenERP) <email address hidden>
-
[FIX] account, bank statement reconciliation: display only one of the lines that are already partially reconciled together
- 9355. By Quentin (OpenERP) <email address hidden>
-
[IMP] account, bank statement reconciliation: improved demo data for operation templates
- 9354. By Quentin (OpenERP) <email address hidden>
-
[FIX] account, bank statement reconciliation: fixed filter on change partner field
- 9353. By Quentin (OpenERP) <email address hidden>
-
[FIX] account, bank statement reconciliation: multi currency issue fixed
- 9352. By Quentin (OpenERP) <email address hidden>
-
[IMP] account: usabiltiy in bank statement form view
- 9351. By Quentin (OpenERP) <email address hidden>
-
[FIX] account: preserve sign of amounts when applying presets
- 9350. By Arthur Maniet
-
[FIX] when changing a reconciliation line's partner, the move lines selected weren't freed for other reconciliations
- 9349. By Arthur Maniet
-
[FIX] do not use a value where a list is expected
removed empty account_bank_statement_ reconciliation. js
can't validate a reconciliation while changing the partner - 9348. By Arthur Maniet
-
[FIX] event handlers on UI that went buggy when the UI was not up to date to the model because of async calls (tested on raspberry pi ; experienced pain).
Preview Diff
1 | === modified file 'account/__openerp__.py' | |||
2 | --- account/__openerp__.py 2014-04-29 15:41:04 +0000 | |||
3 | +++ account/__openerp__.py 2014-05-30 16:18:57 +0000 | |||
4 | @@ -65,6 +65,7 @@ | |||
5 | 65 | 'wizard/account_period_close_view.xml', | 65 | 'wizard/account_period_close_view.xml', |
6 | 66 | 'wizard/account_reconcile_view.xml', | 66 | 'wizard/account_reconcile_view.xml', |
7 | 67 | 'wizard/account_unreconcile_view.xml', | 67 | 'wizard/account_unreconcile_view.xml', |
8 | 68 | 'wizard/account_statement_from_invoice_view.xml', | ||
9 | 68 | 'account_view.xml', | 69 | 'account_view.xml', |
10 | 69 | 'account_report.xml', | 70 | 'account_report.xml', |
11 | 70 | 'account_financial_report_data.xml', | 71 | 'account_financial_report_data.xml', |
12 | @@ -144,6 +145,7 @@ | |||
13 | 144 | 'qweb' : [ | 145 | 'qweb' : [ |
14 | 145 | "static/src/xml/account_move_reconciliation.xml", | 146 | "static/src/xml/account_move_reconciliation.xml", |
15 | 146 | "static/src/xml/account_move_line_quickadd.xml", | 147 | "static/src/xml/account_move_line_quickadd.xml", |
16 | 148 | "static/src/xml/account_bank_statement_reconciliation.xml", | ||
17 | 147 | ], | 149 | ], |
18 | 148 | 'demo': [ | 150 | 'demo': [ |
19 | 149 | 'demo/account_demo.xml', | 151 | 'demo/account_demo.xml', |
20 | @@ -151,6 +153,7 @@ | |||
21 | 151 | 'project/analytic_account_demo.xml', | 153 | 'project/analytic_account_demo.xml', |
22 | 152 | 'demo/account_minimal.xml', | 154 | 'demo/account_minimal.xml', |
23 | 153 | 'demo/account_invoice_demo.xml', | 155 | 'demo/account_invoice_demo.xml', |
24 | 156 | 'demo/account_bank_statement.xml', | ||
25 | 154 | 'account_unit_test.xml', | 157 | 'account_unit_test.xml', |
26 | 155 | ], | 158 | ], |
27 | 156 | 'test': [ | 159 | 'test': [ |
28 | 157 | 160 | ||
29 | === modified file 'account/account.py' | |||
30 | --- account/account.py 2014-04-24 13:45:33 +0000 | |||
31 | +++ account/account.py 2014-05-30 16:18:57 +0000 | |||
32 | @@ -2073,6 +2073,11 @@ | |||
33 | 2073 | cur_price_unit+=amount2 | 2073 | cur_price_unit+=amount2 |
34 | 2074 | return res | 2074 | return res |
35 | 2075 | 2075 | ||
36 | 2076 | def compute_for_bank_reconciliation(self, cr, uid, tax_id, amount, context=None): | ||
37 | 2077 | """ Called by RPC by the bank statement reconciliation widget """ | ||
38 | 2078 | tax = self.browse(cr, uid, tax_id, context=context) | ||
39 | 2079 | return self.compute_all(cr, uid, [tax], amount, 1) # TOCHECK may use force_exclude parameter | ||
40 | 2080 | |||
41 | 2076 | def compute_all(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None, force_excluded=False): | 2081 | def compute_all(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None, force_excluded=False): |
42 | 2077 | """ | 2082 | """ |
43 | 2078 | :param force_excluded: boolean used to say that we don't want to consider the value of field price_include of | 2083 | :param force_excluded: boolean used to say that we don't want to consider the value of field price_include of |
44 | 2079 | 2084 | ||
45 | === modified file 'account/account_bank_statement.py' | |||
46 | --- account/account_bank_statement.py 2014-02-10 06:46:42 +0000 | |||
47 | +++ account/account_bank_statement.py 2014-05-30 16:18:57 +0000 | |||
48 | @@ -19,11 +19,10 @@ | |||
49 | 19 | # | 19 | # |
50 | 20 | ############################################################################## | 20 | ############################################################################## |
51 | 21 | 21 | ||
52 | 22 | import time | ||
53 | 23 | |||
54 | 24 | from openerp.osv import fields, osv | 22 | from openerp.osv import fields, osv |
55 | 25 | from openerp.tools.translate import _ | 23 | from openerp.tools.translate import _ |
56 | 26 | import openerp.addons.decimal_precision as dp | 24 | import openerp.addons.decimal_precision as dp |
57 | 25 | from openerp.report import report_sxw | ||
58 | 27 | 26 | ||
59 | 28 | class account_bank_statement(osv.osv): | 27 | class account_bank_statement(osv.osv): |
60 | 29 | def create(self, cr, uid, vals, context=None): | 28 | def create(self, cr, uid, vals, context=None): |
61 | @@ -66,6 +65,18 @@ | |||
62 | 66 | return periods[0] | 65 | return periods[0] |
63 | 67 | return False | 66 | return False |
64 | 68 | 67 | ||
65 | 68 | def _compute_default_statement_name(self, cr, uid, context=None): | ||
66 | 69 | if context is None: | ||
67 | 70 | context = {} | ||
68 | 71 | obj_seq = self.pool.get('ir.sequence') | ||
69 | 72 | default_journal_id = self._default_journal_id(cr, uid, context=context) | ||
70 | 73 | if default_journal_id != False: | ||
71 | 74 | period = self.pool.get('account.period').browse(cr, uid, self._get_period(cr, uid, context=context), context=context) | ||
72 | 75 | context['fiscalyear_id'] = period.fiscalyear_id.id | ||
73 | 76 | journal = self.pool.get('account.journal').browse(cr, uid, default_journal_id, None) | ||
74 | 77 | return obj_seq.next_by_id(cr, uid, journal.sequence_id.id, context=context) | ||
75 | 78 | return obj_seq.next_by_code(cr, uid, 'account.bank.statement', context=context) | ||
76 | 79 | |||
77 | 69 | def _currency(self, cursor, user, ids, name, args, context=None): | 80 | def _currency(self, cursor, user, ids, name, args, context=None): |
78 | 70 | res = {} | 81 | res = {} |
79 | 71 | res_currency_obj = self.pool.get('res.currency') | 82 | res_currency_obj = self.pool.get('res.currency') |
80 | @@ -92,12 +103,18 @@ | |||
81 | 92 | result[line.statement_id.id] = True | 103 | result[line.statement_id.id] = True |
82 | 93 | return result.keys() | 104 | return result.keys() |
83 | 94 | 105 | ||
84 | 106 | def _all_lines_reconciled(self, cr, uid, ids, name, args, context=None): | ||
85 | 107 | res = {} | ||
86 | 108 | for statement in self.browse(cr, uid, ids, context=context): | ||
87 | 109 | res[statement.id] = all([line.journal_entry_id.id for line in statement.line_ids]) | ||
88 | 110 | return res | ||
89 | 111 | |||
90 | 95 | _order = "date desc, id desc" | 112 | _order = "date desc, id desc" |
91 | 96 | _name = "account.bank.statement" | 113 | _name = "account.bank.statement" |
92 | 97 | _description = "Bank Statement" | 114 | _description = "Bank Statement" |
93 | 98 | _inherit = ['mail.thread'] | 115 | _inherit = ['mail.thread'] |
94 | 99 | _columns = { | 116 | _columns = { |
96 | 100 | 'name': fields.char('Reference', size=64, required=True, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'), # readonly for account_cash_statement | 117 | 'name': fields.char('Reference', size=64, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'), # readonly for account_cash_statement |
97 | 101 | 'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}, select=True), | 118 | 'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}, select=True), |
98 | 102 | 'journal_id': fields.many2one('account.journal', 'Journal', required=True, | 119 | 'journal_id': fields.many2one('account.journal', 'Journal', required=True, |
99 | 103 | readonly=True, states={'draft':[('readonly',False)]}), | 120 | readonly=True, states={'draft':[('readonly',False)]}), |
100 | @@ -129,10 +146,11 @@ | |||
101 | 129 | type='many2one', relation='res.currency'), | 146 | type='many2one', relation='res.currency'), |
102 | 130 | 'account_id': fields.related('journal_id', 'default_debit_account_id', type='many2one', relation='account.account', string='Account used in this journal', readonly=True, help='used in statement reconciliation domain, but shouldn\'t be used elswhere.'), | 147 | 'account_id': fields.related('journal_id', 'default_debit_account_id', type='many2one', relation='account.account', string='Account used in this journal', readonly=True, help='used in statement reconciliation domain, but shouldn\'t be used elswhere.'), |
103 | 131 | 'cash_control': fields.related('journal_id', 'cash_control' , type='boolean', relation='account.journal',string='Cash control'), | 148 | 'cash_control': fields.related('journal_id', 'cash_control' , type='boolean', relation='account.journal',string='Cash control'), |
104 | 149 | 'all_lines_reconciled': fields.function(_all_lines_reconciled, string='All lines reconciled', type='boolean'), | ||
105 | 132 | } | 150 | } |
106 | 133 | 151 | ||
107 | 134 | _defaults = { | 152 | _defaults = { |
109 | 135 | 'name': "/", | 153 | 'name': _compute_default_statement_name, |
110 | 136 | 'date': fields.date.context_today, | 154 | 'date': fields.date.context_today, |
111 | 137 | 'state': 'draft', | 155 | 'state': 'draft', |
112 | 138 | 'journal_id': _default_journal_id, | 156 | 'journal_id': _default_journal_id, |
113 | @@ -193,37 +211,6 @@ | |||
114 | 193 | 'ref': st_line.ref, | 211 | 'ref': st_line.ref, |
115 | 194 | } | 212 | } |
116 | 195 | 213 | ||
117 | 196 | def _prepare_bank_move_line(self, cr, uid, st_line, move_id, amount, company_currency_id, | ||
118 | 197 | context=None): | ||
119 | 198 | """Compute the args to build the dict of values to create the bank move line from a | ||
120 | 199 | statement line by calling the _prepare_move_line_vals. This method may be | ||
121 | 200 | overridden to implement custom move generation (making sure to call super() to | ||
122 | 201 | establish a clean extension chain). | ||
123 | 202 | |||
124 | 203 | :param browse_record st_line: account.bank.statement.line record to | ||
125 | 204 | create the move from. | ||
126 | 205 | :param int/long move_id: ID of the account.move to link the move line | ||
127 | 206 | :param float amount: amount of the move line | ||
128 | 207 | :param int/long company_currency_id: ID of currency of the concerned company | ||
129 | 208 | :return: dict of value to create() the bank account.move.line | ||
130 | 209 | """ | ||
131 | 210 | anl_id = st_line.analytic_account_id and st_line.analytic_account_id.id or False | ||
132 | 211 | debit = ((amount<0) and -amount) or 0.0 | ||
133 | 212 | credit = ((amount>0) and amount) or 0.0 | ||
134 | 213 | cur_id = False | ||
135 | 214 | amt_cur = False | ||
136 | 215 | if st_line.statement_id.currency.id <> company_currency_id: | ||
137 | 216 | cur_id = st_line.statement_id.currency.id | ||
138 | 217 | if st_line.account_id and st_line.account_id.currency_id and st_line.account_id.currency_id.id <> company_currency_id: | ||
139 | 218 | cur_id = st_line.account_id.currency_id.id | ||
140 | 219 | if cur_id: | ||
141 | 220 | res_currency_obj = self.pool.get('res.currency') | ||
142 | 221 | amt_cur = -res_currency_obj.compute(cr, uid, company_currency_id, cur_id, amount, context=context) | ||
143 | 222 | |||
144 | 223 | res = self._prepare_move_line_vals(cr, uid, st_line, move_id, debit, credit, | ||
145 | 224 | amount_currency=amt_cur, currency_id=cur_id, analytic_id=anl_id, context=context) | ||
146 | 225 | return res | ||
147 | 226 | |||
148 | 227 | def _get_counter_part_account(sefl, cr, uid, st_line, context=None): | 214 | def _get_counter_part_account(sefl, cr, uid, st_line, context=None): |
149 | 228 | """Retrieve the account to use in the counterpart move. | 215 | """Retrieve the account to use in the counterpart move. |
150 | 229 | This method may be overridden to implement custom move generation (making sure to | 216 | This method may be overridden to implement custom move generation (making sure to |
151 | @@ -248,8 +235,7 @@ | |||
152 | 248 | """ | 235 | """ |
153 | 249 | return st_line.partner_id and st_line.partner_id.id or False | 236 | return st_line.partner_id and st_line.partner_id.id or False |
154 | 250 | 237 | ||
157 | 251 | def _prepare_counterpart_move_line(self, cr, uid, st_line, move_id, amount, company_currency_id, | 238 | def _prepare_bank_move_line(self, cr, uid, st_line, move_id, amount, company_currency_id, context=None): |
156 | 252 | context=None): | ||
158 | 253 | """Compute the args to build the dict of values to create the counter part move line from a | 239 | """Compute the args to build the dict of values to create the counter part move line from a |
159 | 254 | statement line by calling the _prepare_move_line_vals. This method may be | 240 | statement line by calling the _prepare_move_line_vals. This method may be |
160 | 255 | overridden to implement custom move generation (making sure to call super() to | 241 | overridden to implement custom move generation (making sure to call super() to |
161 | @@ -266,19 +252,22 @@ | |||
162 | 266 | account_id = self._get_counter_part_account(cr, uid, st_line, context=context) | 252 | account_id = self._get_counter_part_account(cr, uid, st_line, context=context) |
163 | 267 | partner_id = self._get_counter_part_partner(cr, uid, st_line, context=context) | 253 | partner_id = self._get_counter_part_partner(cr, uid, st_line, context=context) |
164 | 268 | debit = ((amount > 0) and amount) or 0.0 | 254 | debit = ((amount > 0) and amount) or 0.0 |
166 | 269 | credit = ((amount < 0) and -amount) or 0.0 | 255 | credit = ((amount < 0) and -amount) or 0.0 |
167 | 270 | cur_id = False | 256 | cur_id = False |
168 | 271 | amt_cur = False | 257 | amt_cur = False |
170 | 272 | if st_line.statement_id.currency.id <> company_currency_id: | 258 | if st_line.statement_id.currency.id != company_currency_id: |
171 | 273 | amt_cur = st_line.amount | 259 | amt_cur = st_line.amount |
173 | 274 | cur_id = st_line.statement_id.currency.id | 260 | cur_id = st_line.currency_id or st_line.statement_id.currency.id |
174 | 261 | # TODO : FIXME the amount should be in the journal currency | ||
175 | 262 | if st_line.currency_id and st_line.amount_currency: | ||
176 | 263 | amt_cur = st_line.amount_currency | ||
177 | 264 | cur_id = st_line.currency_id.id | ||
178 | 275 | return self._prepare_move_line_vals(cr, uid, st_line, move_id, debit, credit, | 265 | return self._prepare_move_line_vals(cr, uid, st_line, move_id, debit, credit, |
181 | 276 | amount_currency = amt_cur, currency_id = cur_id, account_id = account_id, | 266 | amount_currency=amt_cur, currency_id=cur_id, account_id=account_id, |
182 | 277 | partner_id = partner_id, context=context) | 267 | partner_id=partner_id, context=context) |
183 | 278 | 268 | ||
187 | 279 | def _prepare_move_line_vals(self, cr, uid, st_line, move_id, debit, credit, currency_id = False, | 269 | def _prepare_move_line_vals(self, cr, uid, st_line, move_id, debit, credit, currency_id=False, |
188 | 280 | amount_currency= False, account_id = False, analytic_id = False, | 270 | amount_currency=False, account_id=False, partner_id=False, context=None): |
186 | 281 | partner_id = False, context=None): | ||
189 | 282 | """Prepare the dict of values to create the move line from a | 271 | """Prepare the dict of values to create the move line from a |
190 | 283 | statement line. All non-mandatory args will replace the default computed one. | 272 | statement line. All non-mandatory args will replace the default computed one. |
191 | 284 | This method may be overridden to implement custom move generation (making sure to | 273 | This method may be overridden to implement custom move generation (making sure to |
192 | @@ -293,7 +282,6 @@ | |||
193 | 293 | :param float amount_currency: amount of the debit/credit expressed in the currency_id | 282 | :param float amount_currency: amount of the debit/credit expressed in the currency_id |
194 | 294 | :param int/long account_id: ID of the account to use in the move line if different | 283 | :param int/long account_id: ID of the account to use in the move line if different |
195 | 295 | from the statement line account ID | 284 | from the statement line account ID |
196 | 296 | :param int/long analytic_id: ID of analytic account to put on the move line | ||
197 | 297 | :param int/long partner_id: ID of the partner to put on the move line | 285 | :param int/long partner_id: ID of the partner to put on the move line |
198 | 298 | :return: dict of value to create() the account.move.line | 286 | :return: dict of value to create() the account.move.line |
199 | 299 | """ | 287 | """ |
200 | @@ -314,67 +302,8 @@ | |||
201 | 314 | 'period_id': st_line.statement_id.period_id.id, | 302 | 'period_id': st_line.statement_id.period_id.id, |
202 | 315 | 'currency_id': amount_currency and cur_id, | 303 | 'currency_id': amount_currency and cur_id, |
203 | 316 | 'amount_currency': amount_currency, | 304 | 'amount_currency': amount_currency, |
204 | 317 | 'analytic_account_id': analytic_id, | ||
205 | 318 | } | 305 | } |
206 | 319 | 306 | ||
207 | 320 | def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None): | ||
208 | 321 | """Create the account move from the statement line. | ||
209 | 322 | |||
210 | 323 | :param int/long st_line_id: ID of the account.bank.statement.line to create the move from. | ||
211 | 324 | :param int/long company_currency_id: ID of the res.currency of the company | ||
212 | 325 | :param char st_line_number: will be used as the name of the generated account move | ||
213 | 326 | :return: ID of the account.move created | ||
214 | 327 | """ | ||
215 | 328 | |||
216 | 329 | if context is None: | ||
217 | 330 | context = {} | ||
218 | 331 | res_currency_obj = self.pool.get('res.currency') | ||
219 | 332 | account_move_obj = self.pool.get('account.move') | ||
220 | 333 | account_move_line_obj = self.pool.get('account.move.line') | ||
221 | 334 | account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') | ||
222 | 335 | st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context) | ||
223 | 336 | st = st_line.statement_id | ||
224 | 337 | |||
225 | 338 | context.update({'date': st_line.date}) | ||
226 | 339 | |||
227 | 340 | move_vals = self._prepare_move(cr, uid, st_line, st_line_number, context=context) | ||
228 | 341 | move_id = account_move_obj.create(cr, uid, move_vals, context=context) | ||
229 | 342 | account_bank_statement_line_obj.write(cr, uid, [st_line.id], { | ||
230 | 343 | 'move_ids': [(4, move_id, False)] | ||
231 | 344 | }) | ||
232 | 345 | torec = [] | ||
233 | 346 | acc_cur = ((st_line.amount<=0) and st.journal_id.default_debit_account_id) or st_line.account_id | ||
234 | 347 | |||
235 | 348 | context.update({ | ||
236 | 349 | 'res.currency.compute.account': acc_cur, | ||
237 | 350 | }) | ||
238 | 351 | amount = res_currency_obj.compute(cr, uid, st.currency.id, | ||
239 | 352 | company_currency_id, st_line.amount, context=context) | ||
240 | 353 | |||
241 | 354 | bank_move_vals = self._prepare_bank_move_line(cr, uid, st_line, move_id, amount, | ||
242 | 355 | company_currency_id, context=context) | ||
243 | 356 | move_line_id = account_move_line_obj.create(cr, uid, bank_move_vals, context=context) | ||
244 | 357 | torec.append(move_line_id) | ||
245 | 358 | |||
246 | 359 | counterpart_move_vals = self._prepare_counterpart_move_line(cr, uid, st_line, move_id, | ||
247 | 360 | amount, company_currency_id, context=context) | ||
248 | 361 | account_move_line_obj.create(cr, uid, counterpart_move_vals, context=context) | ||
249 | 362 | |||
250 | 363 | for line in account_move_line_obj.browse(cr, uid, [x.id for x in | ||
251 | 364 | account_move_obj.browse(cr, uid, move_id, | ||
252 | 365 | context=context).line_id], | ||
253 | 366 | context=context): | ||
254 | 367 | if line.state <> 'valid': | ||
255 | 368 | raise osv.except_osv(_('Error!'), | ||
256 | 369 | _('Journal item "%s" is not valid.') % line.name) | ||
257 | 370 | |||
258 | 371 | # Bank statements will not consider boolean on journal entry_posted | ||
259 | 372 | account_move_obj.post(cr, uid, [move_id], context=context) | ||
260 | 373 | return move_id | ||
261 | 374 | |||
262 | 375 | def get_next_st_line_number(self, cr, uid, st_number, st_line, context=None): | ||
263 | 376 | return st_number + '/' + str(st_line.sequence) | ||
264 | 377 | |||
265 | 378 | def balance_check(self, cr, uid, st_id, journal_type='bank', context=None): | 307 | def balance_check(self, cr, uid, st_id, journal_type='bank', context=None): |
266 | 379 | st = self.browse(cr, uid, st_id, context=context) | 308 | st = self.browse(cr, uid, st_id, context=context) |
267 | 380 | if not ((abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001) or (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001)): | 309 | if not ((abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001) or (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001)): |
268 | @@ -389,49 +318,30 @@ | |||
269 | 389 | return state in ('draft','open') | 318 | return state in ('draft','open') |
270 | 390 | 319 | ||
271 | 391 | def button_confirm_bank(self, cr, uid, ids, context=None): | 320 | def button_confirm_bank(self, cr, uid, ids, context=None): |
272 | 392 | obj_seq = self.pool.get('ir.sequence') | ||
273 | 393 | if context is None: | 321 | if context is None: |
274 | 394 | context = {} | 322 | context = {} |
275 | 395 | 323 | ||
276 | 396 | for st in self.browse(cr, uid, ids, context=context): | 324 | for st in self.browse(cr, uid, ids, context=context): |
277 | 397 | j_type = st.journal_id.type | 325 | j_type = st.journal_id.type |
278 | 398 | company_currency_id = st.journal_id.company_id.currency_id.id | ||
279 | 399 | if not self.check_status_condition(cr, uid, st.state, journal_type=j_type): | 326 | if not self.check_status_condition(cr, uid, st.state, journal_type=j_type): |
280 | 400 | continue | 327 | continue |
281 | 401 | 328 | ||
282 | 402 | self.balance_check(cr, uid, st.id, journal_type=j_type, context=context) | 329 | self.balance_check(cr, uid, st.id, journal_type=j_type, context=context) |
283 | 403 | if (not st.journal_id.default_credit_account_id) \ | 330 | if (not st.journal_id.default_credit_account_id) \ |
284 | 404 | or (not st.journal_id.default_debit_account_id): | 331 | or (not st.journal_id.default_debit_account_id): |
297 | 405 | raise osv.except_osv(_('Configuration Error!'), | 332 | raise osv.except_osv(_('Configuration Error!'), _('Please verify that an account is defined in the journal.')) |
286 | 406 | _('Please verify that an account is defined in the journal.')) | ||
287 | 407 | |||
288 | 408 | if not st.name == '/': | ||
289 | 409 | st_number = st.name | ||
290 | 410 | else: | ||
291 | 411 | c = {'fiscalyear_id': st.period_id.fiscalyear_id.id} | ||
292 | 412 | if st.journal_id.sequence_id: | ||
293 | 413 | st_number = obj_seq.next_by_id(cr, uid, st.journal_id.sequence_id.id, context=c) | ||
294 | 414 | else: | ||
295 | 415 | st_number = obj_seq.next_by_code(cr, uid, 'account.bank.statement', context=c) | ||
296 | 416 | |||
298 | 417 | for line in st.move_line_ids: | 333 | for line in st.move_line_ids: |
299 | 418 | if line.state <> 'valid': | 334 | if line.state <> 'valid': |
302 | 419 | raise osv.except_osv(_('Error!'), | 335 | raise osv.except_osv(_('Error!'), _('The account entries lines are not in valid state.')) |
303 | 420 | _('The account entries lines are not in valid state.')) | 336 | move_ids = [] |
304 | 421 | for st_line in st.line_ids: | 337 | for st_line in st.line_ids: |
305 | 422 | if st_line.analytic_account_id: | ||
306 | 423 | if not st.journal_id.analytic_journal_id: | ||
307 | 424 | raise osv.except_osv(_('No Analytic Journal!'),_("You have to assign an analytic journal on the '%s' journal!") % (st.journal_id.name,)) | ||
308 | 425 | if not st_line.amount: | 338 | if not st_line.amount: |
309 | 426 | continue | 339 | continue |
318 | 427 | st_line_number = self.get_next_st_line_number(cr, uid, st_number, st_line, context) | 340 | if not st_line.journal_entry_id.id: |
319 | 428 | self.create_move_from_st_line(cr, uid, st_line.id, company_currency_id, st_line_number, context) | 341 | raise osv.except_osv(_('Error!'), _('All the account entries lines must be processed in order to close the statement.')) |
320 | 429 | 342 | move_ids.append(st_line.journal_entry_id.id) | |
321 | 430 | self.write(cr, uid, [st.id], { | 343 | self.pool.get('account.move').post(cr, uid, move_ids, context=context) |
322 | 431 | 'name': st_number, | 344 | self.message_post(cr, uid, [st.id], body=_('Statement %s confirmed, journal items were created.') % (st.name,), context=context) |
315 | 432 | 'balance_end_real': st.balance_end | ||
316 | 433 | }, context=context) | ||
317 | 434 | self.message_post(cr, uid, [st.id], body=_('Statement %s confirmed, journal items were created.') % (st_number,), context=context) | ||
323 | 435 | return self.write(cr, uid, ids, {'state':'confirm'}, context=context) | 345 | return self.write(cr, uid, ids, {'state':'confirm'}, context=context) |
324 | 436 | 346 | ||
325 | 437 | def button_cancel(self, cr, uid, ids, context=None): | 347 | def button_cancel(self, cr, uid, ids, context=None): |
326 | @@ -492,93 +402,356 @@ | |||
327 | 492 | return super(account_bank_statement, self).copy(cr, uid, id, default, context=context) | 402 | return super(account_bank_statement, self).copy(cr, uid, id, default, context=context) |
328 | 493 | 403 | ||
329 | 494 | def button_journal_entries(self, cr, uid, ids, context=None): | 404 | def button_journal_entries(self, cr, uid, ids, context=None): |
343 | 495 | ctx = (context or {}).copy() | 405 | ctx = (context or {}).copy() |
344 | 496 | ctx['journal_id'] = self.browse(cr, uid, ids[0], context=context).journal_id.id | 406 | ctx['journal_id'] = self.browse(cr, uid, ids[0], context=context).journal_id.id |
345 | 497 | return { | 407 | return { |
346 | 498 | 'name': _('Journal Items'), | 408 | 'name': _('Journal Items'), |
347 | 499 | 'view_type':'form', | 409 | 'view_type':'form', |
348 | 500 | 'view_mode':'tree', | 410 | 'view_mode':'tree', |
349 | 501 | 'res_model':'account.move.line', | 411 | 'res_model':'account.move.line', |
350 | 502 | 'view_id':False, | 412 | 'view_id':False, |
351 | 503 | 'type':'ir.actions.act_window', | 413 | 'type':'ir.actions.act_window', |
352 | 504 | 'domain':[('statement_id','in',ids)], | 414 | 'domain':[('statement_id','in',ids)], |
353 | 505 | 'context':ctx, | 415 | 'context':ctx, |
354 | 506 | } | 416 | } |
355 | 507 | 417 | ||
356 | 418 | def number_of_lines_reconciled(self, cr, uid, id, context=None): | ||
357 | 419 | bsl_obj = self.pool.get('account.bank.statement.line') | ||
358 | 420 | return bsl_obj.search_count(cr, uid, [('statement_id','=',id), ('journal_entry_id','!=',False)], context=context) | ||
359 | 421 | |||
360 | 422 | def get_format_currency_js_function(self, cr, uid, id, context=None): | ||
361 | 423 | """ Returns a string that can be used to instanciate a javascript function. | ||
362 | 424 | That function formats a number according to the statement's journal currency """ | ||
363 | 425 | company_currency = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id | ||
364 | 426 | currency_obj = id and self.browse(cr, uid, id, context=context).journal_id.currency or company_currency | ||
365 | 427 | digits = 2 # TODO : from currency_obj | ||
366 | 428 | if currency_obj.position == 'after': | ||
367 | 429 | return "return amount.toFixed("+str(digits)+") + ' "+currency_obj.symbol+"';" | ||
368 | 430 | elif currency_obj.position == 'before': | ||
369 | 431 | return "return '"+currency_obj.symbol+" ' + amount.toFixed("+str(digits)+");" | ||
370 | 508 | 432 | ||
371 | 509 | class account_bank_statement_line(osv.osv): | 433 | class account_bank_statement_line(osv.osv): |
372 | 510 | 434 | ||
411 | 511 | def onchange_partner_id(self, cr, uid, ids, partner_id, context=None): | 435 | def get_data_for_reconciliations(self, cr, uid, ids, context=None): |
412 | 512 | obj_partner = self.pool.get('res.partner') | 436 | """ Used to instanciate a batch of reconciliations in a single request """ |
413 | 513 | if context is None: | 437 | # Build a list of reconciliations data |
414 | 514 | context = {} | 438 | ret = [] |
415 | 515 | if not partner_id: | 439 | mv_line_ids_selected = [] |
416 | 516 | return {} | 440 | for st_line_id in ids: |
417 | 517 | part = obj_partner.browse(cr, uid, partner_id, context=context) | 441 | reconciliation_data = { |
418 | 518 | if not part.supplier and not part.customer: | 442 | 'st_line': self.get_statement_line_for_reconciliation(cr, uid, st_line_id, context), |
419 | 519 | type = 'general' | 443 | 'reconciliation_proposition': self.get_reconciliation_proposition(cr, uid, st_line_id, mv_line_ids_selected, context) |
420 | 520 | elif part.supplier and part.customer: | 444 | } |
421 | 521 | type = 'general' | 445 | for mv_line in reconciliation_data['reconciliation_proposition']: |
422 | 522 | else: | 446 | mv_line_ids_selected.append(mv_line['id']) |
423 | 523 | if part.supplier == True: | 447 | ret.append(reconciliation_data); |
424 | 524 | type = 'supplier' | 448 | |
425 | 525 | if part.customer == True: | 449 | # Check if, now that 'candidate' move lines were selected, there are moves left for statement lines |
426 | 526 | type = 'customer' | 450 | for reconciliation_data in ret: |
427 | 527 | res_type = self.onchange_type(cr, uid, ids, partner_id=partner_id, type=type, context=context) | 451 | if not reconciliation_data['st_line']['has_no_partner']: |
428 | 528 | if res_type['value'] and res_type['value'].get('account_id', False): | 452 | if self.get_move_lines_counterparts(cr, uid, reconciliation_data['st_line']['id'], excluded_ids=mv_line_ids_selected, count=True, context=context) == 0: |
429 | 529 | return {'value': {'type': type, 'account_id': res_type['value']['account_id']}} | 453 | reconciliation_data['st_line']['no_match'] = True |
430 | 530 | return {'value': {'type': type}} | 454 | return ret |
431 | 531 | 455 | ||
432 | 532 | def onchange_type(self, cr, uid, line_id, partner_id, type, context=None): | 456 | def get_statement_line_for_reconciliation(self, cr, uid, id, context=None): |
433 | 533 | res = {'value': {}} | 457 | """ Returns the data required by the bank statement reconciliation use case """ |
434 | 534 | obj_partner = self.pool.get('res.partner') | 458 | line = self.browse(cr, uid, id, context=context) |
435 | 535 | if context is None: | 459 | statement_currency = line.journal_id.currency or line.journal_id.company_id.currency_id |
436 | 536 | context = {} | 460 | rml_parser = report_sxw.rml_parse(cr, uid, 'statement_line_widget', context=context) |
437 | 537 | if not partner_id: | 461 | amount_str = line.amount > 0 and line.amount or -line.amount |
438 | 538 | return res | 462 | amount_str = rml_parser.formatLang(amount_str, currency_obj=statement_currency) |
439 | 539 | account_id = False | 463 | amount_currency_str = "" |
440 | 540 | line = self.browse(cr, uid, line_id, context=context) | 464 | if line.amount_currency and line.currency_id: |
441 | 541 | if not line or (line and not line[0].account_id): | 465 | amount_currency_str = rml_parser.formatLang(line.amount_currency, currency_obj=line.currency_id) |
442 | 542 | part = obj_partner.browse(cr, uid, partner_id, context=context) | 466 | |
443 | 543 | if type == 'supplier': | 467 | dict = { |
444 | 544 | account_id = part.property_account_payable.id | 468 | 'id': line.id, |
445 | 545 | else: | 469 | 'ref': line.ref, |
446 | 546 | account_id = part.property_account_receivable.id | 470 | 'note': line.note or "", |
447 | 547 | res['value']['account_id'] = account_id | 471 | 'name': line.name, |
448 | 548 | return res | 472 | 'date': line.date, |
449 | 473 | 'amount': line.amount, | ||
450 | 474 | 'amount_str': amount_str, | ||
451 | 475 | 'no_match': self.get_move_lines_counterparts(cr, uid, id, count=True, context=context) == 0 and line.partner_id.id, | ||
452 | 476 | 'partner_id': line.partner_id.id, | ||
453 | 477 | 'statement_id': line.statement_id.id, | ||
454 | 478 | 'account_code': line.journal_id.default_debit_account_id.code, | ||
455 | 479 | 'account_name': line.journal_id.default_debit_account_id.name, | ||
456 | 480 | 'partner_name': line.partner_id.name, | ||
457 | 481 | 'amount_currency_str': amount_currency_str, | ||
458 | 482 | 'has_no_partner': not line.partner_id.id, | ||
459 | 483 | } | ||
460 | 484 | if line.partner_id.id: | ||
461 | 485 | if line.amount > 0: | ||
462 | 486 | dict['open_balance_account_id'] = line.partner_id.property_account_receivable.id | ||
463 | 487 | else: | ||
464 | 488 | dict['open_balance_account_id'] = line.partner_id.property_account_payable.id | ||
465 | 489 | return dict | ||
466 | 490 | |||
467 | 491 | def get_reconciliation_proposition(self, cr, uid, id, excluded_ids=[], context=None): | ||
468 | 492 | """ Returns move lines that constitute the best guess to reconcile a statement line. """ | ||
469 | 493 | st_line = self.browse(cr, uid, id, context=context) | ||
470 | 494 | company_currency = st_line.journal_id.company_id.currency_id.id | ||
471 | 495 | statement_currency = st_line.journal_id.currency.id or company_currency | ||
472 | 496 | |||
473 | 497 | # either use the unsigned debit/credit fields or the signed amount_currency field | ||
474 | 498 | sign = 1 | ||
475 | 499 | if statement_currency == company_currency: | ||
476 | 500 | if st_line.amount > 0: | ||
477 | 501 | amount_field = 'debit' | ||
478 | 502 | else: | ||
479 | 503 | amount_field = 'credit' | ||
480 | 504 | else: | ||
481 | 505 | amount_field = 'amount_currency' | ||
482 | 506 | if st_line.amount < 0: | ||
483 | 507 | sign = -1 | ||
484 | 508 | |||
485 | 509 | # look for exact match | ||
486 | 510 | exact_match_id = self.get_move_lines_counterparts(cr, uid, id, excluded_ids=excluded_ids, limit=1, additional_domain=[(amount_field,'=',(sign*st_line.amount))]) | ||
487 | 511 | if exact_match_id: | ||
488 | 512 | return exact_match_id | ||
489 | 513 | |||
490 | 514 | # select oldest move lines | ||
491 | 515 | if sign == -1: | ||
492 | 516 | mv_lines = self.get_move_lines_counterparts(cr, uid, id, excluded_ids=excluded_ids, limit=50, additional_domain=[(amount_field,'<',0)]) | ||
493 | 517 | else: | ||
494 | 518 | mv_lines = self.get_move_lines_counterparts(cr, uid, id, excluded_ids=excluded_ids, limit=50, additional_domain=[(amount_field,'>',0)]) | ||
495 | 519 | ret = [] | ||
496 | 520 | total = 0 | ||
497 | 521 | # get_move_lines_counterparts inverts debit and credit | ||
498 | 522 | amount_field = 'debit' if amount_field == 'credit' else 'credit' | ||
499 | 523 | for line in mv_lines: | ||
500 | 524 | if total + line[amount_field] <= st_line.amount: | ||
501 | 525 | ret.append(line) | ||
502 | 526 | total += line[amount_field] | ||
503 | 527 | else: | ||
504 | 528 | break | ||
505 | 529 | |||
506 | 530 | return ret | ||
507 | 531 | |||
508 | 532 | def get_move_lines_counterparts(self, cr, uid, id, excluded_ids=[], str="", offset=0, limit=None, count=False, additional_domain=[], context=None): | ||
509 | 533 | """ Find the move lines that could be used to reconcile a statement line and returns the counterpart that could be created to reconcile them | ||
510 | 534 | If count is true, only returns the count. | ||
511 | 535 | |||
512 | 536 | :param integer id: the id of the statement line | ||
513 | 537 | :param integers list excluded_ids: ids of move lines that should not be fetched | ||
514 | 538 | :param string str: string to filter lines | ||
515 | 539 | :param integer offset: offset of the request | ||
516 | 540 | :param integer limit: number of lines to fetch | ||
517 | 541 | :param boolean count: just return the number of records | ||
518 | 542 | :param tuples list domain: additional domain restrictions | ||
519 | 543 | """ | ||
520 | 544 | if context is None: | ||
521 | 545 | context = {} | ||
522 | 546 | |||
523 | 547 | rml_parser = report_sxw.rml_parse(cr, uid, 'statement_line_counterpart_widget', context=context) | ||
524 | 548 | st_line = self.browse(cr, uid, id, context=context) | ||
525 | 549 | company_currency = st_line.journal_id.company_id.currency_id | ||
526 | 550 | statement_currency = st_line.journal_id.currency or company_currency | ||
527 | 551 | mv_line_pool = self.pool.get('account.move.line') | ||
528 | 552 | currency_obj = self.pool.get('res.currency') | ||
529 | 553 | |||
530 | 554 | domain = additional_domain + [ | ||
531 | 555 | ('partner_id', '=', st_line.partner_id.id), | ||
532 | 556 | ('reconcile_id', '=', False), | ||
533 | 557 | ('state','=','valid'), | ||
534 | 558 | '|',('account_id.type', '=', 'receivable'), | ||
535 | 559 | ('account_id.type', '=', 'payable'), #Let the front-end warn the user if he tries to mix payable and receivable in the same reconciliation | ||
536 | 560 | ] | ||
537 | 561 | if excluded_ids: | ||
538 | 562 | domain.append(('id', 'not in', excluded_ids)) | ||
539 | 563 | if str: | ||
540 | 564 | domain += ['|', ('move_id.name', 'ilike', str), ('move_id.ref', 'ilike', str)] | ||
541 | 565 | #partially reconciled lines can be displayed only once | ||
542 | 566 | reconcile_partial_ids = [] | ||
543 | 567 | ids = mv_line_pool.search(cr, uid, domain, offset=offset, limit=limit, order="date_maturity asc, id asc", context=context) | ||
544 | 568 | |||
545 | 569 | if count: | ||
546 | 570 | nb_lines = 0 | ||
547 | 571 | for line in mv_line_pool.browse(cr, uid, ids, context=context): | ||
548 | 572 | if line.reconcile_partial_id and line.reconcile_partial_id.id in reconcile_partial_ids: | ||
549 | 573 | continue | ||
550 | 574 | nb_lines += 1 | ||
551 | 575 | if line.reconcile_partial_id: | ||
552 | 576 | reconcile_partial_ids.append(line.reconcile_partial_id.id) | ||
553 | 577 | return nb_lines | ||
554 | 578 | else: | ||
555 | 579 | ret = [] | ||
556 | 580 | for line in mv_line_pool.browse(cr, uid, ids, context=context): | ||
557 | 581 | if line.reconcile_partial_id and line.reconcile_partial_id.id in reconcile_partial_ids: | ||
558 | 582 | continue | ||
559 | 583 | amount_currency_str = "" | ||
560 | 584 | if line.currency_id and line.amount_currency: | ||
561 | 585 | amount_currency_str = rml_parser.formatLang(line.amount_currency, currency_obj=line.currency_id) | ||
562 | 586 | ret_line = { | ||
563 | 587 | 'id': line.id, | ||
564 | 588 | 'name': line.move_id.name, | ||
565 | 589 | 'ref': line.move_id.ref, | ||
566 | 590 | 'account_code': line.account_id.code, | ||
567 | 591 | 'account_name': line.account_id.name, | ||
568 | 592 | 'account_type': line.account_id.type, | ||
569 | 593 | 'date_maturity': line.date_maturity, | ||
570 | 594 | 'date': line.date, | ||
571 | 595 | 'period_name': line.period_id.name, | ||
572 | 596 | 'journal_name': line.journal_id.name, | ||
573 | 597 | 'amount_currency_str': amount_currency_str, | ||
574 | 598 | } | ||
575 | 599 | if statement_currency.id != company_currency.id and line.currency_id and line.currency_id.id == statement_currency.id: | ||
576 | 600 | if line.amount_residual_currency < 0: | ||
577 | 601 | ret_line['debit'] = 0 | ||
578 | 602 | ret_line['credit'] = -line.amount_residual_currency | ||
579 | 603 | else: | ||
580 | 604 | ret_line['debit'] = line.amount_residual_currency if line.credit != 0 else 0 | ||
581 | 605 | ret_line['credit'] = line.amount_residual_currency if line.debit != 0 else 0 | ||
582 | 606 | ret_line['amount_currency_str'] = rml_parser.formatLang(line.amount_residual, currency_obj=company_currency) | ||
583 | 607 | else: | ||
584 | 608 | if line.amount_residual < 0: | ||
585 | 609 | ret_line['debit'] = 0 | ||
586 | 610 | ret_line['credit'] = -line.amount_residual | ||
587 | 611 | else: | ||
588 | 612 | ret_line['debit'] = line.amount_residual if line.credit != 0 else 0 | ||
589 | 613 | ret_line['credit'] = line.amount_residual if line.debit != 0 else 0 | ||
590 | 614 | ctx = context.copy() | ||
591 | 615 | ctx.update({'date': st_line.date}) | ||
592 | 616 | ret_line['debit'] = currency_obj.compute(cr, uid, statement_currency.id, company_currency.id, ret_line['debit'], context=ctx) | ||
593 | 617 | ret_line['credit'] = currency_obj.compute(cr, uid, statement_currency.id, company_currency.id, ret_line['credit'], context=ctx) | ||
594 | 618 | ret_line['debit_str'] = rml_parser.formatLang(ret_line['debit'], currency_obj=statement_currency) | ||
595 | 619 | ret_line['credit_str'] = rml_parser.formatLang(ret_line['credit'], currency_obj=statement_currency) | ||
596 | 620 | ret.append(ret_line) | ||
597 | 621 | if line.reconcile_partial_id: | ||
598 | 622 | reconcile_partial_ids.append(line.reconcile_partial_id.id) | ||
599 | 623 | return ret | ||
600 | 624 | |||
601 | 625 | def process_reconciliation(self, cr, uid, id, mv_line_dicts, context=None): | ||
602 | 626 | """ Creates a move line for each item of mv_line_dicts and for the statement line. Reconcile a new move line with its counterpart_move_line_id if specified. Finally, mark the statement line as reconciled by putting the newly created move id in the column journal_entry_id. | ||
603 | 627 | |||
604 | 628 | :param int id: id of the bank statement line | ||
605 | 629 | :param list of dicts mv_line_dicts: move lines to create. If counterpart_move_line_id is specified, reconcile with it | ||
606 | 630 | """ | ||
607 | 631 | st_line = self.browse(cr, uid, id, context=context) | ||
608 | 632 | company_currency = st_line.journal_id.company_id.currency_id | ||
609 | 633 | statement_currency = st_line.journal_id.currency or company_currency | ||
610 | 634 | bs_obj = self.pool.get('account.bank.statement') | ||
611 | 635 | am_obj = self.pool.get('account.move') | ||
612 | 636 | aml_obj = self.pool.get('account.move.line') | ||
613 | 637 | currency_obj = self.pool.get('res.currency') | ||
614 | 638 | |||
615 | 639 | # Checks | ||
616 | 640 | if st_line.journal_entry_id.id != False: | ||
617 | 641 | raise osv.except_osv(_('Error!'), _('The bank statement line was already reconciled.')) | ||
618 | 642 | for mv_line_dict in mv_line_dicts: | ||
619 | 643 | for field in ['debit', 'credit', 'amount_currency']: | ||
620 | 644 | if field not in mv_line_dict: | ||
621 | 645 | mv_line_dict[field] = 0.0 | ||
622 | 646 | if mv_line_dict.get('counterpart_move_line_id'): | ||
623 | 647 | mv_line = aml_obj.browse(cr, uid, mv_line_dict.get('counterpart_move_line_id'), context=context) | ||
624 | 648 | if mv_line.reconcile_id: | ||
625 | 649 | raise osv.except_osv(_('Error!'), _('A selected move line was already reconciled.')) | ||
626 | 650 | |||
627 | 651 | # Create the move | ||
628 | 652 | move_name = st_line.statement_id.name + "/" + str(st_line.sequence) | ||
629 | 653 | move_vals = bs_obj._prepare_move(cr, uid, st_line, move_name, context=context) | ||
630 | 654 | move_id = am_obj.create(cr, uid, move_vals, context=context) | ||
631 | 655 | |||
632 | 656 | # Create the move line for the statement line | ||
633 | 657 | amount = currency_obj.compute(cr, uid, st_line.statement_id.currency.id, company_currency.id, st_line.amount, context=context) | ||
634 | 658 | bank_st_move_vals = bs_obj._prepare_bank_move_line(cr, uid, st_line, move_id, amount, company_currency.id, context=context) | ||
635 | 659 | aml_obj.create(cr, uid, bank_st_move_vals, context=context) | ||
636 | 660 | st_line_currency_rate = bank_st_move_vals['amount_currency'] and statement_currency.id == company_currency.id and (bank_st_move_vals['amount_currency'] / st_line.amount) or False | ||
637 | 661 | st_line_currency = bank_st_move_vals['currency_id'] | ||
638 | 662 | # Complete the dicts | ||
639 | 663 | st_line_statement_id = st_line.statement_id.id | ||
640 | 664 | st_line_journal_id = st_line.journal_id.id | ||
641 | 665 | st_line_partner_id = st_line.partner_id.id | ||
642 | 666 | st_line_company_id = st_line.company_id.id | ||
643 | 667 | st_line_period_id = st_line.statement_id.period_id.id | ||
644 | 668 | for mv_line_dict in mv_line_dicts: | ||
645 | 669 | mv_line_dict['ref'] = move_name | ||
646 | 670 | mv_line_dict['move_id'] = move_id | ||
647 | 671 | mv_line_dict['period_id'] = st_line_period_id | ||
648 | 672 | mv_line_dict['journal_id'] = st_line_journal_id | ||
649 | 673 | mv_line_dict['partner_id'] = st_line_partner_id | ||
650 | 674 | mv_line_dict['company_id'] = st_line_company_id | ||
651 | 675 | mv_line_dict['statement_id'] = st_line_statement_id | ||
652 | 676 | if mv_line_dict.get('counterpart_move_line_id'): | ||
653 | 677 | mv_line = aml_obj.browse(cr, uid, mv_line_dict['counterpart_move_line_id'], context=context) | ||
654 | 678 | mv_line_dict['account_id'] = mv_line.account_id.id | ||
655 | 679 | if statement_currency.id != company_currency.id: | ||
656 | 680 | mv_line_dict['amount_currency'] = mv_line_dict['debit'] - mv_line_dict['credit'] | ||
657 | 681 | mv_line_dict['currency_id'] = statement_currency.id | ||
658 | 682 | mv_line_dict['debit'] = currency_obj.compute(cr, uid, statement_currency.id, company_currency.id, mv_line_dict['debit']) | ||
659 | 683 | mv_line_dict['credit'] = currency_obj.compute(cr, uid, statement_currency.id, company_currency.id, mv_line_dict['credit']) | ||
660 | 684 | elif st_line_currency and st_line_currency_rate: | ||
661 | 685 | mv_line_dict['amount_currency'] = self.pool.get('res.currency').round(cr, uid, st_line.currency_id, (mv_line_dict['debit'] - mv_line_dict['credit']) * st_line_currency_rate) | ||
662 | 686 | mv_line_dict['currency_id'] = st_line_currency | ||
663 | 687 | |||
664 | 688 | # Create move lines | ||
665 | 689 | move_line_pairs_to_reconcile = [] | ||
666 | 690 | for mv_line_dict in mv_line_dicts: | ||
667 | 691 | counterpart_move_line_id = None # NB : this attribute is irrelevant for aml_obj.create() and needs to be removed from the dict | ||
668 | 692 | if mv_line_dict.get('counterpart_move_line_id'): | ||
669 | 693 | counterpart_move_line_id = mv_line_dict['counterpart_move_line_id'] | ||
670 | 694 | del mv_line_dict['counterpart_move_line_id'] | ||
671 | 695 | new_aml_id = aml_obj.create(cr, uid, mv_line_dict, context=context) | ||
672 | 696 | if counterpart_move_line_id != None: | ||
673 | 697 | move_line_pairs_to_reconcile.append([new_aml_id, counterpart_move_line_id]) | ||
674 | 698 | |||
675 | 699 | # Reconcile | ||
676 | 700 | for pair in move_line_pairs_to_reconcile: | ||
677 | 701 | # TODO : too slow | ||
678 | 702 | aml_obj.reconcile_partial(cr, uid, pair, context=context) | ||
679 | 703 | |||
680 | 704 | # Mark the statement line as reconciled | ||
681 | 705 | self.write(cr, uid, id, {'journal_entry_id': move_id}, context=context) | ||
682 | 706 | |||
683 | 707 | # FIXME : if it wasn't for the multicompany security settings in account_security.xml, the method would just | ||
684 | 708 | # return [('journal_entry_id', '=', False)] | ||
685 | 709 | # Unfortunately, that spawns a "no access rights" error ; it shouldn't. | ||
686 | 710 | def _needaction_domain_get(self, cr, uid, context=None): | ||
687 | 711 | user = self.pool.get("res.users").browse(cr, uid, uid) | ||
688 | 712 | return ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('journal_entry_id', '=', False)] | ||
689 | 549 | 713 | ||
690 | 550 | _order = "statement_id desc, sequence" | 714 | _order = "statement_id desc, sequence" |
691 | 551 | _name = "account.bank.statement.line" | 715 | _name = "account.bank.statement.line" |
692 | 552 | _description = "Bank Statement Line" | 716 | _description = "Bank Statement Line" |
693 | 717 | _inherit = ['ir.needaction_mixin'] | ||
694 | 553 | _columns = { | 718 | _columns = { |
695 | 554 | 'name': fields.char('Description', required=True), | 719 | 'name': fields.char('Description', required=True), |
696 | 555 | 'date': fields.date('Date', required=True), | 720 | 'date': fields.date('Date', required=True), |
697 | 556 | 'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')), | 721 | 'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')), |
698 | 557 | 'type': fields.selection([ | ||
699 | 558 | ('supplier','Supplier'), | ||
700 | 559 | ('customer','Customer'), | ||
701 | 560 | ('general','General') | ||
702 | 561 | ], 'Type', required=True), | ||
703 | 562 | 'partner_id': fields.many2one('res.partner', 'Partner'), | 722 | 'partner_id': fields.many2one('res.partner', 'Partner'), |
708 | 563 | 'account_id': fields.many2one('account.account','Account', | 723 | 'bank_account_id': fields.many2one('res.partner.bank','Bank Account'), |
709 | 564 | required=True), | 724 | 'statement_id': fields.many2one('account.bank.statement', 'Statement', select=True, required=True, ondelete='cascade'), |
706 | 565 | 'statement_id': fields.many2one('account.bank.statement', 'Statement', | ||
707 | 566 | select=True, required=True, ondelete='cascade'), | ||
710 | 567 | 'journal_id': fields.related('statement_id', 'journal_id', type='many2one', relation='account.journal', string='Journal', store=True, readonly=True), | 725 | 'journal_id': fields.related('statement_id', 'journal_id', type='many2one', relation='account.journal', string='Journal', store=True, readonly=True), |
711 | 568 | 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'), | ||
712 | 569 | 'move_ids': fields.many2many('account.move', | ||
713 | 570 | 'account_bank_statement_line_move_rel', 'statement_line_id','move_id', | ||
714 | 571 | 'Moves'), | ||
715 | 572 | 'ref': fields.char('Reference', size=32), | 726 | 'ref': fields.char('Reference', size=32), |
716 | 573 | 'note': fields.text('Notes'), | 727 | 'note': fields.text('Notes'), |
717 | 574 | 'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of bank statement lines."), | 728 | 'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of bank statement lines."), |
718 | 575 | 'company_id': fields.related('statement_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True), | 729 | 'company_id': fields.related('statement_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True), |
719 | 730 | 'journal_entry_id': fields.many2one('account.move', 'Journal Entry'), | ||
720 | 731 | 'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optional other currency if it is a multi-currency entry.", digits_compute=dp.get_precision('Account')), | ||
721 | 732 | 'currency_id': fields.many2one('res.currency', 'Currency', help="The optional other currency if it is a multi-currency entry."), | ||
722 | 576 | } | 733 | } |
723 | 577 | _defaults = { | 734 | _defaults = { |
724 | 578 | 'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'), | 735 | 'name': lambda self,cr,uid,context={}: self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement.line'), |
725 | 579 | 'date': lambda self,cr,uid,context={}: context.get('date', fields.date.context_today(self,cr,uid,context=context)), | 736 | 'date': lambda self,cr,uid,context={}: context.get('date', fields.date.context_today(self,cr,uid,context=context)), |
726 | 580 | 'type': 'general', | ||
727 | 581 | } | 737 | } |
728 | 582 | 738 | ||
729 | 739 | class account_statement_operation_template(osv.osv): | ||
730 | 740 | _name = "account.statement.operation.template" | ||
731 | 741 | _description = "Preset for the lines that can be created in a bank statement reconciliation" | ||
732 | 742 | _columns = { | ||
733 | 743 | 'name': fields.char('Button Label', required=True), | ||
734 | 744 | 'account_id': fields.many2one('account.account', 'Account', ondelete='cascade', domain=[('type','!=','view')]), | ||
735 | 745 | 'label': fields.char('Label'), | ||
736 | 746 | 'amount_type': fields.selection([('fixed', 'Fixed'),('percentage_of_total','Percentage of total amount'),('percentage_of_balance', 'Percentage of open balance')], | ||
737 | 747 | 'Amount type', required=True), | ||
738 | 748 | 'amount': fields.float('Amount', digits_compute=dp.get_precision('Account'), help="Leave to 0 to ignore."), | ||
739 | 749 | 'tax_id': fields.many2one('account.tax', 'Tax', ondelete='cascade'), | ||
740 | 750 | 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', ondelete='cascade'), | ||
741 | 751 | } | ||
742 | 752 | _defaults = { | ||
743 | 753 | 'amount_type': 'fixed', | ||
744 | 754 | 'amount': 0.0 | ||
745 | 755 | } | ||
746 | 583 | 756 | ||
747 | 584 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 757 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
748 | 585 | 758 | ||
749 | === modified file 'account/account_invoice.py' | |||
750 | --- account/account_invoice.py 2014-05-07 17:01:12 +0000 | |||
751 | +++ account/account_invoice.py 2014-05-30 16:18:57 +0000 | |||
752 | @@ -216,7 +216,7 @@ | |||
753 | 216 | _name = "account.invoice" | 216 | _name = "account.invoice" |
754 | 217 | _inherit = ['mail.thread'] | 217 | _inherit = ['mail.thread'] |
755 | 218 | _description = 'Invoice' | 218 | _description = 'Invoice' |
757 | 219 | _order = "id desc" | 219 | _order = "number desc, id desc" |
758 | 220 | _track = { | 220 | _track = { |
759 | 221 | 'type': { | 221 | 'type': { |
760 | 222 | }, | 222 | }, |
761 | 223 | 223 | ||
762 | === modified file 'account/account_move_line.py' | |||
763 | --- account/account_move_line.py 2014-05-07 17:01:12 +0000 | |||
764 | +++ account/account_move_line.py 2014-05-30 16:18:57 +0000 | |||
765 | @@ -430,7 +430,7 @@ | |||
766 | 430 | elif line.reconcile_partial_id: | 430 | elif line.reconcile_partial_id: |
767 | 431 | res[line.id] = str(line.reconcile_partial_id.name) | 431 | res[line.id] = str(line.reconcile_partial_id.name) |
768 | 432 | return res | 432 | return res |
770 | 433 | 433 | ||
771 | 434 | def _get_move_from_reconcile(self, cr, uid, ids, context=None): | 434 | def _get_move_from_reconcile(self, cr, uid, ids, context=None): |
772 | 435 | move = {} | 435 | move = {} |
773 | 436 | for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids, context=context): | 436 | for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids, context=context): |
774 | @@ -491,7 +491,7 @@ | |||
775 | 491 | type='many2one', relation='account.invoice', fnct_search=_invoice_search), | 491 | type='many2one', relation='account.invoice', fnct_search=_invoice_search), |
776 | 492 | 'account_tax_id':fields.many2one('account.tax', 'Tax'), | 492 | 'account_tax_id':fields.many2one('account.tax', 'Tax'), |
777 | 493 | 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'), | 493 | 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'), |
779 | 494 | 'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', | 494 | 'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', |
780 | 495 | string='Company', store=True, readonly=True) | 495 | string='Company', store=True, readonly=True) |
781 | 496 | } | 496 | } |
782 | 497 | 497 | ||
783 | @@ -765,7 +765,7 @@ | |||
784 | 765 | WHERE debit > 0 AND credit > 0 AND (last_reconciliation_date IS NULL OR max_date > last_reconciliation_date) | 765 | WHERE debit > 0 AND credit > 0 AND (last_reconciliation_date IS NULL OR max_date > last_reconciliation_date) |
785 | 766 | ORDER BY last_reconciliation_date""") | 766 | ORDER BY last_reconciliation_date""") |
786 | 767 | ids = [x[0] for x in cr.fetchall()] | 767 | ids = [x[0] for x in cr.fetchall()] |
788 | 768 | if not ids: | 768 | if not ids: |
789 | 769 | return [] | 769 | return [] |
790 | 770 | 770 | ||
791 | 771 | # To apply the ir_rules | 771 | # To apply the ir_rules |
792 | @@ -793,9 +793,11 @@ | |||
793 | 793 | else: | 793 | else: |
794 | 794 | currency_id = line.company_id.currency_id | 794 | currency_id = line.company_id.currency_id |
795 | 795 | if line.reconcile_id: | 795 | if line.reconcile_id: |
797 | 796 | raise osv.except_osv(_('Warning'), _("Journal Item '%s' (id: %s), Move '%s' is already reconciled!") % (line.name, line.id, line.move_id.name)) | 796 | raise osv.except_osv(_('Warning'), _("Journal Item '%s' (id: %s), Move '%s' is already reconciled!") % (line.name, line.id, line.move_id.name)) |
798 | 797 | if line.reconcile_partial_id: | 797 | if line.reconcile_partial_id: |
799 | 798 | for line2 in line.reconcile_partial_id.line_partial_ids: | 798 | for line2 in line.reconcile_partial_id.line_partial_ids: |
800 | 799 | if line2.state != 'valid': | ||
801 | 800 | raise osv.except_osv(_('Warning'), _("Journal Item '%s' (id: %s) cannot be used in a reconciliation as it is not balanced!") % (line2.name, line2.id)) | ||
802 | 799 | if not line2.reconcile_id: | 801 | if not line2.reconcile_id: |
803 | 800 | if line2.id not in merges: | 802 | if line2.id not in merges: |
804 | 801 | merges.append(line2.id) | 803 | merges.append(line2.id) |
805 | @@ -1119,7 +1121,7 @@ | |||
806 | 1119 | period = period_obj.browse(cr, uid, period_id, context=context) | 1121 | period = period_obj.browse(cr, uid, period_id, context=context) |
807 | 1120 | for (state,) in result: | 1122 | for (state,) in result: |
808 | 1121 | if state == 'done': | 1123 | if state == 'done': |
810 | 1122 | raise osv.except_osv(_('Error!'), _('You can not add/modify entries in a closed period %s of journal %s.' % (period.name,journal.name))) | 1124 | raise osv.except_osv(_('Error!'), _('You can not add/modify entries in a closed period %s of journal %s.' % (period.name,journal.name))) |
811 | 1123 | if not result: | 1125 | if not result: |
812 | 1124 | jour_period_obj.create(cr, uid, { | 1126 | jour_period_obj.create(cr, uid, { |
813 | 1125 | 'name': (journal.code or journal.name)+':'+(period.name or ''), | 1127 | 'name': (journal.code or journal.name)+':'+(period.name or ''), |
814 | 1126 | 1128 | ||
815 | === modified file 'account/account_unit_test.xml' | |||
816 | --- account/account_unit_test.xml 2013-11-13 13:01:07 +0000 | |||
817 | +++ account/account_unit_test.xml 2014-05-30 16:18:57 +0000 | |||
818 | @@ -6,10 +6,10 @@ | |||
819 | 6 | <field name="currency_id" ref="base.EUR"/> | 6 | <field name="currency_id" ref="base.EUR"/> |
820 | 7 | <field name="company_id" ref="base.main_company"/> | 7 | <field name="company_id" ref="base.main_company"/> |
821 | 8 | <field name="partner_id" ref="base.res_partner_1"/> | 8 | <field name="partner_id" ref="base.res_partner_1"/> |
823 | 9 | <field name="journal_id" ref="account.sales_journal"/> | 9 | <field name="journal_id" ref="account.expenses_journal"/> |
824 | 10 | <field name="state">draft</field> | 10 | <field name="state">draft</field> |
825 | 11 | <field name="type">in_invoice</field> | 11 | <field name="type">in_invoice</field> |
827 | 12 | <field name="account_id" ref="account.a_recv"/> | 12 | <field name="account_id" ref="account.a_pay"/> |
828 | 13 | <field name="name">Test invoice 1</field> | 13 | <field name="name">Test invoice 1</field> |
829 | 14 | </record> | 14 | </record> |
830 | 15 | <record id="test_tax_line" model="account.invoice.tax"> | 15 | <record id="test_tax_line" model="account.invoice.tax"> |
831 | 16 | 16 | ||
832 | === modified file 'account/account_view.xml' | |||
833 | --- account/account_view.xml 2014-05-02 13:07:53 +0000 | |||
834 | +++ account/account_view.xml 2014-05-30 16:18:57 +0000 | |||
835 | @@ -489,6 +489,13 @@ | |||
836 | 489 | src_model="account.journal"/> | 489 | src_model="account.journal"/> |
837 | 490 | 490 | ||
838 | 491 | <!-- Bank statement --> | 491 | <!-- Bank statement --> |
839 | 492 | |||
840 | 493 | <record id="action_bank_reconcile_bank_statements" model="ir.actions.client"> | ||
841 | 494 | <field name="name">Reconciliation on Bank Statements</field> | ||
842 | 495 | <field name="tag">bank_statement_reconciliation_view</field> | ||
843 | 496 | <field name="context">{'statement_id': active_id}</field> | ||
844 | 497 | </record> | ||
845 | 498 | |||
846 | 492 | <record id="view_account_bank_statement_filter" model="ir.ui.view"> | 499 | <record id="view_account_bank_statement_filter" model="ir.ui.view"> |
847 | 493 | <field name="name">account.cash.statement.select</field> | 500 | <field name="name">account.cash.statement.select</field> |
848 | 494 | <field name="model">account.bank.statement</field> | 501 | <field name="model">account.bank.statement</field> |
849 | @@ -525,6 +532,7 @@ | |||
850 | 525 | </tree> | 532 | </tree> |
851 | 526 | </field> | 533 | </field> |
852 | 527 | </record> | 534 | </record> |
853 | 535 | |||
854 | 528 | <record id="view_bank_statement_search" model="ir.ui.view"> | 536 | <record id="view_bank_statement_search" model="ir.ui.view"> |
855 | 529 | <field name="name">account.bank.statement.search</field> | 537 | <field name="name">account.bank.statement.search</field> |
856 | 530 | <field name="model">account.bank.statement</field> | 538 | <field name="model">account.bank.statement</field> |
857 | @@ -544,6 +552,7 @@ | |||
858 | 544 | </search> | 552 | </search> |
859 | 545 | </field> | 553 | </field> |
860 | 546 | </record> | 554 | </record> |
861 | 555 | |||
862 | 547 | <record id="view_bank_statement_form" model="ir.ui.view"> | 556 | <record id="view_bank_statement_form" model="ir.ui.view"> |
863 | 548 | <field name="name">account.bank.statement.form</field> | 557 | <field name="name">account.bank.statement.form</field> |
864 | 549 | <field name="model">account.bank.statement</field> | 558 | <field name="model">account.bank.statement</field> |
865 | @@ -551,14 +560,21 @@ | |||
866 | 551 | <field name="arch" type="xml"> | 560 | <field name="arch" type="xml"> |
867 | 552 | <form string="Bank Statement" version="7.0"> | 561 | <form string="Bank Statement" version="7.0"> |
868 | 553 | <header> | 562 | <header> |
871 | 554 | <button name="button_confirm_bank" states="draft" string="Confirm" type="object" class="oe_highlight"/> | 563 | <field name="all_lines_reconciled" invisible="1" /> |
872 | 555 | <button name="button_dummy" states="draft" string="Compute" type="object" class="oe_highlight"/> | 564 | <span attrs="{'invisible':['|',('all_lines_reconciled','=',True),('line_ids','=',[])]}"> |
873 | 565 | <button name="%(action_bank_reconcile_bank_statements)d" states="draft" string="Reconcile" type="action" class="oe_highlight"/> | ||
874 | 566 | </span> | ||
875 | 567 | <span attrs="{'invisible':[('all_lines_reconciled','=',False)]}"> | ||
876 | 568 | <button name="button_confirm_bank" states="draft" string="Close" type="object" class="oe_highlight"/> | ||
877 | 569 | </span> | ||
878 | 556 | <button name="button_cancel" states="confirm" string="Cancel Statement" type="object"/> | 570 | <button name="button_cancel" states="confirm" string="Cancel Statement" type="object"/> |
879 | 557 | <field name="state" widget="statusbar" statusbar_visible="draft,confirm"/> | 571 | <field name="state" widget="statusbar" statusbar_visible="draft,confirm"/> |
880 | 558 | </header> | 572 | </header> |
881 | 559 | <sheet> | 573 | <sheet> |
882 | 560 | <div class="oe_right oe_button_box" name="import_buttons"> | 574 | <div class="oe_right oe_button_box" name="import_buttons"> |
884 | 561 | <!-- Put here related buttons --> | 575 | <button class="oe_inline oe_stat_button" name="%(action_view_account_statement_from_invoice_lines)d" |
885 | 576 | string="Import Invoice" type="action" | ||
886 | 577 | attrs="{'invisible':[('state','=','confirm')]}" widget="statinfo" icon="fa-pencil-square-o"/> | ||
887 | 562 | </div> | 578 | </div> |
888 | 563 | <label for="name" class="oe_edit_only"/> | 579 | <label for="name" class="oe_edit_only"/> |
889 | 564 | <h1><field name="name"/></h1> | 580 | <h1><field name="name"/></h1> |
890 | @@ -581,41 +597,30 @@ | |||
891 | 581 | <notebook> | 597 | <notebook> |
892 | 582 | <page string="Transactions" name="statement_line_ids"> | 598 | <page string="Transactions" name="statement_line_ids"> |
893 | 583 | <field name="line_ids" context="{'date':date}"> | 599 | <field name="line_ids" context="{'date':date}"> |
895 | 584 | <tree editable="bottom" string="Statement lines"> | 600 | <tree editable="bottom" string="Statement lines" colors="grey:journal_entry_id!=False"> |
896 | 585 | <field name="sequence" readonly="1" invisible="1"/> | 601 | <field name="sequence" readonly="1" invisible="1"/> |
901 | 586 | <field name="date"/> | 602 | <field name="journal_entry_id" invisible="1"/> |
902 | 587 | <field name="name"/> | 603 | <field name="date" attrs="{'readonly' : [('journal_entry_id', '!=', False)] }"/> |
903 | 588 | <field name="ref"/> | 604 | <field name="name" attrs="{'readonly' : [('journal_entry_id', '!=', False)] }"/> |
904 | 589 | <field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="[ | 605 | <field name="ref" attrs="{'readonly' : [('journal_entry_id', '!=', False)] }"/> |
905 | 606 | <field name="partner_id" domain="[ | ||
906 | 590 | '&', | 607 | '&', |
907 | 591 | '|',('parent_id','=',False),('is_company','=',True), | 608 | '|',('parent_id','=',False),('is_company','=',True), |
913 | 592 | '|',('customer','=',True),('supplier','=',True)]" context="{'default_supplier': 1}"/> | 609 | '|',('customer','=',True),('supplier','=',True)]" |
914 | 593 | <field name="type" on_change="onchange_type(partner_id, type)"/> | 610 | context="{'default_supplier': 1}" |
915 | 594 | <field name="account_id" options='{"no_open":True}' domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]"/> | 611 | attrs="{'readonly' : [('journal_entry_id', '!=', False)] }"/> |
916 | 595 | <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '<>', 'view')]"/> | 612 | <field name="amount" attrs="{'readonly' : [('journal_entry_id', '!=', False)] }"/> |
917 | 596 | <field name="amount"/> | 613 | <field name="amount_currency" groups="base.group_multi_currency" attrs="{'readonly' : [('journal_entry_id', '!=', False)] }"/> |
918 | 614 | <field name="currency_id" groups="base.group_multi_currency" attrs="{'readonly' : [('journal_entry_id', '!=', False)] }"/> | ||
919 | 615 | <field name="bank_account_id" groups="base.group_no_one"/> | ||
920 | 597 | </tree> | 616 | </tree> |
921 | 598 | <form string="Statement lines" version="7.0"> | ||
922 | 599 | <group col="4"> | ||
923 | 600 | <field name="date"/> | ||
924 | 601 | <field name="name"/> | ||
925 | 602 | <field name="ref"/> | ||
926 | 603 | <field name="partner_id" on_change="onchange_partner_id(partner_id)"/> | ||
927 | 604 | <field name="type" on_change="onchange_type(partner_id, type)"/> | ||
928 | 605 | <field name="account_id" domain="[('journal_id', '=', parent.journal_id), ('type', '<>', 'view'), ('company_id', '=', parent.company_id)]"/> | ||
929 | 606 | <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '<>', 'view')]"/> | ||
930 | 607 | <field name="amount"/> | ||
931 | 608 | <field name="sequence" readonly="0"/> | ||
932 | 609 | </group> | ||
933 | 610 | <separator string="Notes"/> | ||
934 | 611 | <field name="note"/> | ||
935 | 612 | </form> | ||
936 | 613 | </field> | 617 | </field> |
937 | 614 | </page> | 618 | </page> |
938 | 615 | </notebook> | 619 | </notebook> |
939 | 616 | <group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total"> | 620 | <group class="oe_subtotal_footer oe_right" colspan="2" name="sale_total"> |
940 | 617 | <div class="oe_subtotal_footer_separator oe_inline"> | 621 | <div class="oe_subtotal_footer_separator oe_inline"> |
941 | 618 | <label for="balance_end" /> | 622 | <label for="balance_end" /> |
942 | 623 | <button name="button_dummy" states="draft" string="(update)" type="object" class="oe_edit_only oe_link"/> | ||
943 | 619 | </div> | 624 | </div> |
944 | 620 | <field name="balance_end" nolabel="1" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field': 'currency_id'}"/> | 625 | <field name="balance_end" nolabel="1" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field': 'currency_id'}"/> |
945 | 621 | </group> | 626 | </group> |
946 | @@ -682,6 +687,85 @@ | |||
947 | 682 | <field name="domain">[('state','=','draft')]</field> | 687 | <field name="domain">[('state','=','draft')]</field> |
948 | 683 | <field name="filter" eval="True"/> | 688 | <field name="filter" eval="True"/> |
949 | 684 | </record> | 689 | </record> |
950 | 690 | |||
951 | 691 | <record id="action_bank_reconcile" model="ir.actions.client"> | ||
952 | 692 | <field name="name">Reconciliation on Bank Statements</field> | ||
953 | 693 | <field name="res_model">account.bank.statement.line</field> | ||
954 | 694 | <field name="tag">bank_statement_reconciliation_view</field> | ||
955 | 695 | </record> | ||
956 | 696 | |||
957 | 697 | <!-- because of the needaction badge, groups needs to be specified --> | ||
958 | 698 | <menuitem id="menu_bank_reconcile_bank_statements" name="Reconciliation on Bank Statements" parent="account.periodical_processing_reconciliation" groups="group_account_user" action="action_bank_reconcile" sequence="20"/> | ||
959 | 699 | |||
960 | 700 | <record id="view_account_statement_operation_template_form" model="ir.ui.view"> | ||
961 | 701 | <field name="name">account.statement.operation.template.form</field> | ||
962 | 702 | <field name="model">account.statement.operation.template</field> | ||
963 | 703 | <field name="arch" type="xml"> | ||
964 | 704 | <form string="Statement Operation Templates" version="7.0"> | ||
965 | 705 | <sheet> | ||
966 | 706 | <div class="oe_title"> | ||
967 | 707 | <label for="name" class="oe_edit_only"/> | ||
968 | 708 | <h1> | ||
969 | 709 | <field name="name"/> | ||
970 | 710 | </h1> | ||
971 | 711 | </div> | ||
972 | 712 | <group> | ||
973 | 713 | <group> | ||
974 | 714 | <field name="account_id"/> | ||
975 | 715 | <field name="amount_type"/> | ||
976 | 716 | <field name="tax_id"/> | ||
977 | 717 | </group> | ||
978 | 718 | <group> | ||
979 | 719 | <field name="label"/> | ||
980 | 720 | <label for="amount"/> | ||
981 | 721 | <div> | ||
982 | 722 | <field name="amount" class="oe_inline" /> | ||
983 | 723 | <label string="%" class="oe_inline" attrs="{'invisible':[('amount_type','not in',('percentage_of_total', 'percentage_of_balance'))]}" /> | ||
984 | 724 | </div> | ||
985 | 725 | <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/> | ||
986 | 726 | </group> | ||
987 | 727 | </group> | ||
988 | 728 | </sheet> | ||
989 | 729 | </form> | ||
990 | 730 | </field> | ||
991 | 731 | </record> | ||
992 | 732 | <record id="view_account_statement_operation_template_tree" model="ir.ui.view"> | ||
993 | 733 | <field name="name">account.statement.operation.template.tree</field> | ||
994 | 734 | <field name="model">account.statement.operation.template</field> | ||
995 | 735 | <field name="arch" type="xml"> | ||
996 | 736 | <tree string="Bank Reconciliation Move Presets"> | ||
997 | 737 | <field name="name"/> | ||
998 | 738 | <field name="account_id"/> | ||
999 | 739 | <field name="amount_type"/> | ||
1000 | 740 | </tree> | ||
1001 | 741 | </field> | ||
1002 | 742 | </record> | ||
1003 | 743 | <record id="view_account_statement_operation_template_search" model="ir.ui.view"> | ||
1004 | 744 | <field name="name">account.statement.operation.template.search</field> | ||
1005 | 745 | <field name="model">account.statement.operation.template</field> | ||
1006 | 746 | <field name="arch" type="xml"> | ||
1007 | 747 | <search string="Bank Reconciliation Move preset"> | ||
1008 | 748 | <filter string="With tax" domain="[('tax_id','!=',False)]"/> | ||
1009 | 749 | <field name="amount_type"/> | ||
1010 | 750 | </search> | ||
1011 | 751 | </field> | ||
1012 | 752 | </record> | ||
1013 | 753 | <record id="action_account_statement_operation_template" model="ir.actions.act_window"> | ||
1014 | 754 | <field name="name">Statement Operation Templates</field> | ||
1015 | 755 | <field name="res_model">account.statement.operation.template</field> | ||
1016 | 756 | <field name="view_type">form</field> | ||
1017 | 757 | <field name="view_mode">tree,form</field> | ||
1018 | 758 | <field name="search_view_id" ref="view_account_statement_operation_template_search"/> | ||
1019 | 759 | <field name="help" type="html"> | ||
1020 | 760 | <p class="oe_view_nocontent_create"> | ||
1021 | 761 | Click to create a statement operation template. | ||
1022 | 762 | </p><p> | ||
1023 | 763 | Those can be used to quickly create a move line when reconciling | ||
1024 | 764 | your bank statements. | ||
1025 | 765 | </p> | ||
1026 | 766 | </field> | ||
1027 | 767 | </record> | ||
1028 | 768 | <menuitem action="action_account_statement_operation_template" id="menu_action_account_statement_operation_template" parent="menu_configuration_misc" name="Statement Operation Templates" sequence="22"/> | ||
1029 | 685 | 769 | ||
1030 | 686 | <!-- Account Types --> | 770 | <!-- Account Types --> |
1031 | 687 | <record id="view_account_type_search" model="ir.ui.view"> | 771 | <record id="view_account_type_search" model="ir.ui.view"> |
1032 | @@ -1603,11 +1687,11 @@ | |||
1033 | 1603 | <form string="Payment Term" version="7.0"> | 1687 | <form string="Payment Term" version="7.0"> |
1034 | 1604 | <group> | 1688 | <group> |
1035 | 1605 | <group string="Amount Computation"> | 1689 | <group string="Amount Computation"> |
1041 | 1606 | <field name="value"/> | 1690 | <field name="value"/> |
1042 | 1607 | <label for="value_amount" string="Amount To Pay" attrs="{'invisible':[('value','=','balance')]}"/> | 1691 | <label for="value_amount" string="Amount To Pay" attrs="{'invisible':[('value','=','balance')]}"/> |
1043 | 1608 | <div attrs="{'invisible':[('value','=','balance')]}"> | 1692 | <div attrs="{'invisible':[('value','=','balance')]}"> |
1044 | 1609 | <field name="value_amount" class="oe_inline"/> | 1693 | <field name="value_amount" class="oe_inline"/> |
1045 | 1610 | </div> | 1694 | </div> |
1046 | 1611 | </group> | 1695 | </group> |
1047 | 1612 | <group string="Due Date Computation"> | 1696 | <group string="Due Date Computation"> |
1048 | 1613 | <field name="days"/> | 1697 | <field name="days"/> |
1049 | @@ -2259,7 +2343,13 @@ | |||
1050 | 2259 | <field name="arch" type="xml"> | 2343 | <field name="arch" type="xml"> |
1051 | 2260 | <form string="Statement" version="7.0"> | 2344 | <form string="Statement" version="7.0"> |
1052 | 2261 | <header> | 2345 | <header> |
1054 | 2262 | <button name="button_confirm_cash" states="open" string="Close CashBox" type="object" class="oe_highlight"/> | 2346 | <field name="all_lines_reconciled" invisible="1" /> |
1055 | 2347 | <span attrs="{'invisible':['|',('all_lines_reconciled','=',True),('line_ids','=',[])]}"> | ||
1056 | 2348 | <button name="%(action_bank_reconcile_bank_statements)d" states="open" string="Reconcile" type="action" class="oe_highlight"/> | ||
1057 | 2349 | </span> | ||
1058 | 2350 | <span attrs="{'invisible':[('all_lines_reconciled','=',False)]}"> | ||
1059 | 2351 | <button name="button_confirm_cash" states="open" string="Close CashBox" type="object" class="oe_highlight"/> | ||
1060 | 2352 | </span> | ||
1061 | 2263 | <button name="button_open" states="draft" string="Open CashBox" type="object" class="oe_highlight"/> | 2353 | <button name="button_open" states="draft" string="Open CashBox" type="object" class="oe_highlight"/> |
1062 | 2264 | <button name="button_cancel" states="confirm,open" string="Cancel CashBox" type="object"/> | 2354 | <button name="button_cancel" states="confirm,open" string="Cancel CashBox" type="object"/> |
1063 | 2265 | <field name="state" widget="statusbar" nolabel="1" statusbar_visible="draft,confirm"/> | 2355 | <field name="state" widget="statusbar" nolabel="1" statusbar_visible="draft,confirm"/> |
1064 | @@ -2289,10 +2379,7 @@ | |||
1065 | 2289 | <field name="date"/> | 2379 | <field name="date"/> |
1066 | 2290 | <field name="name"/> | 2380 | <field name="name"/> |
1067 | 2291 | <field name="ref"/> | 2381 | <field name="ref"/> |
1072 | 2292 | <field name="partner_id" on_change="onchange_partner_id(partner_id)"/> | 2382 | <field name="partner_id"/> |
1069 | 2293 | <field name="type" on_change="onchange_type(partner_id, type)"/> | ||
1070 | 2294 | <field domain="[('journal_id','=',parent.journal_id), ('company_id', '=', parent.company_id)]" name="account_id"/> | ||
1071 | 2295 | <field name="analytic_account_id" domain="[('company_id', '=', parent.company_id), ('type', '<>', 'view')]" groups="analytic.group_analytic_accounting" /> | ||
1073 | 2296 | <field name="amount"/> | 2383 | <field name="amount"/> |
1074 | 2297 | </tree> | 2384 | </tree> |
1075 | 2298 | <form string="Statement lines" version="7.0"> | 2385 | <form string="Statement lines" version="7.0"> |
1076 | @@ -2300,10 +2387,7 @@ | |||
1077 | 2300 | <field name="date"/> | 2387 | <field name="date"/> |
1078 | 2301 | <field name="name"/> | 2388 | <field name="name"/> |
1079 | 2302 | <field name="ref"/> | 2389 | <field name="ref"/> |
1084 | 2303 | <field name="partner_id" on_change="onchange_partner_id(partner_id)"/> | 2390 | <field name="partner_id"/> |
1081 | 2304 | <field name="type" on_change="onchange_type(partner_id, type)"/> | ||
1082 | 2305 | <field domain="[('journal_id', '=', parent.journal_id), ('type', '<>', 'view'), ('company_id', '=', parent.company_id)]" name="account_id"/> | ||
1083 | 2306 | <field name="analytic_account_id" domain="[('company_id', '=', parent.company_id), ('type', '<>', 'view')]" groups="analytic.group_analytic_accounting" /> | ||
1085 | 2307 | <field name="amount"/> | 2391 | <field name="amount"/> |
1086 | 2308 | <field name="sequence"/> | 2392 | <field name="sequence"/> |
1087 | 2309 | </group> | 2393 | </group> |
1088 | 2310 | 2394 | ||
1089 | === added file 'account/demo/account_bank_statement.xml' | |||
1090 | --- account/demo/account_bank_statement.xml 1970-01-01 00:00:00 +0000 | |||
1091 | +++ account/demo/account_bank_statement.xml 2014-05-30 16:18:57 +0000 | |||
1092 | @@ -0,0 +1,85 @@ | |||
1093 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
1094 | 2 | <openerp> | ||
1095 | 3 | <data> | ||
1096 | 4 | <!-- A bank statement --> | ||
1097 | 5 | <record id="demo_bank_statement_1" model="account.bank.statement"> | ||
1098 | 6 | <field name="journal_id" ref="account.bank_journal"/> | ||
1099 | 7 | <field name="period_id" ref="account.period_5"/> | ||
1100 | 8 | <field name="date" eval="time.strftime('%Y')+'-01-01'"/> | ||
1101 | 9 | <field name="user_id" ref="base.user_demo"/> | ||
1102 | 10 | <field name="reference_type">none</field> | ||
1103 | 11 | <field name="name">BNK/2014/001</field> | ||
1104 | 12 | <field name="balance_end" eval="2040.0"/> | ||
1105 | 13 | <field name="company_id" ref="base.main_company"/> | ||
1106 | 14 | <field name="state">draft</field> | ||
1107 | 15 | <field name="balance_start" eval="0.0"/> | ||
1108 | 16 | <field name="balance_end_real" eval="3707.58"/> | ||
1109 | 17 | </record> | ||
1110 | 18 | <record id="demo_bank_statement_line_1" model="account.bank.statement.line"> | ||
1111 | 19 | <field name="ref">001</field> | ||
1112 | 20 | <field name="statement_id" ref="demo_bank_statement_1"/> | ||
1113 | 21 | <field name="sequence" eval="1"/> | ||
1114 | 22 | <field name="company_id" ref="base.main_company"/> | ||
1115 | 23 | <field name="name">First 2000 € of SAJ/2014/001</field> | ||
1116 | 24 | <field name="journal_id" ref="account.bank_journal"/> | ||
1117 | 25 | <field name="amount" eval="2000.0"/> | ||
1118 | 26 | <field name="date" eval="time.strftime('%Y')+'-01-01'"/> | ||
1119 | 27 | <field name="partner_id" ref="base.res_partner_9"/> | ||
1120 | 28 | </record> | ||
1121 | 29 | <record id="demo_bank_statement_line_2" model="account.bank.statement.line"> | ||
1122 | 30 | <field name="ref">002</field> | ||
1123 | 31 | <field name="statement_id" ref="demo_bank_statement_1"/> | ||
1124 | 32 | <field name="sequence" eval="2"/> | ||
1125 | 33 | <field name="company_id" ref="base.main_company"/> | ||
1126 | 34 | <field name="name">SAJ/2014/002</field> | ||
1127 | 35 | <field name="journal_id" ref="account.bank_journal"/> | ||
1128 | 36 | <field name="amount" eval="650.0"/> | ||
1129 | 37 | <field name="date" eval="time.strftime('%Y')+'-01-01'"/> | ||
1130 | 38 | <field name="partner_id" ref="base.res_partner_9"/> | ||
1131 | 39 | </record> | ||
1132 | 40 | <record id="demo_bank_statement_line_3" model="account.bank.statement.line"> | ||
1133 | 41 | <field name="ref">003</field> | ||
1134 | 42 | <field name="statement_id" ref="demo_bank_statement_1"/> | ||
1135 | 43 | <field name="sequence" eval="3"/> | ||
1136 | 44 | <field name="company_id" ref="base.main_company"/> | ||
1137 | 45 | <field name="name">Bank fees</field> | ||
1138 | 46 | <field name="journal_id" ref="account.bank_journal"/> | ||
1139 | 47 | <field name="amount" eval="32.58"/> | ||
1140 | 48 | <field name="date" eval="time.strftime('%Y')+'-01-01'"/> | ||
1141 | 49 | </record> | ||
1142 | 50 | <record id="demo_bank_statement_line_4" model="account.bank.statement.line"> | ||
1143 | 51 | <field name="ref">004</field> | ||
1144 | 52 | <field name="statement_id" ref="demo_bank_statement_1"/> | ||
1145 | 53 | <field name="sequence" eval="4"/> | ||
1146 | 54 | <field name="company_id" ref="base.main_company"/> | ||
1147 | 55 | <field name="name">SAJ/2014/003 and SAJ/2014/004</field> | ||
1148 | 56 | <field name="journal_id" ref="account.bank_journal"/> | ||
1149 | 57 | <field name="amount" eval="1025.0"/> | ||
1150 | 58 | <field name="date" eval="time.strftime('%Y')+'-01-01'"/> | ||
1151 | 59 | <field name="partner_id" ref="base.res_partner_2"/> | ||
1152 | 60 | </record> | ||
1153 | 61 | |||
1154 | 62 | <!-- Statement operation templates --> | ||
1155 | 63 | <record id="statement_operation_template_1" model="account.statement.operation.template"> | ||
1156 | 64 | <field name="name">Discount For Early Payment</field> | ||
1157 | 65 | <field name="account_id" ref="a_expense"></field> | ||
1158 | 66 | <field name="label">Discount</field> | ||
1159 | 67 | <field name="amount_type">percentage_of_total</field> | ||
1160 | 68 | <field name="amount">-7</field> | ||
1161 | 69 | </record> | ||
1162 | 70 | <record id="statement_operation_template_2" model="account.statement.operation.template"> | ||
1163 | 71 | <field name="name">Bank Fees</field> | ||
1164 | 72 | <field name="account_id" ref="a_expense"></field> | ||
1165 | 73 | <field name="label">Bank Fees</field> | ||
1166 | 74 | <field name="amount_type">fixed</field> | ||
1167 | 75 | <field name="amount"></field> | ||
1168 | 76 | </record> | ||
1169 | 77 | <record id="statement_operation_template_3" model="account.statement.operation.template"> | ||
1170 | 78 | <field name="name">Profit / Loss</field> | ||
1171 | 79 | <field name="account_id" ref="a_sale"></field> | ||
1172 | 80 | <field name="label">Profit / Loss</field> | ||
1173 | 81 | <field name="amount_type">fixed</field> | ||
1174 | 82 | <field name="amount"></field> | ||
1175 | 83 | </record> | ||
1176 | 84 | </data> | ||
1177 | 85 | </openerp> | ||
1178 | 0 | 86 | ||
1179 | === modified file 'account/demo/account_invoice_demo.xml' | |||
1180 | --- account/demo/account_invoice_demo.xml 2012-11-29 22:26:45 +0000 | |||
1181 | +++ account/demo/account_invoice_demo.xml 2014-05-30 16:18:57 +0000 | |||
1182 | @@ -44,5 +44,135 @@ | |||
1183 | 44 | <field name="partner_id" ref="base.res_partner_17"/> | 44 | <field name="partner_id" ref="base.res_partner_17"/> |
1184 | 45 | <field name="name">Zed+ Antivirus</field> | 45 | <field name="name">Zed+ Antivirus</field> |
1185 | 46 | </record> | 46 | </record> |
1186 | 47 | |||
1187 | 48 | <!-- Some customer invoices used to show the reconciliation process on the bank statement --> | ||
1188 | 49 | <record id="invoice_1" model="account.invoice"> | ||
1189 | 50 | <field name="currency_id" ref="base.EUR"/> | ||
1190 | 51 | <field name="company_id" ref="base.main_company"/> | ||
1191 | 52 | <field name="journal_id" ref="account.sales_journal"/> | ||
1192 | 53 | <field name="state">draft</field> | ||
1193 | 54 | <field name="type">out_invoice</field> | ||
1194 | 55 | <field name="account_id" ref="a_recv"/> | ||
1195 | 56 | <field name="partner_id" ref="base.res_partner_9"/> | ||
1196 | 57 | </record> | ||
1197 | 58 | <record id="invoice_1_line_1" model="account.invoice.line"> | ||
1198 | 59 | <field name="name">Otpez Laptop without OS</field> | ||
1199 | 60 | <field name="invoice_id" ref="invoice_1"/> | ||
1200 | 61 | <field name="price_unit">642</field> | ||
1201 | 62 | <field name="quantity">5</field> | ||
1202 | 63 | <field name="account_id" ref="a_sale"/> | ||
1203 | 64 | </record> | ||
1204 | 65 | <record id="invoice_1_line_2" model="account.invoice.line"> | ||
1205 | 66 | <field name="name">Linutop</field> | ||
1206 | 67 | <field name="invoice_id" ref="invoice_1"/> | ||
1207 | 68 | <field name="price_unit">280</field> | ||
1208 | 69 | <field name="quantity">5</field> | ||
1209 | 70 | <field name="account_id" ref="a_sale"/> | ||
1210 | 71 | </record> | ||
1211 | 72 | <workflow action="invoice_open" model="account.invoice" ref="invoice_1"/> | ||
1212 | 73 | |||
1213 | 74 | <record id="invoice_2" model="account.invoice"> | ||
1214 | 75 | <field name="currency_id" ref="base.EUR"/> | ||
1215 | 76 | <field name="company_id" ref="base.main_company"/> | ||
1216 | 77 | <field name="journal_id" ref="account.sales_journal"/> | ||
1217 | 78 | <field name="state">draft</field> | ||
1218 | 79 | <field name="type">out_invoice</field> | ||
1219 | 80 | <field name="account_id" ref="a_recv"/> | ||
1220 | 81 | <field name="partner_id" ref="base.res_partner_9"/> | ||
1221 | 82 | <field eval="time.strftime('%Y-%m') + '-01'" name="date_invoice"/> | ||
1222 | 83 | </record> | ||
1223 | 84 | <record id="invoice_2_line_1" model="account.invoice.line"> | ||
1224 | 85 | <field name="name">8-port Switch</field> | ||
1225 | 86 | <field name="invoice_id" ref="invoice_2"/> | ||
1226 | 87 | <field name="price_unit">50</field> | ||
1227 | 88 | <field name="quantity">3</field> | ||
1228 | 89 | <field name="account_id" ref="a_sale"/> | ||
1229 | 90 | </record> | ||
1230 | 91 | <record id="invoice_2_line_2" model="account.invoice.line"> | ||
1231 | 92 | <field name="name">30m RJ45 wire</field> | ||
1232 | 93 | <field name="invoice_id" ref="invoice_2"/> | ||
1233 | 94 | <field name="price_unit">25</field> | ||
1234 | 95 | <field name="quantity">20</field> | ||
1235 | 96 | <field name="account_id" ref="a_sale"/> | ||
1236 | 97 | </record> | ||
1237 | 98 | <workflow action="invoice_open" model="account.invoice" ref="invoice_2"/> | ||
1238 | 99 | |||
1239 | 100 | <record id="invoice_3" model="account.invoice"> | ||
1240 | 101 | <field name="currency_id" ref="base.EUR"/> | ||
1241 | 102 | <field name="company_id" ref="base.main_company"/> | ||
1242 | 103 | <field name="journal_id" ref="account.sales_journal"/> | ||
1243 | 104 | <field name="state">draft</field> | ||
1244 | 105 | <field name="type">out_invoice</field> | ||
1245 | 106 | <field name="account_id" ref="a_recv"/> | ||
1246 | 107 | <field name="partner_id" ref="base.res_partner_2"/> | ||
1247 | 108 | <field eval="time.strftime('%Y-%m') + '-08'" name="date_invoice"/> | ||
1248 | 109 | </record> | ||
1249 | 110 | <record id="invoice_3_line_1" model="account.invoice.line"> | ||
1250 | 111 | <field name="name">TypeMatrix Dvorak Keyboard</field> | ||
1251 | 112 | <field name="invoice_id" ref="invoice_3"/> | ||
1252 | 113 | <field name="price_unit">90</field> | ||
1253 | 114 | <field name="quantity">5</field> | ||
1254 | 115 | <field name="account_id" ref="a_sale"/> | ||
1255 | 116 | </record> | ||
1256 | 117 | <record id="invoice_3_line_2" model="account.invoice.line"> | ||
1257 | 118 | <field name="name">Ergonomic Mouse</field> | ||
1258 | 119 | <field name="invoice_id" ref="invoice_3"/> | ||
1259 | 120 | <field name="price_unit">15</field> | ||
1260 | 121 | <field name="quantity">5</field> | ||
1261 | 122 | <field name="account_id" ref="a_sale"/> | ||
1262 | 123 | </record> | ||
1263 | 124 | <workflow action="invoice_open" model="account.invoice" ref="invoice_3"/> | ||
1264 | 125 | |||
1265 | 126 | <record id="invoice_4" model="account.invoice"> | ||
1266 | 127 | <field name="currency_id" ref="base.EUR"/> | ||
1267 | 128 | <field name="company_id" ref="base.main_company"/> | ||
1268 | 129 | <field name="journal_id" ref="account.sales_journal"/> | ||
1269 | 130 | <field name="state">draft</field> | ||
1270 | 131 | <field name="type">out_invoice</field> | ||
1271 | 132 | <field name="account_id" ref="a_recv"/> | ||
1272 | 133 | <field name="partner_id" ref="base.res_partner_2"/> | ||
1273 | 134 | <field eval="time.strftime('%Y-%m') + '-15'" name="date_invoice"/> | ||
1274 | 135 | </record> | ||
1275 | 136 | <record id="invoice_4_line_1" model="account.invoice.line"> | ||
1276 | 137 | <field name="name">Desktop Computer Table</field> | ||
1277 | 138 | <field name="invoice_id" ref="invoice_4"/> | ||
1278 | 139 | <field name="price_unit">80</field> | ||
1279 | 140 | <field name="quantity">5</field> | ||
1280 | 141 | <field name="account_id" ref="a_sale"/> | ||
1281 | 142 | </record> | ||
1282 | 143 | <record id="invoice_4_line_2" model="account.invoice.line"> | ||
1283 | 144 | <field name="name">Desktop Lamp</field> | ||
1284 | 145 | <field name="invoice_id" ref="invoice_4"/> | ||
1285 | 146 | <field name="price_unit">20</field> | ||
1286 | 147 | <field name="quantity">5</field> | ||
1287 | 148 | <field name="account_id" ref="a_sale"/> | ||
1288 | 149 | </record> | ||
1289 | 150 | <workflow action="invoice_open" model="account.invoice" ref="invoice_4"/> | ||
1290 | 151 | |||
1291 | 152 | <record id="invoice_5" model="account.invoice"> | ||
1292 | 153 | <field name="currency_id" ref="base.EUR"/> | ||
1293 | 154 | <field name="company_id" ref="base.main_company"/> | ||
1294 | 155 | <field name="journal_id" ref="account.sales_journal"/> | ||
1295 | 156 | <field name="state">draft</field> | ||
1296 | 157 | <field name="type">out_invoice</field> | ||
1297 | 158 | <field name="account_id" ref="a_recv"/> | ||
1298 | 159 | <field name="partner_id" ref="base.res_partner_9"/> | ||
1299 | 160 | <field eval="time.strftime('%Y-%m') + '-08'" name="date_invoice"/> | ||
1300 | 161 | </record> | ||
1301 | 162 | <record id="invoice_5_line_1" model="account.invoice.line"> | ||
1302 | 163 | <field name="name">TypeMatrix Dvorak Keyboard</field> | ||
1303 | 164 | <field name="invoice_id" ref="invoice_5"/> | ||
1304 | 165 | <field name="price_unit">90</field> | ||
1305 | 166 | <field name="quantity">5</field> | ||
1306 | 167 | <field name="account_id" ref="a_sale"/> | ||
1307 | 168 | </record> | ||
1308 | 169 | <record id="invoice_5_line_2" model="account.invoice.line"> | ||
1309 | 170 | <field name="name">Ergonomic Mouse</field> | ||
1310 | 171 | <field name="invoice_id" ref="invoice_5"/> | ||
1311 | 172 | <field name="price_unit">15</field> | ||
1312 | 173 | <field name="quantity">5</field> | ||
1313 | 174 | <field name="account_id" ref="a_sale"/> | ||
1314 | 175 | </record> | ||
1315 | 176 | <workflow action="invoice_open" model="account.invoice" ref="invoice_5"/> | ||
1316 | 47 | </data> | 177 | </data> |
1317 | 48 | </openerp> | 178 | </openerp> |
1318 | 49 | 179 | ||
1319 | === modified file 'account/security/ir.model.access.csv' | |||
1320 | --- account/security/ir.model.access.csv 2013-10-27 12:31:04 +0000 | |||
1321 | +++ account/security/ir.model.access.csv 2014-05-30 16:18:57 +0000 | |||
1322 | @@ -1,100 +1,101 @@ | |||
1423 | 1 | id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | 1 | id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
1424 | 2 | access_product_product_account_user,product.product.account.user,product.model_product_product,group_account_user,1,0,0,0 | 2 | access_product_product_account_user,product.product.account.user,product.model_product_product,group_account_user,1,0,0,0 |
1425 | 3 | access_account_payment_term,account.payment.term,model_account_payment_term,account.group_account_user,1,0,0,0 | 3 | access_account_payment_term,account.payment.term,model_account_payment_term,account.group_account_user,1,0,0,0 |
1426 | 4 | access_account_payment_term_line,account.payment.term.line,model_account_payment_term_line,account.group_account_user,1,0,0,0 | 4 | access_account_payment_term_line,account.payment.term.line,model_account_payment_term_line,account.group_account_user,1,0,0,0 |
1427 | 5 | access_account_account_type,account.account.type,model_account_account_type,account.group_account_user,1,0,0,0 | 5 | access_account_account_type,account.account.type,model_account_account_type,account.group_account_user,1,0,0,0 |
1428 | 6 | access_account_tax_internal_user,account.tax internal user,model_account_tax,base.group_user,1,0,0,0 | 6 | access_account_tax_internal_user,account.tax internal user,model_account_tax,base.group_user,1,0,0,0 |
1429 | 7 | access_account_account,account.account,model_account_account,account.group_account_user,1,0,0,0 | 7 | access_account_account,account.account,model_account_account,account.group_account_user,1,0,0,0 |
1430 | 8 | access_account_account_user,account.account user,model_account_account,base.group_user,1,0,0,0 | 8 | access_account_account_user,account.account user,model_account_account,base.group_user,1,0,0,0 |
1431 | 9 | access_account_account_partner_manager,account.account partner manager,model_account_account,base.group_partner_manager,1,0,0,0 | 9 | access_account_account_partner_manager,account.account partner manager,model_account_account,base.group_partner_manager,1,0,0,0 |
1432 | 10 | access_account_journal_period_manager,account.journal.period manager,model_account_journal_period,account.group_account_manager,1,0,0,0 | 10 | access_account_journal_period_manager,account.journal.period manager,model_account_journal_period,account.group_account_manager,1,0,0,0 |
1433 | 11 | access_account_tax_code,account.tax.code,model_account_tax_code,account.group_account_invoice,1,0,0,0 | 11 | access_account_tax_code,account.tax.code,model_account_tax_code,account.group_account_invoice,1,0,0,0 |
1434 | 12 | access_account_tax,account.tax,model_account_tax,account.group_account_invoice,1,0,0,0 | 12 | access_account_tax,account.tax,model_account_tax,account.group_account_invoice,1,0,0,0 |
1435 | 13 | access_account_model,account.model,model_account_model,account.group_account_user,1,1,1,1 | 13 | access_account_model,account.model,model_account_model,account.group_account_user,1,1,1,1 |
1436 | 14 | access_account_model_line,account.model.line,model_account_model_line,account.group_account_user,1,1,1,1 | 14 | access_account_model_line,account.model.line,model_account_model_line,account.group_account_user,1,1,1,1 |
1437 | 15 | access_account_subscription,account.subscription,model_account_subscription,account.group_account_user,1,1,1,1 | 15 | access_account_subscription,account.subscription,model_account_subscription,account.group_account_user,1,1,1,1 |
1438 | 16 | access_account_subscription_line,account.subscription.line,model_account_subscription_line,account.group_account_user,1,1,1,1 | 16 | access_account_subscription_line,account.subscription.line,model_account_subscription_line,account.group_account_user,1,1,1,1 |
1439 | 17 | access_account_subscription_manager,account.subscription manager,model_account_subscription,account.group_account_manager,1,0,0,0 | 17 | access_account_subscription_manager,account.subscription manager,model_account_subscription,account.group_account_manager,1,0,0,0 |
1440 | 18 | access_account_subscription_line_manager,account.subscription.line manager,model_account_subscription_line,account.group_account_manager,1,0,0,0 | 18 | access_account_subscription_line_manager,account.subscription.line manager,model_account_subscription_line,account.group_account_manager,1,0,0,0 |
1441 | 19 | access_account_account_template,account.account.template,model_account_account_template,account.group_account_manager,1,1,1,1 | 19 | access_account_account_template,account.account.template,model_account_account_template,account.group_account_manager,1,1,1,1 |
1442 | 20 | access_account_tax_code_template,account.tax.code.template,model_account_tax_code_template,account.group_account_manager,1,1,1,1 | 20 | access_account_tax_code_template,account.tax.code.template,model_account_tax_code_template,account.group_account_manager,1,1,1,1 |
1443 | 21 | access_account_chart_template,account.chart.template,model_account_chart_template,account.group_account_manager,1,1,1,1 | 21 | access_account_chart_template,account.chart.template,model_account_chart_template,account.group_account_manager,1,1,1,1 |
1444 | 22 | access_account_tax_template,account.tax.template,model_account_tax_template,account.group_account_manager,1,1,1,1 | 22 | access_account_tax_template,account.tax.template,model_account_tax_template,account.group_account_manager,1,1,1,1 |
1445 | 23 | access_account_bank_statement,account.bank.statement,model_account_bank_statement,account.group_account_user,1,1,1,1 | 23 | access_account_bank_statement,account.bank.statement,model_account_bank_statement,account.group_account_user,1,1,1,1 |
1446 | 24 | access_account_bank_statement_line,account.bank.statement.line,model_account_bank_statement_line,account.group_account_user,1,1,1,1 | 24 | access_account_bank_statement_line,account.bank.statement.line,model_account_bank_statement_line,account.group_account_user,1,1,1,1 |
1447 | 25 | access_account_analytic_line_manager,account.analytic.line manager,model_account_analytic_line,account.group_account_manager,1,0,0,0 | 25 | access_account_analytic_line_manager,account.analytic.line manager,model_account_analytic_line,account.group_account_manager,1,0,0,0 |
1448 | 26 | access_account_analytic_account,account.analytic.account,analytic.model_account_analytic_account,base.group_user,1,0,0,0 | 26 | access_account_analytic_account,account.analytic.account,analytic.model_account_analytic_account,base.group_user,1,0,0,0 |
1449 | 27 | access_account_analytic_journal,account.analytic.journal,model_account_analytic_journal,account.group_account_user,1,0,0,0 | 27 | access_account_analytic_journal,account.analytic.journal,model_account_analytic_journal,account.group_account_user,1,0,0,0 |
1450 | 28 | access_account_analytic_journal_user,account.analytic.journal,model_account_analytic_journal,base.group_user,1,1,1,0 | 28 | access_account_analytic_journal_user,account.analytic.journal,model_account_analytic_journal,base.group_user,1,1,1,0 |
1451 | 29 | access_account_invoice_uinvoice,account.invoice,model_account_invoice,account.group_account_invoice,1,1,1,1 | 29 | access_account_invoice_uinvoice,account.invoice,model_account_invoice,account.group_account_invoice,1,1,1,1 |
1452 | 30 | access_account_invoice_line_uinvoice,account.invoice.line,model_account_invoice_line,account.group_account_invoice,1,1,1,1 | 30 | access_account_invoice_line_uinvoice,account.invoice.line,model_account_invoice_line,account.group_account_invoice,1,1,1,1 |
1453 | 31 | access_account_invoice_tax_uinvoice,account.invoice.tax,model_account_invoice_tax,account.group_account_invoice,1,1,1,1 | 31 | access_account_invoice_tax_uinvoice,account.invoice.tax,model_account_invoice_tax,account.group_account_invoice,1,1,1,1 |
1454 | 32 | access_account_move_uinvoice,account.move,model_account_move,account.group_account_invoice,1,1,1,1 | 32 | access_account_move_uinvoice,account.move,model_account_move,account.group_account_invoice,1,1,1,1 |
1455 | 33 | access_account_move_line_uinvoice,account.move.line invoice,model_account_move_line,account.group_account_invoice,1,1,1,1 | 33 | access_account_move_line_uinvoice,account.move.line invoice,model_account_move_line,account.group_account_invoice,1,1,1,1 |
1456 | 34 | access_account_move_reconcile_uinvoice,account.move.reconcile,model_account_move_reconcile,account.group_account_invoice,1,1,1,1 | 34 | access_account_move_reconcile_uinvoice,account.move.reconcile,model_account_move_reconcile,account.group_account_invoice,1,1,1,1 |
1457 | 35 | access_account_journal_period_uinvoice,account.journal.period,model_account_journal_period,account.group_account_invoice,1,1,1,1 | 35 | access_account_journal_period_uinvoice,account.journal.period,model_account_journal_period,account.group_account_invoice,1,1,1,1 |
1458 | 36 | access_account_payment_term_manager,account.payment.term,model_account_payment_term,account.group_account_manager,1,1,1,1 | 36 | access_account_payment_term_manager,account.payment.term,model_account_payment_term,account.group_account_manager,1,1,1,1 |
1459 | 37 | access_account_payment_term_line_manager,account.payment.term.line,model_account_payment_term_line,account.group_account_manager,1,1,1,1 | 37 | access_account_payment_term_line_manager,account.payment.term.line,model_account_payment_term_line,account.group_account_manager,1,1,1,1 |
1460 | 38 | access_account_tax_manager,account.tax,model_account_tax,account.group_account_manager,1,1,1,1 | 38 | access_account_tax_manager,account.tax,model_account_tax,account.group_account_manager,1,1,1,1 |
1461 | 39 | access_account_journal_manager,account.journal,model_account_journal,account.group_account_manager,1,1,1,1 | 39 | access_account_journal_manager,account.journal,model_account_journal,account.group_account_manager,1,1,1,1 |
1462 | 40 | access_account_journal_invoice,account.journal invoice,model_account_journal,account.group_account_invoice,1,0,0,0 | 40 | access_account_journal_invoice,account.journal invoice,model_account_journal,account.group_account_invoice,1,0,0,0 |
1463 | 41 | access_account_period_manager,account.period,model_account_period,account.group_account_manager,1,1,1,1 | 41 | access_account_period_manager,account.period,model_account_period,account.group_account_manager,1,1,1,1 |
1464 | 42 | access_account_period_invoice,account.period invoice,model_account_period,account.group_account_invoice,1,0,0,0 | 42 | access_account_period_invoice,account.period invoice,model_account_period,account.group_account_invoice,1,0,0,0 |
1465 | 43 | access_account_invoice_group_invoice,account.invoice group invoice,model_account_invoice,account.group_account_invoice,1,1,1,1 | 43 | access_account_invoice_group_invoice,account.invoice group invoice,model_account_invoice,account.group_account_invoice,1,1,1,1 |
1466 | 44 | access_account_analytic_journal_manager,account.analytic.journal,model_account_analytic_journal,account.group_account_manager,1,1,1,1 | 44 | access_account_analytic_journal_manager,account.analytic.journal,model_account_analytic_journal,account.group_account_manager,1,1,1,1 |
1467 | 45 | access_account_fiscalyear,account.fiscalyear,model_account_fiscalyear,account.group_account_manager,1,1,1,1 | 45 | access_account_fiscalyear,account.fiscalyear,model_account_fiscalyear,account.group_account_manager,1,1,1,1 |
1468 | 46 | access_account_fiscalyear_invoice,account.fiscalyear.invoice,model_account_fiscalyear,account.group_account_invoice,1,0,0,0 | 46 | access_account_fiscalyear_invoice,account.fiscalyear.invoice,model_account_fiscalyear,account.group_account_invoice,1,0,0,0 |
1469 | 47 | access_account_fiscalyear_partner_manager,account.fiscalyear.partnermanager,model_account_fiscalyear,base.group_partner_manager,1,0,0,0 | 47 | access_account_fiscalyear_partner_manager,account.fiscalyear.partnermanager,model_account_fiscalyear,base.group_partner_manager,1,0,0,0 |
1470 | 48 | access_account_fiscalyear_employee,account.fiscalyear employee,model_account_fiscalyear,base.group_user,1,0,0,0 | 48 | access_account_fiscalyear_employee,account.fiscalyear employee,model_account_fiscalyear,base.group_user,1,0,0,0 |
1471 | 49 | access_res_currency_account_manager,res.currency account manager,base.model_res_currency,group_account_manager,1,1,1,1 | 49 | access_res_currency_account_manager,res.currency account manager,base.model_res_currency,group_account_manager,1,1,1,1 |
1472 | 50 | access_res_currency_rate_account_manager,res.currency.rate account manager,base.model_res_currency_rate,group_account_manager,1,1,1,1 | 50 | access_res_currency_rate_account_manager,res.currency.rate account manager,base.model_res_currency_rate,group_account_manager,1,1,1,1 |
1473 | 51 | access_res_currency_rate_type_account_manager,res.currency.rate.type account manager,base.model_res_currency_rate_type,group_account_manager,1,1,1,1 | 51 | access_res_currency_rate_type_account_manager,res.currency.rate.type account manager,base.model_res_currency_rate_type,group_account_manager,1,1,1,1 |
1474 | 52 | access_account_invoice_user,account.invoice user,model_account_invoice,base.group_user,1,0,0,0 | 52 | access_account_invoice_user,account.invoice user,model_account_invoice,base.group_user,1,0,0,0 |
1475 | 53 | access_account_invoice_user,account.invoice.line user,model_account_invoice_line,base.group_user,1,0,0,0 | 53 | access_account_invoice_user,account.invoice.line user,model_account_invoice_line,base.group_user,1,0,0,0 |
1476 | 54 | access_account_payment_term_partner_manager,account.payment.term partner manager,model_account_payment_term,base.group_user,1,0,0,0 | 54 | access_account_payment_term_partner_manager,account.payment.term partner manager,model_account_payment_term,base.group_user,1,0,0,0 |
1477 | 55 | access_account_payment_term_line_partner_manager,account.payment.term.line partner manager,model_account_payment_term_line,base.group_user,1,0,0,0 | 55 | access_account_payment_term_line_partner_manager,account.payment.term.line partner manager,model_account_payment_term_line,base.group_user,1,0,0,0 |
1478 | 56 | access_account_account_sale_manager,account.account sale manager,model_account_account,base.group_sale_manager,1,0,0,0 | 56 | access_account_account_sale_manager,account.account sale manager,model_account_account,base.group_sale_manager,1,0,0,0 |
1479 | 57 | access_account_fiscal_position_product_manager,account.fiscal.position account.manager,model_account_fiscal_position,account.group_account_manager,1,1,1,1 | 57 | access_account_fiscal_position_product_manager,account.fiscal.position account.manager,model_account_fiscal_position,account.group_account_manager,1,1,1,1 |
1480 | 58 | access_account_fiscal_position_tax_product_manager,account.fiscal.position.tax account.manager,model_account_fiscal_position_tax,account.group_account_manager,1,1,1,1 | 58 | access_account_fiscal_position_tax_product_manager,account.fiscal.position.tax account.manager,model_account_fiscal_position_tax,account.group_account_manager,1,1,1,1 |
1481 | 59 | access_account_fiscal_position_account_product_manager,account.fiscal.position account.manager,model_account_fiscal_position_account,account.group_account_manager,1,1,1,1 | 59 | access_account_fiscal_position_account_product_manager,account.fiscal.position account.manager,model_account_fiscal_position_account,account.group_account_manager,1,1,1,1 |
1482 | 60 | access_account_fiscal_position,account.fiscal.position all,model_account_fiscal_position,base.group_user,1,0,0,0 | 60 | access_account_fiscal_position,account.fiscal.position all,model_account_fiscal_position,base.group_user,1,0,0,0 |
1483 | 61 | access_account_fiscal_position_tax,account.fiscal.position.tax all,model_account_fiscal_position_tax,base.group_user,1,0,0,0 | 61 | access_account_fiscal_position_tax,account.fiscal.position.tax all,model_account_fiscal_position_tax,base.group_user,1,0,0,0 |
1484 | 62 | access_account_fiscal_position_account,account.fiscal.position all,model_account_fiscal_position_account,base.group_user,1,0,0,0 | 62 | access_account_fiscal_position_account,account.fiscal.position all,model_account_fiscal_position_account,base.group_user,1,0,0,0 |
1485 | 63 | access_account_fiscal_position_template,account.fiscal.position.template,model_account_fiscal_position_template,account.group_account_manager,1,1,1,1 | 63 | access_account_fiscal_position_template,account.fiscal.position.template,model_account_fiscal_position_template,account.group_account_manager,1,1,1,1 |
1486 | 64 | access_account_fiscal_position_tax_template,account.fiscal.position.tax.template,model_account_fiscal_position_tax_template,account.group_account_manager,1,1,1,1 | 64 | access_account_fiscal_position_tax_template,account.fiscal.position.tax.template,model_account_fiscal_position_tax_template,account.group_account_manager,1,1,1,1 |
1487 | 65 | access_account_fiscal_position_account_template,account.fiscal.position.account.template,model_account_fiscal_position_account_template,account.group_account_manager,1,1,1,1 | 65 | access_account_fiscal_position_account_template,account.fiscal.position.account.template,model_account_fiscal_position_account_template,account.group_account_manager,1,1,1,1 |
1488 | 66 | access_account_sequence_fiscal_year_user,account.sequence.fiscalyear user,model_account_sequence_fiscalyear,base.group_user,1,0,0,0 | 66 | access_account_sequence_fiscal_year_user,account.sequence.fiscalyear user,model_account_sequence_fiscalyear,base.group_user,1,0,0,0 |
1489 | 67 | access_temp_range,temp.range,model_temp_range,account.group_account_manager,1,0,0,0 | 67 | access_temp_range,temp.range,model_temp_range,account.group_account_manager,1,0,0,0 |
1490 | 68 | access_report_aged_receivable,report.aged.receivable,model_report_aged_receivable,account.group_account_manager,1,1,1,1 | 68 | access_report_aged_receivable,report.aged.receivable,model_report_aged_receivable,account.group_account_manager,1,1,1,1 |
1491 | 69 | access_report_invoice_created,report.invoice.created,model_report_invoice_created,account.group_account_manager,1,1,1,1 | 69 | access_report_invoice_created,report.invoice.created,model_report_invoice_created,account.group_account_manager,1,1,1,1 |
1492 | 70 | access_report_account_type_sales,report.account_type.sales,model_report_account_type_sales,account.group_account_manager,1,1,1,1 | 70 | access_report_account_type_sales,report.account_type.sales,model_report_account_type_sales,account.group_account_manager,1,1,1,1 |
1493 | 71 | access_report_account_sales,report.account.sales,model_report_account_sales,account.group_account_manager,1,1,1,1 | 71 | access_report_account_sales,report.account.sales,model_report_account_sales,account.group_account_manager,1,1,1,1 |
1494 | 72 | access_account_invoice_report,account.invoice.report,model_account_invoice_report,account.group_account_manager,1,1,1,1 | 72 | access_account_invoice_report,account.invoice.report,model_account_invoice_report,account.group_account_manager,1,1,1,1 |
1495 | 73 | access_res_partner_group_account_manager,res_partner group_account_manager,model_res_partner,account.group_account_manager,1,0,0,0 | 73 | access_res_partner_group_account_manager,res_partner group_account_manager,model_res_partner,account.group_account_manager,1,0,0,0 |
1496 | 74 | access_account_invoice_accountant,account.invoice accountant,model_account_invoice,account.group_account_user,1,0,0,0 | 74 | access_account_invoice_accountant,account.invoice accountant,model_account_invoice,account.group_account_user,1,0,0,0 |
1497 | 75 | access_account_tax_code_accountant,account.tax.code accountant,model_account_tax_code,account.group_account_user,1,1,1,1 | 75 | access_account_tax_code_accountant,account.tax.code accountant,model_account_tax_code,account.group_account_user,1,1,1,1 |
1498 | 76 | access_account_move_line_manager,account.move.line manager,model_account_move_line,account.group_account_manager,1,0,0,0 | 76 | access_account_move_line_manager,account.move.line manager,model_account_move_line,account.group_account_manager,1,0,0,0 |
1499 | 77 | access_account_move_manager,account.move manager,model_account_move,account.group_account_manager,1,0,0,0 | 77 | access_account_move_manager,account.move manager,model_account_move,account.group_account_manager,1,0,0,0 |
1500 | 78 | access_account_entries_report_manager,account.entries.report,model_account_entries_report,account.group_account_manager,1,1,1,1 | 78 | access_account_entries_report_manager,account.entries.report,model_account_entries_report,account.group_account_manager,1,1,1,1 |
1501 | 79 | access_account_entries_report_invoice,account.entries.report,model_account_entries_report,account.group_account_invoice,1,0,0,0 | 79 | access_account_entries_report_invoice,account.entries.report,model_account_entries_report,account.group_account_invoice,1,0,0,0 |
1502 | 80 | access_account_entries_report_employee,account.entries.report employee,model_account_entries_report,base.group_user,1,0,0,0 | 80 | access_account_entries_report_employee,account.entries.report employee,model_account_entries_report,base.group_user,1,0,0,0 |
1503 | 81 | access_analytic_entries_report_manager,analytic.entries.report,model_analytic_entries_report,account.group_account_manager,1,0,0,0 | 81 | access_analytic_entries_report_manager,analytic.entries.report,model_analytic_entries_report,account.group_account_manager,1,0,0,0 |
1504 | 82 | access_account_cashbox_line,account.cashbox.line,model_account_cashbox_line,account.group_account_user,1,1,1,1 | 82 | access_account_cashbox_line,account.cashbox.line,model_account_cashbox_line,account.group_account_user,1,1,1,1 |
1505 | 83 | access_account_journal_cashbox_line,account.journal.cashbox.line,model_account_journal_cashbox_line,account.group_account_user,1,1,1,0 | 83 | access_account_journal_cashbox_line,account.journal.cashbox.line,model_account_journal_cashbox_line,account.group_account_user,1,1,1,0 |
1506 | 84 | access_account_invoice_tax_accountant,account.invoice.tax accountant,model_account_invoice_tax,account.group_account_user,1,0,0,0 | 84 | access_account_invoice_tax_accountant,account.invoice.tax accountant,model_account_invoice_tax,account.group_account_user,1,0,0,0 |
1507 | 85 | access_account_move_reconcile_manager,account.move.reconcile manager,model_account_move_reconcile,account.group_account_manager,1,0,0,0 | 85 | access_account_move_reconcile_manager,account.move.reconcile manager,model_account_move_reconcile,account.group_account_manager,1,0,0,0 |
1508 | 86 | access_account_analytic_line_invoice,account.analytic.line invoice,model_account_analytic_line,account.group_account_invoice,1,1,1,1 | 86 | access_account_analytic_line_invoice,account.analytic.line invoice,model_account_analytic_line,account.group_account_invoice,1,1,1,1 |
1509 | 87 | access_account_invoice_line_accountant,account.invoice.line accountant,model_account_invoice_line,account.group_account_user,1,0,0,0 | 87 | access_account_invoice_line_accountant,account.invoice.line accountant,model_account_invoice_line,account.group_account_user,1,0,0,0 |
1510 | 88 | access_account_account_invoice,account.account invoice,model_account_account,account.group_account_invoice,1,1,1,1 | 88 | access_account_account_invoice,account.account invoice,model_account_account,account.group_account_invoice,1,1,1,1 |
1511 | 89 | access_account_analytic_accountant,account.analytic.account accountant,analytic.model_account_analytic_account,account.group_account_user,1,1,1,1 | 89 | access_account_analytic_accountant,account.analytic.account accountant,analytic.model_account_analytic_account,account.group_account_user,1,1,1,1 |
1512 | 90 | access_account_account_type_invoice,account.account.type invoice,model_account_account_type,account.group_account_invoice,1,1,1,1 | 90 | access_account_account_type_invoice,account.account.type invoice,model_account_account_type,account.group_account_invoice,1,1,1,1 |
1513 | 91 | access_report_account_receivable_invoice,report.account.receivable.invoice,model_report_account_receivable,account.group_account_invoice,1,1,1,1 | 91 | access_report_account_receivable_invoice,report.account.receivable.invoice,model_report_account_receivable,account.group_account_invoice,1,1,1,1 |
1514 | 92 | access_account_sequence_fiscal_year_invoice,account.sequence.fiscalyear invoice,model_account_sequence_fiscalyear,account.group_account_invoice,1,1,1,1 | 92 | access_account_sequence_fiscal_year_invoice,account.sequence.fiscalyear invoice,model_account_sequence_fiscalyear,account.group_account_invoice,1,1,1,1 |
1515 | 93 | access_account_tax_sale_manager,account.tax sale manager,model_account_tax,base.group_sale_salesman,1,0,0,0 | 93 | access_account_tax_sale_manager,account.tax sale manager,model_account_tax,base.group_sale_salesman,1,0,0,0 |
1516 | 94 | access_account_journal_sale_manager,account.journal sale manager,model_account_journal,base.group_sale_salesman,1,0,0,0 | 94 | access_account_journal_sale_manager,account.journal sale manager,model_account_journal,base.group_sale_salesman,1,0,0,0 |
1517 | 95 | access_account_invoice_tax_sale_manager,account.invoice.tax sale manager,model_account_invoice_tax,base.group_sale_salesman,1,0,0,0 | 95 | access_account_invoice_tax_sale_manager,account.invoice.tax sale manager,model_account_invoice_tax,base.group_sale_salesman,1,0,0,0 |
1518 | 96 | access_account_sequence_fiscal_year_sale_user,account.sequence.fiscalyear.sale.user,model_account_sequence_fiscalyear,base.group_sale_salesman,1,1,1,0 | 96 | access_account_sequence_fiscal_year_sale_user,account.sequence.fiscalyear.sale.user,model_account_sequence_fiscalyear,base.group_sale_salesman,1,1,1,0 |
1519 | 97 | access_account_sequence_fiscal_year_sale_manager,account.sequence.fiscalyear.sale.manager,model_account_sequence_fiscalyear,base.group_sale_manager,1,1,1,1 | 97 | access_account_sequence_fiscal_year_sale_manager,account.sequence.fiscalyear.sale.manager,model_account_sequence_fiscalyear,base.group_sale_manager,1,1,1,1 |
1520 | 98 | access_account_treasury_report_manager,account.treasury.report.manager,model_account_treasury_report,account.group_account_manager,1,0,0,0 | 98 | access_account_treasury_report_manager,account.treasury.report.manager,model_account_treasury_report,account.group_account_manager,1,0,0,0 |
1521 | 99 | access_account_financial_report,account.financial.report,model_account_financial_report,account.group_account_user,1,1,1,1 | 99 | access_account_financial_report,account.financial.report,model_account_financial_report,account.group_account_user,1,1,1,1 |
1522 | 100 | access_account_financial_report_invoice,account.financial.report invoice,model_account_financial_report,account.group_account_invoice,1,0,0,0 | 100 | access_account_financial_report_invoice,account.financial.report invoice,model_account_financial_report,account.group_account_invoice,1,0,0,0 |
1523 | 101 | access_account_statement_operation_template,account.statement.operation.template,model_account_statement_operation_template,account.group_account_user,1,1,1,1 | ||
1524 | 101 | 102 | ||
1525 | === added file 'account/static/src/css/account_bank_statement_reconciliation.css' | |||
1526 | --- account/static/src/css/account_bank_statement_reconciliation.css 1970-01-01 00:00:00 +0000 | |||
1527 | +++ account/static/src/css/account_bank_statement_reconciliation.css 2014-05-30 16:18:57 +0000 | |||
1528 | @@ -0,0 +1,264 @@ | |||
1529 | 1 | .openerp .oe_bank_statement_reconciliation { | ||
1530 | 2 | font-size: 12px; | ||
1531 | 3 | -webkit-user-select: none; | ||
1532 | 4 | -moz-user-select: none; | ||
1533 | 5 | -ms-user-select: none; | ||
1534 | 6 | -o-user-select: none; | ||
1535 | 7 | user-select: none; | ||
1536 | 8 | cursor: default; | ||
1537 | 9 | /* icons */ } | ||
1538 | 10 | .openerp .oe_bank_statement_reconciliation h1 { | ||
1539 | 11 | width: 48%; | ||
1540 | 12 | padding: 0 0 0 15px; | ||
1541 | 13 | margin: 0 0 35px 0; | ||
1542 | 14 | float: left; | ||
1543 | 15 | font-size: 2.3em; } | ||
1544 | 16 | .openerp .oe_bank_statement_reconciliation h2 { | ||
1545 | 17 | font-size: 1.8em; } | ||
1546 | 18 | .openerp .oe_bank_statement_reconciliation .progress { | ||
1547 | 19 | width: 49%; | ||
1548 | 20 | margin: 6px 15px 0 0; | ||
1549 | 21 | float: right; | ||
1550 | 22 | position: relative; | ||
1551 | 23 | display: inline-block; } | ||
1552 | 24 | .openerp .oe_bank_statement_reconciliation .progress .progress-text { | ||
1553 | 25 | text-align: center; | ||
1554 | 26 | position: absolute; | ||
1555 | 27 | width: 100%; | ||
1556 | 28 | left: 0; | ||
1557 | 29 | top: 2px; | ||
1558 | 30 | z-index: 10; | ||
1559 | 31 | text-shadow: -1px -1px 0 #f5f5f5, 1px -1px 0 #f5f5f5, -1px 1px 0 #f5f5f5, 1px 1px 0 #f5f5f5; } | ||
1560 | 32 | .openerp .oe_bank_statement_reconciliation .oe_form_sheet { | ||
1561 | 33 | position: relative; | ||
1562 | 34 | padding-bottom: 30px; } | ||
1563 | 35 | .openerp .oe_bank_statement_reconciliation .protip { | ||
1564 | 36 | margin: 0; | ||
1565 | 37 | position: absolute; | ||
1566 | 38 | bottom: 7px; | ||
1567 | 39 | right: 15px; | ||
1568 | 40 | text-align: right; | ||
1569 | 41 | color: #bbb; } | ||
1570 | 42 | .openerp .oe_bank_statement_reconciliation .done_message { | ||
1571 | 43 | width: 100%; | ||
1572 | 44 | padding: 0 20%; | ||
1573 | 45 | margin-top: 50px; | ||
1574 | 46 | margin-bottom: 50px; } | ||
1575 | 47 | .openerp .oe_bank_statement_reconciliation .done_message h2 { | ||
1576 | 48 | margin-bottom: 30px; } | ||
1577 | 49 | .openerp .oe_bank_statement_reconciliation .done_message h2 .congrats_icon { | ||
1578 | 50 | float: right; | ||
1579 | 51 | font-size: 2em; | ||
1580 | 52 | position: relative; | ||
1581 | 53 | top: -0.25em; } | ||
1582 | 54 | .openerp .oe_bank_statement_reconciliation .done_message .achievements { | ||
1583 | 55 | margin-top: 30px; | ||
1584 | 56 | text-align: center; | ||
1585 | 57 | position: relative; } | ||
1586 | 58 | .openerp .oe_bank_statement_reconciliation .done_message .achievements .achievement { | ||
1587 | 59 | font-size: 4em; | ||
1588 | 60 | margin: 0 0.3em; | ||
1589 | 61 | position: relative; | ||
1590 | 62 | vertical-align: middle; | ||
1591 | 63 | text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2); } | ||
1592 | 64 | .openerp .oe_bank_statement_reconciliation .done_message .achievements .achievement i { | ||
1593 | 65 | font-size: 0.5em; | ||
1594 | 66 | color: white; | ||
1595 | 67 | position: absolute; | ||
1596 | 68 | top: 50%; | ||
1597 | 69 | margin-top: -0.55em; | ||
1598 | 70 | left: 0; | ||
1599 | 71 | width: 100%; | ||
1600 | 72 | text-align: center; } | ||
1601 | 73 | .openerp .oe_bank_statement_reconciliation .done_message .action_buttons { | ||
1602 | 74 | text-align: center; } | ||
1603 | 75 | .openerp .oe_bank_statement_reconciliation .glyphicon { | ||
1604 | 76 | font-size: 12px !important; } | ||
1605 | 77 | .openerp .oe_bank_statement_reconciliation .glyphicon.line_info_button { | ||
1606 | 78 | color: #ccc !important; } | ||
1607 | 79 | .openerp .oe_bank_statement_reconciliation .accounting_view .glyphicon-add-remove:before { | ||
1608 | 80 | content: "\2212"; } | ||
1609 | 81 | .openerp .oe_bank_statement_reconciliation .match .glyphicon-add-remove:before { | ||
1610 | 82 | content: "\2b"; } | ||
1611 | 83 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line { | ||
1612 | 84 | margin-bottom: 30px; | ||
1613 | 85 | /* gap between accounting_view and action view */ | ||
1614 | 86 | /* popover */ | ||
1615 | 87 | /* arrays of move lines */ | ||
1616 | 88 | /* Partie infos */ | ||
1617 | 89 | /* Match view */ | ||
1618 | 90 | /* Action create */ } | ||
1619 | 91 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line table { | ||
1620 | 92 | width: 100%; } | ||
1621 | 93 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .toggle_match, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .toggle_create { | ||
1622 | 94 | -webkit-transition-property: -webkit-transform; | ||
1623 | 95 | -moz-transition-property: -moz-transform; | ||
1624 | 96 | -ms-transition-property: -ms-transform; | ||
1625 | 97 | -o-transition-property: -o-transform; | ||
1626 | 98 | transition-property: transform; | ||
1627 | 99 | -webkit-transform: rotate(0deg); | ||
1628 | 100 | -moz-transform: rotate(0deg); | ||
1629 | 101 | -ms-transform: rotate(0deg); | ||
1630 | 102 | -o-transform: rotate(0deg); | ||
1631 | 103 | transform: rotate(0deg); } | ||
1632 | 104 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .visible_toggle, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line[data-mode="match"] .toggle_match, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line[data-mode="create"] .toggle_create { | ||
1633 | 105 | visibility: visible !important; | ||
1634 | 106 | -webkit-transform: rotate(90deg); | ||
1635 | 107 | -moz-transform: rotate(90deg); | ||
1636 | 108 | -ms-transform: rotate(90deg); | ||
1637 | 109 | -o-transform: rotate(90deg); | ||
1638 | 110 | transform: rotate(90deg); } | ||
1639 | 111 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .change_partner_container { | ||
1640 | 112 | width: 200px; | ||
1641 | 113 | display: none; | ||
1642 | 114 | position: relative !important; } | ||
1643 | 115 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line[data-mode="inactive"] .initial_line > td { | ||
1644 | 116 | background-color: #f8f8f8 !important; } | ||
1645 | 117 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_match:not(.no_partner) .initial_line { | ||
1646 | 118 | cursor: default !important; } | ||
1647 | 119 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_match:not(.no_partner) .initial_line .line_info_button { | ||
1648 | 120 | cursor: pointer; } | ||
1649 | 121 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_match:not(.no_partner) .toggle_match { | ||
1650 | 122 | visibility: hidden !important; } | ||
1651 | 123 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_partner .partner_name, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_partner .line_open_balance { | ||
1652 | 124 | display: none !important; } | ||
1653 | 125 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line > table > tbody > tr:nth-child(1) > td table { | ||
1654 | 126 | margin-bottom: 10px; } | ||
1655 | 127 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line table.details td:first-child { | ||
1656 | 128 | padding-right: 10px; | ||
1657 | 129 | font-weight: bold; } | ||
1658 | 130 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table { | ||
1659 | 131 | width: 100%; } | ||
1660 | 132 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table tr { | ||
1661 | 133 | cursor: pointer; } | ||
1662 | 134 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.created_line, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table tr.created_line { | ||
1663 | 135 | cursor: default !important; } | ||
1664 | 136 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.created_line .line_remove_button, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table tr.created_line .line_remove_button { | ||
1665 | 137 | cursor: pointer; } | ||
1666 | 138 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table td { | ||
1667 | 139 | padding: 1px 8px; | ||
1668 | 140 | vertical-align: middle; } | ||
1669 | 141 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(1), .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(7), .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table td:nth-child(1), .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table td:nth-child(7) { | ||
1670 | 142 | width: 15px; | ||
1671 | 143 | padding: 0; } | ||
1672 | 144 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(1), .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table td:nth-child(1) { | ||
1673 | 145 | text-align: left; } | ||
1674 | 146 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(2), .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table td:nth-child(2) { | ||
1675 | 147 | width: 80px; | ||
1676 | 148 | padding-left: 3px; } | ||
1677 | 149 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(3), .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table td:nth-child(3) { | ||
1678 | 150 | width: 100px; } | ||
1679 | 151 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(5), .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table td:nth-child(5) { | ||
1680 | 152 | text-align: right; | ||
1681 | 153 | width: 15%; } | ||
1682 | 154 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(6), .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table td:nth-child(6) { | ||
1683 | 155 | width: 15%; | ||
1684 | 156 | text-align: right; | ||
1685 | 157 | padding-right: 3px; } | ||
1686 | 158 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(7), .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table td:nth-child(7) { | ||
1687 | 159 | text-align: right; } | ||
1688 | 160 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.line_open_balance, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table tr.line_open_balance { | ||
1689 | 161 | color: #bbb; } | ||
1690 | 162 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr .glyphicon:not(.line_info_button), .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table tr .glyphicon:not(.line_info_button) { | ||
1691 | 163 | visibility: hidden; | ||
1692 | 164 | color: #555; } | ||
1693 | 165 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr:hover .glyphicon, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.active .glyphicon, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table tr:hover .glyphicon, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table tr.active .glyphicon { | ||
1694 | 166 | visibility: visible; } | ||
1695 | 167 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr .do_partial_reconcile_button, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table tr .do_partial_reconcile_button { | ||
1696 | 168 | color: #f0ad4e; | ||
1697 | 169 | padding-right: 5px; } | ||
1698 | 170 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr .undo_partial_reconcile_button, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match table tr .undo_partial_reconcile_button { | ||
1699 | 171 | color: #555; | ||
1700 | 172 | padding-right: 5px; } | ||
1701 | 173 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view .initial_line > td { | ||
1702 | 174 | border-top: 1px solid #bbbbbb; | ||
1703 | 175 | padding-top: 4px; | ||
1704 | 176 | padding-bottom: 5px; | ||
1705 | 177 | background-color: #f0f0f0; | ||
1706 | 178 | -webkit-transition-property: background-color; | ||
1707 | 179 | -moz-transition-property: background-color; | ||
1708 | 180 | -ms-transition-property: background-color; | ||
1709 | 181 | transition-property: background-color; } | ||
1710 | 182 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view .initial_line > td:nth-child(1), .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view .initial_line > td:nth-child(7) { | ||
1711 | 183 | border-top: none; | ||
1712 | 184 | background: white !important; | ||
1713 | 185 | padding-top: 6px; | ||
1714 | 186 | padding-bottom: 3px; } | ||
1715 | 187 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view caption { | ||
1716 | 188 | text-align: left; | ||
1717 | 189 | font-size: 1.1em; | ||
1718 | 190 | font-weight: bold; | ||
1719 | 191 | height: 26px; | ||
1720 | 192 | margin: 0 15px 4px 15px; } | ||
1721 | 193 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view caption .button_ok { | ||
1722 | 194 | float: right; } | ||
1723 | 195 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view caption .button_ok:disabled { | ||
1724 | 196 | opacity: 0.5; } | ||
1725 | 197 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view caption > span, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view caption > input { | ||
1726 | 198 | position: relative; | ||
1727 | 199 | top: 7px; | ||
1728 | 200 | /* meh */ | ||
1729 | 201 | font-weight: bold; | ||
1730 | 202 | cursor: pointer; } | ||
1731 | 203 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(6) { | ||
1732 | 204 | border-left: 1px solid black; } | ||
1733 | 205 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.initial_line > td:nth-child(5) { | ||
1734 | 206 | border-top: 1px solid black; } | ||
1735 | 207 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.initial_line > td:nth-child(6) { | ||
1736 | 208 | border-top: 1px solid black; } | ||
1737 | 209 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls { | ||
1738 | 210 | padding: 0 0 5px 18px; } | ||
1739 | 211 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls .filter { | ||
1740 | 212 | width: 240px; } | ||
1741 | 213 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls .pager_control_left, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls .pager_control_right { | ||
1742 | 214 | display: inline-block; | ||
1743 | 215 | cursor: pointer; } | ||
1744 | 216 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls .pager_control_left { | ||
1745 | 217 | margin-right: 10px; } | ||
1746 | 218 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls .pager_control_left.disabled, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls .pager_control_right.disabled { | ||
1747 | 219 | color: #ddd; | ||
1748 | 220 | cursor: default; } | ||
1749 | 221 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .show_more { | ||
1750 | 222 | display: inline-block; | ||
1751 | 223 | margin-left: 18px; | ||
1752 | 224 | margin-top: 5px; } | ||
1753 | 225 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create { | ||
1754 | 226 | margin: 0 15px; | ||
1755 | 227 | border: 1px solid #d5d5d5; | ||
1756 | 228 | border-radius: 5px; | ||
1757 | 229 | padding: 10px; } | ||
1758 | 230 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .quick_add { | ||
1759 | 231 | margin-bottom: 10px; | ||
1760 | 232 | clear: both; } | ||
1761 | 233 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .quick_add:empty { | ||
1762 | 234 | display: none; } | ||
1763 | 235 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .quick_add:empty { | ||
1764 | 236 | display: none; } | ||
1765 | 237 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .oe_form > table { | ||
1766 | 238 | width: 49%; | ||
1767 | 239 | height: 26px; } | ||
1768 | 240 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .oe_form > table:nth-child(2n+1) { | ||
1769 | 241 | float: left; } | ||
1770 | 242 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .oe_form > table:nth-child(2n) { | ||
1771 | 243 | float: right; } | ||
1772 | 244 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .oe_form > table th { | ||
1773 | 245 | font-weight: bold; | ||
1774 | 246 | line-height: 26px; | ||
1775 | 247 | padding-right: 8px; | ||
1776 | 248 | min-width: 100px; | ||
1777 | 249 | border-right: 1px solid #ddd; | ||
1778 | 250 | white-space: nowrap; | ||
1779 | 251 | width: 1%; } | ||
1780 | 252 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .oe_form > table td { | ||
1781 | 253 | width: 99%; | ||
1782 | 254 | padding-left: 8px; } | ||
1783 | 255 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .oe_form > table input, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .oe_form > table select { | ||
1784 | 256 | width: 100%; } | ||
1785 | 257 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .oe_form > table.add_line_container:nth-child(2n+1) { | ||
1786 | 258 | width: 98%; | ||
1787 | 259 | float: none; | ||
1788 | 260 | margin: auto; } | ||
1789 | 261 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .oe_form > table.add_line_container td { | ||
1790 | 262 | text-align: center; } | ||
1791 | 263 | .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .create .oe_form > table.add_line_container .add_line { | ||
1792 | 264 | line-height: 26px; } | ||
1793 | 0 | 265 | ||
1794 | === added file 'account/static/src/css/account_bank_statement_reconciliation.scss' | |||
1795 | --- account/static/src/css/account_bank_statement_reconciliation.scss 1970-01-01 00:00:00 +0000 | |||
1796 | +++ account/static/src/css/account_bank_statement_reconciliation.scss 2014-05-30 16:18:57 +0000 | |||
1797 | @@ -0,0 +1,447 @@ | |||
1798 | 1 | $actionColWidth: 15px; | ||
1799 | 2 | $mainTableBordersPadding: 3px; | ||
1800 | 3 | $lightBorder: 1px solid #bbb; | ||
1801 | 4 | $accountingBorder: 1px solid #000; | ||
1802 | 5 | $initialLineBackground: #f0f0f0; | ||
1803 | 6 | |||
1804 | 7 | |||
1805 | 8 | .openerp .oe_bank_statement_reconciliation { | ||
1806 | 9 | font-size: 12px; | ||
1807 | 10 | -webkit-user-select: none; | ||
1808 | 11 | -moz-user-select: none; | ||
1809 | 12 | -ms-user-select: none; | ||
1810 | 13 | -o-user-select: none; | ||
1811 | 14 | user-select: none; | ||
1812 | 15 | cursor: default; | ||
1813 | 16 | |||
1814 | 17 | h1 { | ||
1815 | 18 | width: 48%; | ||
1816 | 19 | padding: 0 0 0 $actionColWidth; | ||
1817 | 20 | margin: 0 0 35px 0; | ||
1818 | 21 | float: left; | ||
1819 | 22 | font-size: 2.3em; | ||
1820 | 23 | } | ||
1821 | 24 | |||
1822 | 25 | h2 { | ||
1823 | 26 | font-size: 1.8em; | ||
1824 | 27 | } | ||
1825 | 28 | |||
1826 | 29 | .progress { | ||
1827 | 30 | width: 49%; | ||
1828 | 31 | margin: 6px $actionColWidth 0 0; | ||
1829 | 32 | float: right; | ||
1830 | 33 | position: relative; | ||
1831 | 34 | display: inline-block; | ||
1832 | 35 | |||
1833 | 36 | .progress-text { | ||
1834 | 37 | text-align: center; | ||
1835 | 38 | position: absolute; | ||
1836 | 39 | width: 100%; | ||
1837 | 40 | left: 0; | ||
1838 | 41 | top: 2px; | ||
1839 | 42 | z-index: 10; | ||
1840 | 43 | text-shadow: | ||
1841 | 44 | -1px -1px 0 #f5f5f5, | ||
1842 | 45 | 1px -1px 0 #f5f5f5, | ||
1843 | 46 | -1px 1px 0 #f5f5f5, | ||
1844 | 47 | 1px 1px 0 #f5f5f5; | ||
1845 | 48 | } | ||
1846 | 49 | } | ||
1847 | 50 | |||
1848 | 51 | .oe_form_sheet { | ||
1849 | 52 | position: relative; | ||
1850 | 53 | padding-bottom: 30px; | ||
1851 | 54 | } | ||
1852 | 55 | |||
1853 | 56 | .protip { | ||
1854 | 57 | margin: 0; | ||
1855 | 58 | position: absolute; | ||
1856 | 59 | bottom: 7px; | ||
1857 | 60 | right: 15px; | ||
1858 | 61 | text-align: right; | ||
1859 | 62 | color: #bbb; | ||
1860 | 63 | } | ||
1861 | 64 | |||
1862 | 65 | .done_message { | ||
1863 | 66 | width: 100%; | ||
1864 | 67 | padding: 0 20%; | ||
1865 | 68 | margin-top: 50px; | ||
1866 | 69 | margin-bottom: 50px; | ||
1867 | 70 | |||
1868 | 71 | h2 { | ||
1869 | 72 | margin-bottom: 30px; | ||
1870 | 73 | |||
1871 | 74 | .congrats_icon { | ||
1872 | 75 | float: right; | ||
1873 | 76 | font-size: 2em; | ||
1874 | 77 | position: relative; | ||
1875 | 78 | top: -0.25em; | ||
1876 | 79 | } | ||
1877 | 80 | } | ||
1878 | 81 | |||
1879 | 82 | .achievements { | ||
1880 | 83 | margin-top: 30px; | ||
1881 | 84 | text-align: center; | ||
1882 | 85 | position: relative; | ||
1883 | 86 | |||
1884 | 87 | .achievement { | ||
1885 | 88 | font-size: 4em; | ||
1886 | 89 | margin: 0 0.3em; | ||
1887 | 90 | position: relative; | ||
1888 | 91 | vertical-align: middle; | ||
1889 | 92 | text-shadow: 2px 2px 0px rgba(0,0,0,0.2); | ||
1890 | 93 | |||
1891 | 94 | i { | ||
1892 | 95 | font-size: 0.5em; | ||
1893 | 96 | color: white; | ||
1894 | 97 | position: absolute; | ||
1895 | 98 | top: 50%; | ||
1896 | 99 | margin-top: -0.55em; | ||
1897 | 100 | left: 0; | ||
1898 | 101 | width: 100%; | ||
1899 | 102 | text-align: center; | ||
1900 | 103 | //text-shadow: 1px 1px 0 black; | ||
1901 | 104 | } | ||
1902 | 105 | } | ||
1903 | 106 | } | ||
1904 | 107 | |||
1905 | 108 | .action_buttons { | ||
1906 | 109 | text-align: center; | ||
1907 | 110 | } | ||
1908 | 111 | } | ||
1909 | 112 | |||
1910 | 113 | /* icons */ | ||
1911 | 114 | .glyphicon { | ||
1912 | 115 | font-size: 12px !important; | ||
1913 | 116 | |||
1914 | 117 | &.line_info_button { | ||
1915 | 118 | color: #ccc !important; | ||
1916 | 119 | } | ||
1917 | 120 | } | ||
1918 | 121 | .accounting_view .glyphicon-add-remove:before { | ||
1919 | 122 | content: "\2212"; | ||
1920 | 123 | } | ||
1921 | 124 | .match .glyphicon-add-remove:before { | ||
1922 | 125 | content: "\2b"; | ||
1923 | 126 | } | ||
1924 | 127 | |||
1925 | 128 | // bankStatementReconciliationLine widget | ||
1926 | 129 | .oe_bank_statement_reconciliation_line { | ||
1927 | 130 | margin-bottom: 30px; | ||
1928 | 131 | |||
1929 | 132 | table { | ||
1930 | 133 | width: 100%; | ||
1931 | 134 | } | ||
1932 | 135 | |||
1933 | 136 | // modes : default | ||
1934 | 137 | .toggle_match, .toggle_create { | ||
1935 | 138 | -webkit-transition-property: -webkit-transform; | ||
1936 | 139 | -moz-transition-property: -moz-transform; | ||
1937 | 140 | -ms-transition-property: -ms-transform; | ||
1938 | 141 | -o-transition-property: -o-transform; | ||
1939 | 142 | transition-property: transform; | ||
1940 | 143 | -webkit-transform: rotate(0deg); | ||
1941 | 144 | -moz-transform: rotate(0deg); | ||
1942 | 145 | -ms-transform: rotate(0deg); | ||
1943 | 146 | -o-transform: rotate(0deg); | ||
1944 | 147 | transform: rotate(0deg); | ||
1945 | 148 | } | ||
1946 | 149 | |||
1947 | 150 | .visible_toggle { | ||
1948 | 151 | visibility: visible !important; | ||
1949 | 152 | -webkit-transform: rotate(90deg); | ||
1950 | 153 | -moz-transform: rotate(90deg); | ||
1951 | 154 | -ms-transform: rotate(90deg); | ||
1952 | 155 | -o-transform: rotate(90deg); | ||
1953 | 156 | transform: rotate(90deg); | ||
1954 | 157 | } | ||
1955 | 158 | |||
1956 | 159 | .change_partner_container { | ||
1957 | 160 | width: 200px; | ||
1958 | 161 | display: none; | ||
1959 | 162 | position: relative !important; | ||
1960 | 163 | } | ||
1961 | 164 | |||
1962 | 165 | // modes : specific | ||
1963 | 166 | &[data-mode="match"] { | ||
1964 | 167 | .toggle_match { | ||
1965 | 168 | @extend .visible_toggle; | ||
1966 | 169 | } | ||
1967 | 170 | } | ||
1968 | 171 | |||
1969 | 172 | &[data-mode="create"] { | ||
1970 | 173 | .toggle_create { | ||
1971 | 174 | @extend .visible_toggle; | ||
1972 | 175 | } | ||
1973 | 176 | } | ||
1974 | 177 | |||
1975 | 178 | &[data-mode="inactive"] { | ||
1976 | 179 | .initial_line > td { | ||
1977 | 180 | background-color: ($initialLineBackground + #080808) !important; | ||
1978 | 181 | } | ||
1979 | 182 | } | ||
1980 | 183 | |||
1981 | 184 | &.no_match:not(.no_partner) { | ||
1982 | 185 | .initial_line { | ||
1983 | 186 | cursor: default !important; | ||
1984 | 187 | |||
1985 | 188 | .line_info_button { | ||
1986 | 189 | cursor: pointer; | ||
1987 | 190 | } | ||
1988 | 191 | } | ||
1989 | 192 | .toggle_match { | ||
1990 | 193 | visibility: hidden !important; | ||
1991 | 194 | } | ||
1992 | 195 | } | ||
1993 | 196 | |||
1994 | 197 | &.no_partner { | ||
1995 | 198 | .partner_name, .line_open_balance { | ||
1996 | 199 | display: none !important; | ||
1997 | 200 | } | ||
1998 | 201 | } | ||
1999 | 202 | |||
2000 | 203 | /* gap between accounting_view and action view */ | ||
2001 | 204 | > table > tbody > tr:nth-child(1) > td table { | ||
2002 | 205 | margin-bottom: 10px; | ||
2003 | 206 | } | ||
2004 | 207 | |||
2005 | 208 | /* popover */ | ||
2006 | 209 | table.details { | ||
2007 | 210 | td:first-child { | ||
2008 | 211 | padding-right: 10px; | ||
2009 | 212 | font-weight: bold; | ||
2010 | 213 | } | ||
2011 | 214 | } | ||
2012 | 215 | |||
2013 | 216 | /* arrays of move lines */ | ||
2014 | 217 | .accounting_view, .match table { | ||
2015 | 218 | width: 100%; | ||
2016 | 219 | |||
2017 | 220 | tr { | ||
2018 | 221 | cursor: pointer; | ||
2019 | 222 | |||
2020 | 223 | &.created_line { | ||
2021 | 224 | cursor: default !important; | ||
2022 | 225 | |||
2023 | 226 | .line_remove_button { | ||
2024 | 227 | cursor: pointer; | ||
2025 | 228 | } | ||
2026 | 229 | } | ||
2027 | 230 | } | ||
2028 | 231 | |||
2029 | 232 | td { | ||
2030 | 233 | padding: 1px 8px; | ||
2031 | 234 | vertical-align: middle; | ||
2032 | 235 | } | ||
2033 | 236 | |||
2034 | 237 | td:nth-child(1), td:nth-child(7) { | ||
2035 | 238 | width: $actionColWidth; | ||
2036 | 239 | padding: 0; | ||
2037 | 240 | } | ||
2038 | 241 | |||
2039 | 242 | td:nth-child(1) { | ||
2040 | 243 | text-align: left; | ||
2041 | 244 | } | ||
2042 | 245 | |||
2043 | 246 | td:nth-child(2) { | ||
2044 | 247 | width: 80px; | ||
2045 | 248 | padding-left: $mainTableBordersPadding; | ||
2046 | 249 | } | ||
2047 | 250 | |||
2048 | 251 | td:nth-child(3) { | ||
2049 | 252 | width: 100px; | ||
2050 | 253 | } | ||
2051 | 254 | |||
2052 | 255 | td:nth-child(4) { | ||
2053 | 256 | |||
2054 | 257 | } | ||
2055 | 258 | |||
2056 | 259 | td:nth-child(5) { | ||
2057 | 260 | text-align: right; | ||
2058 | 261 | width: 15%; | ||
2059 | 262 | } | ||
2060 | 263 | |||
2061 | 264 | td:nth-child(6) { | ||
2062 | 265 | width: 15%; | ||
2063 | 266 | text-align: right; | ||
2064 | 267 | padding-right: $mainTableBordersPadding; | ||
2065 | 268 | } | ||
2066 | 269 | |||
2067 | 270 | td:nth-child(7) { | ||
2068 | 271 | text-align: right; | ||
2069 | 272 | } | ||
2070 | 273 | |||
2071 | 274 | tr.line_open_balance { | ||
2072 | 275 | color: #bbb; | ||
2073 | 276 | } | ||
2074 | 277 | |||
2075 | 278 | tr .glyphicon:not(.line_info_button) { | ||
2076 | 279 | visibility: hidden; | ||
2077 | 280 | color: #555; | ||
2078 | 281 | } | ||
2079 | 282 | |||
2080 | 283 | tr:hover .glyphicon, tr.active .glyphicon { | ||
2081 | 284 | visibility: visible; | ||
2082 | 285 | } | ||
2083 | 286 | |||
2084 | 287 | tr .do_partial_reconcile_button { | ||
2085 | 288 | color: #f0ad4e; | ||
2086 | 289 | padding-right: 5px; | ||
2087 | 290 | } | ||
2088 | 291 | |||
2089 | 292 | tr .undo_partial_reconcile_button { | ||
2090 | 293 | color: #555; | ||
2091 | 294 | padding-right: 5px; | ||
2092 | 295 | } | ||
2093 | 296 | } | ||
2094 | 297 | |||
2095 | 298 | /* Partie infos */ | ||
2096 | 299 | .accounting_view { | ||
2097 | 300 | |||
2098 | 301 | .initial_line > td { | ||
2099 | 302 | border-top: $lightBorder; | ||
2100 | 303 | padding-top: 4px; | ||
2101 | 304 | padding-bottom: 5px; | ||
2102 | 305 | background-color: $initialLineBackground; | ||
2103 | 306 | -webkit-transition-property: background-color; | ||
2104 | 307 | -moz-transition-property: background-color; | ||
2105 | 308 | -ms-transition-property: background-color; | ||
2106 | 309 | transition-property: background-color; | ||
2107 | 310 | |||
2108 | 311 | &:nth-child(1), &:nth-child(7) { | ||
2109 | 312 | border-top: none; | ||
2110 | 313 | background: white !important; | ||
2111 | 314 | // Hack pour l'alignement au px près | ||
2112 | 315 | padding-top: 6px; | ||
2113 | 316 | padding-bottom: 3px; | ||
2114 | 317 | } | ||
2115 | 318 | } | ||
2116 | 319 | |||
2117 | 320 | caption { | ||
2118 | 321 | text-align: left; | ||
2119 | 322 | font-size: 1.1em; | ||
2120 | 323 | font-weight: bold; | ||
2121 | 324 | height: 26px; | ||
2122 | 325 | margin: 0 $actionColWidth 4px $actionColWidth; | ||
2123 | 326 | |||
2124 | 327 | .button_ok { | ||
2125 | 328 | float: right; | ||
2126 | 329 | |||
2127 | 330 | &:disabled { | ||
2128 | 331 | opacity: 0.5; | ||
2129 | 332 | } | ||
2130 | 333 | } | ||
2131 | 334 | |||
2132 | 335 | > span, > input { | ||
2133 | 336 | position: relative; top: 7px; /* meh */ | ||
2134 | 337 | font-weight: bold; | ||
2135 | 338 | cursor: pointer; | ||
2136 | 339 | } | ||
2137 | 340 | } | ||
2138 | 341 | |||
2139 | 342 | // accounting "T" | ||
2140 | 343 | td:nth-child(6) { border-left: $accountingBorder; } | ||
2141 | 344 | tr.initial_line > td { | ||
2142 | 345 | &:nth-child(5) { border-top: $accountingBorder; } | ||
2143 | 346 | &:nth-child(6) { border-top: $accountingBorder; } | ||
2144 | 347 | } | ||
2145 | 348 | } | ||
2146 | 349 | |||
2147 | 350 | |||
2148 | 351 | /* Match view */ | ||
2149 | 352 | .match { | ||
2150 | 353 | |||
2151 | 354 | .match_controls { | ||
2152 | 355 | padding: 0 0 5px ($actionColWidth+$mainTableBordersPadding); | ||
2153 | 356 | |||
2154 | 357 | .filter { | ||
2155 | 358 | width: 240px; | ||
2156 | 359 | } | ||
2157 | 360 | |||
2158 | 361 | .pager_control_left, .pager_control_right { | ||
2159 | 362 | display: inline-block; | ||
2160 | 363 | cursor: pointer; | ||
2161 | 364 | } | ||
2162 | 365 | |||
2163 | 366 | .pager_control_left { | ||
2164 | 367 | margin-right: 10px; | ||
2165 | 368 | } | ||
2166 | 369 | |||
2167 | 370 | .pager_control_left.disabled, .pager_control_right.disabled { | ||
2168 | 371 | color: #ddd; | ||
2169 | 372 | cursor: default; | ||
2170 | 373 | } | ||
2171 | 374 | } | ||
2172 | 375 | |||
2173 | 376 | .show_more { | ||
2174 | 377 | display: inline-block; | ||
2175 | 378 | margin-left: ($actionColWidth+$mainTableBordersPadding); | ||
2176 | 379 | margin-top: 5px; | ||
2177 | 380 | } | ||
2178 | 381 | } | ||
2179 | 382 | |||
2180 | 383 | |||
2181 | 384 | /* Action create */ | ||
2182 | 385 | .create { | ||
2183 | 386 | margin: 0 $actionColWidth; | ||
2184 | 387 | border: 1px solid #d5d5d5; | ||
2185 | 388 | border-radius: 5px; | ||
2186 | 389 | padding: 10px; | ||
2187 | 390 | |||
2188 | 391 | .quick_add { | ||
2189 | 392 | margin-bottom: 10px; | ||
2190 | 393 | clear: both; | ||
2191 | 394 | |||
2192 | 395 | &:empty { | ||
2193 | 396 | display: none; | ||
2194 | 397 | } | ||
2195 | 398 | } | ||
2196 | 399 | .quick_add:empty { | ||
2197 | 400 | display: none; | ||
2198 | 401 | } | ||
2199 | 402 | |||
2200 | 403 | .oe_form > table { | ||
2201 | 404 | width: 49%; | ||
2202 | 405 | height: 26px; | ||
2203 | 406 | |||
2204 | 407 | &:nth-child(2n+1) { float: left; } | ||
2205 | 408 | &:nth-child(2n) { float: right; } | ||
2206 | 409 | |||
2207 | 410 | th { | ||
2208 | 411 | font-weight: bold; | ||
2209 | 412 | line-height: 26px; | ||
2210 | 413 | padding-right: 8px; | ||
2211 | 414 | min-width: 100px; | ||
2212 | 415 | border-right: 1px solid #ddd; | ||
2213 | 416 | white-space: nowrap; | ||
2214 | 417 | width: 1%; | ||
2215 | 418 | } | ||
2216 | 419 | |||
2217 | 420 | td { | ||
2218 | 421 | width: 99%; | ||
2219 | 422 | padding-left: 8px; | ||
2220 | 423 | } | ||
2221 | 424 | |||
2222 | 425 | input, select { | ||
2223 | 426 | width: 100%; | ||
2224 | 427 | } | ||
2225 | 428 | |||
2226 | 429 | &.add_line_container { | ||
2227 | 430 | &:nth-child(2n+1) { | ||
2228 | 431 | width: 98%; | ||
2229 | 432 | float: none; | ||
2230 | 433 | margin: auto; | ||
2231 | 434 | } | ||
2232 | 435 | |||
2233 | 436 | td { | ||
2234 | 437 | text-align: center; | ||
2235 | 438 | } | ||
2236 | 439 | |||
2237 | 440 | .add_line { | ||
2238 | 441 | line-height: 26px; | ||
2239 | 442 | } | ||
2240 | 443 | } | ||
2241 | 444 | } | ||
2242 | 445 | } | ||
2243 | 446 | } | ||
2244 | 447 | } | ||
2245 | 0 | 448 | ||
2246 | === renamed file 'account/static/src/js/account_move_reconciliation.js' => 'account/static/src/js/account_widgets.js' | |||
2247 | --- account/static/src/js/account_move_reconciliation.js 2014-04-11 12:28:40 +0000 | |||
2248 | +++ account/static/src/js/account_widgets.js 2014-05-30 16:18:57 +0000 | |||
2249 | @@ -6,6 +6,1474 @@ | |||
2250 | 6 | 6 | ||
2251 | 7 | instance.web.account = instance.web.account || {}; | 7 | instance.web.account = instance.web.account || {}; |
2252 | 8 | 8 | ||
2253 | 9 | instance.web.client_actions.add('bank_statement_reconciliation_view', 'instance.web.account.bankStatementReconciliation'); | ||
2254 | 10 | instance.web.account.bankStatementReconciliation = instance.web.Widget.extend({ | ||
2255 | 11 | className: 'oe_bank_statement_reconciliation', | ||
2256 | 12 | |||
2257 | 13 | init: function(parent, context) { | ||
2258 | 14 | this._super(parent); | ||
2259 | 15 | this.max_reconciliations_displayed = 10; | ||
2260 | 16 | this.statement_id = context.context.statement_id; | ||
2261 | 17 | this.title = context.context.title || _t("Reconciliation"); | ||
2262 | 18 | this.st_lines = []; | ||
2263 | 19 | this.last_displayed_reconciliation_index = undefined; // Flow control | ||
2264 | 20 | this.reconciled_lines = 0; // idem | ||
2265 | 21 | this.already_reconciled_lines = 0; // Number of lines of the statement which were already reconciled | ||
2266 | 22 | this.model_bank_statement = new instance.web.Model("account.bank.statement"); | ||
2267 | 23 | this.model_bank_statement_line = new instance.web.Model("account.bank.statement.line"); | ||
2268 | 24 | this.reconciliation_menu_id = false; // Used to update the needaction badge | ||
2269 | 25 | this.formatCurrency; // Method that formats the currency ; loaded from the server | ||
2270 | 26 | |||
2271 | 27 | // Only for statistical purposes | ||
2272 | 28 | this.lines_reconciled_with_ctrl_enter = 0; | ||
2273 | 29 | this.time_widget_loaded = Date.now(); | ||
2274 | 30 | |||
2275 | 31 | // Stuff used by the children bankStatementReconciliationLine | ||
2276 | 32 | this.max_move_lines_displayed = 5; | ||
2277 | 33 | this.animation_speed = 100; // "Blocking" animations | ||
2278 | 34 | this.aestetic_animation_speed = 300; // eye candy | ||
2279 | 35 | this.map_tax_id_amount = {}; | ||
2280 | 36 | this.presets = {}; | ||
2281 | 37 | // We'll need to get the code of an account selected in a many2one (whose value is the id) | ||
2282 | 38 | this.map_account_id_code = {}; | ||
2283 | 39 | // The same move line cannot be selected for multiple resolutions | ||
2284 | 40 | this.excluded_move_lines_ids = {}; | ||
2285 | 41 | // Description of the fields to initialize in the "create new line" form | ||
2286 | 42 | // NB : for presets to work correctly, a field id must be the same string as a preset field | ||
2287 | 43 | this.create_form_fields = { | ||
2288 | 44 | account_id: { | ||
2289 | 45 | id: "account_id", | ||
2290 | 46 | index: 0, | ||
2291 | 47 | corresponding_property: "account_id", // a account.move field name | ||
2292 | 48 | label: _t("Account"), | ||
2293 | 49 | required: true, | ||
2294 | 50 | tabindex: 10, | ||
2295 | 51 | constructor: instance.web.form.FieldMany2One, | ||
2296 | 52 | field_properties: { | ||
2297 | 53 | relation: "account.account", | ||
2298 | 54 | string: _t("Account"), | ||
2299 | 55 | type: "many2one", | ||
2300 | 56 | domain: [['type','!=','view']], | ||
2301 | 57 | }, | ||
2302 | 58 | }, | ||
2303 | 59 | label: { | ||
2304 | 60 | id: "label", | ||
2305 | 61 | index: 1, | ||
2306 | 62 | corresponding_property: "label", | ||
2307 | 63 | label: _t("Label"), | ||
2308 | 64 | required: true, | ||
2309 | 65 | tabindex: 11, | ||
2310 | 66 | constructor: instance.web.form.FieldChar, | ||
2311 | 67 | field_properties: { | ||
2312 | 68 | string: _t("Label"), | ||
2313 | 69 | type: "char", | ||
2314 | 70 | }, | ||
2315 | 71 | }, | ||
2316 | 72 | tax_id: { | ||
2317 | 73 | id: "tax_id", | ||
2318 | 74 | index: 2, | ||
2319 | 75 | corresponding_property: "tax_id", | ||
2320 | 76 | label: _t("Tax"), | ||
2321 | 77 | required: false, | ||
2322 | 78 | tabindex: 12, | ||
2323 | 79 | constructor: instance.web.form.FieldMany2One, | ||
2324 | 80 | field_properties: { | ||
2325 | 81 | relation: "account.tax", | ||
2326 | 82 | string: _t("Tax"), | ||
2327 | 83 | type: "many2one", | ||
2328 | 84 | }, | ||
2329 | 85 | }, | ||
2330 | 86 | amount: { | ||
2331 | 87 | id: "amount", | ||
2332 | 88 | index: 3, | ||
2333 | 89 | corresponding_property: "amount", | ||
2334 | 90 | label: _t("Amount"), | ||
2335 | 91 | required: true, | ||
2336 | 92 | tabindex: 13, | ||
2337 | 93 | constructor: instance.web.form.FieldFloat, | ||
2338 | 94 | field_properties: { | ||
2339 | 95 | string: _t("Amount"), | ||
2340 | 96 | type: "float", | ||
2341 | 97 | }, | ||
2342 | 98 | }, | ||
2343 | 99 | analytic_account_id: { | ||
2344 | 100 | id: "analytic_account_id", | ||
2345 | 101 | index: 4, | ||
2346 | 102 | corresponding_property: "analytic_account_id", | ||
2347 | 103 | label: _t("Analytic Acc."), | ||
2348 | 104 | required: false, | ||
2349 | 105 | tabindex: 14, | ||
2350 | 106 | group:"analytic.group_analytic_accounting", | ||
2351 | 107 | constructor: instance.web.form.FieldMany2One, | ||
2352 | 108 | field_properties: { | ||
2353 | 109 | relation: "account.analytic.account", | ||
2354 | 110 | string: _t("Analytic Acc."), | ||
2355 | 111 | type: "many2one", | ||
2356 | 112 | }, | ||
2357 | 113 | }, | ||
2358 | 114 | }; | ||
2359 | 115 | }, | ||
2360 | 116 | |||
2361 | 117 | start: function() { | ||
2362 | 118 | this._super(); | ||
2363 | 119 | var self = this; | ||
2364 | 120 | |||
2365 | 121 | // Inject variable styles | ||
2366 | 122 | var style = document.createElement("style"); | ||
2367 | 123 | style.appendChild(document.createTextNode("")); | ||
2368 | 124 | document.head.appendChild(style); | ||
2369 | 125 | var css_selector = ".oe_bank_statement_reconciliation_line .toggle_match, .oe_bank_statement_reconciliation_line .toggle_create, .oe_bank_statement_reconciliation_line .initial_line > td"; | ||
2370 | 126 | if(style.sheet.insertRule) { | ||
2371 | 127 | style.sheet.insertRule(css_selector + " { -webkit-transition-duration: "+self.aestetic_animation_speed+"ms; }", 0); | ||
2372 | 128 | style.sheet.insertRule(css_selector + " { -moz-transition-duration: "+self.aestetic_animation_speed+"ms; }", 0); | ||
2373 | 129 | style.sheet.insertRule(css_selector + " { -ms-transition-duration: "+self.aestetic_animation_speed+"ms; }", 0); | ||
2374 | 130 | style.sheet.insertRule(css_selector + " { -o-transition-duration: "+self.aestetic_animation_speed+"ms; }", 0); | ||
2375 | 131 | style.sheet.insertRule(css_selector + " { transition-duration: "+self.aestetic_animation_speed+"ms; }", 0); | ||
2376 | 132 | } else { | ||
2377 | 133 | style.sheet.addRule(css_selector, "-webkit-transition-duration: "+self.aestetic_animation_speed+"ms;"); | ||
2378 | 134 | style.sheet.addRule(css_selector, "-moz-transition-duration: "+self.aestetic_animation_speed+"ms;"); | ||
2379 | 135 | style.sheet.addRule(css_selector, "-ms-transition-duration: "+self.aestetic_animation_speed+"ms;"); | ||
2380 | 136 | style.sheet.addRule(css_selector, "-o-transition-duration: "+self.aestetic_animation_speed+"ms;"); | ||
2381 | 137 | style.sheet.addRule(css_selector, "-webkit-transition-duration: "+self.aestetic_animation_speed+"ms;"); | ||
2382 | 138 | } | ||
2383 | 139 | |||
2384 | 140 | // Retreive statement infos and reconciliation data from the model | ||
2385 | 141 | var lines_filter = [['journal_entry_id', '=', false]]; | ||
2386 | 142 | var deferred_promises = []; | ||
2387 | 143 | |||
2388 | 144 | if (self.statement_id) { | ||
2389 | 145 | lines_filter.push(['statement_id', '=', self.statement_id]); | ||
2390 | 146 | deferred_promises.push(self.model_bank_statement | ||
2391 | 147 | .query(["name"]) | ||
2392 | 148 | .filter([['id', '=', self.statement_id]]) | ||
2393 | 149 | .first() | ||
2394 | 150 | .then(function(title){ | ||
2395 | 151 | self.title = title.name; | ||
2396 | 152 | }) | ||
2397 | 153 | ); | ||
2398 | 154 | deferred_promises.push(self.model_bank_statement | ||
2399 | 155 | .call("number_of_lines_reconciled", [self.statement_id]) | ||
2400 | 156 | .then(function(num) { | ||
2401 | 157 | self.already_reconciled_lines = num; | ||
2402 | 158 | }) | ||
2403 | 159 | ); | ||
2404 | 160 | } | ||
2405 | 161 | |||
2406 | 162 | deferred_promises.push(new instance.web.Model("account.statement.operation.template") | ||
2407 | 163 | .query(['id','name','account_id','label','amount_type','amount','tax_id','analytic_account_id']) | ||
2408 | 164 | .all().then(function (data) { | ||
2409 | 165 | _(data).each(function(preset){ | ||
2410 | 166 | self.presets[preset.id] = preset; | ||
2411 | 167 | }); | ||
2412 | 168 | }) | ||
2413 | 169 | ); | ||
2414 | 170 | |||
2415 | 171 | deferred_promises.push(self.model_bank_statement | ||
2416 | 172 | .call("get_format_currency_js_function", [self.statement_id]) | ||
2417 | 173 | .then(function(data){ | ||
2418 | 174 | self.formatCurrency = new Function("amount", data); | ||
2419 | 175 | }) | ||
2420 | 176 | ); | ||
2421 | 177 | |||
2422 | 178 | deferred_promises.push(self.model_bank_statement_line | ||
2423 | 179 | .query(['id']) | ||
2424 | 180 | .filter(lines_filter) | ||
2425 | 181 | .order_by('id') | ||
2426 | 182 | .all().then(function (data) { | ||
2427 | 183 | self.st_lines = _(data).map(function(o){ return o.id }); | ||
2428 | 184 | }) | ||
2429 | 185 | ); | ||
2430 | 186 | |||
2431 | 187 | // When queries are done, render template and reconciliation lines | ||
2432 | 188 | return $.when.apply($, deferred_promises).then(function(){ | ||
2433 | 189 | |||
2434 | 190 | // If there is no statement line to reconcile, stop here | ||
2435 | 191 | if (self.st_lines.length === 0) { | ||
2436 | 192 | self.$el.prepend(QWeb.render("bank_statement_nothing_to_reconcile")); | ||
2437 | 193 | return; | ||
2438 | 194 | } | ||
2439 | 195 | |||
2440 | 196 | // Create a dict account id -> account code for display facilities | ||
2441 | 197 | new instance.web.Model("account.account") | ||
2442 | 198 | .query(['id', 'code']) | ||
2443 | 199 | .all().then(function(data) { | ||
2444 | 200 | _.each(data, function(o) { self.map_account_id_code[o.id] = o.code }); | ||
2445 | 201 | }); | ||
2446 | 202 | |||
2447 | 203 | // Create a dict tax id -> amount | ||
2448 | 204 | new instance.web.Model("account.tax") | ||
2449 | 205 | .query(['id', 'amount']) | ||
2450 | 206 | .all().then(function(data) { | ||
2451 | 207 | _.each(data, function(o) { self.map_tax_id_amount[o.id] = o.amount }); | ||
2452 | 208 | }); | ||
2453 | 209 | |||
2454 | 210 | new instance.web.Model("ir.model.data") | ||
2455 | 211 | .call("xmlid_to_res_id", ["account.menu_bank_reconcile_bank_statements"]) | ||
2456 | 212 | .then(function(data) { | ||
2457 | 213 | self.reconciliation_menu_id = data; | ||
2458 | 214 | self.doReloadMenuReconciliation(); | ||
2459 | 215 | }); | ||
2460 | 216 | |||
2461 | 217 | // Bind keyboard events TODO : méthode standard ? | ||
2462 | 218 | $("body").on("keypress", function (e) { | ||
2463 | 219 | self.keyboardShortcutsHandler(e); | ||
2464 | 220 | }); | ||
2465 | 221 | |||
2466 | 222 | // Render and display | ||
2467 | 223 | self.$el.prepend(QWeb.render("bank_statement_reconciliation", {title: self.title, total_lines: self.already_reconciled_lines+self.st_lines.length})); | ||
2468 | 224 | self.updateProgressbar(); | ||
2469 | 225 | var reconciliations_to_show = self.st_lines.slice(0, self.max_reconciliations_displayed); | ||
2470 | 226 | self.last_displayed_reconciliation_index = reconciliations_to_show.length; | ||
2471 | 227 | self.$(".reconciliation_lines_container").css("opacity", 0); | ||
2472 | 228 | |||
2473 | 229 | // Display the reconciliations | ||
2474 | 230 | return self.model_bank_statement_line | ||
2475 | 231 | .call("get_data_for_reconciliations", [reconciliations_to_show]) | ||
2476 | 232 | .then(function (data) { | ||
2477 | 233 | var child_promises = []; | ||
2478 | 234 | _.each(reconciliations_to_show, function(st_line_id){ | ||
2479 | 235 | var datum = data.shift(); | ||
2480 | 236 | child_promises.push(self.displayReconciliation(st_line_id, 'inactive', false, true, datum.st_line, datum.reconciliation_proposition)); | ||
2481 | 237 | }); | ||
2482 | 238 | $.when.apply($, child_promises).then(function(){ | ||
2483 | 239 | self.getChildren()[0].set("mode", "match"); | ||
2484 | 240 | self.$(".reconciliation_lines_container").animate({opacity: 1}, self.aestetic_animation_speed); | ||
2485 | 241 | }); | ||
2486 | 242 | }); | ||
2487 | 243 | }); | ||
2488 | 244 | }, | ||
2489 | 245 | |||
2490 | 246 | keyboardShortcutsHandler: function(e) { | ||
2491 | 247 | var self = this; | ||
2492 | 248 | if (e.which === 13 && (e.ctrlKey || e.metaKey)) { | ||
2493 | 249 | $.each(self.getChildren(), function(i, o){ | ||
2494 | 250 | if (o.is_valid && o.persistAndDestroy()) { | ||
2495 | 251 | self.lines_reconciled_with_ctrl_enter++; | ||
2496 | 252 | } | ||
2497 | 253 | }); | ||
2498 | 254 | } | ||
2499 | 255 | }, | ||
2500 | 256 | |||
2501 | 257 | // Adds move line ids to the list of move lines not to fetch for a given partner | ||
2502 | 258 | // This is required because the same move line cannot be selected for multiple reconciliation | ||
2503 | 259 | excludeMoveLines: function(source_child, partner_id, line_ids) { | ||
2504 | 260 | var self = this; | ||
2505 | 261 | |||
2506 | 262 | var excluded_ids = this.excluded_move_lines_ids[partner_id]; | ||
2507 | 263 | var excluded_move_lines_changed = false; | ||
2508 | 264 | _.each(line_ids, function(line_id){ | ||
2509 | 265 | if (excluded_ids.indexOf(line_id) === -1) { | ||
2510 | 266 | excluded_ids.push(line_id); | ||
2511 | 267 | excluded_move_lines_changed = true; | ||
2512 | 268 | } | ||
2513 | 269 | }); | ||
2514 | 270 | if (! excluded_move_lines_changed) | ||
2515 | 271 | return; | ||
2516 | 272 | |||
2517 | 273 | // Function that finds if an array of line objects contains at least a line identified by its id | ||
2518 | 274 | var contains_lines = function(lines_array, line_ids) { | ||
2519 | 275 | for (var i = 0; i < lines_array.length; i++) | ||
2520 | 276 | for (var j = 0; j < line_ids.length; j++) | ||
2521 | 277 | if (lines_array[i].id === line_ids[j]) | ||
2522 | 278 | return true; | ||
2523 | 279 | return false; | ||
2524 | 280 | }; | ||
2525 | 281 | |||
2526 | 282 | // Update children if needed | ||
2527 | 283 | _.each(self.getChildren(), function(child){ | ||
2528 | 284 | if (child.partner_id === partner_id && child !== source_child) { | ||
2529 | 285 | if (contains_lines(child.get("mv_lines_selected"), line_ids)) { | ||
2530 | 286 | child.set("mv_lines_selected", _.filter(child.get("mv_lines_selected"), function(o){ return line_ids.indexOf(o.id) === -1 })); | ||
2531 | 287 | } else if (contains_lines(child.mv_lines_deselected, line_ids)) { | ||
2532 | 288 | child.mv_lines_deselected = _.filter(child.mv_lines_deselected, function(o){ return line_ids.indexOf(o.id) === -1 }); | ||
2533 | 289 | child.updateMatches(); | ||
2534 | 290 | } else if (contains_lines(child.get("mv_lines"), line_ids)) { | ||
2535 | 291 | child.updateMatches(); | ||
2536 | 292 | } | ||
2537 | 293 | } | ||
2538 | 294 | }); | ||
2539 | 295 | }, | ||
2540 | 296 | |||
2541 | 297 | unexcludeMoveLines: function(source_child, partner_id, line_ids) { | ||
2542 | 298 | var self = this; | ||
2543 | 299 | |||
2544 | 300 | var initial_excluded_lines_num = this.excluded_move_lines_ids[partner_id].length; | ||
2545 | 301 | this.excluded_move_lines_ids[partner_id] = _.difference(this.excluded_move_lines_ids[partner_id], line_ids); | ||
2546 | 302 | if (this.excluded_move_lines_ids[partner_id].length === initial_excluded_lines_num) | ||
2547 | 303 | return; | ||
2548 | 304 | |||
2549 | 305 | // Update children if needed | ||
2550 | 306 | _.each(self.getChildren(), function(child){ | ||
2551 | 307 | if (child.partner_id === partner_id && child !== source_child && (child.get("mode") === "match" || child.$el.hasClass("no_match"))) | ||
2552 | 308 | child.updateMatches(); | ||
2553 | 309 | }); | ||
2554 | 310 | }, | ||
2555 | 311 | |||
2556 | 312 | displayReconciliation: function(st_line_id, mode, animate_entrance, initial_data_provided, st_line, reconciliation_proposition) { | ||
2557 | 313 | var self = this; | ||
2558 | 314 | animate_entrance = (animate_entrance === undefined ? true : animate_entrance); | ||
2559 | 315 | initial_data_provided = (initial_data_provided === undefined ? false : initial_data_provided); | ||
2560 | 316 | |||
2561 | 317 | var context = { | ||
2562 | 318 | st_line_id: st_line_id, | ||
2563 | 319 | mode: mode, | ||
2564 | 320 | animate_entrance: animate_entrance, | ||
2565 | 321 | initial_data_provided: initial_data_provided, | ||
2566 | 322 | st_line: initial_data_provided ? st_line : undefined, | ||
2567 | 323 | reconciliation_proposition: initial_data_provided ? reconciliation_proposition : undefined, | ||
2568 | 324 | }; | ||
2569 | 325 | var widget = new instance.web.account.bankStatementReconciliationLine(self, context); | ||
2570 | 326 | return widget.appendTo(self.$(".reconciliation_lines_container")); | ||
2571 | 327 | }, | ||
2572 | 328 | |||
2573 | 329 | childValidated: function(child) { | ||
2574 | 330 | var self = this; | ||
2575 | 331 | |||
2576 | 332 | self.reconciled_lines++; | ||
2577 | 333 | self.updateProgressbar(); | ||
2578 | 334 | self.doReloadMenuReconciliation(); | ||
2579 | 335 | |||
2580 | 336 | // Display new line if there are left | ||
2581 | 337 | if (self.last_displayed_reconciliation_index < self.st_lines.length) { | ||
2582 | 338 | self.displayReconciliation(self.st_lines[self.last_displayed_reconciliation_index++], 'inactive'); | ||
2583 | 339 | } | ||
2584 | 340 | // Put the first line in match mode | ||
2585 | 341 | if (self.reconciled_lines !== self.st_lines.length) { | ||
2586 | 342 | var first_child = self.getChildren()[0]; | ||
2587 | 343 | if (first_child.get("mode") === "inactive") { | ||
2588 | 344 | first_child.set("mode", "match"); | ||
2589 | 345 | } | ||
2590 | 346 | } | ||
2591 | 347 | // Congratulate the user if the work is done | ||
2592 | 348 | if (self.reconciled_lines === self.st_lines.length) { | ||
2593 | 349 | self.displayDoneMessage(); | ||
2594 | 350 | } | ||
2595 | 351 | }, | ||
2596 | 352 | |||
2597 | 353 | displayDoneMessage: function() { | ||
2598 | 354 | var self = this; | ||
2599 | 355 | |||
2600 | 356 | var sec_taken = Math.round((Date.now()-self.time_widget_loaded)/1000); | ||
2601 | 357 | var sec_per_item = Math.round(sec_taken/self.reconciled_lines); | ||
2602 | 358 | var achievements = []; | ||
2603 | 359 | |||
2604 | 360 | var time_taken; | ||
2605 | 361 | if (sec_taken/60 >= 1) time_taken = Math.floor(sec_taken/60) +"' "+ sec_taken%60 +"''"; | ||
2606 | 362 | else time_taken = sec_taken%60 +" seconds"; | ||
2607 | 363 | |||
2608 | 364 | var title; | ||
2609 | 365 | if (sec_per_item < 5) title = _t("Whew, that was fast !") + " <i class='fa fa-trophy congrats_icon'></i>"; | ||
2610 | 366 | else title = _t("Congrats, you're all done !") + " <i class='fa fa-thumbs-o-up congrats_icon'></i>"; | ||
2611 | 367 | |||
2612 | 368 | if (self.lines_reconciled_with_ctrl_enter === self.reconciled_lines) | ||
2613 | 369 | achievements.push({ | ||
2614 | 370 | title: _t("Efficiency at its finest"), | ||
2615 | 371 | desc: _t("Only use the ctrl-enter shortcut to validate reconciliations."), | ||
2616 | 372 | icon: "fa-keyboard-o"} | ||
2617 | 373 | ); | ||
2618 | 374 | |||
2619 | 375 | if (sec_per_item < 5) | ||
2620 | 376 | achievements.push({ | ||
2621 | 377 | title: _t("Fast reconciler"), | ||
2622 | 378 | desc: _t("Take on average less than 5 seconds to reconcile a transaction."), | ||
2623 | 379 | icon: "fa-bolt"} | ||
2624 | 380 | ); | ||
2625 | 381 | |||
2626 | 382 | // Render it | ||
2627 | 383 | self.$(".protip").hide(); | ||
2628 | 384 | self.$(".oe_form_sheet").append(QWeb.render("bank_statement_reconciliation_done_message", { | ||
2629 | 385 | title: title, | ||
2630 | 386 | time_taken: time_taken, | ||
2631 | 387 | sec_per_item: sec_per_item, | ||
2632 | 388 | transactions_done: self.reconciled_lines, | ||
2633 | 389 | done_with_ctrl_enter: self.lines_reconciled_with_ctrl_enter, | ||
2634 | 390 | achievements: achievements, | ||
2635 | 391 | has_statement_id: self.statement_id !== undefined, | ||
2636 | 392 | })); | ||
2637 | 393 | |||
2638 | 394 | // Animate it | ||
2639 | 395 | var container = $("<div style='overflow: hidden;' />"); | ||
2640 | 396 | self.$(".done_message").wrap(container).css("opacity", 0).css("position", "relative").css("left", "-50%"); | ||
2641 | 397 | self.$(".done_message").animate({opacity: 1, left: 0}, self.aestetic_animation_speed*2, "easeOutCubic"); | ||
2642 | 398 | self.$(".done_message").animate({opacity: 1}, self.aestetic_animation_speed*3, "easeOutCubic"); | ||
2643 | 399 | |||
2644 | 400 | // Make it interactive | ||
2645 | 401 | self.$(".achievement").popover({'placement': 'top', 'container': self.el, 'trigger': 'hover'}); | ||
2646 | 402 | |||
2647 | 403 | self.$(".button_back_to_statement").click(function() { | ||
2648 | 404 | self.do_action({ | ||
2649 | 405 | type: 'ir.actions.client', | ||
2650 | 406 | tag: 'history_back', | ||
2651 | 407 | }); | ||
2652 | 408 | }); | ||
2653 | 409 | |||
2654 | 410 | if (self.$(".button_close_statement").length !== 0) { | ||
2655 | 411 | self.$(".button_close_statement").hide(); | ||
2656 | 412 | self.model_bank_statement | ||
2657 | 413 | .query(["balance_end_real", "balance_end"]) | ||
2658 | 414 | .filter([['id', '=', self.statement_id]]) | ||
2659 | 415 | .first() | ||
2660 | 416 | .then(function(data){ | ||
2661 | 417 | if (data.balance_end_real === data.balance_end) { | ||
2662 | 418 | self.$(".button_close_statement").show(); | ||
2663 | 419 | self.$(".button_close_statement").click(function() { | ||
2664 | 420 | self.$(".button_close_statement").attr("disabled", "disabled"); | ||
2665 | 421 | self.model_bank_statement | ||
2666 | 422 | .call("button_confirm_bank", [[self.statement_id]]) | ||
2667 | 423 | .then(function () { | ||
2668 | 424 | self.do_action({ | ||
2669 | 425 | type: 'ir.actions.client', | ||
2670 | 426 | tag: 'history_back', | ||
2671 | 427 | }); | ||
2672 | 428 | }, function() { | ||
2673 | 429 | self.$(".button_close_statement").removeAttr("disabled"); | ||
2674 | 430 | }); | ||
2675 | 431 | }); | ||
2676 | 432 | } | ||
2677 | 433 | }); | ||
2678 | 434 | } | ||
2679 | 435 | }, | ||
2680 | 436 | |||
2681 | 437 | updateProgressbar: function() { | ||
2682 | 438 | var self = this; | ||
2683 | 439 | var done = self.already_reconciled_lines + self.reconciled_lines; | ||
2684 | 440 | var total = self.already_reconciled_lines + self.st_lines.length; | ||
2685 | 441 | var prog_bar = self.$(".progress .progress-bar"); | ||
2686 | 442 | prog_bar.attr("aria-valuenow", done); | ||
2687 | 443 | prog_bar.css("width", (done/total*100)+"%"); | ||
2688 | 444 | self.$(".progress .progress-text .valuenow").text(done); | ||
2689 | 445 | }, | ||
2690 | 446 | |||
2691 | 447 | /* reloads the needaction badge */ | ||
2692 | 448 | doReloadMenuReconciliation: function () { | ||
2693 | 449 | var menu = instance.webclient.menu; | ||
2694 | 450 | if (!menu || !this.reconciliation_menu_id) { | ||
2695 | 451 | return $.when(); | ||
2696 | 452 | } | ||
2697 | 453 | return menu.rpc("/web/menu/load_needaction", {'menu_ids': [this.reconciliation_menu_id]}).done(function(r) { | ||
2698 | 454 | menu.on_needaction_loaded(r); | ||
2699 | 455 | }).then(function () { | ||
2700 | 456 | menu.trigger("need_action_reloaded"); | ||
2701 | 457 | }); | ||
2702 | 458 | }, | ||
2703 | 459 | }); | ||
2704 | 460 | |||
2705 | 461 | instance.web.account.bankStatementReconciliationLine = instance.web.Widget.extend({ | ||
2706 | 462 | className: 'oe_bank_statement_reconciliation_line', | ||
2707 | 463 | |||
2708 | 464 | events: { | ||
2709 | 465 | "click .partner_name": "partnerNameClickHandler", | ||
2710 | 466 | "click .button_ok": "persistAndDestroy", | ||
2711 | 467 | "click .mv_line": "moveLineClickHandler", | ||
2712 | 468 | "click .initial_line": "initialLineClickHandler", | ||
2713 | 469 | "click .line_open_balance": "lineOpenBalanceClickHandler", | ||
2714 | 470 | "click .pager_control_left:not(.disabled)": "pagerControlLeftHandler", | ||
2715 | 471 | "click .pager_control_right:not(.disabled)": "pagerControlRightHandler", | ||
2716 | 472 | "keyup .filter": "filterHandler", | ||
2717 | 473 | "click .line_info_button": function(e){e.stopPropagation()}, // small usability hack | ||
2718 | 474 | "click .add_line": "addLineBeingEdited", | ||
2719 | 475 | "click .preset": "presetClickHandler", | ||
2720 | 476 | "click .do_partial_reconcile_button": "doPartialReconcileButtonClickHandler", | ||
2721 | 477 | "click .undo_partial_reconcile_button": "undoPartialReconcileButtonClickHandler", | ||
2722 | 478 | }, | ||
2723 | 479 | |||
2724 | 480 | init: function(parent, context) { | ||
2725 | 481 | this._super(parent); | ||
2726 | 482 | |||
2727 | 483 | if (context.initial_data_provided) { | ||
2728 | 484 | // Process data | ||
2729 | 485 | _(context.reconciliation_proposition).each(this.decorateMoveLine.bind(this)); | ||
2730 | 486 | this.set("mv_lines_selected", context.reconciliation_proposition); | ||
2731 | 487 | this.st_line = context.st_line; | ||
2732 | 488 | this.partner_id = context.st_line.partner_id; | ||
2733 | 489 | this.decorateStatementLine(this.st_line); | ||
2734 | 490 | |||
2735 | 491 | // Exclude selected move lines | ||
2736 | 492 | var selected_line_ids = _(context.reconciliation_proposition).map(function(o){ return o.id }); | ||
2737 | 493 | if (this.getParent().excluded_move_lines_ids[this.partner_id] === undefined) | ||
2738 | 494 | this.getParent().excluded_move_lines_ids[this.partner_id] = []; | ||
2739 | 495 | this.getParent().excludeMoveLines(this, this.partner_id, selected_line_ids); | ||
2740 | 496 | } else { | ||
2741 | 497 | this.set("mv_lines_selected", []); | ||
2742 | 498 | this.st_line = undefined; | ||
2743 | 499 | this.partner_id = undefined; | ||
2744 | 500 | } | ||
2745 | 501 | |||
2746 | 502 | this.context = context; | ||
2747 | 503 | this.st_line_id = context.st_line_id; | ||
2748 | 504 | this.max_move_lines_displayed = this.getParent().max_move_lines_displayed; | ||
2749 | 505 | this.animation_speed = this.getParent().animation_speed; | ||
2750 | 506 | this.aestetic_animation_speed = this.getParent().aestetic_animation_speed; | ||
2751 | 507 | this.model_bank_statement_line = new instance.web.Model("account.bank.statement.line"); | ||
2752 | 508 | this.model_res_users = new instance.web.Model("res.users"); | ||
2753 | 509 | this.model_tax = new instance.web.Model("account.tax"); | ||
2754 | 510 | this.map_account_id_code = this.getParent().map_account_id_code; | ||
2755 | 511 | this.map_tax_id_amount = this.getParent().map_tax_id_amount; | ||
2756 | 512 | this.formatCurrency = this.getParent().formatCurrency; | ||
2757 | 513 | this.presets = this.getParent().presets; | ||
2758 | 514 | this.is_valid = true; | ||
2759 | 515 | this.is_consistent = true; // Used to prevent bad server requests | ||
2760 | 516 | this.total_move_lines_num = undefined; // Used for pagers | ||
2761 | 517 | this.filter = ""; | ||
2762 | 518 | |||
2763 | 519 | this.set("balance", undefined); // Debit is +, credit is - | ||
2764 | 520 | this.on("change:balance", this, this.balanceChanged); | ||
2765 | 521 | this.set("mode", undefined); | ||
2766 | 522 | this.on("change:mode", this, this.modeChanged); | ||
2767 | 523 | this.set("pager_index", 0); | ||
2768 | 524 | this.on("change:pager_index", this, this.pagerChanged); | ||
2769 | 525 | // NB : mv_lines represent the counterpart that will be created to reconcile existing move lines, so debit and credit are inverted | ||
2770 | 526 | this.set("mv_lines", []); | ||
2771 | 527 | this.on("change:mv_lines", this, this.mvLinesChanged); | ||
2772 | 528 | this.mv_lines_deselected = []; // deselected lines are displayed on top of the match table | ||
2773 | 529 | this.on("change:mv_lines_selected", this, this.mvLinesSelectedChanged); | ||
2774 | 530 | this.set("lines_created", []); | ||
2775 | 531 | this.set("line_created_being_edited", [{'id': 0}]); | ||
2776 | 532 | this.on("change:lines_created", this, this.createdLinesChanged); | ||
2777 | 533 | this.on("change:line_created_being_edited", this, this.createdLinesChanged); | ||
2778 | 534 | }, | ||
2779 | 535 | |||
2780 | 536 | start: function() { | ||
2781 | 537 | var self = this; | ||
2782 | 538 | return self._super().then(function() { | ||
2783 | 539 | // no animation while loading | ||
2784 | 540 | self.animation_speed = 0; | ||
2785 | 541 | self.aestetic_animation_speed = 0; | ||
2786 | 542 | |||
2787 | 543 | self.is_consistent = false; | ||
2788 | 544 | if (self.context.animate_entrance) self.$el.css("opacity", "0"); | ||
2789 | 545 | |||
2790 | 546 | // Fetch data | ||
2791 | 547 | var deferred_fetch_data = new $.Deferred(); | ||
2792 | 548 | if (! self.context.initial_data_provided) { | ||
2793 | 549 | // Load statement line | ||
2794 | 550 | self.model_bank_statement_line | ||
2795 | 551 | .call("get_statement_line_for_reconciliation", [self.st_line_id]) | ||
2796 | 552 | .then(function (data) { | ||
2797 | 553 | self.st_line = data; | ||
2798 | 554 | self.decorateStatementLine(self.st_line); | ||
2799 | 555 | self.partner_id = data.partner_id; | ||
2800 | 556 | if (self.getParent().excluded_move_lines_ids[self.partner_id] === undefined) | ||
2801 | 557 | self.getParent().excluded_move_lines_ids[self.partner_id] = []; | ||
2802 | 558 | // load and display move lines | ||
2803 | 559 | $.when(self.loadReconciliationProposition()).then(function(){ | ||
2804 | 560 | deferred_fetch_data.resolve(); | ||
2805 | 561 | }); | ||
2806 | 562 | }); | ||
2807 | 563 | } else { | ||
2808 | 564 | deferred_fetch_data.resolve(); | ||
2809 | 565 | } | ||
2810 | 566 | |||
2811 | 567 | // Display the widget | ||
2812 | 568 | return $.when(deferred_fetch_data).then(function(){ | ||
2813 | 569 | // Render template | ||
2814 | 570 | var presets_array = []; | ||
2815 | 571 | for (var id in self.presets) | ||
2816 | 572 | if (self.presets.hasOwnProperty(id)) | ||
2817 | 573 | presets_array.push(self.presets[id]); | ||
2818 | 574 | self.$el.prepend(QWeb.render("bank_statement_reconciliation_line", {line: self.st_line, mode: self.context.mode, presets: presets_array})); | ||
2819 | 575 | |||
2820 | 576 | // Stuff that require the template to be rendered | ||
2821 | 577 | self.$(".match").slideUp(0); | ||
2822 | 578 | self.$(".create").slideUp(0); | ||
2823 | 579 | if (self.st_line.no_match) self.$el.addClass("no_match"); | ||
2824 | 580 | if (self.context.mode !== "match") self.updateMatches(); | ||
2825 | 581 | self.bindPopoverTo(self.$(".line_info_button")); | ||
2826 | 582 | self.createFormWidgets(); | ||
2827 | 583 | |||
2828 | 584 | // Special case hack : no identified partner | ||
2829 | 585 | if (self.st_line.has_no_partner) { | ||
2830 | 586 | self.$el.css("opacity", "0"); | ||
2831 | 587 | self.updateBalance(); | ||
2832 | 588 | self.$(".change_partner_container").show(0); | ||
2833 | 589 | self.change_partner_field.$el.find("input").attr("placeholder", _t("Select Partner")); | ||
2834 | 590 | self.$(".match").slideUp(0); | ||
2835 | 591 | self.$el.addClass("no_partner"); | ||
2836 | 592 | self.set("mode", self.context.mode); | ||
2837 | 593 | self.animation_speed = self.getParent().animation_speed; | ||
2838 | 594 | self.aestetic_animation_speed = self.getParent().aestetic_animation_speed; | ||
2839 | 595 | self.$el.animate({opacity: 1}, self.aestetic_animation_speed); | ||
2840 | 596 | self.is_consistent = true; | ||
2841 | 597 | return; | ||
2842 | 598 | } | ||
2843 | 599 | |||
2844 | 600 | // TODO : the .on handler's returned deferred is lost | ||
2845 | 601 | return $.when(self.set("mode", self.context.mode)).then(function(){ | ||
2846 | 602 | self.is_consistent = true; | ||
2847 | 603 | |||
2848 | 604 | // Make sure the display is OK | ||
2849 | 605 | self.balanceChanged(); | ||
2850 | 606 | self.createdLinesChanged(); | ||
2851 | 607 | self.updateAccountingViewMatchedLines(); | ||
2852 | 608 | |||
2853 | 609 | // Make an entrance | ||
2854 | 610 | self.animation_speed = self.getParent().animation_speed; | ||
2855 | 611 | self.aestetic_animation_speed = self.getParent().aestetic_animation_speed; | ||
2856 | 612 | if (self.context.animate_entrance) return self.$el.animate({opacity: 1}, self.aestetic_animation_speed); | ||
2857 | 613 | }); | ||
2858 | 614 | }); | ||
2859 | 615 | }); | ||
2860 | 616 | }, | ||
2861 | 617 | |||
2862 | 618 | restart: function(mode) { | ||
2863 | 619 | var self = this; | ||
2864 | 620 | mode = (mode === undefined ? 'inactive' : mode); | ||
2865 | 621 | self.$el.css("height", self.$el.outerHeight()); | ||
2866 | 622 | // Destroy everything | ||
2867 | 623 | _.each(self.getChildren(), function(o){ o.destroy() }); | ||
2868 | 624 | self.is_consistent = false; | ||
2869 | 625 | return $.when(self.$el.animate({opacity: 0}, self.animation_speed)).then(function() { | ||
2870 | 626 | self.getParent().unexcludeMoveLines(self, self.partner_id, _.map(self.get("mv_lines_selected"), function(o){ return o.id })); | ||
2871 | 627 | $.each(self.$(".bootstrap_popover"), function(){ $(this).popover('destroy') }); | ||
2872 | 628 | self.$el.empty(); | ||
2873 | 629 | self.$el.removeClass("no_partner"); | ||
2874 | 630 | self.context.mode = mode; | ||
2875 | 631 | self.context.initial_data_provided = false; | ||
2876 | 632 | self.is_valid = true; | ||
2877 | 633 | self.is_consistent = true; | ||
2878 | 634 | self.filter = ""; | ||
2879 | 635 | self.set("balance", undefined, {silent: true}); | ||
2880 | 636 | self.set("mode", undefined, {silent: true}); | ||
2881 | 637 | self.set("pager_index", 0, {silent: true}); | ||
2882 | 638 | self.set("mv_lines", [], {silent: true}); | ||
2883 | 639 | self.set("mv_lines_selected", [], {silent: true}); | ||
2884 | 640 | self.mv_lines_deselected = []; | ||
2885 | 641 | self.set("lines_created", [], {silent: true}); | ||
2886 | 642 | self.set("line_created_being_edited", [{'id': 0}], {silent: true}); | ||
2887 | 643 | // Rebirth | ||
2888 | 644 | return $.when(self.start()).then(function() { | ||
2889 | 645 | self.$el.css("height", "auto"); | ||
2890 | 646 | self.is_consistent = true; | ||
2891 | 647 | self.$el.animate({opacity: 1}, self.animation_speed); | ||
2892 | 648 | }); | ||
2893 | 649 | }); | ||
2894 | 650 | }, | ||
2895 | 651 | |||
2896 | 652 | /* create form widgets, append them to the dom and bind their events handlers */ | ||
2897 | 653 | createFormWidgets: function() { | ||
2898 | 654 | var self = this; | ||
2899 | 655 | var create_form_fields = self.getParent().create_form_fields; | ||
2900 | 656 | var create_form_fields_arr = []; | ||
2901 | 657 | for (var key in create_form_fields) | ||
2902 | 658 | if (create_form_fields.hasOwnProperty(key)) | ||
2903 | 659 | create_form_fields_arr.push(create_form_fields[key]); | ||
2904 | 660 | create_form_fields_arr.sort(function(a, b){ return b.index - a.index }); | ||
2905 | 661 | |||
2906 | 662 | // field_manager | ||
2907 | 663 | var dataset = new instance.web.DataSet(this, "account.account", self.context); | ||
2908 | 664 | dataset.ids = []; | ||
2909 | 665 | dataset.arch = { | ||
2910 | 666 | attrs: { string: "Stéphanie de Monaco", version: "7.0", class: "oe_form_container" }, | ||
2911 | 667 | children: [], | ||
2912 | 668 | tag: "form" | ||
2913 | 669 | }; | ||
2914 | 670 | |||
2915 | 671 | var field_manager = new instance.web.FormView ( | ||
2916 | 672 | this, dataset, false, { | ||
2917 | 673 | initial_mode: 'edit', | ||
2918 | 674 | disable_autofocus: false, | ||
2919 | 675 | $buttons: $(), | ||
2920 | 676 | $pager: $() | ||
2921 | 677 | }); | ||
2922 | 678 | |||
2923 | 679 | field_manager.load_form(dataset); | ||
2924 | 680 | |||
2925 | 681 | // fields default properties | ||
2926 | 682 | var Default_field = function() { | ||
2927 | 683 | this.context = {}; | ||
2928 | 684 | this.domain = []; | ||
2929 | 685 | this.help = ""; | ||
2930 | 686 | this.readonly = false; | ||
2931 | 687 | this.required = true; | ||
2932 | 688 | this.selectable = true; | ||
2933 | 689 | this.states = {}; | ||
2934 | 690 | this.views = {}; | ||
2935 | 691 | }; | ||
2936 | 692 | var Default_node = function(field_name) { | ||
2937 | 693 | this.tag = "field"; | ||
2938 | 694 | this.children = []; | ||
2939 | 695 | this.required = true; | ||
2940 | 696 | this.attrs = { | ||
2941 | 697 | invisible: "False", | ||
2942 | 698 | modifiers: '{"required":true}', | ||
2943 | 699 | name: field_name, | ||
2944 | 700 | nolabel: "True", | ||
2945 | 701 | }; | ||
2946 | 702 | }; | ||
2947 | 703 | |||
2948 | 704 | // Append fields to the field_manager | ||
2949 | 705 | field_manager.fields_view.fields = {}; | ||
2950 | 706 | for (var i=0; i<create_form_fields_arr.length; i++) { | ||
2951 | 707 | field_manager.fields_view.fields[create_form_fields_arr[i].id] = _.extend(new Default_field(), create_form_fields_arr[i].field_properties); | ||
2952 | 708 | } | ||
2953 | 709 | field_manager.fields_view.fields["change_partner"] = _.extend(new Default_field(), { | ||
2954 | 710 | relation: "res.partner", | ||
2955 | 711 | string: _t("Partner"), | ||
2956 | 712 | type: "many2one", | ||
2957 | 713 | domain: [['parent_id','=',false], '|', ['customer','=',true], ['supplier','=',true]], | ||
2958 | 714 | }); | ||
2959 | 715 | |||
2960 | 716 | // Returns a function that serves as a xhr response handler | ||
2961 | 717 | var hideGroupResponseClosureFactory = function(field_widget, $container, obj_key){ | ||
2962 | 718 | return function(has_group){ | ||
2963 | 719 | if (has_group) $container.show(); | ||
2964 | 720 | else { | ||
2965 | 721 | field_widget.destroy(); | ||
2966 | 722 | $container.remove(); | ||
2967 | 723 | delete self[obj_key]; | ||
2968 | 724 | } | ||
2969 | 725 | }; | ||
2970 | 726 | }; | ||
2971 | 727 | |||
2972 | 728 | // generate the create "form" | ||
2973 | 729 | self.create_form = []; | ||
2974 | 730 | for (var i=0; i<create_form_fields_arr.length; i++) { | ||
2975 | 731 | var field_data = create_form_fields_arr[i]; | ||
2976 | 732 | |||
2977 | 733 | // create widgets | ||
2978 | 734 | var node = new Default_node(field_data.id); | ||
2979 | 735 | if (! field_data.required) node.attrs.modifiers = ""; | ||
2980 | 736 | var field = new field_data.constructor(field_manager, node); | ||
2981 | 737 | self[field_data.id+"_field"] = field; | ||
2982 | 738 | self.create_form.push(field); | ||
2983 | 739 | |||
2984 | 740 | // on update : change the last created line | ||
2985 | 741 | field.corresponding_property = field_data.corresponding_property; | ||
2986 | 742 | field.on("change:value", self, self.formCreateInputChanged); | ||
2987 | 743 | |||
2988 | 744 | // append to DOM | ||
2989 | 745 | var $field_container = $(QWeb.render("form_create_field", {id: field_data.id, label: field_data.label})); | ||
2990 | 746 | field.appendTo($field_container.find("td")); | ||
2991 | 747 | self.$(".create_form").prepend($field_container); | ||
2992 | 748 | |||
2993 | 749 | // now that widget's dom has been created (appendTo does that), bind events and adds tabindex | ||
2994 | 750 | if (field_data.field_properties.type != "many2one") { | ||
2995 | 751 | // Triggers change:value TODO : moche bind ? | ||
2996 | 752 | field.$el.find("input").keyup(function(e, field){ field.commit_value(); }.bind(null, null, field)); | ||
2997 | 753 | } | ||
2998 | 754 | field.$el.find("input").attr("tabindex", field_data.tabindex); | ||
2999 | 755 | |||
3000 | 756 | // Hide the field if group not OK | ||
3001 | 757 | if (field_data.group !== undefined) { | ||
3002 | 758 | var target = $field_container; | ||
3003 | 759 | target.hide(); | ||
3004 | 760 | self.model_res_users | ||
3005 | 761 | .call("has_group", [field_data.group]) | ||
3006 | 762 | .then(hideGroupResponseClosureFactory(field, target, (field_data.id+"_field"))); | ||
3007 | 763 | } | ||
3008 | 764 | } | ||
3009 | 765 | |||
3010 | 766 | // generate the change partner "form" | ||
3011 | 767 | var change_partner_node = new Default_node("change_partner"); change_partner_node.attrs.modifiers = ""; | ||
3012 | 768 | self.change_partner_field = new instance.web.form.FieldMany2One(field_manager, change_partner_node); | ||
3013 | 769 | self.change_partner_field.appendTo(self.$(".change_partner_container")); | ||
3014 | 770 | self.change_partner_field.on("change:value", self.change_partner_field, function() { | ||
3015 | 771 | self.changePartner(this.get_value()); | ||
3016 | 772 | }); | ||
3017 | 773 | |||
3018 | 774 | field_manager.do_show(); | ||
3019 | 775 | }, | ||
3020 | 776 | |||
3021 | 777 | /** Utils */ | ||
3022 | 778 | |||
3023 | 779 | /* TODO : if t-call for attr, all in qweb */ | ||
3024 | 780 | decorateStatementLine: function(line){ | ||
3025 | 781 | line.q_popover = QWeb.render("bank_statement_reconciliation_line_details", {line: line}); | ||
3026 | 782 | }, | ||
3027 | 783 | |||
3028 | 784 | // adds fields, prefixed with q_, to the move line for qweb rendering | ||
3029 | 785 | decorateMoveLine: function(line){ | ||
3030 | 786 | line.partial_reconcile = false; | ||
3031 | 787 | line.propose_partial_reconcile = false; | ||
3032 | 788 | line.q_due_date = (line.date_maturity === false ? line.date : line.date_maturity); | ||
3033 | 789 | line.q_amount = (line.debit !== 0 ? "- "+line.q_debit : "") + (line.credit !== 0 ? line.q_credit : ""); | ||
3034 | 790 | line.q_popover = QWeb.render("bank_statement_reconciliation_move_line_details", {line: line}); | ||
3035 | 791 | line.q_label = line.name; | ||
3036 | 792 | |||
3037 | 793 | // WARNING : pretty much of a ugly hack | ||
3038 | 794 | // The value of account_move.ref is either the move's communication or it's name without the slashes | ||
3039 | 795 | if (line.ref && line.ref !== line.name.replace(/\//g,'')) | ||
3040 | 796 | line.q_label += " : " + line.ref; | ||
3041 | 797 | }, | ||
3042 | 798 | |||
3043 | 799 | bindPopoverTo: function(el) { | ||
3044 | 800 | var self = this; | ||
3045 | 801 | $(el).addClass("bootstrap_popover"); | ||
3046 | 802 | el.popover({ | ||
3047 | 803 | 'placement': 'left', | ||
3048 | 804 | 'container': self.el, | ||
3049 | 805 | 'html': true, | ||
3050 | 806 | 'trigger': 'hover', | ||
3051 | 807 | 'animation': false, | ||
3052 | 808 | 'toggle': 'popover' | ||
3053 | 809 | }); | ||
3054 | 810 | }, | ||
3055 | 811 | |||
3056 | 812 | islineCreatedBeingEditedValid: function() { | ||
3057 | 813 | var line = this.get("line_created_being_edited")[0]; | ||
3058 | 814 | return line.amount // must be defined and not 0 | ||
3059 | 815 | && line.account_id // must be defined (and will never be 0) | ||
3060 | 816 | && line.label; // must be defined and not empty | ||
3061 | 817 | }, | ||
3062 | 818 | |||
3063 | 819 | /* returns the created lines, plus the ones being edited if valid */ | ||
3064 | 820 | getCreatedLines: function() { | ||
3065 | 821 | var self = this; | ||
3066 | 822 | var created_lines = self.get("lines_created").slice(); | ||
3067 | 823 | if (self.islineCreatedBeingEditedValid()) | ||
3068 | 824 | return created_lines.concat(self.get("line_created_being_edited")); | ||
3069 | 825 | else | ||
3070 | 826 | return created_lines; | ||
3071 | 827 | }, | ||
3072 | 828 | |||
3073 | 829 | /** Matching */ | ||
3074 | 830 | |||
3075 | 831 | moveLineClickHandler: function(e) { | ||
3076 | 832 | var self = this; | ||
3077 | 833 | if (e.currentTarget.dataset.selected === "true") self.deselectMoveLine(e.currentTarget); | ||
3078 | 834 | else self.selectMoveLine(e.currentTarget); | ||
3079 | 835 | }, | ||
3080 | 836 | |||
3081 | 837 | // Takes a move line from the match view and adds it to the mv_lines_selected array | ||
3082 | 838 | selectMoveLine: function(mv_line) { | ||
3083 | 839 | var self = this; | ||
3084 | 840 | var line_id = mv_line.dataset.lineid; | ||
3085 | 841 | |||
3086 | 842 | // find the line in mv_lines or mv_lines_deselected | ||
3087 | 843 | var line = _.find(self.get("mv_lines"), function(o){ return o.id == line_id }); | ||
3088 | 844 | if (! line) { | ||
3089 | 845 | line = _.find(self.mv_lines_deselected, function(o){ return o.id == line_id }); | ||
3090 | 846 | self.mv_lines_deselected = _.filter(self.mv_lines_deselected, function(o) { return o.id != line_id }); | ||
3091 | 847 | } | ||
3092 | 848 | // If no line found, the view is probably not up to date to the model (asynchronous fun) | ||
3093 | 849 | if (! line) return; | ||
3094 | 850 | |||
3095 | 851 | // Warn the user if he's selecting lines from both a payable and a receivable account | ||
3096 | 852 | var last_selected_line = _.last(self.get("mv_lines_selected")); | ||
3097 | 853 | if (last_selected_line && last_selected_line.account_type != line.account_type) { | ||
3098 | 854 | // TODO : web client API | ||
3099 | 855 | alert(_.str.sprintf(_t("You are selecting transactions from both a payable and a receivable account.\n\nIn order to proceed, you first need to deselect the %s transactions."), last_selected_line.account_type)); | ||
3100 | 856 | return; | ||
3101 | 857 | } | ||
3102 | 858 | |||
3103 | 859 | self.set("mv_lines_selected", self.get("mv_lines_selected").concat(line)); | ||
3104 | 860 | }, | ||
3105 | 861 | |||
3106 | 862 | // Removes a move line from the mv_lines_selected array | ||
3107 | 863 | deselectMoveLine: function(mv_line) { | ||
3108 | 864 | var self = this; | ||
3109 | 865 | var line_id = mv_line.dataset.lineid; | ||
3110 | 866 | var line = _.find(self.get("mv_lines_selected"), function(o) { return o.id == line_id }); | ||
3111 | 867 | // If no line found, the view is probably not up to date to the model (asynchronous fun) | ||
3112 | 868 | if (! line) return; | ||
3113 | 869 | |||
3114 | 870 | // add the line to mv_lines_deselected and remove it from mv_lines_selected | ||
3115 | 871 | self.mv_lines_deselected.unshift(line); | ||
3116 | 872 | var mv_lines_selected = _.filter(self.get("mv_lines_selected"), function(o) { return o.id != line_id }); | ||
3117 | 873 | |||
3118 | 874 | // remove partial reconciliation stuff if necessary | ||
3119 | 875 | if (line.partial_reconcile === true) self.unpartialReconcileLine(line); | ||
3120 | 876 | if (line.propose_partial_reconcile === true) line.propose_partial_reconcile = false; | ||
3121 | 877 | |||
3122 | 878 | self.$el.removeClass("no_match"); | ||
3123 | 879 | self.set("mode", "match"); | ||
3124 | 880 | self.set("mv_lines_selected", mv_lines_selected); | ||
3125 | 881 | }, | ||
3126 | 882 | |||
3127 | 883 | |||
3128 | 884 | /** Matches pagination */ | ||
3129 | 885 | |||
3130 | 886 | pagerControlLeftHandler: function() { | ||
3131 | 887 | var self = this; | ||
3132 | 888 | if (self.$(".pager_control_left").hasClass("disabled")) { return; /* shouldn't happen, anyway*/ } | ||
3133 | 889 | if (self.total_move_lines_num < 0) { return; } | ||
3134 | 890 | self.set("pager_index", self.get("pager_index")-1 ); | ||
3135 | 891 | }, | ||
3136 | 892 | |||
3137 | 893 | pagerControlRightHandler: function() { | ||
3138 | 894 | var self = this; | ||
3139 | 895 | var new_index = self.get("pager_index")+1; | ||
3140 | 896 | if (self.$(".pager_control_right").hasClass("disabled")) { return; /* shouldn't happen, anyway*/ } | ||
3141 | 897 | if ((new_index * self.max_move_lines_displayed) >= self.total_move_lines_num) { return; } | ||
3142 | 898 | self.set("pager_index", new_index ); | ||
3143 | 899 | }, | ||
3144 | 900 | |||
3145 | 901 | filterHandler: function() { | ||
3146 | 902 | var self = this; | ||
3147 | 903 | self.set("pager_index", 0); | ||
3148 | 904 | self.filter = self.$(".filter").val(); | ||
3149 | 905 | window.clearTimeout(self.apply_filter_timeout); | ||
3150 | 906 | self.apply_filter_timeout = window.setTimeout(self.proxy('updateMatches'), 200); | ||
3151 | 907 | }, | ||
3152 | 908 | |||
3153 | 909 | |||
3154 | 910 | /** Creating */ | ||
3155 | 911 | |||
3156 | 912 | initializeCreateForm: function() { | ||
3157 | 913 | var self = this; | ||
3158 | 914 | |||
3159 | 915 | _.each(self.create_form, function(field) { | ||
3160 | 916 | field.set("value", false); | ||
3161 | 917 | }); | ||
3162 | 918 | self.amount_field.set("value", -1*self.get("balance")); | ||
3163 | 919 | self.account_id_field.focus(); | ||
3164 | 920 | }, | ||
3165 | 921 | |||
3166 | 922 | addLineBeingEdited: function() { | ||
3167 | 923 | var self = this; | ||
3168 | 924 | if (! self.islineCreatedBeingEditedValid()) return; | ||
3169 | 925 | |||
3170 | 926 | self.set("lines_created", self.get("lines_created").concat(self.get("line_created_being_edited"))); | ||
3171 | 927 | // Add empty created line | ||
3172 | 928 | var new_id = self.get("line_created_being_edited")[0].id + 1; | ||
3173 | 929 | self.set("line_created_being_edited", [{'id': new_id}]); | ||
3174 | 930 | |||
3175 | 931 | self.initializeCreateForm(); | ||
3176 | 932 | }, | ||
3177 | 933 | |||
3178 | 934 | removeLine: function($line) { | ||
3179 | 935 | var self = this; | ||
3180 | 936 | var line_id = $line.data("lineid"); | ||
3181 | 937 | |||
3182 | 938 | // if deleting the created line that is being edited, validate it before | ||
3183 | 939 | if (line_id === self.get("line_created_being_edited")[0].id) { | ||
3184 | 940 | self.addLineBeingEdited(); | ||
3185 | 941 | } | ||
3186 | 942 | self.set("lines_created", _.filter(self.get("lines_created"), function(o) { return o.id != line_id })); | ||
3187 | 943 | self.amount_field.set("value", -1*self.get("balance")); | ||
3188 | 944 | }, | ||
3189 | 945 | |||
3190 | 946 | presetClickHandler: function(e) { | ||
3191 | 947 | var self = this; | ||
3192 | 948 | self.initializeCreateForm(); | ||
3193 | 949 | var preset = self.presets[e.currentTarget.dataset.presetid]; | ||
3194 | 950 | for (var key in preset) { | ||
3195 | 951 | if (! preset.hasOwnProperty(key) || key === "amount") continue; | ||
3196 | 952 | if (self.hasOwnProperty(key+"_field")) | ||
3197 | 953 | self[key+"_field"].set_value(preset[key]); | ||
3198 | 954 | } | ||
3199 | 955 | var sign = self.amount_field.get_value() < 0 ? -1 : 1; | ||
3200 | 956 | if (preset.amount && self.amount_field) { | ||
3201 | 957 | if (preset.amount_type === "fixed") | ||
3202 | 958 | self.amount_field.set_value(sign * preset.amount); | ||
3203 | 959 | else if (preset.amount_type === "percentage_of_total") | ||
3204 | 960 | self.amount_field.set_value(sign * self.st_line.amount * preset.amount / 100); | ||
3205 | 961 | else if (preset.amount_type === "percentage_of_balance") { | ||
3206 | 962 | self.amount_field.set_value(0); | ||
3207 | 963 | self.updateBalance(); | ||
3208 | 964 | self.amount_field.set_value(sign * Math.abs(self.get("balance")) * preset.amount / 100); | ||
3209 | 965 | } | ||
3210 | 966 | } | ||
3211 | 967 | }, | ||
3212 | 968 | |||
3213 | 969 | |||
3214 | 970 | /** Display */ | ||
3215 | 971 | |||
3216 | 972 | initialLineClickHandler: function() { | ||
3217 | 973 | var self = this; | ||
3218 | 974 | if (self.get("mode") === "match") { | ||
3219 | 975 | self.set("mode", "inactive"); | ||
3220 | 976 | } else { | ||
3221 | 977 | self.set("mode", "match"); | ||
3222 | 978 | } | ||
3223 | 979 | }, | ||
3224 | 980 | |||
3225 | 981 | lineOpenBalanceClickHandler: function() { | ||
3226 | 982 | var self = this; | ||
3227 | 983 | if (self.get("mode") === "create") { | ||
3228 | 984 | self.set("mode", "match"); | ||
3229 | 985 | } else { | ||
3230 | 986 | self.set("mode", "create"); | ||
3231 | 987 | } | ||
3232 | 988 | }, | ||
3233 | 989 | |||
3234 | 990 | partnerNameClickHandler: function() { | ||
3235 | 991 | var self = this; | ||
3236 | 992 | self.$(".partner_name").hide(); | ||
3237 | 993 | self.change_partner_field.$el.find("input").attr("placeholder", self.st_line.partner_name); | ||
3238 | 994 | self.$(".change_partner_container").show(); | ||
3239 | 995 | }, | ||
3240 | 996 | |||
3241 | 997 | |||
3242 | 998 | /** Views updating */ | ||
3243 | 999 | |||
3244 | 1000 | updateAccountingViewMatchedLines: function() { | ||
3245 | 1001 | var self = this; | ||
3246 | 1002 | $.each(self.$(".tbody_matched_lines .bootstrap_popover"), function(){ $(this).popover('destroy') }); | ||
3247 | 1003 | self.$(".tbody_matched_lines").empty(); | ||
3248 | 1004 | |||
3249 | 1005 | _(self.get("mv_lines_selected")).each(function(line){ | ||
3250 | 1006 | var $line = $(QWeb.render("bank_statement_reconciliation_move_line", {line: line, selected: true})); | ||
3251 | 1007 | self.bindPopoverTo($line.find(".line_info_button")); | ||
3252 | 1008 | if (line.propose_partial_reconcile) self.bindPopoverTo($line.find(".do_partial_reconcile_button")); | ||
3253 | 1009 | if (line.partial_reconcile) self.bindPopoverTo($line.find(".undo_partial_reconcile_button")); | ||
3254 | 1010 | self.$(".tbody_matched_lines").append($line); | ||
3255 | 1011 | }); | ||
3256 | 1012 | }, | ||
3257 | 1013 | |||
3258 | 1014 | updateAccountingViewCreatedLines: function() { | ||
3259 | 1015 | var self = this; | ||
3260 | 1016 | $.each(self.$(".tbody_created_lines .bootstrap_popover"), function(){ $(this).popover('destroy') }); | ||
3261 | 1017 | self.$(".tbody_created_lines").empty(); | ||
3262 | 1018 | |||
3263 | 1019 | _(self.getCreatedLines()).each(function(line){ | ||
3264 | 1020 | var $line = $(QWeb.render("bank_statement_reconciliation_created_line", {line: line})); | ||
3265 | 1021 | $line.find(".line_remove_button").click(function(){ self.removeLine($(this).closest(".created_line")) }); | ||
3266 | 1022 | self.$(".tbody_created_lines").append($line); | ||
3267 | 1023 | if (line.no_remove_action) { | ||
3268 | 1024 | // Then the previous line's remove button deletes this line too | ||
3269 | 1025 | $line.hover(function(){ $(this).prev().addClass("active") },function(){ $(this).prev().removeClass("active") }); | ||
3270 | 1026 | } | ||
3271 | 1027 | }); | ||
3272 | 1028 | }, | ||
3273 | 1029 | |||
3274 | 1030 | updateMatchView: function() { | ||
3275 | 1031 | var self = this; | ||
3276 | 1032 | var table = self.$(".match table"); | ||
3277 | 1033 | var nothing_displayed = true; | ||
3278 | 1034 | |||
3279 | 1035 | // Display move lines | ||
3280 | 1036 | $.each(self.$(".match table .bootstrap_popover"), function(){ $(this).popover('destroy') }); | ||
3281 | 1037 | table.empty(); | ||
3282 | 1038 | var slice_start = self.get("pager_index") * self.max_move_lines_displayed; | ||
3283 | 1039 | var slice_end = (self.get("pager_index")+1) * self.max_move_lines_displayed; | ||
3284 | 1040 | _( _.filter(self.mv_lines_deselected, function(o){ | ||
3285 | 1041 | return o.name.indexOf(self.filter) !== -1 || o.ref.indexOf(self.filter) !== -1 }) | ||
3286 | 1042 | .slice(slice_start, slice_end)).each(function(line){ | ||
3287 | 1043 | var $line = $(QWeb.render("bank_statement_reconciliation_move_line", {line: line, selected: false})); | ||
3288 | 1044 | self.bindPopoverTo($line.find(".line_info_button")); | ||
3289 | 1045 | table.append($line); | ||
3290 | 1046 | nothing_displayed = false; | ||
3291 | 1047 | }); | ||
3292 | 1048 | _(self.get("mv_lines")).each(function(line){ | ||
3293 | 1049 | var $line = $(QWeb.render("bank_statement_reconciliation_move_line", {line: line, selected: false})); | ||
3294 | 1050 | self.bindPopoverTo($line.find(".line_info_button")); | ||
3295 | 1051 | table.append($line); | ||
3296 | 1052 | nothing_displayed = false; | ||
3297 | 1053 | }); | ||
3298 | 1054 | if (nothing_displayed) | ||
3299 | 1055 | table.append(QWeb.render("filter_no_match", {filter_str: self.filter})); | ||
3300 | 1056 | }, | ||
3301 | 1057 | |||
3302 | 1058 | updatePagerControls: function() { | ||
3303 | 1059 | var self = this; | ||
3304 | 1060 | |||
3305 | 1061 | if (self.get("pager_index") === 0) | ||
3306 | 1062 | self.$(".pager_control_left").addClass("disabled"); | ||
3307 | 1063 | else | ||
3308 | 1064 | self.$(".pager_control_left").removeClass("disabled"); | ||
3309 | 1065 | if (self.total_move_lines_num <= ((self.get("pager_index")+1) * self.max_move_lines_displayed)) | ||
3310 | 1066 | self.$(".pager_control_right").addClass("disabled"); | ||
3311 | 1067 | else | ||
3312 | 1068 | self.$(".pager_control_right").removeClass("disabled"); | ||
3313 | 1069 | }, | ||
3314 | 1070 | |||
3315 | 1071 | |||
3316 | 1072 | /** Properties changed */ | ||
3317 | 1073 | |||
3318 | 1074 | // Updates the validation button and the "open balance" line | ||
3319 | 1075 | balanceChanged: function() { | ||
3320 | 1076 | var self = this; | ||
3321 | 1077 | var balance = self.get("balance"); | ||
3322 | 1078 | |||
3323 | 1079 | // Special case hack : no identified partner | ||
3324 | 1080 | if (self.st_line.has_no_partner) { | ||
3325 | 1081 | if (Math.abs(balance).toFixed(3) === "0.000") { | ||
3326 | 1082 | self.$(".button_ok").addClass("oe_highlight"); | ||
3327 | 1083 | self.$(".button_ok").removeAttr("disabled"); | ||
3328 | 1084 | self.$(".button_ok").text("OK"); | ||
3329 | 1085 | self.is_valid = true; | ||
3330 | 1086 | } else { | ||
3331 | 1087 | self.$(".button_ok").removeClass("oe_highlight"); | ||
3332 | 1088 | self.$(".button_ok").attr("disabled", "disabled"); | ||
3333 | 1089 | self.$(".button_ok").text("OK"); | ||
3334 | 1090 | self.is_valid = false; | ||
3335 | 1091 | } | ||
3336 | 1092 | return; | ||
3337 | 1093 | } | ||
3338 | 1094 | |||
3339 | 1095 | self.$(".tbody_open_balance").empty(); | ||
3340 | 1096 | if (Math.abs(balance).toFixed(3) === "0.000") { | ||
3341 | 1097 | self.$(".button_ok").addClass("oe_highlight"); | ||
3342 | 1098 | self.$(".button_ok").text("OK"); | ||
3343 | 1099 | } else { | ||
3344 | 1100 | self.$(".button_ok").removeClass("oe_highlight"); | ||
3345 | 1101 | self.$(".button_ok").text("Keep open"); | ||
3346 | 1102 | var debit = (balance > 0 ? self.formatCurrency(balance) : ""); | ||
3347 | 1103 | var credit = (balance < 0 ? self.formatCurrency(-1*balance) : ""); | ||
3348 | 1104 | var $line = $(QWeb.render("bank_statement_reconciliation_line_open_balance", {debit: debit, credit: credit, account_code: self.map_account_id_code[self.st_line.open_balance_account_id]})); | ||
3349 | 1105 | self.$(".tbody_open_balance").append($line); | ||
3350 | 1106 | } | ||
3351 | 1107 | }, | ||
3352 | 1108 | |||
3353 | 1109 | modeChanged: function() { | ||
3354 | 1110 | var self = this; | ||
3355 | 1111 | |||
3356 | 1112 | self.$(".action_pane.active").removeClass("active"); | ||
3357 | 1113 | |||
3358 | 1114 | // Special case hack : if no_partner, either inactive or create | ||
3359 | 1115 | if (self.st_line.has_no_partner) { | ||
3360 | 1116 | if (self.get("mode") === "inactive") { | ||
3361 | 1117 | self.$(".match").slideUp(self.animation_speed); | ||
3362 | 1118 | self.$(".create").slideUp(self.animation_speed); | ||
3363 | 1119 | self.$(".toggle_match").removeClass("visible_toggle"); | ||
3364 | 1120 | self.el.dataset.mode = "inactive"; | ||
3365 | 1121 | } else { | ||
3366 | 1122 | self.initializeCreateForm(); | ||
3367 | 1123 | self.$(".match").slideUp(self.animation_speed); | ||
3368 | 1124 | self.$(".create").slideDown(self.animation_speed); | ||
3369 | 1125 | self.$(".toggle_match").addClass("visible_toggle"); | ||
3370 | 1126 | self.el.dataset.mode = "create"; | ||
3371 | 1127 | } | ||
3372 | 1128 | return; | ||
3373 | 1129 | } | ||
3374 | 1130 | |||
3375 | 1131 | if (self.get("mode") === "inactive") { | ||
3376 | 1132 | self.$(".match").slideUp(self.animation_speed); | ||
3377 | 1133 | self.$(".create").slideUp(self.animation_speed); | ||
3378 | 1134 | self.el.dataset.mode = "inactive"; | ||
3379 | 1135 | |||
3380 | 1136 | } else if (self.get("mode") === "match") { | ||
3381 | 1137 | return $.when(self.updateMatches()).then(function() { | ||
3382 | 1138 | if (self.$el.hasClass("no_match")) { | ||
3383 | 1139 | self.set("mode", "inactive"); | ||
3384 | 1140 | return; | ||
3385 | 1141 | } | ||
3386 | 1142 | self.$(".match").slideDown(self.animation_speed); | ||
3387 | 1143 | self.$(".create").slideUp(self.animation_speed); | ||
3388 | 1144 | self.el.dataset.mode = "match"; | ||
3389 | 1145 | }); | ||
3390 | 1146 | |||
3391 | 1147 | } else if (self.get("mode") === "create") { | ||
3392 | 1148 | self.initializeCreateForm(); | ||
3393 | 1149 | self.$(".match").slideUp(self.animation_speed); | ||
3394 | 1150 | self.$(".create").slideDown(self.animation_speed); | ||
3395 | 1151 | self.el.dataset.mode = "create"; | ||
3396 | 1152 | } | ||
3397 | 1153 | }, | ||
3398 | 1154 | |||
3399 | 1155 | pagerChanged: function() { | ||
3400 | 1156 | var self = this; | ||
3401 | 1157 | self.updateMatches(); | ||
3402 | 1158 | }, | ||
3403 | 1159 | |||
3404 | 1160 | mvLinesChanged: function() { | ||
3405 | 1161 | var self = this; | ||
3406 | 1162 | // If pager_index is out of range, set it to display the last page | ||
3407 | 1163 | if (self.get("pager_index") !== 0 && self.total_move_lines_num <= (self.get("pager_index") * self.max_move_lines_displayed)) { | ||
3408 | 1164 | self.set("pager_index", Math.ceil(self.total_move_lines_num/self.max_move_lines_displayed)-1); | ||
3409 | 1165 | } | ||
3410 | 1166 | |||
3411 | 1167 | // If there is no match to display, disable match view and pass in mode inactive | ||
3412 | 1168 | if (self.total_move_lines_num + self.mv_lines_deselected.length === 0 && self.filter === "") { | ||
3413 | 1169 | self.$el.addClass("no_match"); | ||
3414 | 1170 | if (self.get("mode") === "match") { | ||
3415 | 1171 | self.set("mode", "inactive"); | ||
3416 | 1172 | } | ||
3417 | 1173 | } else { | ||
3418 | 1174 | self.$el.removeClass("no_match"); | ||
3419 | 1175 | } | ||
3420 | 1176 | |||
3421 | 1177 | self.updateMatchView(); | ||
3422 | 1178 | self.updatePagerControls(); | ||
3423 | 1179 | }, | ||
3424 | 1180 | |||
3425 | 1181 | mvLinesSelectedChanged: function(elt, val) { | ||
3426 | 1182 | var self = this; | ||
3427 | 1183 | |||
3428 | 1184 | var added_lines_ids = _.map(_.difference(val.newValue, val.oldValue), function(o){ return o.id }); | ||
3429 | 1185 | var removed_lines_ids = _.map(_.difference(val.oldValue, val.newValue), function(o){ return o.id }); | ||
3430 | 1186 | |||
3431 | 1187 | self.getParent().excludeMoveLines(self, self.partner_id, added_lines_ids); | ||
3432 | 1188 | self.getParent().unexcludeMoveLines(self, self.partner_id, removed_lines_ids); | ||
3433 | 1189 | |||
3434 | 1190 | $.when(self.updateMatches()).then(function(){ | ||
3435 | 1191 | self.updateAccountingViewMatchedLines(); | ||
3436 | 1192 | self.updateBalance(); | ||
3437 | 1193 | }); | ||
3438 | 1194 | }, | ||
3439 | 1195 | |||
3440 | 1196 | // Generic function for updating the line_created_being_edited | ||
3441 | 1197 | formCreateInputChanged: function(elt, val) { | ||
3442 | 1198 | var self = this; | ||
3443 | 1199 | var line_created_being_edited = self.get("line_created_being_edited"); | ||
3444 | 1200 | line_created_being_edited[0][elt.corresponding_property] = val.newValue; | ||
3445 | 1201 | |||
3446 | 1202 | // Specific cases | ||
3447 | 1203 | if (elt === self.account_id_field) | ||
3448 | 1204 | line_created_being_edited[0].account_num = self.map_account_id_code[elt.get("value")]; | ||
3449 | 1205 | |||
3450 | 1206 | // Update tax line | ||
3451 | 1207 | var deferred_tax = new $.Deferred(); | ||
3452 | 1208 | if (elt === self.tax_id_field || elt === self.amount_field) { | ||
3453 | 1209 | var amount = self.amount_field.get("value"); | ||
3454 | 1210 | var tax = self.map_tax_id_amount[self.tax_id_field.get("value")]; | ||
3455 | 1211 | if (amount && tax) { | ||
3456 | 1212 | deferred_tax = $.when(self.model_tax | ||
3457 | 1213 | .call("compute_for_bank_reconciliation", [self.tax_id_field.get("value"), amount])) | ||
3458 | 1214 | .then(function(data){ | ||
3459 | 1215 | var tax = data.taxes[0]; | ||
3460 | 1216 | var tax_account_id = (amount > 0 ? tax.account_collected_id : tax.account_paid_id) | ||
3461 | 1217 | line_created_being_edited[0].amount = (data.total.toFixed(3) === amount.toFixed(3) ? amount : data.total); | ||
3462 | 1218 | line_created_being_edited[1] = {id: line_created_being_edited[0].id, account_id: tax_account_id, account_num: self.map_account_id_code[tax_account_id], label: tax.name, amount: tax.amount, no_remove_action: true}; | ||
3463 | 1219 | } | ||
3464 | 1220 | ); | ||
3465 | 1221 | } else { | ||
3466 | 1222 | line_created_being_edited[0].amount = amount; | ||
3467 | 1223 | delete line_created_being_edited[1]; | ||
3468 | 1224 | deferred_tax.resolve(); | ||
3469 | 1225 | } | ||
3470 | 1226 | } else { deferred_tax.resolve(); } | ||
3471 | 1227 | |||
3472 | 1228 | $.when(deferred_tax).then(function(){ | ||
3473 | 1229 | // Format amounts | ||
3474 | 1230 | if (line_created_being_edited[0].amount) | ||
3475 | 1231 | line_created_being_edited[0].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[0].amount)); | ||
3476 | 1232 | if (line_created_being_edited[1] && line_created_being_edited[1].amount) | ||
3477 | 1233 | line_created_being_edited[1].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[1].amount)); | ||
3478 | 1234 | |||
3479 | 1235 | self.set("line_created_being_edited", line_created_being_edited); | ||
3480 | 1236 | self.createdLinesChanged(); // TODO For some reason, previous line doesn't trigger change handler | ||
3481 | 1237 | }); | ||
3482 | 1238 | }, | ||
3483 | 1239 | |||
3484 | 1240 | createdLinesChanged: function() { | ||
3485 | 1241 | var self = this; | ||
3486 | 1242 | self.updateAccountingViewCreatedLines(); | ||
3487 | 1243 | self.updateBalance(); | ||
3488 | 1244 | |||
3489 | 1245 | if (self.islineCreatedBeingEditedValid()) self.$(".add_line").show(); | ||
3490 | 1246 | else self.$(".add_line").hide(); | ||
3491 | 1247 | }, | ||
3492 | 1248 | |||
3493 | 1249 | |||
3494 | 1250 | /** Model */ | ||
3495 | 1251 | |||
3496 | 1252 | doPartialReconcileButtonClickHandler: function(e) { | ||
3497 | 1253 | var self = this; | ||
3498 | 1254 | |||
3499 | 1255 | var line_id = $(e.currentTarget).closest("tr").data("lineid"); | ||
3500 | 1256 | var line = _.find(self.get("mv_lines_selected"), function(o) { return o.id == line_id }); | ||
3501 | 1257 | self.partialReconcileLine(line); | ||
3502 | 1258 | |||
3503 | 1259 | $(e.currentTarget).popover('destroy'); | ||
3504 | 1260 | self.updateAccountingViewMatchedLines(); | ||
3505 | 1261 | self.updateBalance(); | ||
3506 | 1262 | e.stopPropagation(); | ||
3507 | 1263 | }, | ||
3508 | 1264 | |||
3509 | 1265 | partialReconcileLine: function(line) { | ||
3510 | 1266 | var self = this; | ||
3511 | 1267 | var balance = self.get("balance"); | ||
3512 | 1268 | line.initial_amount = line.debit !== 0 ? line.debit : -1 * line.credit; | ||
3513 | 1269 | if (balance < 0) { | ||
3514 | 1270 | line.debit -= balance; | ||
3515 | 1271 | line.debit_str = self.formatCurrency(line.debit); | ||
3516 | 1272 | } else { | ||
3517 | 1273 | line.credit -= balance; | ||
3518 | 1274 | line.credit_str = self.formatCurrency(line.credit); | ||
3519 | 1275 | } | ||
3520 | 1276 | line.propose_partial_reconcile = false; | ||
3521 | 1277 | line.partial_reconcile = true; | ||
3522 | 1278 | }, | ||
3523 | 1279 | |||
3524 | 1280 | undoPartialReconcileButtonClickHandler: function(e) { | ||
3525 | 1281 | var self = this; | ||
3526 | 1282 | |||
3527 | 1283 | var line_id = $(e.currentTarget).closest("tr").data("lineid"); | ||
3528 | 1284 | var line = _.find(self.get("mv_lines_selected"), function(o) { return o.id == line_id }); | ||
3529 | 1285 | self.unpartialReconcileLine(line); | ||
3530 | 1286 | |||
3531 | 1287 | $(e.currentTarget).popover('destroy'); | ||
3532 | 1288 | self.updateAccountingViewMatchedLines(); | ||
3533 | 1289 | self.updateBalance(); | ||
3534 | 1290 | e.stopPropagation(); | ||
3535 | 1291 | }, | ||
3536 | 1292 | |||
3537 | 1293 | unpartialReconcileLine: function(line) { | ||
3538 | 1294 | if (line.initial_amount > 0) { | ||
3539 | 1295 | line.debit = line.initial_amount; | ||
3540 | 1296 | line.debit_str = this.formatCurrency(line.debit); | ||
3541 | 1297 | } else { | ||
3542 | 1298 | line.credit = -1 * line.initial_amount; | ||
3543 | 1299 | line.credit_str = this.formatCurrency(line.credit); | ||
3544 | 1300 | } | ||
3545 | 1301 | line.propose_partial_reconcile = true; | ||
3546 | 1302 | line.partial_reconcile = false; | ||
3547 | 1303 | }, | ||
3548 | 1304 | |||
3549 | 1305 | updateBalance: function() { | ||
3550 | 1306 | var self = this; | ||
3551 | 1307 | var mv_lines_selected = self.get("mv_lines_selected"); | ||
3552 | 1308 | var balance = 0; | ||
3553 | 1309 | balance -= self.st_line.amount; | ||
3554 | 1310 | _.each(mv_lines_selected, function(o) { | ||
3555 | 1311 | balance = balance - o.debit + o.credit; | ||
3556 | 1312 | }); | ||
3557 | 1313 | _.each(self.getCreatedLines(), function(o) { | ||
3558 | 1314 | balance += o.amount; | ||
3559 | 1315 | }); | ||
3560 | 1316 | self.set("balance", balance); | ||
3561 | 1317 | |||
3562 | 1318 | // Propose partial reconciliation if necessary | ||
3563 | 1319 | var lines_selected_num = mv_lines_selected.length; | ||
3564 | 1320 | var lines_created_num = self.getCreatedLines().length; | ||
3565 | 1321 | if (lines_selected_num === 1 && lines_created_num === 0 && self.st_line.amount * balance > 0) { | ||
3566 | 1322 | mv_lines_selected[0].propose_partial_reconcile = true; | ||
3567 | 1323 | self.updateAccountingViewMatchedLines(); | ||
3568 | 1324 | } | ||
3569 | 1325 | if (lines_selected_num !== 1 || lines_created_num !== 0) { | ||
3570 | 1326 | // remove partial reconciliation stuff if necessary | ||
3571 | 1327 | _.each(mv_lines_selected, function(line) { | ||
3572 | 1328 | if (line.partial_reconcile === true) self.unpartialReconcileLine(line); | ||
3573 | 1329 | if (line.propose_partial_reconcile === true) line.propose_partial_reconcile = false; | ||
3574 | 1330 | }); | ||
3575 | 1331 | self.updateAccountingViewMatchedLines(); | ||
3576 | 1332 | } | ||
3577 | 1333 | }, | ||
3578 | 1334 | |||
3579 | 1335 | loadReconciliationProposition: function() { | ||
3580 | 1336 | var self = this; | ||
3581 | 1337 | return self.model_bank_statement_line | ||
3582 | 1338 | .call("get_reconciliation_proposition", [self.st_line.id, self.getParent().excluded_move_lines_ids[self.partner_id]]) | ||
3583 | 1339 | .then(function (lines) { | ||
3584 | 1340 | _(lines).each(self.decorateMoveLine.bind(self)); | ||
3585 | 1341 | self.set("mv_lines_selected", self.get("mv_lines_selected").concat(lines)); | ||
3586 | 1342 | }); | ||
3587 | 1343 | }, | ||
3588 | 1344 | |||
3589 | 1345 | // Loads move lines according to the widget's state | ||
3590 | 1346 | updateMatches: function() { | ||
3591 | 1347 | var self = this; | ||
3592 | 1348 | var deselected_lines_num = self.mv_lines_deselected.length; | ||
3593 | 1349 | var move_lines = {}; | ||
3594 | 1350 | var move_lines_num = 0; | ||
3595 | 1351 | var offset = self.get("pager_index") * self.max_move_lines_displayed - deselected_lines_num; | ||
3596 | 1352 | if (offset < 0) offset = 0; | ||
3597 | 1353 | var limit = (self.get("pager_index")+1) * self.max_move_lines_displayed - deselected_lines_num; | ||
3598 | 1354 | if (limit > self.max_move_lines_displayed) limit = self.max_move_lines_displayed; | ||
3599 | 1355 | var excluded_ids = _.collect(self.get("mv_lines_selected").concat(self.mv_lines_deselected), function(o){ return o.id }); | ||
3600 | 1356 | excluded_ids = excluded_ids.concat(self.getParent().excluded_move_lines_ids[self.partner_id]); | ||
3601 | 1357 | |||
3602 | 1358 | var deferred_move_lines; | ||
3603 | 1359 | if (limit > 0) { | ||
3604 | 1360 | // Load move lines | ||
3605 | 1361 | deferred_move_lines = self.model_bank_statement_line | ||
3606 | 1362 | .call("get_move_lines_counterparts", [self.st_line.id, excluded_ids, self.filter, offset, limit]) | ||
3607 | 1363 | .then(function (lines) { | ||
3608 | 1364 | _(lines).each(self.decorateMoveLine.bind(self)); | ||
3609 | 1365 | move_lines = lines; | ||
3610 | 1366 | }); | ||
3611 | 1367 | } | ||
3612 | 1368 | |||
3613 | 1369 | // Fetch the number of move lines corresponding to this statement line and this filter | ||
3614 | 1370 | var deferred_total_move_lines_num = self.model_bank_statement_line | ||
3615 | 1371 | .call("get_move_lines_counterparts", [self.st_line.id, excluded_ids, self.filter, offset, limit, true]) | ||
3616 | 1372 | .then(function(num){ | ||
3617 | 1373 | move_lines_num = num; | ||
3618 | 1374 | }); | ||
3619 | 1375 | |||
3620 | 1376 | return $.when(deferred_move_lines, deferred_total_move_lines_num).then(function(){ | ||
3621 | 1377 | self.total_move_lines_num = move_lines_num + deselected_lines_num; | ||
3622 | 1378 | self.set("mv_lines", move_lines); | ||
3623 | 1379 | }); | ||
3624 | 1380 | }, | ||
3625 | 1381 | |||
3626 | 1382 | // Changes the partner_id of the statement_line in the DB and reloads the widget | ||
3627 | 1383 | changePartner: function(partner_id) { | ||
3628 | 1384 | var self = this; | ||
3629 | 1385 | self.is_consistent = false; | ||
3630 | 1386 | return self.model_bank_statement_line | ||
3631 | 1387 | // Update model | ||
3632 | 1388 | .call("write", [[self.st_line_id], {'partner_id': partner_id}]) | ||
3633 | 1389 | .then(function () { | ||
3634 | 1390 | return $.when(self.restart(self.get("mode"))).then(function(){ | ||
3635 | 1391 | self.is_consistent = true; | ||
3636 | 1392 | }); | ||
3637 | 1393 | }); | ||
3638 | 1394 | }, | ||
3639 | 1395 | |||
3640 | 1396 | // Returns an object that can be passed to process_reconciliation() | ||
3641 | 1397 | prepareSelectedMoveLineForPersisting: function(line) { | ||
3642 | 1398 | return { | ||
3643 | 1399 | name: line.name, | ||
3644 | 1400 | debit: line.debit, | ||
3645 | 1401 | credit: line.credit, | ||
3646 | 1402 | counterpart_move_line_id: line.id, | ||
3647 | 1403 | }; | ||
3648 | 1404 | }, | ||
3649 | 1405 | |||
3650 | 1406 | // idem | ||
3651 | 1407 | prepareCreatedMoveLineForPersisting: function(line) { | ||
3652 | 1408 | var dict = {}; | ||
3653 | 1409 | |||
3654 | 1410 | if (dict['account_id'] === undefined) | ||
3655 | 1411 | dict['account_id'] = line.account_id; | ||
3656 | 1412 | dict['name'] = line.label; | ||
3657 | 1413 | if (line.amount > 0) dict['credit'] = line.amount; | ||
3658 | 1414 | if (line.amount < 0) dict['debit'] = -1*line.amount; | ||
3659 | 1415 | if (line.tax_id) dict['tax_code_id'] = line.tax_id; | ||
3660 | 1416 | if (line.analytic_account_id) dict['analytic_account_id'] = line.analytic_account_id; | ||
3661 | 1417 | |||
3662 | 1418 | return dict; | ||
3663 | 1419 | }, | ||
3664 | 1420 | |||
3665 | 1421 | // idem | ||
3666 | 1422 | prepareOpenBalanceForPersisting: function() { | ||
3667 | 1423 | var balance = this.get("balance"); | ||
3668 | 1424 | var dict = {}; | ||
3669 | 1425 | |||
3670 | 1426 | dict['account_id'] = this.st_line.open_balance_account_id; | ||
3671 | 1427 | dict['name'] = _t("Open balance"); | ||
3672 | 1428 | if (balance > 0) dict['debit'] = balance; | ||
3673 | 1429 | if (balance < 0) dict['credit'] = -1*balance; | ||
3674 | 1430 | |||
3675 | 1431 | return dict; | ||
3676 | 1432 | }, | ||
3677 | 1433 | |||
3678 | 1434 | // Persist data, notify parent view and terminate widget | ||
3679 | 1435 | persistAndDestroy: function() { | ||
3680 | 1436 | var self = this; | ||
3681 | 1437 | if (! self.is_consistent) return; | ||
3682 | 1438 | |||
3683 | 1439 | self.getParent().unexcludeMoveLines(self, self.partner_id, _.map(self.get("mv_lines_selected"), function(o){ return o.id })); | ||
3684 | 1440 | |||
3685 | 1441 | // Prepare data | ||
3686 | 1442 | var mv_line_dicts = []; | ||
3687 | 1443 | _.each(self.get("mv_lines_selected"), function(o) { mv_line_dicts.push(self.prepareSelectedMoveLineForPersisting(o)) }); | ||
3688 | 1444 | _.each(self.getCreatedLines(), function(o) { mv_line_dicts.push(self.prepareCreatedMoveLineForPersisting(o)) }); | ||
3689 | 1445 | if (Math.abs(self.get("balance")).toFixed(3) !== "0.000") mv_line_dicts.push(self.prepareOpenBalanceForPersisting()); | ||
3690 | 1446 | |||
3691 | 1447 | // Sliding animation | ||
3692 | 1448 | var height = self.$el.outerHeight(); | ||
3693 | 1449 | var container = $("<div />"); | ||
3694 | 1450 | container.css("height", height) | ||
3695 | 1451 | .css("marginTop", self.$el.css("marginTop")) | ||
3696 | 1452 | .css("marginBottom", self.$el.css("marginBottom")); | ||
3697 | 1453 | self.$el.wrap(container); | ||
3698 | 1454 | var deferred_animation = self.$el.parent().slideUp(self.animation_speed*height/150); | ||
3699 | 1455 | |||
3700 | 1456 | // RPC | ||
3701 | 1457 | return self.model_bank_statement_line | ||
3702 | 1458 | .call("process_reconciliation", [self.st_line_id, mv_line_dicts]) | ||
3703 | 1459 | .then(function () { | ||
3704 | 1460 | $.each(self.$(".bootstrap_popover"), function(){ $(this).popover('destroy') }); | ||
3705 | 1461 | return $.when(deferred_animation).then(function(){ | ||
3706 | 1462 | self.$el.parent().remove(); | ||
3707 | 1463 | var parent = self.getParent(); | ||
3708 | 1464 | return $.when(self.destroy()).then(function() { | ||
3709 | 1465 | parent.childValidated(self); | ||
3710 | 1466 | }); | ||
3711 | 1467 | }); | ||
3712 | 1468 | }, function(){ | ||
3713 | 1469 | self.$el.parent().slideDown(self.animation_speed*height/150, function(){ | ||
3714 | 1470 | self.$el.unwrap(); | ||
3715 | 1471 | }); | ||
3716 | 1472 | }); | ||
3717 | 1473 | |||
3718 | 1474 | }, | ||
3719 | 1475 | }); | ||
3720 | 1476 | |||
3721 | 9 | instance.web.views.add('tree_account_reconciliation', 'instance.web.account.ReconciliationListView'); | 1477 | instance.web.views.add('tree_account_reconciliation', 'instance.web.account.ReconciliationListView'); |
3722 | 10 | instance.web.account.ReconciliationListView = instance.web.ListView.extend({ | 1478 | instance.web.account.ReconciliationListView = instance.web.ListView.extend({ |
3723 | 11 | init: function() { | 1479 | init: function() { |
3724 | 12 | 1480 | ||
3725 | === added file 'account/static/src/xml/account_bank_statement_reconciliation.xml' | |||
3726 | --- account/static/src/xml/account_bank_statement_reconciliation.xml 1970-01-01 00:00:00 +0000 | |||
3727 | +++ account/static/src/xml/account_bank_statement_reconciliation.xml 2014-05-30 16:18:57 +0000 | |||
3728 | @@ -0,0 +1,194 @@ | |||
3729 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
3730 | 2 | |||
3731 | 3 | <templates xml:space="preserve"> | ||
3732 | 4 | |||
3733 | 5 | <t t-name="bank_statement_nothing_to_reconcile"> | ||
3734 | 6 | <div class="oe_form_sheetbg"><div class="oe_form_sheet oe_form_sheet_width"> | ||
3735 | 7 | <div class="oe_view_nocontent"><p> | ||
3736 | 8 | <b>Good Job!</b> Bank statements are fully reconciled.</p> | ||
3737 | 9 | <p>This page displays all the bank transactions that are to be reconciled and provides with a neat interface to do so.</p> | ||
3738 | 10 | </div> | ||
3739 | 11 | </div></div> | ||
3740 | 12 | </t> | ||
3741 | 13 | |||
3742 | 14 | <t t-name="bank_statement_reconciliation"> | ||
3743 | 15 | <div class="oe_form_sheetbg"><div class="oe_form_sheet oe_form_sheet_width"> | ||
3744 | 16 | <h1><t t-esc="title"/></h1> | ||
3745 | 17 | <div class="progress progress-striped"> | ||
3746 | 18 | <div class="progress-text"><span class="valuenow">0</span> / <span class="valuemax"><t t-esc="total_lines"/></span></div> | ||
3747 | 19 | <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" t-att-aria-valuemax="total_lines" style="width: 0%;"> | ||
3748 | 20 | </div> | ||
3749 | 21 | </div> | ||
3750 | 22 | <div class="oe_clear"></div> | ||
3751 | 23 | <div class="reconciliation_lines_container"></div> | ||
3752 | 24 | <p class='protip'>Tip : Hit ctrl-enter to validate the whole sheet.</p> | ||
3753 | 25 | </div></div> | ||
3754 | 26 | </t> | ||
3755 | 27 | |||
3756 | 28 | <t t-name="bank_statement_reconciliation_done_message"> | ||
3757 | 29 | <div class='done_message'> | ||
3758 | 30 | <h2><t t-raw="title" /></h2> | ||
3759 | 31 | <p>It took you <strong><t t-esc="time_taken" /></strong> to reconcile <strong><t t-esc="transactions_done" /> transactions.<br/></strong> That's on average <t t-esc="sec_per_item" /> seconds per transaction.</p> | ||
3760 | 32 | <t t-if="done_with_ctrl_enter !== 0"> | ||
3761 | 33 | <p>You validated <t t-esc="done_with_ctrl_enter" /> reconciliations with the ctrl-enter shortcut.</p> | ||
3762 | 34 | </t> | ||
3763 | 35 | <p class='achievements'> | ||
3764 | 36 | <t t-foreach="achievements" t-as="achievement"> | ||
3765 | 37 | <i class='fa fa-certificate achievement' t-att-data-title='achievement.title' t-att-data-content='achievement.desc'><i t-att-class="'fa '+achievement.icon"></i></i> | ||
3766 | 38 | </t> | ||
3767 | 39 | </p> | ||
3768 | 40 | <p class="action_buttons"> | ||
3769 | 41 | <t t-if="has_statement_id"> | ||
3770 | 42 | <button class="button_back_to_statement">Back to statement</button> | ||
3771 | 43 | <button class="button_close_statement">Close the statement</button> | ||
3772 | 44 | </t> | ||
3773 | 45 | </p> | ||
3774 | 46 | </div> | ||
3775 | 47 | </t> | ||
3776 | 48 | |||
3777 | 49 | <t t-name="bank_statement_reconciliation_line"> | ||
3778 | 50 | <table t-att-data-mode="mode"> | ||
3779 | 51 | <tr> | ||
3780 | 52 | <td> | ||
3781 | 53 | <table class="accounting_view"> | ||
3782 | 54 | <caption> | ||
3783 | 55 | <button class="button_ok"></button> | ||
3784 | 56 | <span class="partner_name"><t t-esc="line.partner_name"/></span> | ||
3785 | 57 | <div class="change_partner_container oe_form"></div> | ||
3786 | 58 | </caption> | ||
3787 | 59 | <tbody class="tbody_initial_line"> | ||
3788 | 60 | <tr class="initial_line"> | ||
3789 | 61 | <td><span class="toggle_match glyphicon glyphicon-cog"></span></td> | ||
3790 | 62 | <td><t t-esc="line.account_code"/></td> | ||
3791 | 63 | <td><t t-esc="line.date"/></td> | ||
3792 | 64 | <td><t t-esc="line.name"/> | ||
3793 | 65 | <t t-if="line.amount_currency_str"> (<t t-esc="line.amount_currency_str"/>)</t></td> | ||
3794 | 66 | <td><t t-if="line.amount > 0"> | ||
3795 | 67 | <t t-esc="line.amount_str"/></t></td> | ||
3796 | 68 | <td><t t-if="line.amount < 0"> | ||
3797 | 69 | <t t-esc="line.amount_str"/></t></td> | ||
3798 | 70 | <td><span class="line_info_button glyphicon glyphicon-info-sign" t-att-data-content="line.q_popover"></span></td> | ||
3799 | 71 | </tr> | ||
3800 | 72 | </tbody> | ||
3801 | 73 | <tbody class="tbody_matched_lines"></tbody> | ||
3802 | 74 | <tbody class="tbody_created_lines"></tbody> | ||
3803 | 75 | <tbody class="tbody_open_balance"></tbody> | ||
3804 | 76 | </table> | ||
3805 | 77 | </td> | ||
3806 | 78 | </tr> | ||
3807 | 79 | <tr> | ||
3808 | 80 | <td> | ||
3809 | 81 | <div class="action_pane match"> | ||
3810 | 82 | <div class="match_controls"> | ||
3811 | 83 | <input type="text" class="filter" placeholder="Filter" value="" /> | ||
3812 | 84 | <span class="pager_control_right pull-right glyphicon glyphicon-chevron-right"></span> | ||
3813 | 85 | <span class="pager_control_left pull-right glyphicon glyphicon-chevron-left"></span> | ||
3814 | 86 | </div> | ||
3815 | 87 | <table></table> | ||
3816 | 88 | </div> | ||
3817 | 89 | |||
3818 | 90 | <div class="action_pane create"> | ||
3819 | 91 | <!-- NB : I use a .quick_add:empty selector. whitespace characters being a node, there shall be none --> | ||
3820 | 92 | <div class="quick_add btn-group btn-group-sm"><t t-foreach="presets" t-as="preset"><button type='button' class='btn btn-default preset' t-att-data-presetid="preset.id"><t t-esc="preset.name"/></button></t></div> | ||
3821 | 93 | <div class="oe_form create_form"> | ||
3822 | 94 | <!-- here come some form_create_field --> | ||
3823 | 95 | <table class="create_field add_line_container"><tr><td><a href="javascript:void(0)" class="add_line">New</a></td></tr></table> | ||
3824 | 96 | </div> | ||
3825 | 97 | </div> | ||
3826 | 98 | </td> | ||
3827 | 99 | </tr> | ||
3828 | 100 | </table> | ||
3829 | 101 | </t> | ||
3830 | 102 | |||
3831 | 103 | <t t-name="filter_no_match"> | ||
3832 | 104 | <tr><td style='text-align: center;'>No result matching '<t t-esc="filter_str" />'</td></tr> | ||
3833 | 105 | </t> | ||
3834 | 106 | |||
3835 | 107 | <t t-name="form_create_field"> | ||
3836 | 108 | <table t-att-class='"create_field create_"+id'><tr> | ||
3837 | 109 | <th><t t-esc="label"/></th> | ||
3838 | 110 | <td class="create_account_container" t-att-class='"create_"+id+"_container"'></td> | ||
3839 | 111 | </tr></table> | ||
3840 | 112 | </t> | ||
3841 | 113 | |||
3842 | 114 | <t t-name="bank_statement_reconciliation_line_details"> | ||
3843 | 115 | <table class='details'> | ||
3844 | 116 | <tr><td>Date</td><td><t t-esc="line.date"/></td></tr> | ||
3845 | 117 | <tr><td>Partner</td><td><t t-esc="line.partner_name"/></td></tr> | ||
3846 | 118 | <tr t-if="line.ref"><td>Transaction</td><td><t t-esc="line.ref"/></td></tr> | ||
3847 | 119 | <tr><td>Description</td><td><t t-esc="line.name"/></td></tr> | ||
3848 | 120 | <tr><td>Amount</td><td><t t-esc="line.amount_str"/><t t-if="line.amount_currency_str"> (<t t-esc="line.amount_currency_str"/>)</t></td></tr> | ||
3849 | 121 | <tr><td>Account</td><td><t t-esc="line.account_code"/> <t t-esc="line.account_name"/></td></tr> | ||
3850 | 122 | </table> | ||
3851 | 123 | </t> | ||
3852 | 124 | |||
3853 | 125 | |||
3854 | 126 | <t t-name="bank_statement_reconciliation_move_line"> | ||
3855 | 127 | <tr class="mv_line" t-att-data-lineid="line.id" t-att-data-selected="selected"> | ||
3856 | 128 | <td><span class="glyphicon glyphicon-add-remove"></span></td> | ||
3857 | 129 | <td><t t-esc="line.account_code"/></td> | ||
3858 | 130 | <td><t t-esc="line.q_due_date"/></td> | ||
3859 | 131 | <td><t t-esc="line.q_label"/></td> | ||
3860 | 132 | |||
3861 | 133 | <td><t t-if="line.debit !== 0"> | ||
3862 | 134 | <t t-if="line.propose_partial_reconcile" t-call="icon_do_partial_reconciliation"></t> | ||
3863 | 135 | <t t-if="line.partial_reconcile" t-call="icon_undo_partial_reconciliation"></t> | ||
3864 | 136 | <t t-esc="line.debit_str"/> | ||
3865 | 137 | </t></td> | ||
3866 | 138 | <td><t t-if="line.credit !== 0"> | ||
3867 | 139 | <t t-if="line.propose_partial_reconcile"><t t-call="icon_do_partial_reconciliation" /></t> | ||
3868 | 140 | <t t-if="line.partial_reconcile"><t t-call="icon_undo_partial_reconciliation" /></t> | ||
3869 | 141 | <t t-esc="line.credit_str"/> | ||
3870 | 142 | </t></td> | ||
3871 | 143 | <td><span class="line_info_button glyphicon glyphicon-info-sign" t-att-data-content="line.q_popover"></span></td> | ||
3872 | 144 | </tr> | ||
3873 | 145 | </t> | ||
3874 | 146 | |||
3875 | 147 | <t t-name="icon_do_partial_reconciliation"> | ||
3876 | 148 | <i class="do_partial_reconcile_button fa fa-exclamation-triangle" data-content="This move's amount is higher than the transaction's amount. Click to do a partial reconciliation"></i> | ||
3877 | 149 | </t> | ||
3878 | 150 | |||
3879 | 151 | <t t-name="icon_undo_partial_reconciliation"> | ||
3880 | 152 | <i class="undo_partial_reconcile_button fa fa-exclamation-triangle" data-content="Undo the partial reconciliation."></i> | ||
3881 | 153 | </t> | ||
3882 | 154 | |||
3883 | 155 | <t t-name="bank_statement_reconciliation_move_line_details"> | ||
3884 | 156 | <table class='details'> | ||
3885 | 157 | <tr><td>ID</td><td><t t-esc="line.id"/></td></tr> | ||
3886 | 158 | <tr><td>Account</td><td><t t-esc="line.account_code"/> <t t-esc="line.account_name"/></td></tr> | ||
3887 | 159 | <tr><td>Journal</td><td><t t-esc="line.journal_name"/></td></tr> | ||
3888 | 160 | <tr><td>Period</td><td><t t-esc="line.period_name"/></td></tr> | ||
3889 | 161 | <tr><td>Date</td><td><t t-esc="line.date"/></td></tr> | ||
3890 | 162 | <tr><td>Due Date</td><td><t t-esc="line.q_due_date"/></td></tr> | ||
3891 | 163 | <tr><td>Amount</td> | ||
3892 | 164 | <td><t t-if="line.debit !== 0" t-esc="line.debit_str"/><t t-if="line.credit !== 0" t-esc="line.credit_str"/> | ||
3893 | 165 | <t t-if="line.amount_currency_str"> (<t t-esc="line.amount_currency_str"/>)</t> | ||
3894 | 166 | </td></tr> | ||
3895 | 167 | </table> | ||
3896 | 168 | </t> | ||
3897 | 169 | |||
3898 | 170 | |||
3899 | 171 | <t t-name="bank_statement_reconciliation_created_line"> | ||
3900 | 172 | <tr class="created_line" t-att-data-lineid="line.id"> | ||
3901 | 173 | <td><t t-if="! line.no_remove_action"><span class="line_remove_button glyphicon glyphicon-remove"></span></t></td> | ||
3902 | 174 | <td><t t-esc="line.account_num"/></td> | ||
3903 | 175 | <td></td> | ||
3904 | 176 | <td><t t-esc="line.label"/></td> | ||
3905 | 177 | <td><t t-if="line.amount < 0"><t t-esc="line.amount_str"/></t></td> | ||
3906 | 178 | <td><t t-if="line.amount > 0"><t t-esc="line.amount_str"/></t></td> | ||
3907 | 179 | <td></td> | ||
3908 | 180 | </tr> | ||
3909 | 181 | </t> | ||
3910 | 182 | |||
3911 | 183 | <t t-name="bank_statement_reconciliation_line_open_balance"> | ||
3912 | 184 | <tr class="line_open_balance"> | ||
3913 | 185 | <td><span class="toggle_create glyphicon glyphicon-play"></span></td> | ||
3914 | 186 | <td><t t-esc="account_code"/></td> | ||
3915 | 187 | <td></td> | ||
3916 | 188 | <td>Open balance</td> | ||
3917 | 189 | <td><t t-esc="debit"/></td> | ||
3918 | 190 | <td><t t-esc="credit"/></td> | ||
3919 | 191 | <td></td> | ||
3920 | 192 | </tr> | ||
3921 | 193 | </t> | ||
3922 | 194 | </templates> | ||
3923 | 0 | 195 | ||
3924 | === modified file 'account/views/account.xml' | |||
3925 | --- account/views/account.xml 2014-04-24 17:21:29 +0000 | |||
3926 | +++ account/views/account.xml 2014-05-30 16:18:57 +0000 | |||
3927 | @@ -8,7 +8,8 @@ | |||
3928 | 8 | <link rel="stylesheet" href="/account/static/src/css/account_move_reconciliation.css"/> | 8 | <link rel="stylesheet" href="/account/static/src/css/account_move_reconciliation.css"/> |
3929 | 9 | <link rel="stylesheet" href="/account/static/src/css/account_move_line_quickadd.css"/> | 9 | <link rel="stylesheet" href="/account/static/src/css/account_move_line_quickadd.css"/> |
3930 | 10 | <link rel="stylesheet" href="/account/static/src/css/account_bank_and_cash.css"/> | 10 | <link rel="stylesheet" href="/account/static/src/css/account_bank_and_cash.css"/> |
3932 | 11 | <script type="text/javascript" src="/account/static/src/js/account_move_reconciliation.js"></script> | 11 | <link rel="stylesheet" href="/account/static/src/css/account_bank_statement_reconciliation.css"/> |
3933 | 12 | <script type="text/javascript" src="/account/static/src/js/account_widgets.js"></script> | ||
3934 | 12 | <script type="text/javascript" src="/account/static/src/js/account_move_line_quickadd.js"></script> | 13 | <script type="text/javascript" src="/account/static/src/js/account_move_line_quickadd.js"></script> |
3935 | 13 | </xpath> | 14 | </xpath> |
3936 | 14 | </template> | 15 | </template> |
3937 | 15 | 16 | ||
3938 | === modified file 'account/wizard/__init__.py' | |||
3939 | --- account/wizard/__init__.py 2012-11-29 22:26:45 +0000 | |||
3940 | +++ account/wizard/__init__.py 2014-05-30 16:18:57 +0000 | |||
3941 | @@ -63,8 +63,6 @@ | |||
3942 | 63 | 63 | ||
3943 | 64 | import account_change_currency | 64 | import account_change_currency |
3944 | 65 | 65 | ||
3947 | 66 | import pos_box; | 66 | import pos_box |
3948 | 67 | 67 | import account_statement_from_invoice | |
3949 | 68 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 68 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3950 | 69 | |||
3951 | 70 | |||
3952 | 71 | 69 | ||
3953 | === renamed file 'account_voucher/wizard/account_statement_from_invoice.py' => 'account/wizard/account_statement_from_invoice.py' | |||
3954 | --- account_voucher/wizard/account_statement_from_invoice.py 2014-02-12 17:51:41 +0000 | |||
3955 | +++ account/wizard/account_statement_from_invoice.py 2014-05-30 16:18:57 +0000 | |||
3956 | @@ -22,7 +22,6 @@ | |||
3957 | 22 | import time | 22 | import time |
3958 | 23 | 23 | ||
3959 | 24 | from openerp.osv import fields, osv | 24 | from openerp.osv import fields, osv |
3960 | 25 | from openerp.tools.translate import _ | ||
3961 | 26 | 25 | ||
3962 | 27 | class account_statement_from_invoice_lines(osv.osv_memory): | 26 | class account_statement_from_invoice_lines(osv.osv_memory): |
3963 | 28 | """ | 27 | """ |
3964 | @@ -35,12 +34,13 @@ | |||
3965 | 35 | } | 34 | } |
3966 | 36 | 35 | ||
3967 | 37 | def populate_statement(self, cr, uid, ids, context=None): | 36 | def populate_statement(self, cr, uid, ids, context=None): |
3968 | 37 | #TODO: can be moved in account module | ||
3969 | 38 | if context is None: | 38 | if context is None: |
3970 | 39 | context = {} | 39 | context = {} |
3971 | 40 | statement_id = context.get('statement_id', False) | 40 | statement_id = context.get('statement_id', False) |
3972 | 41 | if not statement_id: | 41 | if not statement_id: |
3973 | 42 | return {'type': 'ir.actions.act_window_close'} | 42 | return {'type': 'ir.actions.act_window_close'} |
3975 | 43 | data = self.read(cr, uid, ids, context=context)[0] | 43 | data = self.read(cr, uid, ids, context=context)[0] |
3976 | 44 | line_ids = data['line_ids'] | 44 | line_ids = data['line_ids'] |
3977 | 45 | if not line_ids: | 45 | if not line_ids: |
3978 | 46 | return {'type': 'ir.actions.act_window_close'} | 46 | return {'type': 'ir.actions.act_window_close'} |
3979 | @@ -49,14 +49,11 @@ | |||
3980 | 49 | statement_obj = self.pool.get('account.bank.statement') | 49 | statement_obj = self.pool.get('account.bank.statement') |
3981 | 50 | statement_line_obj = self.pool.get('account.bank.statement.line') | 50 | statement_line_obj = self.pool.get('account.bank.statement.line') |
3982 | 51 | currency_obj = self.pool.get('res.currency') | 51 | currency_obj = self.pool.get('res.currency') |
3983 | 52 | voucher_obj = self.pool.get('account.voucher') | ||
3984 | 53 | voucher_line_obj = self.pool.get('account.voucher.line') | ||
3985 | 54 | line_date = time.strftime('%Y-%m-%d') | 52 | line_date = time.strftime('%Y-%m-%d') |
3986 | 55 | statement = statement_obj.browse(cr, uid, statement_id, context=context) | 53 | statement = statement_obj.browse(cr, uid, statement_id, context=context) |
3987 | 56 | 54 | ||
3988 | 57 | # for each selected move lines | 55 | # for each selected move lines |
3989 | 58 | for line in line_obj.browse(cr, uid, line_ids, context=context): | 56 | for line in line_obj.browse(cr, uid, line_ids, context=context): |
3990 | 59 | voucher_res = {} | ||
3991 | 60 | ctx = context.copy() | 57 | ctx = context.copy() |
3992 | 61 | # take the date for computation of currency => use payment date | 58 | # take the date for computation of currency => use payment date |
3993 | 62 | ctx['date'] = line_date | 59 | ctx['date'] = line_date |
3994 | @@ -70,55 +67,19 @@ | |||
3995 | 70 | if line.amount_currency: | 67 | if line.amount_currency: |
3996 | 71 | amount = currency_obj.compute(cr, uid, line.currency_id.id, | 68 | amount = currency_obj.compute(cr, uid, line.currency_id.id, |
3997 | 72 | statement.currency.id, line.amount_currency, context=ctx) | 69 | statement.currency.id, line.amount_currency, context=ctx) |
3999 | 73 | elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id): | 70 | elif (line.invoice and line.invoice.currency_id.id != statement.currency.id): |
4000 | 74 | amount = currency_obj.compute(cr, uid, line.invoice.currency_id.id, | 71 | amount = currency_obj.compute(cr, uid, line.invoice.currency_id.id, |
4001 | 75 | statement.currency.id, amount, context=ctx) | 72 | statement.currency.id, amount, context=ctx) |
4002 | 76 | 73 | ||
4003 | 77 | context.update({'move_line_ids': [line.id], | 74 | context.update({'move_line_ids': [line.id], |
4004 | 78 | 'invoice_id': line.invoice.id}) | 75 | 'invoice_id': line.invoice.id}) |
4039 | 79 | type = 'general' | 76 | |
4006 | 80 | ttype = amount < 0 and 'payment' or 'receipt' | ||
4007 | 81 | sign = 1 | ||
4008 | 82 | if line.journal_id.type in ('sale', 'sale_refund'): | ||
4009 | 83 | type = 'customer' | ||
4010 | 84 | ttype = 'receipt' | ||
4011 | 85 | elif line.journal_id.type in ('purchase', 'purhcase_refund'): | ||
4012 | 86 | type = 'supplier' | ||
4013 | 87 | ttype = 'payment' | ||
4014 | 88 | sign = -1 | ||
4015 | 89 | result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, amount=sign*amount, currency_id= statement.currency.id, ttype=ttype, date=line_date, context=context) | ||
4016 | 90 | voucher_res = { 'type': ttype, | ||
4017 | 91 | 'name': line.name, | ||
4018 | 92 | 'partner_id': line.partner_id.id, | ||
4019 | 93 | 'journal_id': statement.journal_id.id, | ||
4020 | 94 | 'account_id': result['value'].get('account_id', statement.journal_id.default_credit_account_id.id), | ||
4021 | 95 | 'company_id': statement.company_id.id, | ||
4022 | 96 | 'currency_id': statement.currency.id, | ||
4023 | 97 | 'date': statement.date, | ||
4024 | 98 | 'amount': sign*amount, | ||
4025 | 99 | 'payment_rate': result['value']['payment_rate'], | ||
4026 | 100 | 'payment_rate_currency_id': result['value']['payment_rate_currency_id'], | ||
4027 | 101 | 'period_id':statement.period_id.id} | ||
4028 | 102 | voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) | ||
4029 | 103 | |||
4030 | 104 | voucher_line_dict = {} | ||
4031 | 105 | for line_dict in result['value']['line_cr_ids'] + result['value']['line_dr_ids']: | ||
4032 | 106 | move_line = line_obj.browse(cr, uid, line_dict['move_line_id'], context) | ||
4033 | 107 | if line.move_id.id == move_line.move_id.id: | ||
4034 | 108 | voucher_line_dict = line_dict | ||
4035 | 109 | |||
4036 | 110 | if voucher_line_dict: | ||
4037 | 111 | voucher_line_dict.update({'voucher_id': voucher_id}) | ||
4038 | 112 | voucher_line_obj.create(cr, uid, voucher_line_dict, context=context) | ||
4040 | 113 | statement_line_obj.create(cr, uid, { | 77 | statement_line_obj.create(cr, uid, { |
4041 | 114 | 'name': line.name or '?', | 78 | 'name': line.name or '?', |
4042 | 115 | 'amount': amount, | 79 | 'amount': amount, |
4043 | 116 | 'type': type, | ||
4044 | 117 | 'partner_id': line.partner_id.id, | 80 | 'partner_id': line.partner_id.id, |
4045 | 118 | 'account_id': line.account_id.id, | ||
4046 | 119 | 'statement_id': statement_id, | 81 | 'statement_id': statement_id, |
4047 | 120 | 'ref': line.ref, | 82 | 'ref': line.ref, |
4048 | 121 | 'voucher_id': voucher_id, | ||
4049 | 122 | 'date': statement.date, | 83 | 'date': statement.date, |
4050 | 123 | }, context=context) | 84 | }, context=context) |
4051 | 124 | return {'type': 'ir.actions.act_window_close'} | 85 | return {'type': 'ir.actions.act_window_close'} |
4052 | 125 | 86 | ||
4053 | === renamed file 'account_voucher/wizard/account_statement_from_invoice_view.xml' => 'account/wizard/account_statement_from_invoice_view.xml' | |||
4054 | === modified file 'account/wizard/pos_box.py' | |||
4055 | --- account/wizard/pos_box.py 2013-12-27 15:35:17 +0000 | |||
4056 | +++ account/wizard/pos_box.py 2014-05-30 16:18:57 +0000 | |||
4057 | @@ -56,7 +56,6 @@ | |||
4058 | 56 | return { | 56 | return { |
4059 | 57 | 'statement_id' : record.id, | 57 | 'statement_id' : record.id, |
4060 | 58 | 'journal_id' : record.journal_id.id, | 58 | 'journal_id' : record.journal_id.id, |
4061 | 59 | 'account_id' : record.journal_id.internal_account_id.id, | ||
4062 | 60 | 'amount' : box.amount or 0.0, | 59 | 'amount' : box.amount or 0.0, |
4063 | 61 | 'ref' : '%s' % (box.ref or ''), | 60 | 'ref' : '%s' % (box.ref or ''), |
4064 | 62 | 'name' : box.name, | 61 | 'name' : box.name, |
4065 | @@ -73,7 +72,6 @@ | |||
4066 | 73 | return { | 72 | return { |
4067 | 74 | 'statement_id' : record.id, | 73 | 'statement_id' : record.id, |
4068 | 75 | 'journal_id' : record.journal_id.id, | 74 | 'journal_id' : record.journal_id.id, |
4069 | 76 | 'account_id' : record.journal_id.internal_account_id.id, | ||
4070 | 77 | 'amount' : -amount if amount > 0.0 else amount, | 75 | 'amount' : -amount if amount > 0.0 else amount, |
4071 | 78 | 'name' : box.name, | 76 | 'name' : box.name, |
4072 | 79 | } | 77 | } |
4073 | 80 | 78 | ||
4074 | === modified file 'account_analytic_plans/__openerp__.py' | |||
4075 | --- account_analytic_plans/__openerp__.py 2014-04-02 16:40:53 +0000 | |||
4076 | +++ account_analytic_plans/__openerp__.py 2014-05-30 16:18:57 +0000 | |||
4077 | @@ -74,6 +74,7 @@ | |||
4078 | 74 | 'wizard/analytic_plan_create_model_view.xml', | 74 | 'wizard/analytic_plan_create_model_view.xml', |
4079 | 75 | 'wizard/account_crossovered_analytic_view.xml', | 75 | 'wizard/account_crossovered_analytic_view.xml', |
4080 | 76 | 'views/report_crossoveredanalyticplans.xml', | 76 | 'views/report_crossoveredanalyticplans.xml', |
4081 | 77 | 'views/account_analytic_plans.xml', | ||
4082 | 77 | ], | 78 | ], |
4083 | 78 | 'demo': [], | 79 | 'demo': [], |
4084 | 79 | 'test': ['test/acount_analytic_plans_report.yml'], | 80 | 'test': ['test/acount_analytic_plans_report.yml'], |
4085 | 80 | 81 | ||
4086 | === modified file 'account_analytic_plans/account_analytic_plans_view.xml' | |||
4087 | --- account_analytic_plans/account_analytic_plans_view.xml 2014-02-10 05:26:55 +0000 | |||
4088 | +++ account_analytic_plans/account_analytic_plans_view.xml 2014-05-30 16:18:57 +0000 | |||
4089 | @@ -233,57 +233,25 @@ | |||
4090 | 233 | 233 | ||
4091 | 234 | <!-- add property field on default analytic account--> | 234 | <!-- add property field on default analytic account--> |
4092 | 235 | 235 | ||
4145 | 236 | <record model="ir.ui.view" id="view_default_inherit_form"> | 236 | <record model="ir.ui.view" id="view_default_inherit_form"> |
4146 | 237 | <field name="name">account.analytic.default.form.plans</field> | 237 | <field name="name">account.analytic.default.form.plans</field> |
4147 | 238 | <field name="model">account.analytic.default</field> | 238 | <field name="model">account.analytic.default</field> |
4148 | 239 | <field name="inherit_id" ref="account_analytic_default.view_account_analytic_default_form"/> | 239 | <field name="inherit_id" ref="account_analytic_default.view_account_analytic_default_form"/> |
4149 | 240 | <field name="arch" type="xml"> | 240 | <field name="arch" type="xml"> |
4150 | 241 | <field name="analytic_id" required="1" position="replace"> | 241 | <field name="analytic_id" required="1" position="replace"> |
4151 | 242 | <field name="analytics_id" required="1"/> | 242 | <field name="analytics_id" required="1"/> |
4152 | 243 | </field> | 243 | </field> |
4153 | 244 | </field> | 244 | </field> |
4154 | 245 | </record> | 245 | </record> |
4155 | 246 | <record model="ir.ui.view" id="view_default_inherit_tree"> | 246 | <record model="ir.ui.view" id="view_default_inherit_tree"> |
4156 | 247 | <field name="name">account.analytic.default.tree.plans</field> | 247 | <field name="name">account.analytic.default.tree.plans</field> |
4157 | 248 | <field name="model">account.analytic.default</field> | 248 | <field name="model">account.analytic.default</field> |
4158 | 249 | <field name="inherit_id" ref="account_analytic_default.view_account_analytic_default_tree"/> | 249 | <field name="inherit_id" ref="account_analytic_default.view_account_analytic_default_tree"/> |
4159 | 250 | <field name="arch" type="xml"> | 250 | <field name="arch" type="xml"> |
4160 | 251 | <xpath expr="//field[@name='analytic_id']" position="attributes"> | 251 | <xpath expr="//field[@name='analytic_id']" position="replace"> |
4161 | 252 | <attribute name="invisible">1</attribute> | 252 | <field name="analytics_id" required="1"/> |
4162 | 253 | </xpath> | 253 | </xpath> |
4163 | 254 | <xpath expr="//field[@name='analytic_id']" position="after"> | 254 | </field> |
4164 | 255 | <field name="analytics_id" required="1"/> | 255 | </record> |
4113 | 256 | </xpath> | ||
4114 | 257 | </field> | ||
4115 | 258 | </record> | ||
4116 | 259 | |||
4117 | 260 | <record id="view_bank_statement_inherit_form" model="ir.ui.view"> | ||
4118 | 261 | <field name="name">account.bank.statement.form.inherit</field> | ||
4119 | 262 | <field name="model">account.bank.statement</field> | ||
4120 | 263 | <field name="inherit_id" ref="account.view_bank_statement_form"/> | ||
4121 | 264 | <field name="arch" type="xml"> | ||
4122 | 265 | <xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/tree/field[@name='analytic_account_id']" position="replace"> | ||
4123 | 266 | <field name="analytics_id" groups="analytic.group_analytic_accounting"/> | ||
4124 | 267 | </xpath> | ||
4125 | 268 | <xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/form/group/field[@name='analytic_account_id']" position="replace"> | ||
4126 | 269 | <field name="analytics_id" groups="analytic.group_analytic_accounting"/> | ||
4127 | 270 | </xpath> | ||
4128 | 271 | </field> | ||
4129 | 272 | </record> | ||
4130 | 273 | |||
4131 | 274 | <record id="view_bank_statement_inherit_form2" model="ir.ui.view"> | ||
4132 | 275 | <field name="name">account.bank.statement.form.inherit</field> | ||
4133 | 276 | <field name="model">account.bank.statement</field> | ||
4134 | 277 | <field name="inherit_id" ref="account.view_bank_statement_form2"/> | ||
4135 | 278 | <field name="arch" type="xml"> | ||
4136 | 279 | <xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/tree/field[@name='analytic_account_id']" position="replace"> | ||
4137 | 280 | <field name="analytics_id" groups="analytic.group_analytic_accounting"/> | ||
4138 | 281 | </xpath> | ||
4139 | 282 | <xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/form/group/field[@name='analytic_account_id']" position="replace"> | ||
4140 | 283 | <field name="analytics_id" groups="analytic.group_analytic_accounting"/> | ||
4141 | 284 | </xpath> | ||
4142 | 285 | </field> | ||
4143 | 286 | </record> | ||
4144 | 287 | |||
4165 | 288 | </data> | 256 | </data> |
4166 | 289 | </openerp> | 257 | </openerp> |
4167 | 290 | 258 | ||
4168 | === added directory 'account_analytic_plans/static' | |||
4169 | === added directory 'account_analytic_plans/static/src' | |||
4170 | === added directory 'account_analytic_plans/static/src/js' | |||
4171 | === added file 'account_analytic_plans/static/src/js/account_bank_reconciliation.js' | |||
4172 | --- account_analytic_plans/static/src/js/account_bank_reconciliation.js 1970-01-01 00:00:00 +0000 | |||
4173 | +++ account_analytic_plans/static/src/js/account_bank_reconciliation.js 2014-05-30 16:18:57 +0000 | |||
4174 | @@ -0,0 +1,35 @@ | |||
4175 | 1 | openerp.account_analytic_plans = function(instance) { | ||
4176 | 2 | |||
4177 | 3 | var _t = instance.web._t, | ||
4178 | 4 | _lt = instance.web._lt; | ||
4179 | 5 | var QWeb = instance.web.qweb; | ||
4180 | 6 | |||
4181 | 7 | instance.web.account.bankStatementReconciliation.include({ | ||
4182 | 8 | |||
4183 | 9 | init: function(parent, context) { | ||
4184 | 10 | this._super(parent, context); | ||
4185 | 11 | delete this.create_form_fields.analytic_account_id; | ||
4186 | 12 | this.create_form_fields["analytic_plan"] = { | ||
4187 | 13 | id: "analytic_plan", | ||
4188 | 14 | index: 4, | ||
4189 | 15 | corresponding_property: "analytics_id", | ||
4190 | 16 | label: _t("Analytic Distribution"), | ||
4191 | 17 | required: false, | ||
4192 | 18 | tabindex: 14, | ||
4193 | 19 | group: "analytic.group_analytic_accounting", | ||
4194 | 20 | constructor: instance.web.form.FieldMany2One, | ||
4195 | 21 | field_properties: { | ||
4196 | 22 | relation: "account.analytic.plan.instance", | ||
4197 | 23 | string: _t("Analytic Distribution"), | ||
4198 | 24 | type: "many2one", | ||
4199 | 25 | } | ||
4200 | 26 | }; | ||
4201 | 27 | }, | ||
4202 | 28 | |||
4203 | 29 | start: function() { | ||
4204 | 30 | return this._super().then(function() { | ||
4205 | 31 | }); | ||
4206 | 32 | }, | ||
4207 | 33 | |||
4208 | 34 | }); | ||
4209 | 35 | }; | ||
4210 | 0 | 36 | ||
4211 | === added file 'account_analytic_plans/views/account_analytic_plans.xml' | |||
4212 | --- account_analytic_plans/views/account_analytic_plans.xml 1970-01-01 00:00:00 +0000 | |||
4213 | +++ account_analytic_plans/views/account_analytic_plans.xml 2014-05-30 16:18:57 +0000 | |||
4214 | @@ -0,0 +1,12 @@ | |||
4215 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
4216 | 2 | <!-- vim:fdn=3: | ||
4217 | 3 | --> | ||
4218 | 4 | <openerp> | ||
4219 | 5 | <data> | ||
4220 | 6 | <template id="assets_backend" name="account analytic plans assets" inherit_id="web.assets_backend"> | ||
4221 | 7 | <xpath expr="." position="inside"> | ||
4222 | 8 | <script type="text/javascript" src="/account_analytic_plans/static/src/js/account_bank_reconciliation.js"></script> | ||
4223 | 9 | </xpath> | ||
4224 | 10 | </template> | ||
4225 | 11 | </data> | ||
4226 | 12 | </openerp> | ||
4227 | 0 | 13 | ||
4228 | === modified file 'account_bank_statement_extensions/account_bank_statement_view.xml' | |||
4229 | --- account_bank_statement_extensions/account_bank_statement_view.xml 2012-11-29 22:26:45 +0000 | |||
4230 | +++ account_bank_statement_extensions/account_bank_statement_view.xml 2014-05-30 16:18:57 +0000 | |||
4231 | @@ -74,10 +74,7 @@ | |||
4232 | 74 | <field name="name"/> | 74 | <field name="name"/> |
4233 | 75 | <field name="statement_id"/> | 75 | <field name="statement_id"/> |
4234 | 76 | <field name="ref" readonly="1"/> | 76 | <field name="ref" readonly="1"/> |
4239 | 77 | <field name="partner_id" on_change="onchange_partner_id(partner_id)"/> | 77 | <field name="partner_id"/> |
4236 | 78 | <field name="type" on_change="onchange_type(partner_id, type)"/> | ||
4237 | 79 | <field name="account_id"/> | ||
4238 | 80 | <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('type', '<>', 'view')]"/> | ||
4240 | 81 | <field name="amount" readonly="1" sum="Total Amount"/> | 78 | <field name="amount" readonly="1" sum="Total Amount"/> |
4241 | 82 | <field name="globalisation_id" string="Glob. Id"/> | 79 | <field name="globalisation_id" string="Glob. Id"/> |
4242 | 83 | <field name="globalisation_amount" string="Glob. Am."/> | 80 | <field name="globalisation_amount" string="Glob. Am."/> |
4243 | @@ -98,10 +95,7 @@ | |||
4244 | 98 | <field name="val_date"/> | 95 | <field name="val_date"/> |
4245 | 99 | <field name="name"/> | 96 | <field name="name"/> |
4246 | 100 | <field name="ref" readonly="0"/> | 97 | <field name="ref" readonly="0"/> |
4251 | 101 | <field name="partner_id" on_change="onchange_partner_id(partner_id)"/> | 98 | <field name="partner_id"/> |
4248 | 102 | <field name="type" on_change="onchange_type(partner_id, type)"/> | ||
4249 | 103 | <field domain="[('type', '<>', 'view')]" name="account_id"/> | ||
4250 | 104 | <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('type', '<>', 'view')]"/> | ||
4252 | 105 | <field name="amount"/> | 99 | <field name="amount"/> |
4253 | 106 | <field name="globalisation_id"/> | 100 | <field name="globalisation_id"/> |
4254 | 107 | <field name="sequence" readonly="0"/> | 101 | <field name="sequence" readonly="0"/> |
4255 | @@ -129,7 +123,6 @@ | |||
4256 | 129 | <field name="statement_id"/> | 123 | <field name="statement_id"/> |
4257 | 130 | <field name="globalisation_id" string="Glob. Id"/> | 124 | <field name="globalisation_id" string="Glob. Id"/> |
4258 | 131 | <group string="Extended Filters..." expand="0"> | 125 | <group string="Extended Filters..." expand="0"> |
4259 | 132 | <field name="account_id"/> | ||
4260 | 133 | <field name="partner_id"/> | 126 | <field name="partner_id"/> |
4261 | 134 | <field name="amount"/> | 127 | <field name="amount"/> |
4262 | 135 | <field name="globalisation_amount" string="Glob. Amount"/> | 128 | <field name="globalisation_amount" string="Glob. Amount"/> |
4263 | @@ -138,7 +131,6 @@ | |||
4264 | 138 | <group string="Group By..." expand="1"> | 131 | <group string="Group By..." expand="1"> |
4265 | 139 | <filter string="Journal" context="{'group_by':'journal_id'}" icon="terp-folder-green"/> | 132 | <filter string="Journal" context="{'group_by':'journal_id'}" icon="terp-folder-green"/> |
4266 | 140 | <filter string="Statement" context="{'group_by':'statement_id'}" icon="terp-folder-orange"/> | 133 | <filter string="Statement" context="{'group_by':'statement_id'}" icon="terp-folder-orange"/> |
4267 | 141 | <filter string="Fin.Account" context="{'group_by':'account_id'}" icon="terp-folder-yellow"/> | ||
4268 | 142 | </group> | 134 | </group> |
4269 | 143 | </search> | 135 | </search> |
4270 | 144 | </field> | 136 | </field> |
4271 | 145 | 137 | ||
4272 | === modified file 'account_payment/wizard/account_payment_populate_statement.py' | |||
4273 | --- account_payment/wizard/account_payment_populate_statement.py 2013-10-27 12:31:04 +0000 | |||
4274 | +++ account_payment/wizard/account_payment_populate_statement.py 2014-05-30 16:18:57 +0000 | |||
4275 | @@ -107,12 +107,9 @@ | |||
4276 | 107 | st_line_id = statement_line_obj.create(cr, uid, { | 107 | st_line_id = statement_line_obj.create(cr, uid, { |
4277 | 108 | 'name': line.order_id.reference or '?', | 108 | 'name': line.order_id.reference or '?', |
4278 | 109 | 'amount': - amount, | 109 | 'amount': - amount, |
4279 | 110 | 'type': 'supplier', | ||
4280 | 111 | 'partner_id': line.partner_id.id, | 110 | 'partner_id': line.partner_id.id, |
4281 | 112 | 'account_id': line.move_line_id.account_id.id, | ||
4282 | 113 | 'statement_id': statement.id, | 111 | 'statement_id': statement.id, |
4283 | 114 | 'ref': line.communication, | 112 | 'ref': line.communication, |
4284 | 115 | 'voucher_id': voucher_id, | ||
4285 | 116 | }, context=context) | 113 | }, context=context) |
4286 | 117 | 114 | ||
4287 | 118 | line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id}) | 115 | line_obj.write(cr, uid, [line.id], {'bank_statement_line_id': st_line_id}) |
4288 | 119 | 116 | ||
4289 | === modified file 'account_voucher/__init__.py' | |||
4290 | --- account_voucher/__init__.py 2012-11-29 22:26:45 +0000 | |||
4291 | +++ account_voucher/__init__.py 2014-05-30 16:18:57 +0000 | |||
4292 | @@ -22,6 +22,5 @@ | |||
4293 | 22 | import account_voucher | 22 | import account_voucher |
4294 | 23 | import invoice | 23 | import invoice |
4295 | 24 | import report | 24 | import report |
4296 | 25 | import wizard | ||
4297 | 26 | 25 | ||
4298 | 27 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 26 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4299 | 28 | 27 | ||
4300 | === modified file 'account_voucher/__openerp__.py' | |||
4301 | --- account_voucher/__openerp__.py 2014-04-02 16:40:53 +0000 | |||
4302 | +++ account_voucher/__openerp__.py 2014-05-30 16:18:57 +0000 | |||
4303 | @@ -49,7 +49,6 @@ | |||
4304 | 49 | 'security/ir.model.access.csv', | 49 | 'security/ir.model.access.csv', |
4305 | 50 | 'account_voucher_sequence.xml', | 50 | 'account_voucher_sequence.xml', |
4306 | 51 | 'account_voucher_workflow.xml', | 51 | 'account_voucher_workflow.xml', |
4307 | 52 | 'wizard/account_statement_from_invoice_view.xml', | ||
4308 | 53 | 'account_voucher_view.xml', | 52 | 'account_voucher_view.xml', |
4309 | 54 | 'voucher_payment_receipt_view.xml', | 53 | 'voucher_payment_receipt_view.xml', |
4310 | 55 | 'voucher_sales_purchase_view.xml', | 54 | 'voucher_sales_purchase_view.xml', |
4311 | 56 | 55 | ||
4312 | === modified file 'account_voucher/account_voucher.py' | |||
4313 | --- account_voucher/account_voucher.py 2014-05-02 13:03:52 +0000 | |||
4314 | +++ account_voucher/account_voucher.py 2014-05-30 16:18:57 +0000 | |||
4315 | @@ -327,7 +327,6 @@ | |||
4316 | 327 | } | 327 | } |
4317 | 328 | 328 | ||
4318 | 329 | _columns = { | 329 | _columns = { |
4319 | 330 | 'active': fields.boolean('Active', help="By default, reconciliation vouchers made on draft bank statements are set as inactive, which allow to hide the customer/supplier payment while the bank statement isn't confirmed."), | ||
4320 | 331 | 'type':fields.selection([ | 330 | 'type':fields.selection([ |
4321 | 332 | ('sale','Sale'), | 331 | ('sale','Sale'), |
4322 | 333 | ('purchase','Purchase'), | 332 | ('purchase','Purchase'), |
4323 | @@ -389,7 +388,6 @@ | |||
4324 | 389 | 'currency_help_label': fields.function(_fnct_currency_help_label, type='text', string="Helping Sentence", help="This sentence helps you to know how to specify the payment rate by giving you the direct effect it has"), | 388 | 'currency_help_label': fields.function(_fnct_currency_help_label, type='text', string="Helping Sentence", help="This sentence helps you to know how to specify the payment rate by giving you the direct effect it has"), |
4325 | 390 | } | 389 | } |
4326 | 391 | _defaults = { | 390 | _defaults = { |
4327 | 392 | 'active': True, | ||
4328 | 393 | 'period_id': _get_period, | 391 | 'period_id': _get_period, |
4329 | 394 | 'partner_id': _get_partner, | 392 | 'partner_id': _get_partner, |
4330 | 395 | 'journal_id':_get_journal, | 393 | 'journal_id':_get_journal, |
4331 | @@ -1583,114 +1581,6 @@ | |||
4332 | 1583 | }) | 1581 | }) |
4333 | 1584 | return values | 1582 | return values |
4334 | 1585 | 1583 | ||
4335 | 1586 | class account_bank_statement(osv.osv): | ||
4336 | 1587 | _inherit = 'account.bank.statement' | ||
4337 | 1588 | |||
4338 | 1589 | def button_confirm_bank(self, cr, uid, ids, context=None): | ||
4339 | 1590 | voucher_obj = self.pool.get('account.voucher') | ||
4340 | 1591 | voucher_ids = [] | ||
4341 | 1592 | for statement in self.browse(cr, uid, ids, context=context): | ||
4342 | 1593 | voucher_ids += [line.voucher_id.id for line in statement.line_ids if line.voucher_id] | ||
4343 | 1594 | if voucher_ids: | ||
4344 | 1595 | voucher_obj.write(cr, uid, voucher_ids, {'active': True}, context=context) | ||
4345 | 1596 | return super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context) | ||
4346 | 1597 | |||
4347 | 1598 | def button_cancel(self, cr, uid, ids, context=None): | ||
4348 | 1599 | voucher_obj = self.pool.get('account.voucher') | ||
4349 | 1600 | for st in self.browse(cr, uid, ids, context=context): | ||
4350 | 1601 | voucher_ids = [] | ||
4351 | 1602 | for line in st.line_ids: | ||
4352 | 1603 | if line.voucher_id: | ||
4353 | 1604 | voucher_ids.append(line.voucher_id.id) | ||
4354 | 1605 | voucher_obj.cancel_voucher(cr, uid, voucher_ids, context) | ||
4355 | 1606 | return super(account_bank_statement, self).button_cancel(cr, uid, ids, context=context) | ||
4356 | 1607 | |||
4357 | 1608 | def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, next_number, context=None): | ||
4358 | 1609 | voucher_obj = self.pool.get('account.voucher') | ||
4359 | 1610 | move_line_obj = self.pool.get('account.move.line') | ||
4360 | 1611 | bank_st_line_obj = self.pool.get('account.bank.statement.line') | ||
4361 | 1612 | st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context) | ||
4362 | 1613 | if st_line.voucher_id: | ||
4363 | 1614 | voucher_obj.write(cr, uid, [st_line.voucher_id.id], | ||
4364 | 1615 | {'number': next_number, | ||
4365 | 1616 | 'date': st_line.date, | ||
4366 | 1617 | 'period_id': st_line.statement_id.period_id.id}, | ||
4367 | 1618 | context=context) | ||
4368 | 1619 | if st_line.voucher_id.state == 'cancel': | ||
4369 | 1620 | voucher_obj.action_cancel_draft(cr, uid, [st_line.voucher_id.id], context=context) | ||
4370 | 1621 | voucher_obj.signal_proforma_voucher(cr, uid, [st_line.voucher_id.id]) | ||
4371 | 1622 | |||
4372 | 1623 | v = voucher_obj.browse(cr, uid, st_line.voucher_id.id, context=context) | ||
4373 | 1624 | bank_st_line_obj.write(cr, uid, [st_line_id], { | ||
4374 | 1625 | 'move_ids': [(4, v.move_id.id, False)] | ||
4375 | 1626 | }) | ||
4376 | 1627 | |||
4377 | 1628 | return move_line_obj.write(cr, uid, [x.id for x in v.move_ids], {'statement_id': st_line.statement_id.id}, context=context) | ||
4378 | 1629 | return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line.id, company_currency_id, next_number, context=context) | ||
4379 | 1630 | |||
4380 | 1631 | def write(self, cr, uid, ids, vals, context=None): | ||
4381 | 1632 | # Restrict to modify the journal if we already have some voucher of reconciliation created/generated. | ||
4382 | 1633 | # Because the voucher keeps in memory the journal it was created with. | ||
4383 | 1634 | for bk_st in self.browse(cr, uid, ids, context=context): | ||
4384 | 1635 | if vals.get('journal_id') and bk_st.line_ids: | ||
4385 | 1636 | if any([x.voucher_id and True or False for x in bk_st.line_ids]): | ||
4386 | 1637 | raise osv.except_osv(_('Unable to Change Journal!'), _('You can not change the journal as you already reconciled some statement lines!')) | ||
4387 | 1638 | return super(account_bank_statement, self).write(cr, uid, ids, vals, context=context) | ||
4388 | 1639 | |||
4389 | 1640 | |||
4390 | 1641 | class account_bank_statement_line(osv.osv): | ||
4391 | 1642 | _inherit = 'account.bank.statement.line' | ||
4392 | 1643 | |||
4393 | 1644 | def onchange_partner_id(self, cr, uid, ids, partner_id, context=None): | ||
4394 | 1645 | res = super(account_bank_statement_line, self).onchange_partner_id(cr, uid, ids, partner_id, context=context) | ||
4395 | 1646 | if 'value' not in res: | ||
4396 | 1647 | res['value'] = {} | ||
4397 | 1648 | res['value'].update({'voucher_id' : False}) | ||
4398 | 1649 | return res | ||
4399 | 1650 | |||
4400 | 1651 | def onchange_amount(self, cr, uid, ids, amount, context=None): | ||
4401 | 1652 | return {'value' : {'voucher_id' : False}} | ||
4402 | 1653 | |||
4403 | 1654 | def _amount_reconciled(self, cursor, user, ids, name, args, context=None): | ||
4404 | 1655 | if not ids: | ||
4405 | 1656 | return {} | ||
4406 | 1657 | res = {} | ||
4407 | 1658 | for line in self.browse(cursor, user, ids, context=context): | ||
4408 | 1659 | if line.voucher_id: | ||
4409 | 1660 | res[line.id] = line.voucher_id.amount# | ||
4410 | 1661 | else: | ||
4411 | 1662 | res[line.id] = 0.0 | ||
4412 | 1663 | return res | ||
4413 | 1664 | |||
4414 | 1665 | def _check_amount(self, cr, uid, ids, context=None): | ||
4415 | 1666 | for obj in self.browse(cr, uid, ids, context=context): | ||
4416 | 1667 | if obj.voucher_id: | ||
4417 | 1668 | diff = abs(obj.amount) - abs(obj.voucher_id.amount) | ||
4418 | 1669 | if not self.pool.get('res.currency').is_zero(cr, uid, obj.statement_id.currency, diff): | ||
4419 | 1670 | return False | ||
4420 | 1671 | return True | ||
4421 | 1672 | |||
4422 | 1673 | _constraints = [ | ||
4423 | 1674 | (_check_amount, 'The amount of the voucher must be the same amount as the one on the statement line.', ['amount']), | ||
4424 | 1675 | ] | ||
4425 | 1676 | |||
4426 | 1677 | _columns = { | ||
4427 | 1678 | 'amount_reconciled': fields.function(_amount_reconciled, | ||
4428 | 1679 | string='Amount reconciled', type='float'), | ||
4429 | 1680 | 'voucher_id': fields.many2one('account.voucher', 'Reconciliation'), | ||
4430 | 1681 | } | ||
4431 | 1682 | |||
4432 | 1683 | def unlink(self, cr, uid, ids, context=None): | ||
4433 | 1684 | voucher_obj = self.pool.get('account.voucher') | ||
4434 | 1685 | statement_line = self.browse(cr, uid, ids, context=context) | ||
4435 | 1686 | unlink_ids = [] | ||
4436 | 1687 | for st_line in statement_line: | ||
4437 | 1688 | if st_line.voucher_id: | ||
4438 | 1689 | unlink_ids.append(st_line.voucher_id.id) | ||
4439 | 1690 | voucher_obj.unlink(cr, uid, unlink_ids, context=context) | ||
4440 | 1691 | return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context) | ||
4441 | 1692 | |||
4442 | 1693 | |||
4443 | 1694 | def resolve_o2m_operations(cr, uid, target_osv, operations, fields, context): | 1584 | def resolve_o2m_operations(cr, uid, target_osv, operations, fields, context): |
4444 | 1695 | results = [] | 1585 | results = [] |
4445 | 1696 | for operation in operations: | 1586 | for operation in operations: |
4446 | 1697 | 1587 | ||
4447 | === modified file 'account_voucher/account_voucher_view.xml' | |||
4448 | --- account_voucher/account_voucher_view.xml 2014-04-10 14:51:31 +0000 | |||
4449 | +++ account_voucher/account_voucher_view.xml 2014-05-30 16:18:57 +0000 | |||
4450 | @@ -193,59 +193,7 @@ | |||
4451 | 193 | <field name="context">{'state':'posted'}</field> | 193 | <field name="context">{'state':'posted'}</field> |
4452 | 194 | <field name="search_view_id" ref="view_voucher_filter"/> | 194 | <field name="search_view_id" ref="view_voucher_filter"/> |
4453 | 195 | </record> | 195 | </record> |
4507 | 196 | 196 | ||
4455 | 197 | <record id="view_bank_statement_form_invoice" model="ir.ui.view"> | ||
4456 | 198 | <field name="name">account.bank.statement.invoice.form.inherit</field> | ||
4457 | 199 | <field name="model">account.bank.statement</field> | ||
4458 | 200 | <field name="inherit_id" ref="account.view_bank_statement_form"/> | ||
4459 | 201 | <field name="arch" type="xml"> | ||
4460 | 202 | <xpath expr="//div[@name='import_buttons']" position="inside"> | ||
4461 | 203 | <button class="oe_inline oe_stat_button" name="%(action_view_account_statement_from_invoice_lines)d" | ||
4462 | 204 | string="Import Invoice" type="action" | ||
4463 | 205 | attrs="{'invisible':[('state','=','confirm')]}" widget="statinfo" icon="fa-pencil-square-o"/> | ||
4464 | 206 | </xpath> | ||
4465 | 207 | </field> | ||
4466 | 208 | </record> | ||
4467 | 209 | |||
4468 | 210 | <record id="view_bank_statement_form_voucher" model="ir.ui.view"> | ||
4469 | 211 | <field name="name">account.bank.statement.voucher.tree.inherit</field> | ||
4470 | 212 | <field name="model">account.bank.statement</field> | ||
4471 | 213 | <field name="inherit_id" ref="account.view_bank_statement_form"/> | ||
4472 | 214 | <field name="arch" type="xml"> | ||
4473 | 215 | <xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='amount']" position="after"> | ||
4474 | 216 | <field name="voucher_id" string="" widget="many2onebutton" options="{'label':{'create':'Reconcile','edit':'Edit Reconciliation'}}" context="{'line_type': type, 'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name, 'default_active': False, 'account_id': account_id}"/> | ||
4475 | 217 | </xpath> | ||
4476 | 218 | <xpath expr="//page[@name='statement_line_ids']/field[@name='line_ids']/form/group/field[@name='sequence']" position="before"> | ||
4477 | 219 | <field name="voucher_id" widget="many2onebutton" options="{'label':{'create':'Reconcile','edit':'Edit Reconciliation'}}" context="{'line_type': type, 'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name, 'default_active': False, 'account_id': account_id}"/> | ||
4478 | 220 | </xpath> | ||
4479 | 221 | <field name="amount" position="attributes"> | ||
4480 | 222 | <attribute name="on_change">onchange_amount(amount)</attribute> | ||
4481 | 223 | </field> | ||
4482 | 224 | </field> | ||
4483 | 225 | </record> | ||
4484 | 226 | |||
4485 | 227 | <record id="view_cash_statement_tree_voucher" model="ir.ui.view"> | ||
4486 | 228 | <field name="name">account.cash.statement.voucher.tree.inherit</field> | ||
4487 | 229 | <field name="model">account.bank.statement</field> | ||
4488 | 230 | <field name="inherit_id" ref="account.view_bank_statement_form2"/> | ||
4489 | 231 | <field name="arch" type="xml"> | ||
4490 | 232 | <xpath expr="//page/field[@name='line_ids']/tree/field[@name='amount']" position="after"> | ||
4491 | 233 | <field name="voucher_id" context="{'line_type': type, 'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name, 'account_id': account_id}"/> | ||
4492 | 234 | </xpath> | ||
4493 | 235 | </field> | ||
4494 | 236 | </record> | ||
4495 | 237 | |||
4496 | 238 | <record id="view_cash_statement_form_voucher" model="ir.ui.view"> | ||
4497 | 239 | <field name="name">account.cash.statement.voucher.form.inherit</field> | ||
4498 | 240 | <field name="model">account.bank.statement</field> | ||
4499 | 241 | <field name="inherit_id" ref="account.view_bank_statement_form2"/> | ||
4500 | 242 | <field name="arch" type="xml"> | ||
4501 | 243 | <xpath expr="//page/field[@name='line_ids']/form/group/field[@name='amount']" position="after"> | ||
4502 | 244 | <field name="voucher_id" context="{'line_type': type, 'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name, 'account_id': account_id}"/> | ||
4503 | 245 | </xpath> | ||
4504 | 246 | </field> | ||
4505 | 247 | </record> | ||
4506 | 248 | |||
4508 | 249 | <!-- res.config form view --> | 197 | <!-- res.config form view --> |
4509 | 250 | <record model="ir.ui.view" id="view_account_settings_currency_xchange_form"> | 198 | <record model="ir.ui.view" id="view_account_settings_currency_xchange_form"> |
4510 | 251 | <field name="name">account.config.settings.inherit</field> | 199 | <field name="name">account.config.settings.inherit</field> |
4511 | 252 | 200 | ||
4512 | === removed directory 'account_voucher/wizard' | |||
4513 | === removed file 'account_voucher/wizard/__init__.py' | |||
4514 | --- account_voucher/wizard/__init__.py 2012-11-29 22:26:45 +0000 | |||
4515 | +++ account_voucher/wizard/__init__.py 1970-01-01 00:00:00 +0000 | |||
4516 | @@ -1,24 +0,0 @@ | |||
4517 | 1 | # -*- coding: utf-8 -*- | ||
4518 | 2 | ############################################################################## | ||
4519 | 3 | # | ||
4520 | 4 | # OpenERP, Open Source Management Solution | ||
4521 | 5 | # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). | ||
4522 | 6 | # | ||
4523 | 7 | # This program is free software: you can redistribute it and/or modify | ||
4524 | 8 | # it under the terms of the GNU Affero General Public License as | ||
4525 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
4526 | 10 | # License, or (at your option) any later version. | ||
4527 | 11 | # | ||
4528 | 12 | # This program is distributed in the hope that it will be useful, | ||
4529 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4530 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4531 | 15 | # GNU Affero General Public License for more details. | ||
4532 | 16 | # | ||
4533 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
4534 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
4535 | 19 | # | ||
4536 | 20 | ############################################################################## | ||
4537 | 21 | |||
4538 | 22 | import account_statement_from_invoice | ||
4539 | 23 | |||
4540 | 24 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
4541 | 25 | 0 | ||
4542 | === modified file 'l10n_be_coda/__openerp__.py' | |||
4543 | --- l10n_be_coda/__openerp__.py 2012-12-06 11:18:16 +0000 | |||
4544 | +++ l10n_be_coda/__openerp__.py 2014-05-30 16:18:57 +0000 | |||
4545 | @@ -2,9 +2,9 @@ | |||
4546 | 2 | ############################################################################## | 2 | ############################################################################## |
4547 | 3 | # | 3 | # |
4548 | 4 | # OpenERP, Open Source Management Solution | 4 | # OpenERP, Open Source Management Solution |
4550 | 5 | # | 5 | # |
4551 | 6 | # Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved. | 6 | # Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved. |
4553 | 7 | # | 7 | # |
4554 | 8 | # This program is free software: you can redistribute it and/or modify | 8 | # This program is free software: you can redistribute it and/or modify |
4555 | 9 | # it under the terms of the GNU Affero General Public License as | 9 | # it under the terms of the GNU Affero General Public License as |
4556 | 10 | # published by the Free Software Foundation, either version 3 of the | 10 | # published by the Free Software Foundation, either version 3 of the |
4557 | @@ -34,64 +34,64 @@ | |||
4558 | 34 | * CODA v2.2 support. | 34 | * CODA v2.2 support. |
4559 | 35 | * Foreign Currency support. | 35 | * Foreign Currency support. |
4560 | 36 | * Support for all data record types (0, 1, 2, 3, 4, 8, 9). | 36 | * Support for all data record types (0, 1, 2, 3, 4, 8, 9). |
4562 | 37 | * Parsing & logging of all Transaction Codes and Structured Format | 37 | * Parsing & logging of all Transaction Codes and Structured Format |
4563 | 38 | Communications. | 38 | Communications. |
4564 | 39 | * Automatic Financial Journal assignment via CODA configuration parameters. | 39 | * Automatic Financial Journal assignment via CODA configuration parameters. |
4565 | 40 | * Support for multiple Journals per Bank Account Number. | 40 | * Support for multiple Journals per Bank Account Number. |
4567 | 41 | * Support for multiple statements from different bank accounts in a single | 41 | * Support for multiple statements from different bank accounts in a single |
4568 | 42 | CODA file. | 42 | CODA file. |
4570 | 43 | * Support for 'parsing only' CODA Bank Accounts (defined as type='info' in | 43 | * Support for 'parsing only' CODA Bank Accounts (defined as type='info' in |
4571 | 44 | the CODA Bank Account configuration records). | 44 | the CODA Bank Account configuration records). |
4573 | 45 | * Multi-language CODA parsing, parsing configuration data provided for EN, | 45 | * Multi-language CODA parsing, parsing configuration data provided for EN, |
4574 | 46 | NL, FR. | 46 | NL, FR. |
4575 | 47 | 47 | ||
4580 | 48 | The machine readable CODA Files are parsed and stored in human readable format in | 48 | The machine readable CODA Files are parsed and stored in human readable format in |
4581 | 49 | CODA Bank Statements. Also Bank Statements are generated containing a subset of | 49 | CODA Bank Statements. Also Bank Statements are generated containing a subset of |
4582 | 50 | the CODA information (only those transaction lines that are required for the | 50 | the CODA information (only those transaction lines that are required for the |
4583 | 51 | creation of the Financial Accounting records). The CODA Bank Statement is a | 51 | creation of the Financial Accounting records). The CODA Bank Statement is a |
4584 | 52 | 'read-only' object, hence remaining a reliable representation of the original | 52 | 'read-only' object, hence remaining a reliable representation of the original |
4586 | 53 | CODA file whereas the Bank Statement will get modified as required by accounting | 53 | CODA file whereas the Bank Statement will get modified as required by accounting |
4587 | 54 | business processes. | 54 | business processes. |
4588 | 55 | 55 | ||
4589 | 56 | CODA Bank Accounts configured as type 'Info' will only generate CODA Bank Statements. | 56 | CODA Bank Accounts configured as type 'Info' will only generate CODA Bank Statements. |
4590 | 57 | 57 | ||
4593 | 58 | A removal of one object in the CODA processing results in the removal of the | 58 | A removal of one object in the CODA processing results in the removal of the |
4594 | 59 | associated objects. The removal of a CODA File containing multiple Bank | 59 | associated objects. The removal of a CODA File containing multiple Bank |
4595 | 60 | Statements will also remove those associated statements. | 60 | Statements will also remove those associated statements. |
4596 | 61 | 61 | ||
4597 | 62 | The following reconciliation logic has been implemented in the CODA processing: | 62 | The following reconciliation logic has been implemented in the CODA processing: |
4598 | 63 | ------------------------------------------------------------------------------- | 63 | ------------------------------------------------------------------------------- |
4602 | 64 | 1) The Company's Bank Account Number of the CODA statement is compared against | 64 | 1) The Company's Bank Account Number of the CODA statement is compared against |
4603 | 65 | the Bank Account Number field of the Company's CODA Bank Account | 65 | the Bank Account Number field of the Company's CODA Bank Account |
4604 | 66 | configuration records (whereby bank accounts defined in type='info' | 66 | configuration records (whereby bank accounts defined in type='info' |
4605 | 67 | configuration records are ignored). If this is the case an 'internal transfer' | 67 | configuration records are ignored). If this is the case an 'internal transfer' |
4607 | 68 | transaction is generated using the 'Internal Transfer Account' field of the | 68 | transaction is generated using the 'Internal Transfer Account' field of the |
4608 | 69 | CODA File Import wizard. | 69 | CODA File Import wizard. |
4609 | 70 | 2) As a second step the 'Structured Communication' field of the CODA transaction | 70 | 2) As a second step the 'Structured Communication' field of the CODA transaction |
4611 | 71 | line is matched against the reference field of in- and outgoing invoices | 71 | line is matched against the reference field of in- and outgoing invoices |
4612 | 72 | (supported : Belgian Structured Communication Type). | 72 | (supported : Belgian Structured Communication Type). |
4615 | 73 | 3) When the previous step doesn't find a match, the transaction counterparty is | 73 | 3) When the previous step doesn't find a match, the transaction counterparty is |
4616 | 74 | located via the Bank Account Number configured on the OpenERP Customer and | 74 | located via the Bank Account Number configured on the OpenERP Customer and |
4617 | 75 | Supplier records. | 75 | Supplier records. |
4620 | 76 | 4) In case the previous steps are not successful, the transaction is generated | 76 | 4) In case the previous steps are not successful, the transaction is generated |
4621 | 77 | by using the 'Default Account for Unrecognized Movement' field of the CODA | 77 | by using the 'Default Account for Unrecognized Movement' field of the CODA |
4622 | 78 | File Import wizard in order to allow further manual processing. | 78 | File Import wizard in order to allow further manual processing. |
4623 | 79 | 79 | ||
4626 | 80 | In stead of a manual adjustment of the generated Bank Statements, you can also | 80 | In stead of a manual adjustment of the generated Bank Statements, you can also |
4627 | 81 | re-import the CODA after updating the OpenERP database with the information that | 81 | re-import the CODA after updating the OpenERP database with the information that |
4628 | 82 | was missing to allow automatic reconciliation. | 82 | was missing to allow automatic reconciliation. |
4629 | 83 | 83 | ||
4630 | 84 | Remark on CODA V1 support: | 84 | Remark on CODA V1 support: |
4631 | 85 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | 85 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
4633 | 86 | In some cases a transaction code, transaction category or structured | 86 | In some cases a transaction code, transaction category or structured |
4634 | 87 | communication code has been given a new or clearer description in CODA V2.The | 87 | communication code has been given a new or clearer description in CODA V2.The |
4636 | 88 | description provided by the CODA configuration tables is based upon the CODA | 88 | description provided by the CODA configuration tables is based upon the CODA |
4637 | 89 | V2.2 specifications. | 89 | V2.2 specifications. |
4638 | 90 | If required, you can manually adjust the descriptions via the CODA configuration menu. | 90 | If required, you can manually adjust the descriptions via the CODA configuration menu. |
4639 | 91 | ''', | 91 | ''', |
4643 | 92 | 'images' : ['images/coda_logs.jpeg','images/import_coda_logs.jpeg'], | 92 | 'images': ['images/coda_logs.jpeg', 'images/import_coda_logs.jpeg'], |
4644 | 93 | 'depends': ['account_voucher','base_iban', 'l10n_be_invoice_bba',], | 93 | 'depends': ['account_voucher', 'base_iban', 'l10n_be_invoice_bba'], |
4645 | 94 | 'demo': [], | 94 | 'demo': ['l10n_be_coda_demo.xml'], |
4646 | 95 | 'data': [ | 95 | 'data': [ |
4647 | 96 | 'l10n_be_coda_wizard.xml', | 96 | 'l10n_be_coda_wizard.xml', |
4648 | 97 | 'l10n_be_coda_view.xml', | 97 | 'l10n_be_coda_view.xml', |
4649 | 98 | 98 | ||
4650 | === added file 'l10n_be_coda/l10n_be_coda_demo.xml' | |||
4651 | --- l10n_be_coda/l10n_be_coda_demo.xml 1970-01-01 00:00:00 +0000 | |||
4652 | +++ l10n_be_coda/l10n_be_coda_demo.xml 2014-05-30 16:18:57 +0000 | |||
4653 | @@ -0,0 +1,36 @@ | |||
4654 | 1 | <?xml version="1.0" ?> | ||
4655 | 2 | <openerp> | ||
4656 | 3 | <data> | ||
4657 | 4 | <record id="demo_bank_account" model="res.partner.bank"> | ||
4658 | 5 | <field name="state">bank</field> | ||
4659 | 6 | <field name="acc_number">BE33737018595246</field> | ||
4660 | 7 | <field name="bank_bic">KREDBEBB</field> | ||
4661 | 8 | <field name="journal_id" ref="account.bank_journal"/> | ||
4662 | 9 | <field name="partner_id" ref="base.main_partner"/> | ||
4663 | 10 | </record> | ||
4664 | 11 | <!-- | ||
4665 | 12 | Fiscal year | ||
4666 | 13 | --> | ||
4667 | 14 | |||
4668 | 15 | <record id="data_fiscalyear_2011" model="account.fiscalyear"> | ||
4669 | 16 | <field eval="'Fiscal Year X 2011'" name="name"/> | ||
4670 | 17 | <field eval="'FY2011'" name="code"/> | ||
4671 | 18 | <field eval="'2011-01-01'" name="date_start"/> | ||
4672 | 19 | <field eval="'2011-12-31'" name="date_stop"/> | ||
4673 | 20 | <field name="company_id" ref="base.main_company"/> | ||
4674 | 21 | </record> | ||
4675 | 22 | |||
4676 | 23 | <!-- | ||
4677 | 24 | Fiscal Periods | ||
4678 | 25 | --> | ||
4679 | 26 | |||
4680 | 27 | <record id="period_1_2011" model="account.period"> | ||
4681 | 28 | <field eval="'01/2011'" name="code"/> | ||
4682 | 29 | <field eval="'X 01/2011'" name="name"/> | ||
4683 | 30 | <field name="fiscalyear_id" ref="data_fiscalyear_2011"/> | ||
4684 | 31 | <field eval="'2011-01-01'" name="date_start"/> | ||
4685 | 32 | <field eval="'2011-01-31'" name="date_stop"/> | ||
4686 | 33 | <field name="company_id" ref="base.main_company"/> | ||
4687 | 34 | </record> | ||
4688 | 35 | </data> | ||
4689 | 36 | </openerp> | ||
4690 | 0 | 37 | ||
4691 | === modified file 'l10n_be_coda/l10n_be_coda_view.xml' | |||
4692 | --- l10n_be_coda/l10n_be_coda_view.xml 2013-10-27 12:31:04 +0000 | |||
4693 | +++ l10n_be_coda/l10n_be_coda_view.xml 2014-05-30 16:18:57 +0000 | |||
4694 | @@ -25,8 +25,6 @@ | |||
4695 | 25 | <field name="name"/> | 25 | <field name="name"/> |
4696 | 26 | <field name="ref" readonly="0"/> | 26 | <field name="ref" readonly="0"/> |
4697 | 27 | <field name="partner_id"/> | 27 | <field name="partner_id"/> |
4698 | 28 | <field name="type" /> | ||
4699 | 29 | <field domain="[('type', '<>', 'view')]" name="account_id"/> | ||
4700 | 30 | <field name="amount"/> | 28 | <field name="amount"/> |
4701 | 31 | <field name="sequence" readonly="0"/> | 29 | <field name="sequence" readonly="0"/> |
4702 | 32 | </group> | 30 | </group> |
4703 | @@ -46,10 +44,7 @@ | |||
4704 | 46 | <field name="date"/> | 44 | <field name="date"/> |
4705 | 47 | <field name="name"/> | 45 | <field name="name"/> |
4706 | 48 | <field name="ref"/> | 46 | <field name="ref"/> |
4711 | 49 | <field name="partner_id" on_change="onchange_partner_id(partner_id)"/> | 47 | <field name="partner_id"/> |
4708 | 50 | <field name="type" on_change="onchange_type(partner_id, type)"/> | ||
4709 | 51 | <field name="account_id" options='{"no_open":True}' domain="[('type', '<>', 'view')]"/> | ||
4710 | 52 | <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('type', '<>', 'view')]"/> | ||
4712 | 53 | <field name="amount"/> | 48 | <field name="amount"/> |
4713 | 54 | <field name="note"/> | 49 | <field name="note"/> |
4714 | 55 | </tree> | 50 | </tree> |
4715 | @@ -66,17 +61,14 @@ | |||
4716 | 66 | <filter name="credit" string="Credit" domain="[('amount','<',0)]" icon="terp-folder-orange" help="Credit Transactions."/> | 61 | <filter name="credit" string="Credit" domain="[('amount','<',0)]" icon="terp-folder-orange" help="Credit Transactions."/> |
4717 | 67 | <field name="statement_id"/> | 62 | <field name="statement_id"/> |
4718 | 68 | <group expand="0" string="Extended Filters..."> | 63 | <group expand="0" string="Extended Filters..."> |
4719 | 69 | <field name="account_id"/> | ||
4720 | 70 | <field name="partner_id"/> | 64 | <field name="partner_id"/> |
4721 | 71 | <field name="amount"/> | 65 | <field name="amount"/> |
4722 | 72 | <field name="type"/> | ||
4723 | 73 | <field name="note"/> | 66 | <field name="note"/> |
4724 | 74 | </group> | 67 | </group> |
4725 | 75 | <newline/> | 68 | <newline/> |
4726 | 76 | <group string="Group By..." expand="0"> | 69 | <group string="Group By..." expand="0"> |
4727 | 77 | <filter string="Partner" context="{'group_by':'partner_id'}" icon="terp-folder-green"/> | 70 | <filter string="Partner" context="{'group_by':'partner_id'}" icon="terp-folder-green"/> |
4728 | 78 | <filter string="Statement" context="{'group_by':'statement_id'}" icon="terp-folder-orange"/> | 71 | <filter string="Statement" context="{'group_by':'statement_id'}" icon="terp-folder-orange"/> |
4729 | 79 | <filter string="Fin.Account" context="{'group_by':'account_id'}" icon="terp-folder-yellow"/> | ||
4730 | 80 | </group> | 72 | </group> |
4731 | 81 | </search> | 73 | </search> |
4732 | 82 | </field> | 74 | </field> |
4733 | 83 | 75 | ||
4734 | === modified file 'l10n_be_coda/l10n_be_coda_wizard.xml' | |||
4735 | --- l10n_be_coda/l10n_be_coda_wizard.xml 2012-12-20 14:52:27 +0000 | |||
4736 | +++ l10n_be_coda/l10n_be_coda_wizard.xml 2014-05-30 16:18:57 +0000 | |||
4737 | @@ -10,7 +10,6 @@ | |||
4738 | 10 | <form string="Import CODA File" version="7.0"> | 10 | <form string="Import CODA File" version="7.0"> |
4739 | 11 | <group col="2"> | 11 | <group col="2"> |
4740 | 12 | <field name="coda_data" filename="coda_fname"/> | 12 | <field name="coda_data" filename="coda_fname"/> |
4741 | 13 | <field name="temporary_account_id" /> | ||
4742 | 14 | </group> | 13 | </group> |
4743 | 15 | <footer> | 14 | <footer> |
4744 | 16 | <button name="coda_parsing" string="_Import" type="object" class="oe_highlight"/> | 15 | <button name="coda_parsing" string="_Import" type="object" class="oe_highlight"/> |
4745 | 17 | 16 | ||
4746 | === modified file 'l10n_be_coda/wizard/account_coda_import.py' | |||
4747 | --- l10n_be_coda/wizard/account_coda_import.py 2013-10-27 12:31:04 +0000 | |||
4748 | +++ l10n_be_coda/wizard/account_coda_import.py 2014-05-30 16:18:57 +0000 | |||
4749 | @@ -37,20 +37,10 @@ | |||
4750 | 37 | 'coda_data': fields.binary('CODA File', required=True), | 37 | 'coda_data': fields.binary('CODA File', required=True), |
4751 | 38 | 'coda_fname': fields.char('CODA Filename', size=128, required=True), | 38 | 'coda_fname': fields.char('CODA Filename', size=128, required=True), |
4752 | 39 | 'note': fields.text('Log'), | 39 | 'note': fields.text('Log'), |
4753 | 40 | 'temporary_account_id': fields.many2one('account.account', 'Temporary Account', domain="[('type','!=','view')]", help="It acts as a temporary account for general amount", required=True), | ||
4754 | 41 | } | 40 | } |
4755 | 42 | 41 | ||
4756 | 43 | def _get_default_tmp_account(self, cr, uid, context): | ||
4757 | 44 | tmp_accounts = self.pool.get('account.account').search(cr, uid, [('code', '=', '490000')]) | ||
4758 | 45 | if tmp_accounts and len(tmp_accounts) > 0: | ||
4759 | 46 | tmp_account_id = tmp_accounts[0] | ||
4760 | 47 | else: | ||
4761 | 48 | tmp_account_id = False | ||
4762 | 49 | return tmp_account_id | ||
4763 | 50 | |||
4764 | 51 | _defaults = { | 42 | _defaults = { |
4765 | 52 | 'coda_fname': lambda *a: '', | 43 | 'coda_fname': lambda *a: '', |
4766 | 53 | 'temporary_account_id': _get_default_tmp_account, | ||
4767 | 54 | } | 44 | } |
4768 | 55 | 45 | ||
4769 | 56 | def coda_parsing(self, cr, uid, ids, context=None, batch=False, codafile=None, codafilename=None): | 46 | def coda_parsing(self, cr, uid, ids, context=None, batch=False, codafile=None, codafilename=None): |
4770 | @@ -64,7 +54,6 @@ | |||
4771 | 64 | try: | 54 | try: |
4772 | 65 | codafile = data.coda_data | 55 | codafile = data.coda_data |
4773 | 66 | codafilename = data.coda_fname | 56 | codafilename = data.coda_fname |
4774 | 67 | temporaryaccount = data.temporary_account_id.id | ||
4775 | 68 | except: | 57 | except: |
4776 | 69 | raise osv.except_osv(_('Error'), _('Wizard in incorrect state. Please hit the Cancel button')) | 58 | raise osv.except_osv(_('Error'), _('Wizard in incorrect state. Please hit the Cancel button')) |
4777 | 70 | return {} | 59 | return {} |
4778 | @@ -149,7 +138,6 @@ | |||
4779 | 149 | statementLine['amount'] = float(rmspaces(line[32:47])) / 1000 | 138 | statementLine['amount'] = float(rmspaces(line[32:47])) / 1000 |
4780 | 150 | if statementLine['debit'] == '1': | 139 | if statementLine['debit'] == '1': |
4781 | 151 | statementLine['amount'] = - statementLine['amount'] | 140 | statementLine['amount'] = - statementLine['amount'] |
4782 | 152 | statementLine['transaction_type'] = line[53] | ||
4783 | 153 | statementLine['transactionDate'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[47:53]), '%d%m%y')) | 141 | statementLine['transactionDate'] = time.strftime(tools.DEFAULT_SERVER_DATE_FORMAT, time.strptime(rmspaces(line[47:53]), '%d%m%y')) |
4784 | 154 | statementLine['transaction_family'] = rmspaces(line[54:56]) | 142 | statementLine['transaction_family'] = rmspaces(line[54:56]) |
4785 | 155 | statementLine['transaction_code'] = rmspaces(line[56:58]) | 143 | statementLine['transaction_code'] = rmspaces(line[56:58]) |
4786 | @@ -211,7 +199,6 @@ | |||
4787 | 211 | infoLine['sequence'] = len(statement['lines']) + 1 | 199 | infoLine['sequence'] = len(statement['lines']) + 1 |
4788 | 212 | infoLine['ref'] = rmspaces(line[2:10]) | 200 | infoLine['ref'] = rmspaces(line[2:10]) |
4789 | 213 | infoLine['transactionRef'] = rmspaces(line[10:31]) | 201 | infoLine['transactionRef'] = rmspaces(line[10:31]) |
4790 | 214 | infoLine['transaction_type'] = line[31] | ||
4791 | 215 | infoLine['transaction_family'] = rmspaces(line[32:34]) | 202 | infoLine['transaction_family'] = rmspaces(line[32:34]) |
4792 | 216 | infoLine['transaction_code'] = rmspaces(line[34:36]) | 203 | infoLine['transaction_code'] = rmspaces(line[34:36]) |
4793 | 217 | infoLine['transaction_category'] = rmspaces(line[36:39]) | 204 | infoLine['transaction_category'] = rmspaces(line[36:39]) |
4794 | @@ -304,91 +291,78 @@ | |||
4795 | 304 | if 'counterpartyAddress' in line and line['counterpartyAddress'] != '': | 291 | if 'counterpartyAddress' in line and line['counterpartyAddress'] != '': |
4796 | 305 | note.append(_('Counter Party Address') + ': ' + line['counterpartyAddress']) | 292 | note.append(_('Counter Party Address') + ': ' + line['counterpartyAddress']) |
4797 | 306 | line['name'] = "\n".join(filter(None, [line['counterpartyName'], line['communication']])) | 293 | line['name'] = "\n".join(filter(None, [line['counterpartyName'], line['communication']])) |
4798 | 307 | line['transaction_type'] = 'general' | ||
4799 | 308 | partner = None | 294 | partner = None |
4800 | 309 | partner_id = None | 295 | partner_id = None |
4801 | 310 | invoice = False | 296 | invoice = False |
4802 | 311 | if line['communication_struct'] and 'communication_type' in line and line['communication_type'] == '101': | 297 | if line['communication_struct'] and 'communication_type' in line and line['communication_type'] == '101': |
4803 | 312 | ids = self.pool.get('account.invoice').search(cr, uid, [('reference', '=', line['communication']), ('reference_type', '=', 'bba')]) | 298 | ids = self.pool.get('account.invoice').search(cr, uid, [('reference', '=', line['communication']), ('reference_type', '=', 'bba')]) |
4851 | 313 | if ids: | 299 | |
4852 | 314 | invoice = self.pool.get('account.invoice').browse(cr, uid, ids[0]) | 300 | # Gère les communications structurées |
4853 | 315 | partner = invoice.partner_id | 301 | # TODO : à faire primer sur resolution_proposition : si la communication indique une facture, on la sélectionne |
4854 | 316 | partner_id = partner.id | 302 | |
4855 | 317 | if invoice.type in ['in_invoice', 'in_refund'] and line['debit'] == '1': | 303 | # if ids: |
4856 | 318 | line['transaction_type'] = 'supplier' | 304 | # invoice = self.pool.get('account.invoice').browse(cr, uid, ids[0]) |
4857 | 319 | elif invoice.type in ['out_invoice', 'out_refund'] and line['debit'] == '0': | 305 | # partner = invoice.partner_id |
4858 | 320 | line['transaction_type'] = 'customer' | 306 | # partner_id = partner.id |
4859 | 321 | line['account'] = invoice.account_id.id | 307 | # if invoice.type in ['in_invoice', 'in_refund'] and line['debit'] == '1': |
4860 | 322 | line['reconcile'] = False | 308 | # line['transaction_type'] = 'supplier' |
4861 | 323 | if invoice.type in ['in_invoice', 'out_invoice']: | 309 | # elif invoice.type in ['out_invoice', 'out_refund'] and line['debit'] == '0': |
4862 | 324 | iml_ids = self.pool.get('account.move.line').search(cr, uid, [('move_id', '=', invoice.move_id.id), ('reconcile_id', '=', False), ('account_id.reconcile', '=', True)]) | 310 | # line['transaction_type'] = 'customer' |
4863 | 325 | if iml_ids: | 311 | # line['account'] = invoice.account_id.id |
4864 | 326 | line['reconcile'] = iml_ids[0] | 312 | # line['reconcile'] = False |
4865 | 327 | if line['reconcile']: | 313 | # if invoice.type in ['in_invoice', 'out_invoice']: |
4866 | 328 | voucher_vals = { | 314 | # iml_ids = self.pool.get('account.move.line').search(cr, uid, [('move_id', '=', invoice.move_id.id), ('reconcile_id', '=', False), ('account_id.reconcile', '=', True)]) |
4867 | 329 | 'type': line['transaction_type'] == 'supplier' and 'payment' or 'receipt', | 315 | # if iml_ids: |
4868 | 330 | 'name': line['name'], | 316 | # line['reconcile'] = iml_ids[0] |
4869 | 331 | 'partner_id': partner_id, | 317 | # if line['reconcile']: |
4870 | 332 | 'journal_id': statement['journal_id'].id, | 318 | # voucher_vals = { |
4871 | 333 | 'account_id': statement['journal_id'].default_credit_account_id.id, | 319 | # 'type': line['transaction_type'] == 'supplier' and 'payment' or 'receipt', |
4872 | 334 | 'company_id': statement['journal_id'].company_id.id, | 320 | # 'name': line['name'], |
4873 | 335 | 'currency_id': statement['journal_id'].company_id.currency_id.id, | 321 | # 'partner_id': partner_id, |
4874 | 336 | 'date': line['entryDate'], | 322 | # 'journal_id': statement['journal_id'].id, |
4875 | 337 | 'amount': abs(line['amount']), | 323 | # 'account_id': statement['journal_id'].default_credit_account_id.id, |
4876 | 338 | 'period_id': statement['period_id'], | 324 | # 'company_id': statement['journal_id'].company_id.id, |
4877 | 339 | 'invoice_id': invoice.id, | 325 | # 'currency_id': statement['journal_id'].company_id.currency_id.id, |
4878 | 340 | } | 326 | # 'date': line['entryDate'], |
4879 | 341 | context['invoice_id'] = invoice.id | 327 | # 'amount': abs(line['amount']), |
4880 | 342 | voucher_vals.update(self.pool.get('account.voucher').onchange_partner_id(cr, uid, [], | 328 | # 'period_id': statement['period_id'], |
4881 | 343 | partner_id=partner_id, | 329 | # 'invoice_id': invoice.id, |
4882 | 344 | journal_id=statement['journal_id'].id, | 330 | # } |
4883 | 345 | amount=abs(line['amount']), | 331 | # context['invoice_id'] = invoice.id |
4884 | 346 | currency_id=statement['journal_id'].company_id.currency_id.id, | 332 | # voucher_vals.update(self.pool.get('account.voucher').onchange_partner_id(cr, uid, [], |
4885 | 347 | ttype=line['transaction_type'] == 'supplier' and 'payment' or 'receipt', | 333 | # partner_id=partner_id, |
4886 | 348 | date=line['transactionDate'], | 334 | # journal_id=statement['journal_id'].id, |
4887 | 349 | context=context | 335 | # amount=abs(line['amount']), |
4888 | 350 | )['value']) | 336 | # currency_id=statement['journal_id'].company_id.currency_id.id, |
4889 | 351 | line_drs = [] | 337 | # ttype=line['transaction_type'] == 'supplier' and 'payment' or 'receipt', |
4890 | 352 | for line_dr in voucher_vals['line_dr_ids']: | 338 | # date=line['transactionDate'], |
4891 | 353 | line_drs.append((0, 0, line_dr)) | 339 | # context=context |
4892 | 354 | voucher_vals['line_dr_ids'] = line_drs | 340 | # )['value']) |
4893 | 355 | line_crs = [] | 341 | # line_drs = [] |
4894 | 356 | for line_cr in voucher_vals['line_cr_ids']: | 342 | # for line_dr in voucher_vals['line_dr_ids']: |
4895 | 357 | line_crs.append((0, 0, line_cr)) | 343 | # line_drs.append((0, 0, line_dr)) |
4896 | 358 | voucher_vals['line_cr_ids'] = line_crs | 344 | # voucher_vals['line_dr_ids'] = line_drs |
4897 | 359 | line['voucher_id'] = self.pool.get('account.voucher').create(cr, uid, voucher_vals, context=context) | 345 | # line_crs = [] |
4898 | 346 | # for line_cr in voucher_vals['line_cr_ids']: | ||
4899 | 347 | # line_crs.append((0, 0, line_cr)) | ||
4900 | 348 | # voucher_vals['line_cr_ids'] = line_crs | ||
4901 | 349 | # line['voucher_id'] = self.pool.get('account.voucher').create(cr, uid, voucher_vals, context=context) | ||
4902 | 360 | if 'counterpartyNumber' in line and line['counterpartyNumber']: | 350 | if 'counterpartyNumber' in line and line['counterpartyNumber']: |
4903 | 361 | ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', str(line['counterpartyNumber']))]) | 351 | ids = self.pool.get('res.partner.bank').search(cr, uid, [('acc_number', '=', str(line['counterpartyNumber']))]) |
4904 | 362 | if ids and len(ids) > 0: | 352 | if ids and len(ids) > 0: |
4905 | 363 | partner = self.pool.get('res.partner.bank').browse(cr, uid, ids[0], context=context).partner_id | 353 | partner = self.pool.get('res.partner.bank').browse(cr, uid, ids[0], context=context).partner_id |
4906 | 364 | partner_id = partner.id | 354 | partner_id = partner.id |
4907 | 365 | if not invoice: | ||
4908 | 366 | if line['debit'] == '0': | ||
4909 | 367 | line['account'] = partner.property_account_receivable.id | ||
4910 | 368 | if partner.customer: | ||
4911 | 369 | line['transaction_type'] = 'customer' | ||
4912 | 370 | elif line['debit'] == '1': | ||
4913 | 371 | line['account'] = partner.property_account_payable.id | ||
4914 | 372 | if partner.supplier: | ||
4915 | 373 | line['transaction_type'] = 'supplier' | ||
4916 | 374 | if not partner and not invoice: | ||
4917 | 375 | line['account'] = temporaryaccount | ||
4918 | 376 | if 'communication' in line and line['communication'] != '': | 355 | if 'communication' in line and line['communication'] != '': |
4919 | 377 | note.append(_('Communication') + ': ' + line['communication']) | 356 | note.append(_('Communication') + ': ' + line['communication']) |
4920 | 378 | if 'voucher_id' not in line: | ||
4921 | 379 | line['voucher_id'] = None | ||
4922 | 380 | data = { | 357 | data = { |
4923 | 381 | 'name': line['name'], | 358 | 'name': line['name'], |
4924 | 382 | 'note': "\n".join(note), | 359 | 'note': "\n".join(note), |
4925 | 383 | 'date': line['entryDate'], | 360 | 'date': line['entryDate'], |
4926 | 384 | 'amount': line['amount'], | 361 | 'amount': line['amount'], |
4927 | 385 | 'type': line['transaction_type'], | ||
4928 | 386 | 'partner_id': partner_id, | 362 | 'partner_id': partner_id, |
4929 | 387 | 'account_id': line['account'], | ||
4930 | 388 | 'statement_id': statement['id'], | 363 | 'statement_id': statement['id'], |
4931 | 389 | 'ref': line['ref'], | 364 | 'ref': line['ref'], |
4932 | 390 | 'sequence': line['sequence'], | 365 | 'sequence': line['sequence'], |
4933 | 391 | 'voucher_id': line['voucher_id'], | ||
4934 | 392 | 'coda_account_number': line['counterpartyNumber'], | 366 | 'coda_account_number': line['counterpartyNumber'], |
4935 | 393 | } | 367 | } |
4936 | 394 | self.pool.get('account.bank.statement.line').create(cr, uid, data, context=context) | 368 | self.pool.get('account.bank.statement.line').create(cr, uid, data, context=context) |
4937 | 395 | 369 | ||
4938 | === modified file 'point_of_sale/point_of_sale.py' | |||
4939 | --- point_of_sale/point_of_sale.py 2014-05-08 14:39:40 +0000 | |||
4940 | +++ point_of_sale/point_of_sale.py 2014-05-30 16:18:57 +0000 | |||
4941 | @@ -457,19 +457,13 @@ | |||
4942 | 457 | if st.difference and st.journal_id.cash_control == True: | 457 | if st.difference and st.journal_id.cash_control == True: |
4943 | 458 | if st.difference > 0.0: | 458 | if st.difference > 0.0: |
4944 | 459 | name= _('Point of Sale Profit') | 459 | name= _('Point of Sale Profit') |
4945 | 460 | account_id = st.journal_id.profit_account_id.id | ||
4946 | 461 | else: | 460 | else: |
4947 | 462 | account_id = st.journal_id.loss_account_id.id | ||
4948 | 463 | name= _('Point of Sale Loss') | 461 | name= _('Point of Sale Loss') |
4949 | 464 | if not account_id: | ||
4950 | 465 | raise osv.except_osv( _('Error!'), | ||
4951 | 466 | _("Please set your profit and loss accounts on your payment method '%s'. This will allow OpenERP to post the difference of %.2f in your ending balance. To close this session, you can update the 'Closing Cash Control' to avoid any difference.") % (st.journal_id.name,st.difference)) | ||
4952 | 467 | bsl.create(cr, uid, { | 462 | bsl.create(cr, uid, { |
4953 | 468 | 'statement_id': st.id, | 463 | 'statement_id': st.id, |
4954 | 469 | 'amount': st.difference, | 464 | 'amount': st.difference, |
4955 | 470 | 'ref': record.name, | 465 | 'ref': record.name, |
4956 | 471 | 'name': name, | 466 | 'name': name, |
4957 | 472 | 'account_id': account_id | ||
4958 | 473 | }, context=context) | 467 | }, context=context) |
4959 | 474 | 468 | ||
4960 | 475 | if st.journal_id.type == 'bank': | 469 | if st.journal_id.type == 'bank': |
4961 | @@ -822,20 +816,9 @@ | |||
4962 | 822 | 'amount': data['amount'], | 816 | 'amount': data['amount'], |
4963 | 823 | 'date': data.get('payment_date', time.strftime('%Y-%m-%d')), | 817 | 'date': data.get('payment_date', time.strftime('%Y-%m-%d')), |
4964 | 824 | 'name': order.name + ': ' + (data.get('payment_name', '') or ''), | 818 | 'name': order.name + ': ' + (data.get('payment_name', '') or ''), |
4965 | 819 | 'partner_id': order.partner_id and order.partner_id.id or None, | ||
4966 | 825 | } | 820 | } |
4967 | 826 | 821 | ||
4968 | 827 | account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context) | ||
4969 | 828 | args['account_id'] = (order.partner_id and order.partner_id.property_account_receivable \ | ||
4970 | 829 | and order.partner_id.property_account_receivable.id) or (account_def and account_def.id) or False | ||
4971 | 830 | args['partner_id'] = order.partner_id and order.partner_id.id or None | ||
4972 | 831 | |||
4973 | 832 | if not args['account_id']: | ||
4974 | 833 | if not args['partner_id']: | ||
4975 | 834 | msg = _('There is no receivable account defined to make payment.') | ||
4976 | 835 | else: | ||
4977 | 836 | msg = _('There is no receivable account defined to make payment for the partner: "%s" (id:%d).') % (order.partner_id.name, order.partner_id.id,) | ||
4978 | 837 | raise osv.except_osv(_('Configuration Error!'), msg) | ||
4979 | 838 | |||
4980 | 839 | context.pop('pos_session_id', False) | 822 | context.pop('pos_session_id', False) |
4981 | 840 | 823 | ||
4982 | 841 | journal_id = data.get('journal', False) | 824 | journal_id = data.get('journal', False) |
4983 | @@ -857,7 +840,6 @@ | |||
4984 | 857 | 'statement_id' : statement_id, | 840 | 'statement_id' : statement_id, |
4985 | 858 | 'pos_statement_id' : order_id, | 841 | 'pos_statement_id' : order_id, |
4986 | 859 | 'journal_id' : journal_id, | 842 | 'journal_id' : journal_id, |
4987 | 860 | 'type' : 'customer', | ||
4988 | 861 | 'ref' : order.session_id.name, | 843 | 'ref' : order.session_id.name, |
4989 | 862 | }) | 844 | }) |
4990 | 863 | 845 | ||
4991 | 864 | 846 | ||
4992 | === modified file 'point_of_sale/point_of_sale_view.xml' | |||
4993 | --- point_of_sale/point_of_sale_view.xml 2014-05-07 18:29:17 +0000 | |||
4994 | +++ point_of_sale/point_of_sale_view.xml 2014-05-30 16:18:57 +0000 | |||
4995 | @@ -68,13 +68,6 @@ | |||
4996 | 68 | <field name="statement_id"/> | 68 | <field name="statement_id"/> |
4997 | 69 | <field name="amount"/> | 69 | <field name="amount"/> |
4998 | 70 | </tree> | 70 | </tree> |
4999 | 71 | <form string="Statement lines" version="7.0"> | ||
5000 | 72 | <group col="4"> |