Merge lp:~domsense/account-payment/adding_account_vat_on_payment_7 into lp:~account-payment-team/account-payment/7.0

Proposed by Lorenzo Battistini
Status: Needs review
Proposed branch: lp:~domsense/account-payment/adding_account_vat_on_payment_7
Merge into: lp:~account-payment-team/account-payment/7.0
Diff against target: 816 lines (+770/-0)
9 files modified
account_vat_on_payment/AUTHORS.txt (+1/-0)
account_vat_on_payment/__init__.py (+25/-0)
account_vat_on_payment/__openerp__.py (+60/-0)
account_vat_on_payment/account.py (+433/-0)
account_vat_on_payment/account_view.xml (+104/-0)
account_vat_on_payment/company.py (+42/-0)
account_vat_on_payment/company_view.xml (+21/-0)
account_vat_on_payment/partner.py (+36/-0)
account_vat_on_payment/partner_view.xml (+48/-0)
To merge this branch: bzr merge lp:~domsense/account-payment/adding_account_vat_on_payment_7
Reviewer Review Type Date Requested Status
Lorenzo Battistini (community) Disapprove
Omar (Pexego) code review, no test Approve
Review via email: mp+196914@code.launchpad.net

Description of the change

See 'account_voucher_cash_basis' description.

To activate the VAT on payment behaviour, this module adds a checkbox on
invoice form: 'Vat on payment'

Moreover, three things have to be configured:
 - On account object, Related account used for real registrations on a VAT on
    payment basis
 - On journal object, Related journal used for shadow registrations on a VAT on
    payment basis
 - On tax code object, Related tax code used for real registrations on a VAT on
    payment basis

Requirements:
https://docs.google.com/spreadsheet/ccc?key=0Aodwq17jxF4edDJaZ2dOQkVEN0hodEtfRmpVdlg2Vnc#gid=0
Howto:
http://planet.agilebg.com/en/2012/10/vat-on-payment-treatment-with-openerp/

I propose this now so we can discuss about the usefulness of this module.

I set it 'work in progress' also because YAML tests are missing.

To post a comment you must log in.
Revision history for this message
Davide Corio (enlightx-deactivatedaccount) wrote :
Revision history for this message
Lorenzo Battistini (elbati) wrote :

2013/11/27 Davide Corio <email address hidden>

> there's a blocking typo here:
>
>
> http://bazaar.launchpad.net/~domsense/account-payment/adding_account_vat_on_payment_7/view/head:/account_vat_on_payment/account.py#L45
>
> s/vat_on_paymen/vat_on_payment
>
>
Oops.
Fixed.
Thanks!

Revision history for this message
Omar (Pexego) (omar7r) wrote :

Could you take the time to bring this to the 7.0 community addons coding conventions. This includes:

* not using the shortcut imports (things in the openerp namespace need to be imported from openerp)
* using the from . import xxx for relative imports (typically in __init__.py files)
* using orm.Model and orm.TransientModel as base class rather than osv.osv and osv.osv_memory
* etc.

Thanks

review: Needs Fixing (code review)
Revision history for this message
Nicola Malcontenti - Agile BG (hurrin1c0) wrote :

Hi Omar,
Thanks for the segnalation,
we have done all the modify requested.

Greetings.
-N.

Revision history for this message
Lorenzo Battistini (elbati) wrote :
Revision history for this message
Omar (Pexego) (omar7r) wrote :

Thanks, LGTM

review: Approve (code review, no test)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

This project is now hosted on https://github.com/OCA/account-payment. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

Revision history for this message
Lorenzo Battistini (elbati) wrote :
review: Disapprove

Unmerged revisions

115. By Lorenzo Battistini

[FIX] when selecting partner without fiscal position, do not overwrite invoice field

114. By Lorenzo Battistini

[FIX] [7.0] account_vat_on_payment - impossible to compute VAT based on invoice total in case of write-off

113. By Lorenzo Battistini

[FIX] missing fields

112. By Hurrinico

[FIX] PEP8 fixing

111. By Lorenzo Battistini

[IMP] handling fiscal positions

110. By Lorenzo Battistini

[FIX] typo

109. By Lorenzo Battistini

[fix] URL

108. By Lorenzo Battistini

[imp] other PEP8

107. By Lorenzo Battistini

[imp] other PEP8

106. By Lorenzo Battistini

