Merge lp:~sandi-dirntis/openerpsl/20140717_1 into lp:openerpsl/7.0

Proposed by Aleksander Dirntiš
Status: Merged
Merged at revision: 434
Proposed branch: lp:~sandi-dirntis/openerpsl/20140717_1
Merge into: lp:openerpsl/7.0
Diff against target: 1333 lines (+602/-540)
25 files modified
.bzrignore (+1/-0)
account_slovenian/__init__.py (+0/-7)
account_slovenian/__openerp__.py (+8/-12)
account_slovenian/account_invoice.py (+0/-45)
account_slovenian/account_invoice_line.py (+4/-4)
account_slovenian/account_journal.py (+0/-45)
account_slovenian/account_model_line.py (+0/-32)
account_slovenian/account_move_line.py (+0/-88)
account_slovenian/account_voucher.py (+0/-63)
account_slovenian/account_voucher_line.py (+0/-61)
account_slovenian/account_voucher_view.xml (+0/-132)
account_slovenian/purchase_order.py (+1/-0)
account_slovenian/stock_move.py (+0/-46)
account_slovenian/stock_picking.py (+3/-4)
account_slovenian_storno/__init__.py (+29/-0)
account_slovenian_storno/__openerp__.py (+43/-0)
account_slovenian_storno/account_invoice.py (+46/-0)
account_slovenian_storno/account_journal.py (+46/-0)
account_slovenian_storno/account_model_line.py (+33/-0)
account_slovenian_storno/account_move_line.py (+85/-0)
account_slovenian_storno/account_voucher.py (+63/-0)
account_slovenian_storno/account_voucher_line.py (+60/-0)
account_slovenian_storno/account_voucher_view.xml (+132/-0)
account_slovenian_storno/stock_move.py (+46/-0)
stock_product_moves/stock_product_moves.py (+2/-1)
To merge this branch: bzr merge lp:~sandi-dirntis/openerpsl/20140717_1
Reviewer Review Type Date Requested Status
Mentis Pending
Review via email: mp+227154@code.launchpad.net

Description of the change

[MOD] Code cleanup

To post a comment you must log in.
434. By Dušan Laznik (Mentis)