[IMP] some PEP8

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'account_vat_on_payment'
=== added file 'account_vat_on_payment/AUTHORS.txt'
--- account_vat_on_payment/AUTHORS.txt 1970-01-01 00:00:00 +0000
+++ account_vat_on_payment/AUTHORS.txt 2014-06-03 16:12:49 +0000
@@ -0,0 +1,1 @@
1Lorenzo Battistini <lorenzo.battistini@agilebg.com>
02
=== added file 'account_vat_on_payment/__init__.py'
--- account_vat_on_payment/__init__.py 1970-01-01 00:00:00 +0000
+++ account_vat_on_payment/__init__.py 2014-06-03 16:12:49 +0000
@@ -0,0 +1,25 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
6# Copyright (C) 2012-2013 Agile Business Group sagl
7# (<http://www.agilebg.com>)
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as
11# published by the Free Software Foundation, either version 3 of the
12# License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################E
23from . import account
24from . import company
25from . import partner
026
=== added file 'account_vat_on_payment/__openerp__.py'
--- account_vat_on_payment/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_vat_on_payment/__openerp__.py 2014-06-03 16:12:49 +0000
@@ -0,0 +1,60 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
6# Copyright (C) 2012-2013 Agile Business Group sagl
7# (<http://www.agilebg.com>)
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as
11# published by the Free Software Foundation, either version 3 of the
12# License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23
24
25{
26 "name": "VAT on payment",
27 "version": "2.0",
28 'category': 'Generic Modules/Accounting',
29 "depends": ["account_voucher_cash_basis"],
30 "author": "Agile Business Group",
31 "description": """
32See 'account_voucher_cash_basis' description.
33
34To activate the VAT on payment behaviour, this module adds a checkbox on
35invoice form: 'Vat on payment'
36
37Moreover, three things have to be configured:
38 - On account object, Related account used for real registrations on a VAT on
39 payment basis
40 - On journal object, Related journal used for shadow registrations on a VAT on
41 payment basis
42 - On tax code object, Related tax code used for real registrations on a VAT on
43 payment basis
44
45Requirements:
46https://docs.google.com/spreadsheet/ccc?key=0Aodwq17jxF4edDJaZ2dOQkVEN0hodEtfRmpVdlg2Vnc#gid=0
47Howto:
48http://planet.agilebg.com/en/2012/10/vat-on-payment-treatment-with-openerp/
49 """,
50 'website': 'http://www.agilebg.com',
51 'init_xml': [],
52 'update_xml': [
53 'account_view.xml',
54 'company_view.xml',
55 'partner_view.xml',
56 ],
57 'demo_xml': [], # TODO YAML tests
58 'installable': True,
59 'active': False,
60}
061
=== added file 'account_vat_on_payment/account.py'
--- account_vat_on_payment/account.py 1970-01-01 00:00:00 +0000
+++ account_vat_on_payment/account.py 2014-06-03 16:12:49 +0000
@@ -0,0 +1,433 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
6# Copyright (C) 2012-2013 Agile Business Group sagl
7# (<http://www.agilebg.com>)
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as
11# published by the Free Software Foundation, either version 3 of the
12# License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23
24from openerp.osv import orm, fields
25from tools.translate import _
26
27
28class account_voucher(orm.Model):
29 _inherit = "account.voucher"
30
31 _columns = {
32 'shadow_move_id': fields.many2one(
33 'account.move', 'Shadow Entry', readonly=True),
34 }
35
36 def is_vat_on_payment(self, voucher):
37 vat_on_p = 0
38 valid_lines = 0
39 if voucher.type in ('payment', 'receipt'):
40 for line in voucher.line_ids:
41 if line.amount:
42 valid_lines += 1
43 if (
44 line.move_line_id and line.move_line_id.invoice
45 and line.move_line_id.invoice.vat_on_payment
46 ):
47 vat_on_p += 1
48 if vat_on_p and vat_on_p != valid_lines:
49 raise osv.except_osv(
50 _('Error'),
51 _("""Can't handle VAT on payment if not every invoice
52 is on a VAT on payment treatment"""))
53 return vat_on_p
54
55 def action_move_line_create(self, cr, uid, ids, context=None):
56 if context is None:
57 context = {}
58 inv_pool = self.pool.get('account.invoice')
59 journal_pool = self.pool.get('account.journal')
60 move_line_pool = self.pool.get('account.move.line')
61 move_pool = self.pool.get('account.move')
62 currency_obj = self.pool.get('res.currency')
63 res = False
64 for voucher in self.browse(cr, uid, ids, context):
65 entry_posted = voucher.journal_id.entry_posted
66 # disable the 'skip draft state' option because "mixed" entry
67 # (shadow + real) won't pass validation. Anyway every entry will be
68 # posted later (if 'entry_posted' is enabled)
69 if entry_posted:
70 journal_pool.write(
71 cr, uid, voucher.journal_id.id, {'entry_posted': False})
72 res = super(account_voucher, self).action_move_line_create(
73 cr, uid, [voucher.id], context)
74 # because 'move_id' has been updated by 'action_move_line_create'
75 voucher.refresh()
76 if entry_posted:
77 journal_pool.write(
78 cr, uid, voucher.journal_id.id, {'entry_posted': True})
79 if self.is_vat_on_payment(voucher):
80 if not voucher.journal_id.vat_on_payment_related_journal_id:
81 raise osv.except_osv(
82 _('Error'),
83 _("""We are on a VAT on payment treatment
84 but journal %s does not have a related shadow
85 journal""")
86 % voucher.journal_id.name)
87 lines_to_create = []
88 amounts_by_invoice = super(
89 account_voucher, self
90 ).allocated_amounts_grouped_by_invoice(
91 cr, uid, voucher, context)
92 for inv_id in amounts_by_invoice:
93 invoice = inv_pool.browse(cr, uid, inv_id, context)
94 for inv_move_line in invoice.move_id.line_id:
95 if (
96 inv_move_line.account_id.type != 'receivable'
97 and inv_move_line.account_id.type != 'payable'
98 ):
99 # compute the VAT or base line proportionally to
100 # the paid amount
101 if (
102 voucher.exclude_write_off
103 and voucher.payment_option == 'with_writeoff'
104 ):
105 # avoid including write-off if set in voucher.
106 # That means: use the invoice's total
107 # (as we are in 'full reconcile' case)
108 allocated_amount = amounts_by_invoice[
109 invoice.id
110 ]['allocated']
111 else:
112 allocated_amount = (
113 amounts_by_invoice[invoice.id]['allocated']
114 +
115 amounts_by_invoice[invoice.id]['write-off']
116 )
117 new_line_amount = currency_obj.round(
118 cr, uid, voucher.company_id.currency_id,
119 (
120 allocated_amount
121 /
122 amounts_by_invoice[invoice.id]['total']
123 )
124 *
125 (inv_move_line.credit or inv_move_line.debit)
126 )
127 new_line_amount_curr = False
128 if (
129 amounts_by_invoice[invoice.id].get(
130 'allocated_currency')
131 and amounts_by_invoice[invoice.id].get(
132 'foreign_currency_id')
133 ):
134 for_curr = currency_obj.browse(
135 cr, uid,
136 amounts_by_invoice[invoice.id][
137 'foreign_currency_id'],
138 context=context)
139 if (
140 voucher.exclude_write_off
141 and
142 voucher.payment_option == 'with_writeoff'
143 ):
144 # again
145 # avoid including write-off if set in
146 # voucher.
147 allocated_amount = amounts_by_invoice[
148 invoice.id]['allocated_currency']
149 else:
150 allocated_amount = (
151 amounts_by_invoice[invoice.id][
152 'allocated_currency']
153 +
154 amounts_by_invoice[invoice.id][
155 'currency-write-off']
156 )
157 new_line_amount_curr = currency_obj.round(
158 cr, uid, for_curr,
159 (
160 allocated_amount
161 /
162 amounts_by_invoice[
163 invoice.id
164 ]['total_currency']
165 )
166 *
167 (inv_move_line.amount_currency)
168 )
169
170 if not inv_move_line.real_account_id:
171 raise osv.except_osv(
172 _('Error'),
173 _("""We are on a VAT on payment treatment
174 but move line %s does not have a related
175 real account""")
176 % inv_move_line.name)
177
178 # prepare the real move line
179 vals = {
180 'name': inv_move_line.name,
181 'account_id': inv_move_line.real_account_id.id,
182 'credit': (
183 inv_move_line.credit
184 and new_line_amount or 0.0),
185 'debit': (
186 inv_move_line.debit
187 and new_line_amount or 0.0),
188 'type': 'real',
189 'partner_id': (
190 inv_move_line.partner_id
191 and inv_move_line.partner_id.id or False)
192 }
193 if new_line_amount_curr:
194 vals['amount_currency'] = new_line_amount_curr
195 vals['currency_id'] = for_curr.id
196 if inv_move_line.tax_code_id:
197 if not inv_move_line.real_tax_code_id:
198 raise osv.except_osv(
199 _('Error'),
200 _("""We are on a VAT on payment
201 treatment but move line %s does not
202 have a related real tax code""")
203 % inv_move_line.name
204 )
205 vals[
206 'tax_code_id'
207 ] = inv_move_line.real_tax_code_id.id
208 if inv_move_line.tax_amount < 0:
209 vals['tax_amount'] = -new_line_amount
210 else:
211 vals['tax_amount'] = new_line_amount
212 lines_to_create.append(vals)
213
214 # prepare the shadow move line
215 vals = {
216 'name': inv_move_line.name,
217 'account_id': inv_move_line.account_id.id,
218 'credit': (
219 inv_move_line.debit
220 and new_line_amount or 0.0),
221 'debit': (
222 inv_move_line.credit
223 and new_line_amount or 0.0),
224 'type': 'shadow',
225 'partner_id': (
226 inv_move_line.partner_id
227 and inv_move_line.partner_id.id or False)
228 }
229 if inv_move_line.tax_code_id:
230 vals[
231 'tax_code_id'
232 ] = inv_move_line.tax_code_id.id
233 if inv_move_line.tax_amount < 0:
234 vals['tax_amount'] = new_line_amount
235 else:
236 vals['tax_amount'] = -new_line_amount
237 lines_to_create.append(vals)
238
239 context['journal_id'] = (
240 voucher.journal_id.vat_on_payment_related_journal_id.id)
241 context['period_id'] = voucher.move_id.period_id.id
242 shadow_move_id = move_pool.create(cr, uid, {
243 'journal_id': (
244 voucher.journal_id.vat_on_payment_related_journal_id.id
245 ),
246 'period_id': voucher.move_id.period_id.id,
247 'date': voucher.move_id.date,
248 }, context)
249
250 # move the payment move lines to shadow entry
251 for line in voucher.move_ids:
252 if line.account_id.type != 'liquidity':
253 # If the line is related to write-off and user doesn't
254 # want to compute the tax including write-off,
255 # write-off move line must stay on the real move
256 if not (
257 voucher.exclude_write_off
258 and voucher.payment_option == 'with_writeoff'
259 and line.account_id.id
260 == voucher.writeoff_acc_id.id
261 ):
262 line.write({
263 'move_id': shadow_move_id,
264 }, update_check=False)
265 # this will allow user to see the real entry from
266 # invoice payment tab
267 if (
268 line.account_id.type == 'receivable'
269 or line.account_id.type == 'payable'
270 ):
271 line.write({
272 'real_payment_move_id': voucher.move_id.id,
273 })
274
275 for line_to_create in lines_to_create:
276 if line_to_create['type'] == 'real':
277 line_to_create['move_id'] = voucher.move_id.id
278 elif line_to_create['type'] == 'shadow':
279 line_to_create['move_id'] = shadow_move_id
280 del line_to_create['type']
281
282 move_line_pool.create(cr, uid, line_to_create, context)
283
284 voucher.write({'shadow_move_id': shadow_move_id})
285
286 super(account_voucher, self).balance_move(
287 cr, uid, shadow_move_id, context)
288 super(account_voucher, self).balance_move(
289 cr, uid, voucher.move_id.id, context)
290
291 return res
292
293 def cancel_voucher(self, cr, uid, ids, context=None):
294 res = super(account_voucher, self).cancel_voucher(
295 cr, uid, ids, context)
296 reconcile_pool = self.pool.get('account.move.reconcile')
297 move_pool = self.pool.get('account.move')
298 for voucher in self.browse(cr, uid, ids, context=context):
299 recs = []
300 if voucher.shadow_move_id:
301 for line in voucher.shadow_move_id.line_id:
302 if line.reconcile_id:
303 recs += [line.reconcile_id.id]
304 if line.reconcile_partial_id:
305 recs += [line.reconcile_partial_id.id]
306
307 reconcile_pool.unlink(cr, uid, recs)
308
309 if voucher.shadow_move_id:
310 move_pool.button_cancel(
311 cr, uid, [voucher.shadow_move_id.id])
312 move_pool.unlink(cr, uid, [voucher.shadow_move_id.id])
313 return res
314
315
316class account_invoice(orm.Model):
317
318 def _get_vat_on_payment(self, cr, uid, context=None):
319 return self.pool.get('res.users').browse(
320 cr, uid, uid, context).company_id.vat_on_payment
321
322 def finalize_invoice_move_lines(self, cr, uid, invoice_browse, move_lines):
323 """
324 Use shadow accounts for journal entry to be generated, according to
325 account and tax code related records
326 """
327 move_lines = super(account_invoice, self).finalize_invoice_move_lines(
328 cr, uid, invoice_browse, move_lines)
329 acc_pool = self.pool.get('account.account')
330 tax_code_pool = self.pool.get('account.tax.code')
331 new_move_lines = []
332 for line_tup in move_lines:
333 if invoice_browse.vat_on_payment:
334 if line_tup[2].get('account_id', False):
335 account = acc_pool.browse(
336 cr, uid, line_tup[2]['account_id'])
337 if (
338 account.type != 'receivable'
339 and account.type != 'payable'
340 ):
341 if not account.vat_on_payment_related_account_id:
342 raise osv.except_osv(
343 _('Error'),
344 _('''The invoice is \'VAT on payment\' but
345 account %s does not have a related shadow
346 account''')
347 % account.name)
348 line_tup[2]['real_account_id'] = line_tup[
349 2]['account_id']
350 line_tup[2]['account_id'] = (
351 account.vat_on_payment_related_account_id.id)
352 if line_tup[2].get('tax_code_id', False):
353 tax_code = tax_code_pool.browse(
354 cr, uid, line_tup[2]['tax_code_id'])
355 if not tax_code.vat_on_payment_related_tax_code_id:
356 raise osv.except_osv(
357 _('Error'),
358 _('''The invoice is \'VAT on payment\' but
359 tax code %s does not have a related shadow
360 tax code''')
361 % tax_code.name)
362 line_tup[2]['real_tax_code_id'] = line_tup[
363 2]['tax_code_id']
364 line_tup[2]['tax_code_id'] = (
365 tax_code.vat_on_payment_related_tax_code_id.id)
366 new_move_lines.append(line_tup)
367 return new_move_lines
368
369 def onchange_partner_id(
370 self, cr, uid, ids, type, partner_id, date_invoice=False,
371 payment_term=False, partner_bank_id=False, company_id=False):
372 res = super(account_invoice, self).onchange_partner_id(
373 cr, uid, ids, type, partner_id, date_invoice, payment_term,
374 partner_bank_id, company_id)
375 # default value for VAT on Payment is changed every time the
376 # customer/supplier is changed
377 partner_obj = self.pool.get("res.partner")
378 if partner_id:
379 p = partner_obj.browse(cr, uid, partner_id)
380 if p.property_account_position:
381 res['value'][
382 'vat_on_payment'
383 ] = p.property_account_position.default_has_vat_on_payment
384 return res
385
386 _inherit = "account.invoice"
387 _columns = {
388 'vat_on_payment': fields.boolean('Vat on payment'),
389 }
390 _defaults = {
391 'vat_on_payment': _get_vat_on_payment,
392 }
393
394
395class account_move_line(orm.Model):
396 _inherit = "account.move.line"
397 _columns = {
398 'real_payment_move_id': fields.many2one(
399 'account.move', 'Real payment entry'),
400 'real_account_id': fields.many2one('account.account', 'Real account'),
401 'real_tax_code_id': fields.many2one(
402 'account.tax.code', 'Real tax code'),
403 }
404
405
406class account_account(orm.Model):
407 _inherit = "account.account"
408 _columns = {
409 'vat_on_payment_related_account_id': fields.many2one(
410 'account.account', 'Shadow Account for VAT on payment',
411 help='''Related account used for real registrations on a
412 VAT on payment basis. Set the shadow account here'''),
413 }
414
415
416class account_tax_code(orm.Model):
417 _inherit = "account.tax.code"
418 _columns = {
419 'vat_on_payment_related_tax_code_id': fields.many2one(
420 'account.tax.code', 'Shadow Tax code for VAT on payment',
421 help='''Related tax code used for real registrations on a
422 VAT on payment basis. Set the shadow tax code here'''),
423 }
424
425
426class account_journal(orm.Model):
427 _inherit = "account.journal"
428 _columns = {
429 'vat_on_payment_related_journal_id': fields.many2one(
430 'account.journal', 'Shadow Journal for VAT on payment',
431 help='''Related journal used for shadow registrations on a
432 VAT on payment basis. Set the shadow journal here'''),
433 }
0434
=== added file 'account_vat_on_payment/account_view.xml'
--- account_vat_on_payment/account_view.xml 1970-01-01 00:00:00 +0000
+++ account_vat_on_payment/account_view.xml 2014-06-03 16:12:49 +0000
@@ -0,0 +1,104 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5<!-- account -->
6
7 <record id="view_account_form" model="ir.ui.view">
8 <field name="name">account.account.form</field>
9 <field name="model">account.account</field>
10 <field name="inherit_id" ref="account.view_account_form"/>
11 <field name="arch" type="xml">
12 <field position="after" name="child_consol_ids">
13 <field name="vat_on_payment_related_account_id"/>
14 </field>
15 </field>
16 </record>
17
18<!-- tax code -->
19
20 <record id="view_tax_code_form" model="ir.ui.view">
21 <field name="name">account.tax.code.form</field>
22 <field name="model">account.tax.code</field>
23 <field name="inherit_id" ref="account.view_tax_code_form"/>
24 <field name="arch" type="xml">
25 <field position="after" name="company_id">
26 <field name="vat_on_payment_related_tax_code_id"/>
27 </field>
28 </field>
29 </record>
30
31<!-- journal -->
32
33 <record id="view_account_journal_form" model="ir.ui.view">
34 <field name="name">account.journal.form</field>
35 <field name="model">account.journal</field>
36 <field name="inherit_id" ref="account.view_account_journal_form"/>
37 <field name="arch" type="xml">
38 <field name="group_invoice_lines" position="after">
39 <field name="vat_on_payment_related_journal_id"/>
40 </field>
41 </field>
42 </record>
43
44<!-- invoice -->
45
46 <record id="invoice_form" model="ir.ui.view">
47 <field name="name">account.invoice.form</field>
48 <field name="model">account.invoice</field>
49 <field name="inherit_id" ref="account.invoice_form"/>
50 <field name="arch" type="xml">
51 <field name="payment_term" position="after">
52 <field name="vat_on_payment"/>
53 </field>
54 </field>
55 </record>
56 <record id="invoice_supplier_form" model="ir.ui.view">
57 <field name="name">account.invoice.supplier.form</field>
58 <field name="model">account.invoice</field>
59 <field name="inherit_id" ref="account.invoice_supplier_form"/>
60 <field name="arch" type="xml">
61 <field name="date_due" position="after">
62 <field name="vat_on_payment"/>
63 </field>
64 </field>
65 </record>
66
67 <!-- move line -->
68
69 <record id="view_move_line_form" model="ir.ui.view">
70 <field name="name">account.move.line.form</field>
71 <field name="model">account.move.line</field>
72 <field name="inherit_id" ref="account.view_move_line_form"/>
73 <field name="arch" type="xml">
74 <field name="reconcile_partial_id" position="after">
75 <field name="real_payment_move_id" />
76 </field>
77 </field>
78 </record>
79
80 <!-- voucher -->
81
82 <record id="view_vendor_receipt_form_shadow_move" model="ir.ui.view">
83 <field name="name">account.voucher.receipt.form.shadow.move</field>
84 <field name="model">account.voucher</field>
85 <field name="inherit_id" ref="account_voucher.view_vendor_receipt_form"/>
86 <field name="arch" type="xml">
87 <field name="move_ids" position="after">
88 <field name="shadow_move_id" />
89 </field>
90 </field>
91 </record>
92
93 <record id="view_vendor_payment_form_shadow_move" model="ir.ui.view">
94 <field name="name">account.voucher.payment.form.shadow.move</field>
95 <field name="model">account.voucher</field>
96 <field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
97 <field name="arch" type="xml">
98 <field name="move_ids" position="after">
99 <field name="shadow_move_id" />
100 </field>
101 </field>
102 </record>
103 </data>
104</openerp>
0105
=== added file 'account_vat_on_payment/company.py'
--- account_vat_on_payment/company.py 1970-01-01 00:00:00 +0000
+++ account_vat_on_payment/company.py 2014-06-03 16:12:49 +0000
@@ -0,0 +1,42 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
6# Copyright (C) 2012-2013 Agile Business Group sagl
7# (<http://www.agilebg.com>)
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as
11# published by the Free Software Foundation, either version 3 of the
12# License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23
24from openerp.osv import orm, fields
25from tools.translate import _
26
27
28class res_company(orm.Model):
29 _inherit = "res.company"
30 _columns = {
31 'vat_on_payment': fields.boolean('VAT on payment treatment'),
32 }
33
34
35class account_config_settings(orm.TransientModel):
36 _inherit = 'account.config.settings'
37 _columns = {
38 'vat_on_payment': fields.related(
39 'company_id', 'vat_on_payment',
40 type='boolean',
41 string="VAT on payment treatment"),
42 }
043
=== added file 'account_vat_on_payment/company_view.xml'
--- account_vat_on_payment/company_view.xml 1970-01-01 00:00:00 +0000
+++ account_vat_on_payment/company_view.xml 2014-06-03 16:12:49 +0000
@@ -0,0 +1,21 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5<!-- account -->
6
7 <record id="view_account_settings_currency_xchange_form" model="ir.ui.view">
8 <field name="name">view_account_settings_currency_xchange_form</field>
9 <field name="model">account.config.settings</field>
10 <field name="inherit_id" ref="account_voucher_cash_basis.view_account_config_settings"/>
11 <field name="arch" type="xml">
12 <xpath expr="/form/group[5]/div" position="inside">
13 <div>
14 <field name="vat_on_payment" class="oe_inline"/>
15 <label for="vat_on_payment"/>
16 </div>
17 </xpath>
18 </field>
19 </record>
20 </data>
21</openerp>
022
=== added directory 'account_vat_on_payment/i18n'
=== added file 'account_vat_on_payment/partner.py'
--- account_vat_on_payment/partner.py 1970-01-01 00:00:00 +0000
+++ account_vat_on_payment/partner.py 2014-06-03 16:12:49 +0000
@@ -0,0 +1,36 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
6# Copyright (C) 2012-2013 Agile Business Group sagl
7# (<http://www.agilebg.com>)
8# Copyright (C) 2014 Develer srl (<http://www.develer.com>)
9#
10# This program is free software: you can redistribute it and/or modify
11# it under the terms of the GNU Affero General Public License as
12# published by the Free Software Foundation, either version 3 of the
13# License, or (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU Affero General Public License for more details.
19#
20# You should have received a copy of the GNU Affero General Public License
21# along with this program. If not, see <http://www.gnu.org/licenses/>.
22#
23##############################################################################
24
25
26from openerp.osv import fields, orm
27from openerp.tools.translate import _
28
29
30class account_fiscal_position(orm.Model):
31 _inherit = 'account.fiscal.position'
32
33 _columns = {
34 'default_has_vat_on_payment': fields.boolean(
35 'VAT on Payment Default Flag'),
36 }
037
=== added file 'account_vat_on_payment/partner_view.xml'
--- account_vat_on_payment/partner_view.xml 1970-01-01 00:00:00 +0000
+++ account_vat_on_payment/partner_view.xml 2014-06-03 16:12:49 +0000
@@ -0,0 +1,48 @@
1<?xml version="1.0"?>
2
3<!--
4# -*- coding: utf-8 -*-
5##############################################################################
6#
7# OpenERP, Open Source Management Solution
8# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
9# Copyright (C) 2012-2013 Agile Business Group sagl
10# (<http://www.agilebg.com>)
11# Copyright (C) 2014 Develer srl (<http://www.develer.com>)
12#
13# This program is free software: you can redistribute it and/or modify
14# it under the terms of the GNU Affero General Public License as
15# published by the Free Software Foundation, either version 3 of the
16# License, or (at your option) any later version.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU Affero General Public License for more details.
22#
23# You should have received a copy of the GNU Affero General Public License
24# along with this program. If not, see <http://www.gnu.org/licenses/>.
25#
26##############################################################################
27-->
28
29
30<openerp>
31 <data>
32
33 <!-- res.partner customizations -->
34
35 <record id="view_partner_form" model="ir.ui.view">
36 <field name="name">account.fiscal.position.vat.default.view</field>
37 <field name="model">account.fiscal.position</field>
38 <field name="inherit_id" ref="account.view_account_position_form"/>
39 <field name="arch" type="xml">
40 <field name="active" position="after" version="7.0">
41 <field name="default_has_vat_on_payment" class="oe_inline"/>
42 </field>
43 </field>
44 </record>
45
46
47 </data>
48</openerp>