[MOD] Code cleanup

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.bzrignore'
2--- .bzrignore 1970-01-01 00:00:00 +0000
3+++ .bzrignore 2014-07-17 08:32:41 +0000
4@@ -0,0 +1,1 @@
5+./.git
6
7=== modified file 'account_slovenian/__init__.py'
8--- account_slovenian/__init__.py 2014-06-26 12:21:06 +0000
9+++ account_slovenian/__init__.py 2014-07-17 08:32:41 +0000
10@@ -21,12 +21,5 @@
11 ##############################################################################
12
13 import stock_picking
14-import stock_move
15 import purchase_order
16-import account_invoice
17 import account_invoice_line
18-import account_move_line
19-import account_model_line
20-import account_voucher
21-import account_voucher_line
22-import account_journal
23
24=== modified file 'account_slovenian/__openerp__.py'
25--- account_slovenian/__openerp__.py 2014-06-26 12:21:06 +0000
26+++ account_slovenian/__openerp__.py 2014-07-17 08:32:41 +0000
27@@ -22,25 +22,21 @@
28
29 {
30 'name': 'Slovenian Accounting',
31- 'version': '0.10',
32+ 'version': '0.9',
33 'author': 'Mentis d.o.o.',
34 'website': 'http://www.mentis.si/openerp',
35- 'description': """
36-This module supports expands accounting according to Slovenian legislation
37-=====================================================================================================
38-
39-- implemented negative values for refund journals and vouchers
40-- input and output interim accounts and written on proper sides and in positive or negative numbers
41-
42+ 'description':
43+"""
44+This module supports expands the Anglo-Saxon accounting methodology according to Slovenian legislation
45+======================================================================================================
46 Slovenian accounting expansion uses same input and output interim accounts depending if it is supplier
47+or customer document.
48 """,
49 'images': [],
50- 'depends': ['account','account_voucher','account_anglo_saxon'],
51+ 'depends': ['account_anglo_saxon'],
52 'category': 'Accounting & Finance',
53 'demo': [],
54- 'data': [
55-# 'account_voucher_view.xml'
56- ],
57+ 'data': [],
58 'auto_install': False,
59 'installable': True,
60 }
61\ No newline at end of file
62
63=== removed file 'account_slovenian/account_invoice.py'
64--- account_slovenian/account_invoice.py 2014-06-26 12:21:06 +0000
65+++ account_slovenian/account_invoice.py 1970-01-01 00:00:00 +0000
66@@ -1,45 +0,0 @@
67-# -*- encoding: utf-8 -*-
68-##############################################################################
69-#
70-# OpenERP, Open Source Management Solution
71-# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
72-# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
73-#
74-# This program is free software: you can redistribute it and/or modify
75-# it under the terms of the GNU Affero General Public License as
76-# published by the Free Software Foundation, either version 3 of the
77-# License, or (at your option) any later version.
78-#
79-# This program is distributed in the hope that it will be useful,
80-# but WITHOUT ANY WARRANTY; without even the implied warranty of
81-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82-# GNU Affero General Public License for more details.
83-#
84-# You should have received a copy of the GNU Affero General Public License
85-# along with this program. If not, see <http://www.gnu.org/licenses/>.
86-#
87-##############################################################################
88-
89-from openerp.osv import osv, fields
90-
91-class account_invoice(osv.Model):
92- _inherit = "account.invoice"
93-
94- def finalize_invoice_move_lines(self, cr, uid, invoice_browse, move_lines):
95- move_lines = super(account_invoice, self).finalize_invoice_move_lines(cr, uid, invoice_browse, move_lines)
96-
97- if invoice_browse.type in ('in_refund', 'out_refund'):
98- _move_lines = []
99- for line in move_lines:
100- if line[2]['credit'] and line[2]['credit'] != 0.0:
101- _debit = line[2]['credit'] * -1
102- _credit = False
103- else:
104- _credit = line[2]['debit'] * -1
105- _debit = False
106- line[2]['credit'] = _credit
107- line[2]['debit'] = _debit
108- _move_lines.append(line)
109- return _move_lines
110- else:
111- return move_lines
112
113=== modified file 'account_slovenian/account_invoice_line.py'
114--- account_slovenian/account_invoice_line.py 2014-04-02 13:42:12 +0000
115+++ account_slovenian/account_invoice_line.py 2014-07-17 08:32:41 +0000
116@@ -22,6 +22,7 @@
117
118 from openerp.osv import osv
119
120+
121 class account_invoice_line(osv.Model):
122 _inherit = "account.invoice.line"
123
124@@ -35,12 +36,11 @@
125 _res = []
126 for _line in res:
127 if _line.get('product_id', False):
128- _product_id = self.pool.get('product.product').browse(cr, uid, _line ['product_id'], context)
129+ _product_id = self.pool.get('product.product').browse(cr, uid, _line['product_id'], context)
130 if _product_id and _product_id.valuation == 'real_time':
131-
132 acc_out = _product_id.property_stock_account_output and _product_id.property_stock_account_output.id
133 if not acc_out:
134- acc_out = _product_id.categ_id.property_stock_account_output_categ and _product_id.categ_id.property_stock_account_output_categ.id
135+ acc_out = _product_id.categ_id.property_stock_account_output_categ and _product_id.categ_id.property_stock_account_output_categ.id
136
137 acc_in = _product_id.property_stock_account_input and _product_id.property_stock_account_input.id
138 if not acc_in:
139@@ -67,5 +67,5 @@
140 if oa:
141 fpos = fposition_id and fiscal_pool.browse(cr, uid, fposition_id, context=context) or False
142 a = fiscal_pool.map_account(cr, uid, fpos, oa)
143- res['value'].update({'account_id':a})
144+ res['value'].update({'account_id': a})
145 return res
146
147=== removed file 'account_slovenian/account_journal.py'
148--- account_slovenian/account_journal.py 2014-06-26 12:21:06 +0000
149+++ account_slovenian/account_journal.py 1970-01-01 00:00:00 +0000
150@@ -1,45 +0,0 @@
151-# -*- encoding: utf-8 -*-
152-##############################################################################
153-#
154-# OpenERP, Open Source Management Solution
155-# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
156-# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
157-#
158-# This program is free software: you can redistribute it and/or modify
159-# it under the terms of the GNU Affero General Public License as
160-# published by the Free Software Foundation, either version 3 of the
161-# License, or (at your option) any later version.
162-#
163-# This program is distributed in the hope that it will be useful,
164-# but WITHOUT ANY WARRANTY; without even the implied warranty of
165-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
166-# GNU Affero General Public License for more details.
167-#
168-# You should have received a copy of the GNU Affero General Public License
169-# along with this program. If not, see <http://www.gnu.org/licenses/>.
170-#
171-##############################################################################
172-
173-from openerp.osv import osv, fields
174-import openerp.addons.decimal_precision as dp
175-
176-class account_journal(osv.Model):
177- _inherit = "account.journal"
178-
179- _columns = {
180- 'type': fields.selection([('sale', 'Sale'),
181- ('sale_refund','Sale Refund'),
182- ('purchase', 'Purchase'),
183- ('purchase_refund','Purchase Refund'),
184- ('cash', 'Cash'),
185- ('bank', 'Bank and Checks'),
186- ('reconcile', 'Reconciliation'),
187- ('general', 'General'),
188- ('situation', 'Opening/Closing Situation')], 'Type', size=32, required=True,
189- help="Select 'Sale' for customer invoices journals."\
190- " Select 'Purchase' for supplier invoices journals."\
191- " Select 'Cash' or 'Bank' for journals that are used in customer or supplier payments."\
192- " Select 'Reconciliation' for journals used for reconciling receivable and payable entries."\
193- " Select 'General' for miscellaneous operations journals."\
194- " Select 'Opening/Closing Situation' for entries generated for new fiscal years."),
195- }
196
197=== removed file 'account_slovenian/account_model_line.py'
198--- account_slovenian/account_model_line.py 2014-06-26 12:21:06 +0000
199+++ account_slovenian/account_model_line.py 1970-01-01 00:00:00 +0000
200@@ -1,32 +0,0 @@
201-# -*- encoding: utf-8 -*-
202-##############################################################################
203-#
204-# OpenERP, Open Source Management Solution
205-# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
206-# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
207-#
208-# This program is free software: you can redistribute it and/or modify
209-# it under the terms of the GNU Affero General Public License as
210-# published by the Free Software Foundation, either version 3 of the
211-# License, or (at your option) any later version.
212-#
213-# This program is distributed in the hope that it will be useful,
214-# but WITHOUT ANY WARRANTY; without even the implied warranty of
215-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
216-# GNU Affero General Public License for more details.
217-#
218-# You should have received a copy of the GNU Affero General Public License
219-# along with this program. If not, see <http://www.gnu.org/licenses/>.
220-#
221-##############################################################################
222-
223-from openerp.osv import osv, fields
224-import openerp.addons.decimal_precision as dp
225-
226-class account_model_line(osv.Model):
227- _inherit = "account.model.line"
228-
229- _sql_constraints = [
230- ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in accounting entry !'),
231- ('credit_debit2', 'CHECK (ABS(credit+debit)>=0)', 'Wrong credit or debit value in accounting entry !'),
232- ]
233
234=== removed file 'account_slovenian/account_move_line.py'
235--- account_slovenian/account_move_line.py 2014-06-26 12:21:06 +0000
236+++ account_slovenian/account_move_line.py 1970-01-01 00:00:00 +0000
237@@ -1,88 +0,0 @@
238-# -*- encoding: utf-8 -*-
239-##############################################################################
240-#
241-# OpenERP, Open Source Management Solution
242-# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
243-# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
244-#
245-# This program is free software: you can redistribute it and/or modify
246-# it under the terms of the GNU Affero General Public License as
247-# published by the Free Software Foundation, either version 3 of the
248-# License, or (at your option) any later version.
249-#
250-# This program is distributed in the hope that it will be useful,
251-# but WITHOUT ANY WARRANTY; without even the implied warranty of
252-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
253-# GNU Affero General Public License for more details.
254-#
255-# You should have received a copy of the GNU Affero General Public License
256-# along with this program. If not, see <http://www.gnu.org/licenses/>.
257-#
258-##############################################################################
259-
260-from openerp.osv import osv, fields
261-import openerp.addons.decimal_precision as dp
262-
263-class account_move_line(osv.Model):
264- _inherit = "account.move.line"
265-
266- def _amount_residual(self, cr, uid, ids, field_names, args, context=None):
267- """
268- This function returns the residual amount on a receivable or payable account.move.line.
269- By default, it returns an amount in the currency of this journal entry (maybe different
270- of the company currency), but if you pass 'residual_in_company_currency' = True in the
271- context then the returned amount will be in company currency.
272- """
273- res = {}
274- if context is None:
275- context = {}
276- cur_obj = self.pool.get('res.currency')
277- for move_line in self.browse(cr, uid, ids, context=context):
278- res[move_line.id] = {
279- 'amount_residual': 0.0,
280- 'amount_residual_currency': 0.0,
281- }
282-
283- if move_line.reconcile_id:
284- continue
285- if not move_line.account_id.type in ('payable', 'receivable'):
286- #this function does not support to be used on move lines not related to payable or receivable accounts
287- continue
288-
289- if move_line.currency_id:
290- move_line_total = move_line.amount_currency
291- sign = move_line.amount_currency < 0 and -1 or 1
292- else:
293- move_line_total = move_line.debit - move_line.credit
294- sign = (move_line.debit - move_line.credit) < 0 and -1 or 1
295- line_total_in_company_currency = move_line.debit - move_line.credit
296- context_unreconciled = context.copy()
297- if move_line.reconcile_partial_id:
298- for payment_line in move_line.reconcile_partial_id.line_partial_ids:
299- if payment_line.id == move_line.id:
300- continue
301- if payment_line.currency_id and move_line.currency_id and payment_line.currency_id.id == move_line.currency_id.id:
302- move_line_total += payment_line.amount_currency
303- else:
304- if move_line.currency_id:
305- context_unreconciled.update({'date': payment_line.date})
306- amount_in_foreign_currency = cur_obj.compute(cr, uid, move_line.company_id.currency_id.id, move_line.currency_id.id, (payment_line.debit - payment_line.credit), round=False, context=context_unreconciled)
307- move_line_total += amount_in_foreign_currency
308- else:
309- move_line_total += (payment_line.debit - payment_line.credit)
310- line_total_in_company_currency += (payment_line.debit - payment_line.credit)
311-
312- result = move_line_total
313- res[move_line.id]['amount_residual_currency'] = sign * (move_line.currency_id and self.pool.get('res.currency').round(cr, uid, move_line.currency_id, result) or result)
314- res[move_line.id]['amount_residual'] = sign * line_total_in_company_currency
315- return res
316-
317- _columns = {
318- 'amount_residual_currency': fields.function(_amount_residual, string='Residual Amount in Currency', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in its currency (maybe different of the company currency)."),
319- 'amount_residual': fields.function(_amount_residual, string='Residual Amount', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in the company currency."),
320- }
321-
322- _sql_constraints = [
323- ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in accounting entry !'),
324- ('credit_debit2', 'CHECK (ABS(credit+debit)>=0)', 'Wrong credit or debit value in accounting entry !'),
325- ]
326
327=== removed file 'account_slovenian/account_voucher.py'
328--- account_slovenian/account_voucher.py 2014-06-26 12:21:06 +0000
329+++ account_slovenian/account_voucher.py 1970-01-01 00:00:00 +0000
330@@ -1,63 +0,0 @@
331-# -*- encoding: utf-8 -*-
332-##############################################################################
333-#
334-# OpenERP, Open Source Management Solution
335-# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
336-# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
337-#
338-# This program is free software: you can redistribute it and/or modify
339-# it under the terms of the GNU Affero General Public License as
340-# published by the Free Software Foundation, either version 3 of the
341-# License, or (at your option) any later version.
342-#
343-# This program is distributed in the hope that it will be useful,
344-# but WITHOUT ANY WARRANTY; without even the implied warranty of
345-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
346-# GNU Affero General Public License for more details.
347-#
348-# You should have received a copy of the GNU Affero General Public License
349-# along with this program. If not, see <http://www.gnu.org/licenses/>.
350-#
351-##############################################################################
352-
353-from openerp.osv import osv, fields
354-import openerp.addons.decimal_precision as dp
355-
356-class account_voucher(osv.Model):
357- _inherit = "account.voucher"
358-
359- def voucher_move_line_create(self, cr, uid, voucher_id, line_total, move_id, company_currency, current_currency, context=None):
360- tot_line, rec_lst_ids = super(account_voucher, self).voucher_move_line_create(cr, uid, voucher_id, line_total, move_id, company_currency, current_currency, context)
361-
362- _negative_values = False
363- for _lines in rec_lst_ids:
364- _origin_move = self.pool.get('account.move.line').browse(cr, uid, _lines[1], context)
365- if _origin_move.debit < 0.0 or _origin_move.credit < 0.0:
366- _negative_values = True
367-
368- if _negative_values:
369- for _lines in rec_lst_ids:
370- _reconc_move = self.pool.get('account.move.line').browse(cr, uid, _lines[0], context)
371- _origin_move = self.pool.get('account.move.line').browse(cr, uid, _lines[1], context)
372-
373- _credit = _reconc_move.credit
374- _debit = _reconc_move.debit
375-
376- if _origin_move.credit and _origin_move.credit != 0.0:
377- if _origin_move.credit > 0.0:
378- _credit = abs(_reconc_move.credit + _reconc_move.debit) * -1
379- _debit = False
380- else:
381- _credit = abs(_reconc_move.credit + _reconc_move.debit)
382- _debit = False
383- elif _origin_move.debit and _origin_move.debit != 0.0:
384- if _origin_move.debit > 0.0:
385- _debit = abs(_reconc_move.credit + _reconc_move.debit) * -1
386- _credit = False
387- else:
388- _debit = abs(_reconc_move.credit + _reconc_move.debit)
389- _credit = False
390-
391- _reconc_move.write({'debit': _debit, 'credit': _credit})
392-
393- return tot_line, rec_lst_ids
394
395=== removed file 'account_slovenian/account_voucher_line.py'
396--- account_slovenian/account_voucher_line.py 2014-06-26 12:21:06 +0000
397+++ account_slovenian/account_voucher_line.py 1970-01-01 00:00:00 +0000
398@@ -1,61 +0,0 @@
399-# -*- encoding: utf-8 -*-
400-##############################################################################
401-#
402-# OpenERP, Open Source Management Solution
403-# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
404-# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
405-#
406-# This program is free software: you can redistribute it and/or modify
407-# it under the terms of the GNU Affero General Public License as
408-# published by the Free Software Foundation, either version 3 of the
409-# License, or (at your option) any later version.
410-#
411-# This program is distributed in the hope that it will be useful,
412-# but WITHOUT ANY WARRANTY; without even the implied warranty of
413-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
414-# GNU Affero General Public License for more details.
415-#
416-# You should have received a copy of the GNU Affero General Public License
417-# along with this program. If not, see <http://www.gnu.org/licenses/>.
418-#
419-##############################################################################
420-
421-from openerp.osv import osv, fields
422-import openerp.addons.decimal_precision as dp
423-
424-class account_voucher_line(osv.Model):
425- _inherit = "account.voucher.line"
426-
427- def _compute_balance(self, cr, uid, ids, name, args, context=None):
428- currency_pool = self.pool.get('res.currency')
429- rs_data = {}
430- for line in self.browse(cr, uid, ids, context=context):
431- ctx = context.copy()
432- ctx.update({'date': line.voucher_id.date})
433- voucher_rate = self.pool.get('res.currency').read(cr, uid, line.voucher_id.currency_id.id, ['rate'], context=ctx)['rate']
434- ctx.update({
435- 'voucher_special_currency': line.voucher_id.payment_rate_currency_id and line.voucher_id.payment_rate_currency_id.id or False,
436- 'voucher_special_currency_rate': line.voucher_id.payment_rate * voucher_rate})
437- res = {}
438- company_currency = line.voucher_id.journal_id.company_id.currency_id.id
439- voucher_currency = line.voucher_id.currency_id and line.voucher_id.currency_id.id or company_currency
440- move_line = line.move_line_id or False
441-
442- if not move_line:
443- res['amount_original'] = 0.0
444- res['amount_unreconciled'] = 0.0
445- elif move_line.currency_id and voucher_currency==move_line.currency_id.id:
446- res['amount_original'] = move_line.amount_currency
447- res['amount_unreconciled'] = move_line.amount_residual_currency
448- else:
449- #always use the amount booked in the company currency as the basis of the conversion into the voucher currency
450- res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.credit or move_line.debit or 0.0, context=ctx)
451- res['amount_unreconciled'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.amount_residual, context=ctx)
452-
453- rs_data[line.id] = res
454- return rs_data
455-
456- _columns = {
457- 'amount_original': fields.function(_compute_balance, multi='dc', type='float', string='Original Amount', store=True, digits_compute=dp.get_precision('Account')),
458- 'amount_unreconciled': fields.function(_compute_balance, multi='dc', type='float', string='Open Balance', store=True, digits_compute=dp.get_precision('Account')),
459- }
460
461=== removed file 'account_slovenian/account_voucher_view.xml'
462--- account_slovenian/account_voucher_view.xml 2014-06-26 12:21:06 +0000
463+++ account_slovenian/account_voucher_view.xml 1970-01-01 00:00:00 +0000
464@@ -1,132 +0,0 @@
465-<?xml version="1.0" encoding="UTF-8"?>
466-<openerp>
467- <data>
468-
469- <record id="view_voucher_filter_customer_pay_inherit" model="ir.ui.view">
470- <field name="name">account.voucher.customer.pay.select</field>
471- <field name="model">account.voucher</field>
472- <field name="inherit_id" ref="account_voucher.view_voucher_filter_customer_pay"/>
473- <field name="arch" type="xml">
474- <field name="journal_id" position="replace">
475- <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}"
476- domain="[('type','in',['bank','cash','reconcile'])]"/>
477- </field>
478- </field>
479- </record>
480-
481- <record id="view_voucher_filter_vendor_pay_inherit" model="ir.ui.view">
482- <field name="name">account.voucher.purchase.pay.select</field>
483- <field name="model">account.voucher</field>
484- <field name="inherit_id" ref="account_voucher.view_voucher_filter_vendor_pay"/>
485- <field name="arch" type="xml">
486- <field name="journal_id" position="replace">
487- <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}"
488- domain="[('type','in',['bank','cash','reconcile'])]"/>
489- </field>
490- </field>
491- </record>
492-
493- <record model="ir.ui.view" id="view_low_priority_payment_form_inherit">
494- <field name="name">account.voucher.payment.low.priority.form</field>
495- <field name="model">account.voucher</field>
496- <field name="inherit_id" ref="account_voucher.view_low_priority_payment_form"/>
497- <field name="arch" type="xml">
498- <field name="journal_id" position="replace">
499- <field name="journal_id" string="Payment Method" widget="selection"
500- domain="[('type','in',['bank','cash','reconcile'])]"
501- on_change="onchange_journal(journal_id, line_dr_ids, False, partner_id, date, amount, type, company_id, context)"/>
502- </field>
503- </field>
504- </record>
505-
506- <!-- Supplier Payment -->
507- <record model="ir.ui.view" id="view_vendor_payment_form_inherit">
508- <field name="name">account.voucher.payment.form</field>
509- <field name="model">account.voucher</field>
510- <field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
511- <field name="arch" type="xml">
512- <field name="journal_id" position="replace">
513- <field name="journal_id" string="Payment Method" widget="selection"
514- domain="[('type','in',['bank','cash','reconcile'])]"
515- invisible="context.get('line_type', False)"
516- on_change="onchange_journal(journal_id, line_dr_ids, False, partner_id, date, amount, type, company_id, context)"/>
517- </field>
518- </field>
519- </record>
520-
521- <delete model="ir.actions.act_window" id="account_voucher.action_vendor_payment"/>
522- <record id="action_vendor_payment" model="ir.actions.act_window">
523- <field name="name">Supplier Payments</field>
524- <field name="res_model">account.voucher</field>
525- <field name="view_type">form</field>
526- <field name="domain">[('journal_id.type', 'in', ['bank','cash','reconcile']), ('type','=','payment')]</field>
527- <field name="context">{'type':'payment'}</field>
528- <field name="view_id" eval="False"/>
529- <field name="search_view_id" ref="view_voucher_filter_vendor_pay_inherit"/>
530- <field name="target">current</field>
531- <field name="help" type="html">
532- <p class="oe_view_nocontent_create">
533- Click to create a new supplier payment.
534- </p><p>
535- OpenERP helps you easily track payments you make and the remaining balances you need to pay your suppliers.
536- </p>
537- </field>
538- </record>
539- <menuitem action="action_vendor_payment" icon="STOCK_JUSTIFY_FILL" sequence="12"
540- id="menu_action_vendor_payment" parent="account.menu_finance_payables"/>
541-
542- <record model="ir.ui.view" id="view_vendor_receipt_dialog_form_inherit">
543- <field name="name">account.voucher.receipt.dialog.form</field>
544- <field name="model">account.voucher</field>
545- <field name="inherit_id" ref="account_voucher.view_vendor_receipt_dialog_form"/>
546- <field name="arch" type="xml">
547- <field name="journal_id" position="replace">
548- <field name="journal_id" string="Payment Method" widget="selection"
549- domain="[('type','in',['bank','cash','reconcile'])]"
550- invisible="context.get('line_type', False)"
551- on_change="onchange_journal(journal_id, line_cr_ids, False, partner_id, date, amount, type, company_id, context)"/>
552- </field>
553- </field>
554- </record>
555-
556-
557- <!-- Customer Payment -->
558- <record model="ir.ui.view" id="view_vendor_receipt_form_inherit">
559- <field name="name">account.voucher.receipt.form</field>
560- <field name="model">account.voucher</field>
561- <field name="inherit_id" ref="account_voucher.view_vendor_receipt_form"/>
562- <field name="arch" type="xml">
563- <field name="journal_id" position="replace">
564- <field name="journal_id" string="Payment Method" widget="selection"
565- domain="[('type','in',['bank','cash','reconcile'])]"
566- on_change="onchange_journal(journal_id, line_cr_ids, False, partner_id, date, amount, type, company_id, context)"/>
567- </field>
568- </field>
569- </record>
570-
571- <delete model="ir.actions.act_window" id="account_voucher.action_vendor_receipt"/>
572- <record id="action_vendor_receipt" model="ir.actions.act_window">
573- <field name="name">Customer Payments</field>
574- <field name="res_model">account.voucher</field>
575- <field name="view_type">form</field>
576- <field name="domain">[('journal_id.type', 'in', ['bank','cash','reconcile']), ('type','=','receipt')]</field>
577- <field name="context">{'type':'receipt'}</field>
578- <field name="search_view_id" ref="view_voucher_filter_customer_pay_inherit"/>
579- <field name="view_id" eval="False"/>
580- <field name="target">current</field>
581- <field name="help" type="html">
582- <p class="oe_view_nocontent_create">
583- Click to register a new payment.
584- </p><p>
585- Enter the customer and the payment method and then, either
586- create manually a payment record or OpenERP will propose to you
587- automatically the reconciliation of this payment with the open
588- invoices or sales receipts.
589- </p>
590- </field>
591- </record>
592- <menuitem action="action_vendor_receipt" icon="STOCK_JUSTIFY_FILL" sequence="12"
593- id="menu_action_vendor_receipt" parent="account.menu_finance_receivables"/>
594-
595- </data>
596-</openerp>
597
598=== modified file 'account_slovenian/purchase_order.py'
599--- account_slovenian/purchase_order.py 2014-03-17 07:50:11 +0000
600+++ account_slovenian/purchase_order.py 2014-07-17 08:32:41 +0000
601@@ -22,6 +22,7 @@
602
603 from openerp.osv import fields, osv
604
605+
606 class purchase_order(osv.Model):
607 _name = "purchase.order"
608 _inherit = "purchase.order"
609
610=== removed file 'account_slovenian/stock_move.py'
611--- account_slovenian/stock_move.py 2014-06-26 12:21:06 +0000
612+++ account_slovenian/stock_move.py 1970-01-01 00:00:00 +0000
613@@ -1,46 +0,0 @@
614-# -*- encoding: utf-8 -*-
615-##############################################################################
616-#
617-# OpenERP, Open Source Management Solution
618-# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
619-# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
620-#
621-# This program is free software: you can redistribute it and/or modify
622-# it under the terms of the GNU Affero General Public License as
623-# published by the Free Software Foundation, either version 3 of the
624-# License, or (at your option) any later version.
625-#
626-# This program is distributed in the hope that it will be useful,
627-# but WITHOUT ANY WARRANTY; without even the implied warranty of
628-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
629-# GNU Affero General Public License for more details.
630-#
631-# You should have received a copy of the GNU Affero General Public License
632-# along with this program. If not, see <http://www.gnu.org/licenses/>.
633-#
634-##############################################################################
635-
636-from openerp.osv import osv
637-
638-class stock_move(osv.Model):
639- _inherit = "stock.move"
640-
641- def _create_account_move_line(self, cr, uid, move, src_account_id, dest_account_id, reference_amount, reference_currency_id, context=None):
642- _move_lines = super(stock_move, self)._create_account_move_line(cr, uid, move, src_account_id, dest_account_id, reference_amount, reference_currency_id, context)
643- _old_debit_lines = _move_lines[0][2]
644- _old_credit_lines = _move_lines[1][2]
645-
646- if (move.picking_id.type == 'in' and move.location_id.usage == 'customer') \
647- or (move.picking_id.type == 'out' and move.location_dest_id.usage == 'supplier'):
648- _new_debit_lines = _old_credit_lines.copy()
649- _new_debit_lines['debit'] = _new_debit_lines['credit'] * -1
650- _new_debit_lines['credit'] = 0.0
651-
652- _new_credit_lines = _old_debit_lines.copy()
653- _new_credit_lines['credit'] = _new_credit_lines['debit'] * -1
654- _new_credit_lines['debit'] = 0.0
655- else:
656- _new_debit_lines = _old_debit_lines
657- _new_credit_lines = _old_credit_lines
658-
659- return [(0, 0, _new_debit_lines), (0, 0, _new_credit_lines)]
660
661=== modified file 'account_slovenian/stock_picking.py'
662--- account_slovenian/stock_picking.py 2014-06-26 12:21:06 +0000
663+++ account_slovenian/stock_picking.py 2014-07-17 08:32:41 +0000
664@@ -22,12 +22,11 @@
665
666 from openerp.osv import osv
667
668+
669 class stock_picking(osv.Model):
670 _inherit = "stock.picking"
671
672- def action_invoice_create(self, cr, uid, ids, journal_id=False,
673- group=False, type='out_invoice', context=None):
674- '''Return ids of created invoices for the pickings'''
675+ def action_invoice_create(self, cr, uid, ids, journal_id=False, group=False, type='out_invoice', context=None):
676 res = super(stock_picking,self).action_invoice_create(cr, uid, ids, journal_id, group, type, context=context)
677 if type == 'in_invoice' or type == 'in_refund':
678 for inv in self.pool.get('account.invoice').browse(cr, uid, res.values(), context=context):
679@@ -35,7 +34,7 @@
680 if ol.product_id:
681 oa = ol.product_id.property_stock_account_input and ol.product_id.property_stock_account_input.id
682 if not oa:
683- oa = ol.product_id.categ_id.property_stock_account_input_categ and ol.product_id.categ_id.property_stock_account_input_categ.id
684+ oa = ol.product_id.categ_id.property_stock_account_input_categ and ol.product_id.categ_id.property_stock_account_input_categ.id
685 if oa:
686 fpos = ol.invoice_id.fiscal_position or False
687 a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa)
688
689=== added directory 'account_slovenian_storno'
690=== added file 'account_slovenian_storno/__init__.py'
691--- account_slovenian_storno/__init__.py 1970-01-01 00:00:00 +0000
692+++ account_slovenian_storno/__init__.py 2014-07-17 08:32:41 +0000
693@@ -0,0 +1,29 @@
694+# -*- encoding: utf-8 -*-
695+##############################################################################
696+#
697+# OpenERP, Open Source Management Solution
698+# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
699+# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
700+#
701+# This program is free software: you can redistribute it and/or modify
702+# it under the terms of the GNU Affero General Public License as
703+# published by the Free Software Foundation, either version 3 of the
704+# License, or (at your option) any later version.
705+#
706+# This program is distributed in the hope that it will be useful,
707+# but WITHOUT ANY WARRANTY; without even the implied warranty of
708+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
709+# GNU Affero General Public License for more details.
710+#
711+# You should have received a copy of the GNU Affero General Public License
712+# along with this program. If not, see <http://www.gnu.org/licenses/>.
713+#
714+##############################################################################
715+
716+import stock_move
717+import account_invoice
718+import account_move_line
719+import account_model_line
720+import account_voucher
721+import account_voucher_line
722+#import account_journal
723
724=== added file 'account_slovenian_storno/__openerp__.py'
725--- account_slovenian_storno/__openerp__.py 1970-01-01 00:00:00 +0000
726+++ account_slovenian_storno/__openerp__.py 2014-07-17 08:32:41 +0000
727@@ -0,0 +1,43 @@
728+# -*- encoding: utf-8 -*-
729+##############################################################################
730+#
731+# OpenERP, Open Source Management Solution
732+# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
733+# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
734+#
735+# This program is free software: you can redistribute it and/or modify
736+# it under the terms of the GNU Affero General Public License as
737+# published by the Free Software Foundation, either version 3 of the
738+# License, or (at your option) any later version.
739+#
740+# This program is distributed in the hope that it will be useful,
741+# but WITHOUT ANY WARRANTY; without even the implied warranty of
742+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
743+# GNU Affero General Public License for more details.
744+#
745+# You should have received a copy of the GNU Affero General Public License
746+# along with this program. If not, see <http://www.gnu.org/licenses/>.
747+#
748+##############################################################################
749+
750+{
751+ 'name': 'Slovenian Accounting - Storno',
752+ 'version': '0.9',
753+ 'author': 'Mentis d.o.o.',
754+ 'website': 'http://www.mentis.si/openerp',
755+ 'description':
756+"""
757+This module supports expands accounting with option of using negative values in accounting documents
758+====================================================================================================
759+- implemented negative values for refund journals and vouchers
760+""",
761+ 'images': [],
762+ 'depends': ['account', 'account_voucher', 'account_slovenian'],
763+ 'category': 'Accounting & Finance',
764+ 'demo': [],
765+ 'data': [
766+# 'account_voucher_view.xml'
767+ ],
768+ 'auto_install': False,
769+ 'installable': True,
770+}
771\ No newline at end of file
772
773=== added file 'account_slovenian_storno/account_invoice.py'
774--- account_slovenian_storno/account_invoice.py 1970-01-01 00:00:00 +0000
775+++ account_slovenian_storno/account_invoice.py 2014-07-17 08:32:41 +0000
776@@ -0,0 +1,46 @@
777+# -*- encoding: utf-8 -*-
778+##############################################################################
779+#
780+# OpenERP, Open Source Management Solution
781+# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
782+# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
783+#
784+# This program is free software: you can redistribute it and/or modify
785+# it under the terms of the GNU Affero General Public License as
786+# published by the Free Software Foundation, either version 3 of the
787+# License, or (at your option) any later version.
788+#
789+# This program is distributed in the hope that it will be useful,
790+# but WITHOUT ANY WARRANTY; without even the implied warranty of
791+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
792+# GNU Affero General Public License for more details.
793+#
794+# You should have received a copy of the GNU Affero General Public License
795+# along with this program. If not, see <http://www.gnu.org/licenses/>.
796+#
797+##############################################################################
798+
799+from openerp.osv import osv, fields
800+
801+
802+class account_invoice(osv.Model):
803+ _inherit = "account.invoice"
804+
805+ def finalize_invoice_move_lines(self, cr, uid, invoice_browse, move_lines):
806+ move_lines = super(account_invoice, self).finalize_invoice_move_lines(cr, uid, invoice_browse, move_lines)
807+
808+ if invoice_browse.type in ('in_refund', 'out_refund'):
809+ _move_lines = []
810+ for line in move_lines:
811+ if line[2]['credit'] and line[2]['credit'] != 0.0:
812+ _debit = line[2]['credit'] * -1
813+ _credit = False
814+ else:
815+ _credit = line[2]['debit'] * -1
816+ _debit = False
817+ line[2]['credit'] = _credit
818+ line[2]['debit'] = _debit
819+ _move_lines.append(line)
820+ return _move_lines
821+ else:
822+ return move_lines
823
824=== added file 'account_slovenian_storno/account_journal.py'
825--- account_slovenian_storno/account_journal.py 1970-01-01 00:00:00 +0000
826+++ account_slovenian_storno/account_journal.py 2014-07-17 08:32:41 +0000
827@@ -0,0 +1,46 @@
828+# -*- encoding: utf-8 -*-
829+##############################################################################
830+#
831+# OpenERP, Open Source Management Solution
832+# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
833+# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
834+#
835+# This program is free software: you can redistribute it and/or modify
836+# it under the terms of the GNU Affero General Public License as
837+# published by the Free Software Foundation, either version 3 of the
838+# License, or (at your option) any later version.
839+#
840+# This program is distributed in the hope that it will be useful,
841+# but WITHOUT ANY WARRANTY; without even the implied warranty of
842+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
843+# GNU Affero General Public License for more details.
844+#
845+# You should have received a copy of the GNU Affero General Public License
846+# along with this program. If not, see <http://www.gnu.org/licenses/>.
847+#
848+##############################################################################
849+
850+from openerp.osv import osv, fields
851+import openerp.addons.decimal_precision as dp
852+
853+
854+class account_journal(osv.Model):
855+ _inherit = "account.journal"
856+
857+ _columns = {
858+ 'type': fields.selection([('sale', 'Sale'),
859+ ('sale_refund', 'Sale Refund'),
860+ ('purchase', 'Purchase'),
861+ ('purchase_refund', 'Purchase Refund'),
862+ ('cash', 'Cash'),
863+ ('bank', 'Bank and Checks'),
864+ ('reconcile', 'Reconciliation'),
865+ ('general', 'General'),
866+ ('situation', 'Opening/Closing Situation')], 'Type', size=32, required=True,
867+ help="Select 'Sale' for customer invoices journals."
868+ " Select 'Purchase' for supplier invoices journals."
869+ " Select 'Cash' or 'Bank' for journals that are used in customer or supplier payments."
870+ " Select 'Reconciliation' for journals used for reconciling receivable and payable entries."
871+ " Select 'General' for miscellaneous operations journals."
872+ " Select 'Opening/Closing Situation' for entries generated for new fiscal years."),
873+ }
874
875=== added file 'account_slovenian_storno/account_model_line.py'
876--- account_slovenian_storno/account_model_line.py 1970-01-01 00:00:00 +0000
877+++ account_slovenian_storno/account_model_line.py 2014-07-17 08:32:41 +0000
878@@ -0,0 +1,33 @@
879+# -*- encoding: utf-8 -*-
880+##############################################################################
881+#
882+# OpenERP, Open Source Management Solution
883+# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
884+# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
885+#
886+# This program is free software: you can redistribute it and/or modify
887+# it under the terms of the GNU Affero General Public License as
888+# published by the Free Software Foundation, either version 3 of the
889+# License, or (at your option) any later version.
890+#
891+# This program is distributed in the hope that it will be useful,
892+# but WITHOUT ANY WARRANTY; without even the implied warranty of
893+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
894+# GNU Affero General Public License for more details.
895+#
896+# You should have received a copy of the GNU Affero General Public License
897+# along with this program. If not, see <http://www.gnu.org/licenses/>.
898+#
899+##############################################################################
900+
901+from openerp.osv import osv, fields
902+import openerp.addons.decimal_precision as dp
903+
904+
905+class account_model_line(osv.Model):
906+ _inherit = "account.model.line"
907+
908+ _sql_constraints = [
909+ ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in accounting entry !'),
910+ ('credit_debit2', 'CHECK (ABS(credit+debit)>=0)', 'Wrong credit or debit value in accounting entry !'),
911+ ]
912
913=== added file 'account_slovenian_storno/account_move_line.py'
914--- account_slovenian_storno/account_move_line.py 1970-01-01 00:00:00 +0000
915+++ account_slovenian_storno/account_move_line.py 2014-07-17 08:32:41 +0000
916@@ -0,0 +1,85 @@
917+# -*- encoding: utf-8 -*-
918+##############################################################################
919+#
920+# OpenERP, Open Source Management Solution
921+# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
922+# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
923+#
924+# This program is free software: you can redistribute it and/or modify
925+# it under the terms of the GNU Affero General Public License as
926+# published by the Free Software Foundation, either version 3 of the
927+# License, or (at your option) any later version.
928+#
929+# This program is distributed in the hope that it will be useful,
930+# but WITHOUT ANY WARRANTY; without even the implied warranty of
931+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
932+# GNU Affero General Public License for more details.
933+#
934+# You should have received a copy of the GNU Affero General Public License
935+# along with this program. If not, see <http://www.gnu.org/licenses/>.
936+#
937+##############################################################################
938+
939+from openerp.osv import osv, fields
940+import openerp.addons.decimal_precision as dp
941+
942+
943+class account_move_line(osv.Model):
944+ _inherit = "account.move.line"
945+
946+ def _amount_residual(self, cr, uid, ids, field_names, args, context=None):
947+ res = {}
948+ if context is None:
949+ context = {}
950+ cur_obj = self.pool.get('res.currency')
951+ for move_line in self.browse(cr, uid, ids, context=context):
952+ res[move_line.id] = {
953+ 'amount_residual': 0.0,
954+ 'amount_residual_currency': 0.0,
955+ }
956+
957+ if move_line.reconcile_id:
958+ continue
959+ if not move_line.account_id.type in ('payable', 'receivable'):
960+ continue
961+
962+ if move_line.currency_id:
963+ move_line_total = move_line.amount_currency
964+ sign = move_line.amount_currency < 0 and -1 or 1
965+ else:
966+ move_line_total = move_line.debit - move_line.credit
967+ sign = (move_line.debit - move_line.credit) < 0 and -1 or 1
968+ line_total_in_company_currency = move_line.debit - move_line.credit
969+ context_unreconciled = context.copy()
970+ if move_line.reconcile_partial_id:
971+ for payment_line in move_line.reconcile_partial_id.line_partial_ids:
972+ if payment_line.id == move_line.id:
973+ continue
974+ if payment_line.currency_id and move_line.currency_id and \
975+ payment_line.currency_id.id == move_line.currency_id.id:
976+ move_line_total += payment_line.amount_currency
977+ else:
978+ if move_line.currency_id:
979+ context_unreconciled.update({'date': payment_line.date})
980+ amount_in_foreign_currency = cur_obj.compute(cr, uid, move_line.company_id.currency_id.id, move_line.currency_id.id, (payment_line.debit - payment_line.credit), round=False, context=context_unreconciled)
981+ move_line_total += amount_in_foreign_currency
982+ else:
983+ move_line_total += (payment_line.debit - payment_line.credit)
984+ line_total_in_company_currency += (payment_line.debit - payment_line.credit)
985+
986+ result = move_line_total
987+ res[move_line.id]['amount_residual_currency'] = sign * (move_line.currency_id and self.pool.get('res.currency').round(cr, uid, move_line.currency_id, result) or result)
988+ res[move_line.id]['amount_residual'] = sign * line_total_in_company_currency
989+ return res
990+
991+ _columns = {
992+ 'amount_residual_currency': fields.function(_amount_residual, string='Residual Amount in Currency', multi="residual",
993+ help="The residual amount on a receivable or payable of a journal entry expressed in its currency (maybe different of the company currency)."),
994+ 'amount_residual': fields.function(_amount_residual, string='Residual Amount', multi="residual",
995+ help="The residual amount on a receivable or payable of a journal entry expressed in the company currency."),
996+ }
997+
998+ _sql_constraints = [
999+ ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in accounting entry !'),
1000+ ('credit_debit2', 'CHECK (ABS(credit+debit)>=0)', 'Wrong credit or debit value in accounting entry !'),
1001+ ]
1002
1003=== added file 'account_slovenian_storno/account_voucher.py'
1004--- account_slovenian_storno/account_voucher.py 1970-01-01 00:00:00 +0000
1005+++ account_slovenian_storno/account_voucher.py 2014-07-17 08:32:41 +0000
1006@@ -0,0 +1,63 @@
1007+# -*- encoding: utf-8 -*-
1008+##############################################################################
1009+#
1010+# OpenERP, Open Source Management Solution
1011+# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
1012+# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
1013+#
1014+# This program is free software: you can redistribute it and/or modify
1015+# it under the terms of the GNU Affero General Public License as
1016+# published by the Free Software Foundation, either version 3 of the
1017+# License, or (at your option) any later version.
1018+#
1019+# This program is distributed in the hope that it will be useful,
1020+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1021+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1022+# GNU Affero General Public License for more details.
1023+#
1024+# You should have received a copy of the GNU Affero General Public License
1025+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1026+#
1027+##############################################################################
1028+
1029+from openerp.osv import osv, fields
1030+import openerp.addons.decimal_precision as dp
1031+
1032+class account_voucher(osv.Model):
1033+ _inherit = "account.voucher"
1034+
1035+ def voucher_move_line_create(self, cr, uid, voucher_id, line_total, move_id, company_currency, current_currency, context=None):
1036+ tot_line, rec_lst_ids = super(account_voucher, self).voucher_move_line_create(cr, uid, voucher_id, line_total, move_id, company_currency, current_currency, context)
1037+
1038+ _negative_values = False
1039+ for _lines in rec_lst_ids:
1040+ _origin_move = self.pool.get('account.move.line').browse(cr, uid, _lines[1], context)
1041+ if _origin_move.debit < 0.0 or _origin_move.credit < 0.0:
1042+ _negative_values = True
1043+
1044+ if _negative_values:
1045+ for _lines in rec_lst_ids:
1046+ _reconc_move = self.pool.get('account.move.line').browse(cr, uid, _lines[0], context)
1047+ _origin_move = self.pool.get('account.move.line').browse(cr, uid, _lines[1], context)
1048+
1049+ _credit = _reconc_move.credit
1050+ _debit = _reconc_move.debit
1051+
1052+ if _origin_move.credit and _origin_move.credit != 0.0:
1053+ if _origin_move.credit > 0.0:
1054+ _credit = abs(_reconc_move.credit + _reconc_move.debit) * -1
1055+ _debit = False
1056+ else:
1057+ _credit = abs(_reconc_move.credit + _reconc_move.debit)
1058+ _debit = False
1059+ elif _origin_move.debit and _origin_move.debit != 0.0:
1060+ if _origin_move.debit > 0.0:
1061+ _debit = abs(_reconc_move.credit + _reconc_move.debit) * -1
1062+ _credit = False
1063+ else:
1064+ _debit = abs(_reconc_move.credit + _reconc_move.debit)
1065+ _credit = False
1066+
1067+ _reconc_move.write({'debit': _debit, 'credit': _credit})
1068+
1069+ return tot_line, rec_lst_ids
1070
1071=== added file 'account_slovenian_storno/account_voucher_line.py'
1072--- account_slovenian_storno/account_voucher_line.py 1970-01-01 00:00:00 +0000
1073+++ account_slovenian_storno/account_voucher_line.py 2014-07-17 08:32:41 +0000
1074@@ -0,0 +1,60 @@
1075+# -*- encoding: utf-8 -*-
1076+##############################################################################
1077+#
1078+# OpenERP, Open Source Management Solution
1079+# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
1080+# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
1081+#
1082+# This program is free software: you can redistribute it and/or modify
1083+# it under the terms of the GNU Affero General Public License as
1084+# published by the Free Software Foundation, either version 3 of the
1085+# License, or (at your option) any later version.
1086+#
1087+# This program is distributed in the hope that it will be useful,
1088+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1089+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1090+# GNU Affero General Public License for more details.
1091+#
1092+# You should have received a copy of the GNU Affero General Public License
1093+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1094+#
1095+##############################################################################
1096+
1097+from openerp.osv import osv, fields
1098+import openerp.addons.decimal_precision as dp
1099+
1100+class account_voucher_line(osv.Model):
1101+ _inherit = "account.voucher.line"
1102+
1103+ def _compute_balance(self, cr, uid, ids, name, args, context=None):
1104+ currency_pool = self.pool.get('res.currency')
1105+ rs_data = {}
1106+ for line in self.browse(cr, uid, ids, context=context):
1107+ ctx = context.copy()
1108+ ctx.update({'date': line.voucher_id.date})
1109+ voucher_rate = self.pool.get('res.currency').read(cr, uid, line.voucher_id.currency_id.id, ['rate'], context=ctx)['rate']
1110+ ctx.update({
1111+ 'voucher_special_currency': line.voucher_id.payment_rate_currency_id and line.voucher_id.payment_rate_currency_id.id or False,
1112+ 'voucher_special_currency_rate': line.voucher_id.payment_rate * voucher_rate})
1113+ res = {}
1114+ company_currency = line.voucher_id.journal_id.company_id.currency_id.id
1115+ voucher_currency = line.voucher_id.currency_id and line.voucher_id.currency_id.id or company_currency
1116+ move_line = line.move_line_id or False
1117+
1118+ if not move_line:
1119+ res['amount_original'] = 0.0
1120+ res['amount_unreconciled'] = 0.0
1121+ elif move_line.currency_id and voucher_currency==move_line.currency_id.id:
1122+ res['amount_original'] = move_line.amount_currency
1123+ res['amount_unreconciled'] = move_line.amount_residual_currency
1124+ else:
1125+ res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.credit or move_line.debit or 0.0, context=ctx)
1126+ res['amount_unreconciled'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.amount_residual, context=ctx)
1127+
1128+ rs_data[line.id] = res
1129+ return rs_data
1130+
1131+ _columns = {
1132+ 'amount_original': fields.function(_compute_balance, multi='dc', type='float', string='Original Amount', store=True, digits_compute=dp.get_precision('Account')),
1133+ 'amount_unreconciled': fields.function(_compute_balance, multi='dc', type='float', string='Open Balance', store=True, digits_compute=dp.get_precision('Account')),
1134+ }
1135
1136=== added file 'account_slovenian_storno/account_voucher_view.xml'
1137--- account_slovenian_storno/account_voucher_view.xml 1970-01-01 00:00:00 +0000
1138+++ account_slovenian_storno/account_voucher_view.xml 2014-07-17 08:32:41 +0000
1139@@ -0,0 +1,132 @@
1140+<?xml version="1.0" encoding="UTF-8"?>
1141+<openerp>
1142+ <data>
1143+
1144+ <record id="view_voucher_filter_customer_pay_inherit" model="ir.ui.view">
1145+ <field name="name">account.voucher.customer.pay.select</field>
1146+ <field name="model">account.voucher</field>
1147+ <field name="inherit_id" ref="account_voucher.view_voucher_filter_customer_pay"/>
1148+ <field name="arch" type="xml">
1149+ <field name="journal_id" position="replace">
1150+ <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}"
1151+ domain="[('type','in',['bank','cash','reconcile'])]"/>
1152+ </field>
1153+ </field>
1154+ </record>
1155+
1156+ <record id="view_voucher_filter_vendor_pay_inherit" model="ir.ui.view">
1157+ <field name="name">account.voucher.purchase.pay.select</field>
1158+ <field name="model">account.voucher</field>
1159+ <field name="inherit_id" ref="account_voucher.view_voucher_filter_vendor_pay"/>
1160+ <field name="arch" type="xml">
1161+ <field name="journal_id" position="replace">
1162+ <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}"
1163+ domain="[('type','in',['bank','cash','reconcile'])]"/>
1164+ </field>
1165+ </field>
1166+ </record>
1167+
1168+ <record model="ir.ui.view" id="view_low_priority_payment_form_inherit">
1169+ <field name="name">account.voucher.payment.low.priority.form</field>
1170+ <field name="model">account.voucher</field>
1171+ <field name="inherit_id" ref="account_voucher.view_low_priority_payment_form"/>
1172+ <field name="arch" type="xml">
1173+ <field name="journal_id" position="replace">
1174+ <field name="journal_id" string="Payment Method" widget="selection"
1175+ domain="[('type','in',['bank','cash','reconcile'])]"
1176+ on_change="onchange_journal(journal_id, line_dr_ids, False, partner_id, date, amount, type, company_id, context)"/>
1177+ </field>
1178+ </field>
1179+ </record>
1180+
1181+ <!-- Supplier Payment -->
1182+ <record model="ir.ui.view" id="view_vendor_payment_form_inherit">
1183+ <field name="name">account.voucher.payment.form</field>
1184+ <field name="model">account.voucher</field>
1185+ <field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
1186+ <field name="arch" type="xml">
1187+ <field name="journal_id" position="replace">
1188+ <field name="journal_id" string="Payment Method" widget="selection"
1189+ domain="[('type','in',['bank','cash','reconcile'])]"
1190+ invisible="context.get('line_type', False)"
1191+ on_change="onchange_journal(journal_id, line_dr_ids, False, partner_id, date, amount, type, company_id, context)"/>
1192+ </field>
1193+ </field>
1194+ </record>
1195+
1196+ <delete model="ir.actions.act_window" id="account_voucher.action_vendor_payment"/>
1197+ <record id="action_vendor_payment" model="ir.actions.act_window">
1198+ <field name="name">Supplier Payments</field>
1199+ <field name="res_model">account.voucher</field>
1200+ <field name="view_type">form</field>
1201+ <field name="domain">[('journal_id.type', 'in', ['bank','cash','reconcile']), ('type','=','payment')]</field>
1202+ <field name="context">{'type':'payment'}</field>
1203+ <field name="view_id" eval="False"/>
1204+ <field name="search_view_id" ref="view_voucher_filter_vendor_pay_inherit"/>
1205+ <field name="target">current</field>
1206+ <field name="help" type="html">
1207+ <p class="oe_view_nocontent_create">
1208+ Click to create a new supplier payment.
1209+ </p><p>
1210+ OpenERP helps you easily track payments you make and the remaining balances you need to pay your suppliers.
1211+ </p>
1212+ </field>
1213+ </record>
1214+ <menuitem action="action_vendor_payment" icon="STOCK_JUSTIFY_FILL" sequence="12"
1215+ id="menu_action_vendor_payment" parent="account.menu_finance_payables"/>
1216+
1217+ <record model="ir.ui.view" id="view_vendor_receipt_dialog_form_inherit">
1218+ <field name="name">account.voucher.receipt.dialog.form</field>
1219+ <field name="model">account.voucher</field>
1220+ <field name="inherit_id" ref="account_voucher.view_vendor_receipt_dialog_form"/>
1221+ <field name="arch" type="xml">
1222+ <field name="journal_id" position="replace">
1223+ <field name="journal_id" string="Payment Method" widget="selection"
1224+ domain="[('type','in',['bank','cash','reconcile'])]"
1225+ invisible="context.get('line_type', False)"
1226+ on_change="onchange_journal(journal_id, line_cr_ids, False, partner_id, date, amount, type, company_id, context)"/>
1227+ </field>
1228+ </field>
1229+ </record>
1230+
1231+
1232+ <!-- Customer Payment -->
1233+ <record model="ir.ui.view" id="view_vendor_receipt_form_inherit">
1234+ <field name="name">account.voucher.receipt.form</field>
1235+ <field name="model">account.voucher</field>
1236+ <field name="inherit_id" ref="account_voucher.view_vendor_receipt_form"/>
1237+ <field name="arch" type="xml">
1238+ <field name="journal_id" position="replace">
1239+ <field name="journal_id" string="Payment Method" widget="selection"
1240+ domain="[('type','in',['bank','cash','reconcile'])]"
1241+ on_change="onchange_journal(journal_id, line_cr_ids, False, partner_id, date, amount, type, company_id, context)"/>
1242+ </field>
1243+ </field>
1244+ </record>
1245+
1246+ <delete model="ir.actions.act_window" id="account_voucher.action_vendor_receipt"/>
1247+ <record id="action_vendor_receipt" model="ir.actions.act_window">
1248+ <field name="name">Customer Payments</field>
1249+ <field name="res_model">account.voucher</field>
1250+ <field name="view_type">form</field>
1251+ <field name="domain">[('journal_id.type', 'in', ['bank','cash','reconcile']), ('type','=','receipt')]</field>
1252+ <field name="context">{'type':'receipt'}</field>
1253+ <field name="search_view_id" ref="view_voucher_filter_customer_pay_inherit"/>
1254+ <field name="view_id" eval="False"/>
1255+ <field name="target">current</field>
1256+ <field name="help" type="html">
1257+ <p class="oe_view_nocontent_create">
1258+ Click to register a new payment.
1259+ </p><p>
1260+ Enter the customer and the payment method and then, either
1261+ create manually a payment record or OpenERP will propose to you
1262+ automatically the reconciliation of this payment with the open
1263+ invoices or sales receipts.
1264+ </p>
1265+ </field>
1266+ </record>
1267+ <menuitem action="action_vendor_receipt" icon="STOCK_JUSTIFY_FILL" sequence="12"
1268+ id="menu_action_vendor_receipt" parent="account.menu_finance_receivables"/>
1269+
1270+ </data>
1271+</openerp>
1272
1273=== added file 'account_slovenian_storno/stock_move.py'
1274--- account_slovenian_storno/stock_move.py 1970-01-01 00:00:00 +0000
1275+++ account_slovenian_storno/stock_move.py 2014-07-17 08:32:41 +0000
1276@@ -0,0 +1,46 @@
1277+# -*- encoding: utf-8 -*-
1278+##############################################################################
1279+#
1280+# OpenERP, Open Source Management Solution
1281+# Copyright (C) 2004-TODAY OpenERP s.a. (<http://www.openerp.com>)
1282+# Copyright (C) 2013-TODAY Mentis d.o.o. (<http://www.mentis.si/openerp>)
1283+#
1284+# This program is free software: you can redistribute it and/or modify
1285+# it under the terms of the GNU Affero General Public License as
1286+# published by the Free Software Foundation, either version 3 of the
1287+# License, or (at your option) any later version.
1288+#
1289+# This program is distributed in the hope that it will be useful,
1290+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1291+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1292+# GNU Affero General Public License for more details.
1293+#
1294+# You should have received a copy of the GNU Affero General Public License
1295+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1296+#
1297+##############################################################################
1298+
1299+from openerp.osv import osv
1300+
1301+class stock_move(osv.Model):
1302+ _inherit = "stock.move"
1303+
1304+ def _create_account_move_line(self, cr, uid, move, src_account_id, dest_account_id, reference_amount, reference_currency_id, context=None):
1305+ _move_lines = super(stock_move, self)._create_account_move_line(cr, uid, move, src_account_id, dest_account_id, reference_amount, reference_currency_id, context)
1306+ _old_debit_lines = _move_lines[0][2]
1307+ _old_credit_lines = _move_lines[1][2]
1308+
1309+ if (move.picking_id.type == 'in' and move.location_id.usage == 'customer') \
1310+ or (move.picking_id.type == 'out' and move.location_dest_id.usage == 'supplier'):
1311+ _new_debit_lines = _old_credit_lines.copy()
1312+ _new_debit_lines['debit'] = _new_debit_lines['credit'] * -1
1313+ _new_debit_lines['credit'] = 0.0
1314+
1315+ _new_credit_lines = _old_debit_lines.copy()
1316+ _new_credit_lines['credit'] = _new_credit_lines['debit'] * -1
1317+ _new_credit_lines['debit'] = 0.0
1318+ else:
1319+ _new_debit_lines = _old_debit_lines
1320+ _new_credit_lines = _old_credit_lines
1321+
1322+ return [(0, 0, _new_debit_lines), (0, 0, _new_credit_lines)]
1323
1324=== modified file 'stock_product_moves/stock_product_moves.py'
1325--- stock_product_moves/stock_product_moves.py 2014-03-19 08:55:42 +0000
1326+++ stock_product_moves/stock_product_moves.py 2014-07-17 08:32:41 +0000
1327@@ -90,4 +90,5 @@
1328 LEFT OUTER JOIN account_invoice AS sai ON sai.id = sail.invoice_id
1329 LEFT OUTER JOIN account_invoice_line AS pail ON pail.id = polir.invoice_id
1330 LEFT OUTER JOIN account_invoice AS pai ON pai.id = pail.invoice_id
1331- WHERE sm.state = 'done');""")
1332+ WHERE sm.state = 'done'
1333+ AND sm.location_id <> sm.location_dest_id);""")

Subscribers

People subscribed via source and target branches