Merge lp:~vauxoo/addons-vauxoo/7.0-avts-dev-julio into lp:addons-vauxoo/7.0

Proposed by Julio Serna-http://www.vauxoo.com
Status: Merged
Merged at revision: 901
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-avts-dev-julio
Merge into: lp:addons-vauxoo/7.0
Diff against target: 793 lines (+711/-1)
13 files modified
account_update_amount_tax_in_move_lines/wizard/update_amount_base_tax_wizard.py (+1/-1)
account_voucher_tax_sat/__init__.py (+26/-0)
account_voucher_tax_sat/__openerp__.py (+53/-0)
account_voucher_tax_sat/model/__init__.py (+25/-0)
account_voucher_tax_sat/model/account_voucher_tax_sat.py (+268/-0)
account_voucher_tax_sat/model/partner.py (+36/-0)
account_voucher_tax_sat/security/ir.model.access.csv (+4/-0)
account_voucher_tax_sat/security/security.xml (+23/-0)
account_voucher_tax_sat/view/account_voucher_tax_sat_view.xml (+130/-0)
account_voucher_tax_sat/view/partner_view.xml (+15/-0)
account_voucher_tax_sat/wizard/__init__.py (+25/-0)
account_voucher_tax_sat/wizard/account_tax_sat.py (+66/-0)
account_voucher_tax_sat/wizard/account_tax_sat_view.xml (+39/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-avts-dev-julio
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Approve
Review via email: mp+192217@code.launchpad.net

Description of the change

Crea modulo de pago al sat de las retenciones de iva y cancelación de los impuestos con retencion

To post a comment you must log in.
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) :
review: Approve
886. By Julio Serna-http://www.vauxoo.com

[IMP]revert change in aml of iva in vovuher tax

Revision history for this message
hbto [Vauxoo] http://www.vauxoo.com (humbertoarocha) wrote :

Buenas noches,

No he probado el código,

sin embargo, podría indicar

que sería mas favorable,

indicar un period_id cuyo special=False, para buscar los aml,
que se estarían filtrando,

un la búsqueda del periodo de la fecha de Contabilizacion,
colocaría tambien un filtro special=False para evitar usar los
periodos espaciales.

Saludos.

887. By Julio Serna-http://www.vauxoo.com

[MERGE] merge addons-vauxoo/7.0

888. By Julio Serna-http://www.vauxoo.com

[IMP]added onchanged in field period to reomve aml

889. By Julio Serna-http://www.vauxoo.com

[IMP] get period in wizard from model of sat

890. By Julio Serna-http://www.vauxoo.com

[IMP]added domain in partner_id is sat

891. By Julio Serna-http://www.vauxoo.com

[IMP] create state in module

892. By Julio Serna-http://www.vauxoo.com

[IMP]added function that validate aml not repeat

893. By Julio Serna-http://www.vauxoo.com

[MERGE] merge addons-vauxoo/7.0

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_update_amount_tax_in_move_lines/wizard/update_amount_base_tax_wizard.py'
2--- account_update_amount_tax_in_move_lines/wizard/update_amount_base_tax_wizard.py 2013-10-23 00:25:14 +0000
3+++ account_update_amount_tax_in_move_lines/wizard/update_amount_base_tax_wizard.py 2013-10-25 22:36:34 +0000
4@@ -98,7 +98,7 @@
5 attrs.append(('amount_base', '=', False))
6 lines_without_amount = move_line_obj.search(cr, uid, attrs, context=context)
7 for move in move_line_obj.browse(cr, uid, lines_without_amount, context=context):
8- amount_tax = move.tax_id_secondary.amount
9+ amount_tax = move.tax_id_secondary.tax_category_id.value_tax or move.tax_id_secondary.amount
10 amount_base = 0
11 if move.debit != 0:
12 amount_base = move.debit
13
14=== added directory 'account_voucher_tax_sat'
15=== added file 'account_voucher_tax_sat/__init__.py'
16--- account_voucher_tax_sat/__init__.py 1970-01-01 00:00:00 +0000
17+++ account_voucher_tax_sat/__init__.py 2013-10-25 22:36:34 +0000
18@@ -0,0 +1,26 @@
19+#!/usr/bin/python
20+# -*- encoding: utf-8 -*-
21+###########################################################################
22+# Module Writen to OpenERP, Open Source Management Solution
23+# Copyright (C) Vauxoo (<http://vauxoo.com>).
24+# All Rights Reserved
25+###############Credits######################################################
26+# Coded by: Julio Cesar Serna Hernandez(julio@vauxoo.com)
27+#############################################################################
28+# This program is free software: you can redistribute it and/or modify
29+# it under the terms of the GNU Affero General Public License as published by
30+# the Free Software Foundation, either version 3 of the License, or
31+# (at your option) any later version.
32+#
33+# This program is distributed in the hope that it will be useful,
34+# but WITHOUT ANY WARRANTY; without even the implied warranty of
35+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36+# GNU Affero General Public License for more details.
37+#
38+# You should have received a copy of the GNU Affero General Public License
39+# along with this program. If not, see <http://www.gnu.org/licenses/>.
40+################################################################################
41+
42+
43+import model
44+import wizard
45\ No newline at end of file
46
47=== added file 'account_voucher_tax_sat/__openerp__.py'
48--- account_voucher_tax_sat/__openerp__.py 1970-01-01 00:00:00 +0000
49+++ account_voucher_tax_sat/__openerp__.py 2013-10-25 22:36:34 +0000
50@@ -0,0 +1,53 @@
51+#!/usr/bin/python
52+# -*- encoding: utf-8 -*-
53+###########################################################################
54+# Module Writen to OpenERP, Open Source Management Solution
55+# Copyright (C) Vauxoo (<http://vauxoo.com>).
56+# All Rights Reserved
57+###############Credits######################################################
58+# Coded by: Julio Cesar Serna Hernandez(julio@vauxoo.com)
59+#############################################################################
60+# This program is free software: you can redistribute it and/or modify
61+# it under the terms of the GNU Affero General Public License as published by
62+# the Free Software Foundation, either version 3 of the License, or
63+# (at your option) any later version.
64+#
65+# This program is distributed in the hope that it will be useful,
66+# but WITHOUT ANY WARRANTY; without even the implied warranty of
67+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68+# GNU Affero General Public License for more details.
69+#
70+# You should have received a copy of the GNU Affero General Public License
71+# along with this program. If not, see <http://www.gnu.org/licenses/>.
72+################################################################################
73+{
74+ "name": "Account Voucher Tax SAT",
75+ "version": "1.0",
76+ "author" : "Vauxoo",
77+ "category": "Accounting",
78+ "website" : "http://www.vauxoo.com/",
79+ "description": """
80+Polizas de SAT:
81+===============
82+
83+1.- Crea los apuntes contables para los impuestos con retenciones
84+2.- Crea provicion de pago al SAT
85+3.- Crea apuntes contables para las retenciones de IVA
86+ """,
87+ 'depends': [
88+ 'account',
89+ 'account_voucher_tax'
90+ ],
91+ 'data': [
92+ 'security/security.xml',
93+ 'security/ir.model.access.csv',
94+ 'wizard/account_tax_sat_view.xml',
95+ 'view/account_voucher_tax_sat_view.xml',
96+ 'view/partner_view.xml',
97+ ],
98+ 'demo': [],
99+ 'test': [],
100+ 'installable': True,
101+ 'active': False,
102+}
103+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
104
105=== added directory 'account_voucher_tax_sat/model'
106=== added file 'account_voucher_tax_sat/model/__init__.py'
107--- account_voucher_tax_sat/model/__init__.py 1970-01-01 00:00:00 +0000
108+++ account_voucher_tax_sat/model/__init__.py 2013-10-25 22:36:34 +0000
109@@ -0,0 +1,25 @@
110+#!/usr/bin/python
111+# -*- encoding: utf-8 -*-
112+###########################################################################
113+# Module Writen to OpenERP, Open Source Management Solution
114+# Copyright (C) Vauxoo (<http://vauxoo.com>).
115+# All Rights Reserved
116+###############Credits######################################################
117+# Coded by: Julio Cesar Serna Hernandez(julio@vauxoo.com)
118+#############################################################################
119+# This program is free software: you can redistribute it and/or modify
120+# it under the terms of the GNU Affero General Public License as published by
121+# the Free Software Foundation, either version 3 of the License, or
122+# (at your option) any later version.
123+#
124+# This program is distributed in the hope that it will be useful,
125+# but WITHOUT ANY WARRANTY; without even the implied warranty of
126+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
127+# GNU Affero General Public License for more details.
128+#
129+# You should have received a copy of the GNU Affero General Public License
130+# along with this program. If not, see <http://www.gnu.org/licenses/>.
131+################################################################################
132+
133+import account_voucher_tax_sat
134+import partner
135\ No newline at end of file
136
137=== added file 'account_voucher_tax_sat/model/account_voucher_tax_sat.py'
138--- account_voucher_tax_sat/model/account_voucher_tax_sat.py 1970-01-01 00:00:00 +0000
139+++ account_voucher_tax_sat/model/account_voucher_tax_sat.py 2013-10-25 22:36:34 +0000
140@@ -0,0 +1,268 @@
141+#!/usr/bin/python
142+# -*- encoding: utf-8 -*-
143+###########################################################################
144+# Module Writen to OpenERP, Open Source Management Solution
145+# Copyright (C) Vauxoo (<http://vauxoo.com>).
146+# All Rights Reserved
147+###############Credits######################################################
148+# Coded by: Julio Cesar Serna Hernandez(julio@vauxoo.com)
149+#############################################################################
150+# This program is free software: you can redistribute it and/or modify
151+# it under the terms of the GNU Affero General Public License as published by
152+# the Free Software Foundation, either version 3 of the License, or
153+# (at your option) any later version.
154+#
155+# This program is distributed in the hope that it will be useful,
156+# but WITHOUT ANY WARRANTY; without even the implied warranty of
157+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
158+# GNU Affero General Public License for more details.
159+#
160+# You should have received a copy of the GNU Affero General Public License
161+# along with this program. If not, see <http://www.gnu.org/licenses/>.
162+################################################################################
163+import time
164+from openerp.osv import fields, osv
165+from openerp import netsvc
166+import openerp.addons.decimal_precision as dp
167+from openerp.tools.translate import _
168+
169+
170+class account_voucher_tax_sat(osv.Model):
171+
172+ _name = 'account.voucher.tax.sat'
173+
174+ _columns = {
175+ 'name': fields.char('Name', size=128,
176+ help='Name of This Document',
177+ ),
178+ 'partner_id': fields.many2one('res.partner', 'Partner',
179+ domain = "[('sat', '=', True)]",
180+ help='Partner of SAT',
181+ ),
182+ 'date': fields.date('Accounting Date',
183+ help='Accounting date affected',
184+ ),
185+ 'aml_ids': fields.many2many('account.move.line', 'voucher_tax_sat_rel',
186+ 'voucher_tax_sat_id', 'move_line_id',
187+ 'Move Lines', help='Entries to close',
188+ ),
189+ 'journal_id':fields.many2one('account.journal', 'Journal',
190+ help='Accounting Journal where Entries will be posted',
191+ ),
192+ 'move_id': fields.many2one('account.move', 'Journal Entry',
193+ help='Accounting Entry'),
194+ 'company_id':fields.many2one('res.company', 'Company', help='Company'),
195+ 'period_id': fields.many2one('account.period', 'Period', required=True,
196+ help='Period of Entries to find',
197+ ),
198+ 'state': fields.selection([
199+ ('draft', 'New'),
200+ ('cancelled', 'Cancelled'),
201+ ('done', 'Done')],
202+ 'Status', readonly=True, track_visibility='onchange'),
203+ }
204+ _defaults = {
205+ 'company_id': lambda s, c, u, cx: s.pool.get('res.users').browse(c, u,
206+ u, cx).company_id.id,
207+ 'state': 'draft'
208+ }
209+
210+ def onchange_period(self, cr, uid, ids, period, context=None):
211+ res = {}
212+ if period:
213+ res['value'] = {'aml_ids': []}
214+ return res
215+
216+ def validate_move_line(self, cr, uid, voucher_tax, context=None):
217+ move_line_obj = self.pool.get('account.move.line')
218+ cr.execute(""" SELECT DISTINCT move_line_id FROM voucher_tax_sat_rel
219+ WHERE voucher_tax_sat_id <> %s
220+ AND move_line_id IN %s """,(
221+ voucher_tax.id,
222+ tuple([ move_lines.id\
223+ for move_lines in voucher_tax.aml_ids ]))
224+ )
225+ dat = cr.dictfetchall()
226+ move_line_tax = list( set([ move_tax['move_line_id'] for move_tax in dat ]) )
227+ if dat:
228+ raise osv.except_osv(_('Warning'),
229+ _("You have this jornal items in other voucher tax sat '%s' ")
230+ % ([ move_line.name\
231+ for move_line in move_line_obj.browse(cr, uid,
232+ move_line_tax, context=context)]))
233+
234+ return True
235+
236+ def action_close_tax(self, cr, uid, ids, context=None):
237+ aml_obj = self.pool.get('account.move.line')
238+ period_obj = self.pool.get('account.period')
239+ context = context or {}
240+ ids= isinstance(ids,(int,long)) and [ids] or ids
241+ for voucher_tax_sat in self.browse(cr, uid, ids, context=context):
242+
243+ self.validate_move_line(cr, uid,
244+ voucher_tax_sat, context=context)
245+
246+ move_id = self.create_move_sat(cr, uid, ids, context=context)
247+ self.write(cr, uid, ids, {'move_id': move_id})
248+
249+ amount_tax_sat = sum([move_line_tax_sat.credit
250+ for move_line_tax_sat in voucher_tax_sat.aml_ids])
251+
252+ self.create_move_line_sat(cr, uid, voucher_tax_sat,
253+ amount_tax_sat, context=context)
254+
255+ self.create_entries_tax_iva_sat(cr, uid, voucher_tax_sat,
256+ context=context)
257+
258+ move_line_copy = [ aml_obj.copy(cr, uid, move_line_tax.id,
259+ {
260+ 'move_id': move_id,
261+ 'period_id': period_obj.find(cr, uid,
262+ voucher_tax_sat.date,
263+ context=context)[0],
264+ 'journal_id': voucher_tax_sat.journal_id.id,
265+ 'credit': 0.0,
266+ 'debit': move_line_tax.credit,
267+ 'amount_base': None,
268+ 'tax_id_secondary': None,
269+ 'not_move_diot': True
270+ }) for move_line_tax in voucher_tax_sat.aml_ids ]
271+
272+ cr.execute('UPDATE account_move_line '\
273+ 'SET amount_tax_unround = null '\
274+ 'WHERE id in %s ',(tuple(move_line_copy), ))
275+
276+ return self.write(cr, uid, ids, {'state': 'done'}, context=context)
277+
278+ def action_cancel(self, cr, uid, ids, context=None):
279+ obj_move_line = self.pool.get('account.move.line')
280+ obj_move = self.pool.get('account.move')
281+ for tax_sat in self.browse(cr, uid, ids, context=context):
282+ if tax_sat.move_id:
283+ obj_move_line._remove_move_reconcile(cr, uid,
284+ [move_line.id
285+ for move_line in tax_sat.move_id.line_id],
286+ context=context)
287+ obj_move.unlink(cr, uid, [tax_sat.move_id.id],
288+ context=context)
289+ return self.write(cr, uid, ids, {'state': 'draft'}, context=context)
290+
291+ def create_entries_tax_iva_sat(self, cr, uid, voucher_tax_sat,
292+ context=None):
293+ aml_obj = self.pool.get('account.move.line')
294+ av_obj = self.pool.get('account.voucher')
295+ period_obj = self.pool.get('account.period')
296+ for move_line in voucher_tax_sat.aml_ids:
297+ if move_line.tax_id_secondary and\
298+ move_line.tax_id_secondary.tax_sat_ok:
299+ amount_base, tax_secondary = av_obj._get_base_amount_tax_secondary(cr,
300+ uid, move_line.tax_id_secondary,
301+ move_line.amount_base, move_line.credit,
302+ context=context)
303+ move_line_dt = {
304+ 'move_id': voucher_tax_sat.move_id.id,
305+ 'journal_id': voucher_tax_sat.journal_id.id,
306+ 'date': voucher_tax_sat.date,
307+ 'period_id': period_obj.find(cr, uid,
308+ voucher_tax_sat.date,
309+ context=context)[0],
310+ 'debit': move_line.credit,
311+ 'name': _('Close of IVA Retained'),
312+ 'partner_id' : move_line.partner_id.id,
313+ 'account_id': move_line.tax_id_secondary.account_id_creditable.id,
314+ 'credit': 0.0,
315+ 'amount_base': amount_base,
316+ 'tax_id_secondary': move_line.tax_id_secondary.tax_reference.id
317+ }
318+ move_line_cr = {
319+ 'move_id': voucher_tax_sat.move_id.id,
320+ 'journal_id': voucher_tax_sat.journal_id.id,
321+ 'date': voucher_tax_sat.date,
322+ 'period_id': period_obj.find(cr, uid,
323+ voucher_tax_sat.date,
324+ context=context)[0],
325+ 'debit': 0.0,
326+ 'name': _('Close of IVA Retained'),
327+ 'partner_id' : move_line.partner_id.id,
328+ 'account_id': move_line.tax_id_secondary.account_id_by_creditable.id,
329+ 'credit': move_line.credit,
330+ }
331+ for line_dt_cr in [move_line_dt, move_line_cr]:
332+ aml_obj.create(cr, uid, line_dt_cr, context=context)
333+ return True
334+
335+ def create_move_line_sat(self, cr, uid, voucher_tax_sat, amount, context=None):
336+ aml_obj = self.pool.get('account.move.line')
337+ period_obj = self.pool.get('account.period')
338+ vals = {
339+ 'move_id': voucher_tax_sat.move_id.id,
340+ 'journal_id': voucher_tax_sat.journal_id.id,
341+ 'date': voucher_tax_sat.date,
342+ 'period_id': period_obj.find(cr, uid,
343+ voucher_tax_sat.date,
344+ context=context)[0],
345+ 'debit': 0,
346+ 'name': _('Payment to SAT'),
347+ 'partner_id': voucher_tax_sat.partner_id.id,
348+ 'account_id': voucher_tax_sat.partner_id.property_account_payable.id,
349+ 'credit': amount,
350+ }
351+ return aml_obj.create(cr, uid, vals, context=context)
352+
353+ def create_move_sat(self, cr, uid, ids, context=None):
354+ account_move_obj = self.pool.get('account.move')
355+ context = context or {}
356+ ids= isinstance(ids,(int,long)) and [ids] or ids
357+ for move_tax_sat in self.browse(cr, uid, ids, context=context):
358+ vals_move_tax= account_move_obj.account_move_prepare(cr, uid,
359+ move_tax_sat.journal_id.id,
360+ date = move_tax_sat.date,
361+ ref='Entry SAT', context=context)
362+ return account_move_obj.create(cr, uid, vals_move_tax, context=context)
363+
364+
365+ def sat_pay(self, cr, uid, ids, context=None):
366+ """
367+ """
368+ context = context or {}
369+ ids = isinstance(ids, (int, long)) and [ids] or ids
370+ if not ids: return []
371+ dummy, view_id = self.pool.get('ir.model.data').\
372+ get_object_reference(cr, uid,
373+ 'account_voucher', 'view_vendor_payment_form')
374+ exp_brw = self.browse(cr, uid, ids[0], context=context)
375+ return {
376+ 'name':_("Pay SAT"),
377+ 'view_mode': 'form',
378+ 'view_id': view_id,
379+ 'view_type': 'form',
380+ 'res_model': 'account.voucher',
381+ 'type': 'ir.actions.act_window',
382+ 'nodestroy': True,
383+ 'target': 'current',
384+ 'domain': '[]',
385+ 'context': {
386+ 'default_partner_id': exp_brw.partner_id.id,
387+ 'default_amount': 0.0,
388+ 'close_after_process': True,
389+ 'default_type': 'payment',
390+ 'type': 'payment',
391+ }
392+ }
393+
394+
395+class account_tax(osv.Model):
396+
397+ _inherit = 'account.tax'
398+
399+ _columns = {
400+ 'tax_sat_ok': fields.boolean('Create entries IVA to SAT'),
401+ 'account_id_creditable': fields.many2one('account.account',
402+ 'Account of entries SAT Acreditable'),
403+ 'account_id_by_creditable': fields.many2one('account.account',
404+ 'Account of entries SAT x Acreditable'),
405+ 'tax_reference': fields.many2one('account.tax',
406+ 'Tax Reference',
407+ help = 'Tax Reference to get data of DIOT/SAT')
408+ }
409\ No newline at end of file
410
411=== added file 'account_voucher_tax_sat/model/partner.py'
412--- account_voucher_tax_sat/model/partner.py 1970-01-01 00:00:00 +0000
413+++ account_voucher_tax_sat/model/partner.py 2013-10-25 22:36:34 +0000
414@@ -0,0 +1,36 @@
415+#!/usr/bin/python
416+# -*- encoding: utf-8 -*-
417+###########################################################################
418+# Module Writen to OpenERP, Open Source Management Solution
419+# Copyright (C) Vauxoo (<http://vauxoo.com>).
420+# All Rights Reserved
421+###############Credits######################################################
422+# Coded by: Julio Cesar Serna Hernandez(julio@vauxoo.com)
423+#############################################################################
424+# This program is free software: you can redistribute it and/or modify
425+# it under the terms of the GNU Affero General Public License as published by
426+# the Free Software Foundation, either version 3 of the License, or
427+# (at your option) any later version.
428+#
429+# This program is distributed in the hope that it will be useful,
430+# but WITHOUT ANY WARRANTY; without even the implied warranty of
431+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
432+# GNU Affero General Public License for more details.
433+#
434+# You should have received a copy of the GNU Affero General Public License
435+# along with this program. If not, see <http://www.gnu.org/licenses/>.
436+################################################################################
437+import time
438+from openerp.osv import fields, osv
439+from openerp import netsvc
440+import openerp.addons.decimal_precision as dp
441+from openerp.tools.translate import _
442+
443+
444+class res_partner(osv.Model):
445+
446+ _inherit = 'res.partner'
447+
448+ _columns = {
449+ 'sat': fields.boolean('Is SAT?')
450+ }
451\ No newline at end of file
452
453=== added directory 'account_voucher_tax_sat/security'
454=== added file 'account_voucher_tax_sat/security/ir.model.access.csv'
455--- account_voucher_tax_sat/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
456+++ account_voucher_tax_sat/security/ir.model.access.csv 2013-10-25 22:36:34 +0000
457@@ -0,0 +1,4 @@
458+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
459+"access_tax_sat_user","account.voucher.tax.sat.manager","model_account_voucher_tax_sat","group_voucher_tax_sat_manager",1,1,1,1
460+"access_tax_sat_manager","account.voucher.tax.sat.user","model_account_voucher_tax_sat","group_voucher_tax_sat_user",1,0,0,0
461+"access_tax_sat_assigned","account.voucher.tax.assigned","model_account_voucher_tax_assigned","",1,1,1,1
462
463=== added file 'account_voucher_tax_sat/security/security.xml'
464--- account_voucher_tax_sat/security/security.xml 1970-01-01 00:00:00 +0000
465+++ account_voucher_tax_sat/security/security.xml 2013-10-25 22:36:34 +0000
466@@ -0,0 +1,23 @@
467+<?xml version="1.0" encoding="utf-8"?>
468+<openerp>
469+ <data>
470+ <record model="res.groups" id="group_voucher_tax_sat_user">
471+ <field name="name">Tax SAT User</field>
472+ </record>
473+ <record model="res.groups" id="group_voucher_tax_sat_manager">
474+ <field name="name">Tax SAT Manager</field>
475+ </record>
476+
477+ <record id="ir_rule_tax_sat_company" model="ir.rule">
478+ <field name="name">See Taxes of SAT of My Own Company</field>
479+ <field model="ir.model" name="model_id" ref="model_account_voucher_tax_sat"/>
480+ <field name="perm_read" eval="True"/>
481+ <field name="perm_write" eval="False"/>
482+ <field name="perm_create" eval="False"/>
483+ <field name="perm_unlink" eval="False"/>
484+ <field eval="False" name="global"/>
485+ <field name="domain_force">[('company_id','=',user.company_id.id)]</field>
486+ <field name="groups" eval="[(4,ref('account_voucher_tax_sat.group_voucher_tax_sat_manager')),(4,ref('account_voucher_tax_sat.group_voucher_tax_sat_user'))]"/>
487+ </record>
488+ </data>
489+</openerp>
490
491=== added directory 'account_voucher_tax_sat/view'
492=== added file 'account_voucher_tax_sat/view/account_voucher_tax_sat_view.xml'
493--- account_voucher_tax_sat/view/account_voucher_tax_sat_view.xml 1970-01-01 00:00:00 +0000
494+++ account_voucher_tax_sat/view/account_voucher_tax_sat_view.xml 2013-10-25 22:36:34 +0000
495@@ -0,0 +1,130 @@
496+<?xml version="1.0" encoding="utf-8"?>
497+<openerp>
498+ <data>
499+
500+ <record id="view_account_voucher_tax_sat_form" model="ir.ui.view">
501+ <field name="name">account.voucher.tax.sat.form</field>
502+ <field name="model">account.voucher.tax.sat</field>
503+ <field name="arch" type="xml">
504+ <form string="Account Voucher Tax SAT" version="7.0">
505+ <header>
506+ <button string="Liquidar Cuentas"
507+ name="action_close_tax"
508+ type="object"
509+ states="draft"
510+ class="oe_highlight"/>
511+
512+ <button string="Pay SAT"
513+ name="sat_pay"
514+ type="object"
515+ class="oe_highlight"/>
516+
517+ <button name="%(action_view_account_voucher_tax_assigned)d"
518+ type='action'
519+ string='Assigned Account'
520+ states="draft"
521+ class="oe_highlight"/>
522+
523+ <button name="action_cancel"
524+ type='object'
525+ string='Cancel'
526+ states="done"
527+ class="oe_highlight"/>
528+
529+ <field name="state"
530+ widget="statusbar"
531+ statusbar_visible="draft,done,cancelled"
532+ statusbar_colors='{"draft":"blue","approved":"blue"}'/>
533+ </header>
534+ <div class="oe_title">
535+ <div class="oe_edit_only">
536+ <label for="name"/>
537+ </div>
538+ <h1>
539+ <field name="name"
540+ default_focus="1"
541+ placeholder="Name"
542+ required='1'
543+ attrs="{'readonly':[('state','!=','draft')]}"/>
544+ </h1>
545+ </div>
546+ <group col="4">
547+ <group col='4'>
548+ <field name='partner_id'
549+ required='1'
550+ attrs="{'readonly':[('state','!=','draft')]}"
551+ />
552+ <field name='date'
553+ required='1'
554+ attrs="{'readonly':[('state','!=','draft')]}"
555+ />
556+ <field name='journal_id'
557+ required='1'
558+ attrs="{'readonly':[('state','!=','draft')]}"
559+ />
560+ <field name='period_id'
561+ on_change="onchange_period(period_id)"
562+ required='1'
563+ attrs="{'readonly':[('state','!=','draft')]}"
564+ />
565+ <field name='move_id'
566+ readonly='1'
567+ />
568+ </group>
569+ <group col='1' colspan='4'>
570+ <field name='aml_ids'
571+ attrs="{'readonly':[('state','!=','draft')]}"
572+ />
573+ </group>
574+ </group>
575+ </form>
576+ </field>
577+ </record>
578+
579+ <record id="view_account_voucher_tax_sat_tree" model="ir.ui.view">
580+ <field name="name">account.voucher.tax.sat.tree</field>
581+ <field name="model">account.voucher.tax.sat</field>
582+ <field name="arch" type="xml">
583+ <tree string="Account Voucher Tax SAT">
584+ <field name="name"/>
585+ <field name="date"/>
586+ <field name="aml_ids"/>
587+ </tree>
588+ </field>
589+ </record>
590+
591+ <record model="ir.actions.act_window" id="account_voucher_tax_sat_action">
592+ <field name="name">Voucher Tax SAT</field>
593+ <field name="res_model">account.voucher.tax.sat</field>
594+ <field name="view_type">form</field>
595+ <field name="view_mode">tree,form</field>
596+ </record>
597+
598+ <menuitem
599+ id="account_voucher_tax_sat_menu"
600+ parent='account.menu_finance_payables'
601+ action='account_voucher_tax_sat_action'
602+ sequence='20'
603+ />
604+
605+
606+ <record id="view_account_voucher_tax_sat" model="ir.ui.view">
607+ <field name="name">view.account.voucher.tax.sat</field>
608+ <field name="model">account.tax</field>
609+ <field name="inherit_id" ref="account.view_tax_form"/>
610+ <field name="arch" type="xml">
611+ <xpath expr="//field[@name='active']" position="after">
612+ <field name="tax_sat_ok"/>
613+ <newline/>
614+ <group attrs="{'invisible':[('tax_sat_ok','=',False)]}" colspan="4">
615+ <field name="account_id_creditable" attrs="{'required':[('tax_sat_ok','=',True)]}"/>
616+ <field name="account_id_by_creditable" attrs="{'required':[('tax_sat_ok','=',True)]}"/>
617+ <field name="tax_reference" attrs="{'required':[('tax_sat_ok','=',True)]}"/>
618+ </group>
619+ </xpath>
620+ </field>
621+ </record>
622+
623+
624+ </data>
625+</openerp>
626
627=== added file 'account_voucher_tax_sat/view/partner_view.xml'
628--- account_voucher_tax_sat/view/partner_view.xml 1970-01-01 00:00:00 +0000
629+++ account_voucher_tax_sat/view/partner_view.xml 2013-10-25 22:36:34 +0000
630@@ -0,0 +1,15 @@
631+<?xml version="1.0" encoding="utf-8"?>
632+<openerp>
633+ <data>
634+ <record id="view_res_partner_sat" model="ir.ui.view">
635+ <field name="name">view.res.partner.sat</field>
636+ <field name="model">res.partner</field>
637+ <field name="inherit_id" ref="base.view_partner_form"/>
638+ <field name="arch" type="xml">
639+ <xpath expr="//field[@name='customer']" position="after">
640+ <field name="sat"/>
641+ </xpath>
642+ </field>
643+ </record>
644+ </data>
645+</openerp>
646
647=== added directory 'account_voucher_tax_sat/wizard'
648=== added file 'account_voucher_tax_sat/wizard/__init__.py'
649--- account_voucher_tax_sat/wizard/__init__.py 1970-01-01 00:00:00 +0000
650+++ account_voucher_tax_sat/wizard/__init__.py 2013-10-25 22:36:34 +0000
651@@ -0,0 +1,25 @@
652+#!/usr/bin/python
653+# -*- encoding: utf-8 -*-
654+###########################################################################
655+# Module Writen to OpenERP, Open Source Management Solution
656+# Copyright (C) Vauxoo (<http://vauxoo.com>).
657+# All Rights Reserved
658+###############Credits######################################################
659+# Coded by: Julio Cesar Serna Hernandez(julio@vauxoo.com)
660+#############################################################################
661+# This program is free software: you can redistribute it and/or modify
662+# it under the terms of the GNU Affero General Public License as published by
663+# the Free Software Foundation, either version 3 of the License, or
664+# (at your option) any later version.
665+#
666+# This program is distributed in the hope that it will be useful,
667+# but WITHOUT ANY WARRANTY; without even the implied warranty of
668+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
669+# GNU Affero General Public License for more details.
670+#
671+# You should have received a copy of the GNU Affero General Public License
672+# along with this program. If not, see <http://www.gnu.org/licenses/>.
673+################################################################################
674+
675+
676+import account_tax_sat
677\ No newline at end of file
678
679=== added file 'account_voucher_tax_sat/wizard/account_tax_sat.py'
680--- account_voucher_tax_sat/wizard/account_tax_sat.py 1970-01-01 00:00:00 +0000
681+++ account_voucher_tax_sat/wizard/account_tax_sat.py 2013-10-25 22:36:34 +0000
682@@ -0,0 +1,66 @@
683+#!/usr/bin/python
684+# -*- encoding: utf-8 -*-
685+###########################################################################
686+# Module Writen to OpenERP, Open Source Management Solution
687+# Copyright (C) Vauxoo (<http://vauxoo.com>).
688+# All Rights Reserved
689+###############Credits######################################################
690+# Coded by: Julio Cesar Serna Hernandez(julio@vauxoo.com)
691+#############################################################################
692+# This program is free software: you can redistribute it and/or modify
693+# it under the terms of the GNU Affero General Public License as published by
694+# the Free Software Foundation, either version 3 of the License, or
695+# (at your option) any later version.
696+#
697+# This program is distributed in the hope that it will be useful,
698+# but WITHOUT ANY WARRANTY; without even the implied warranty of
699+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
700+# GNU Affero General Public License for more details.
701+#
702+# You should have received a copy of the GNU Affero General Public License
703+# along with this program. If not, see <http://www.gnu.org/licenses/>.
704+################################################################################
705+
706+
707+import time
708+from openerp.osv import fields, osv
709+from openerp import netsvc
710+import openerp.addons.decimal_precision as dp
711+from openerp.tools.translate import _
712+
713+
714+class account_voucher_tax_assigned(osv.TransientModel):
715+
716+ _name = 'account.voucher.tax.assigned'
717+
718+ _columns = {
719+ 'tax_ids': fields.many2many('account.tax', 'voucher_assgined_tax_rel',
720+ 'wiz_id',
721+ 'tax_id',
722+ 'Taxes to Close'),
723+ 'account_ids': fields.many2many('account.account', 'assigned_account_rel',
724+ 'wiz_id',
725+ 'account_id',
726+ 'Account to Close'),
727+ }
728+
729+ def action_account_assigned(self, cr, uid, ids, context=None):
730+ aml_obj = self.pool.get('account.move.line')
731+ acc_voucher_tax_sat_obj = self.pool.get('account.voucher.tax.sat')
732+ if context is None:
733+ context = {}
734+ for tax_assigned in self.browse(cr, uid, ids, context=context):
735+ acc_vocuher_tax_sat = acc_voucher_tax_sat_obj.browse(cr, uid,
736+ context.get('active_id', False))
737+ taxe_assigned = [taxes.id for taxes in tax_assigned.tax_ids]
738+ account_assigned = [acc.id for acc in tax_assigned.account_ids]
739+ move_line_to_close = aml_obj.search(cr, uid, ['|',
740+ ('tax_id_secondary', 'in', taxe_assigned),
741+ ('account_id', 'in', account_assigned),
742+ ('credit', '>', 0.0),
743+ ('period_id', '=', acc_vocuher_tax_sat.period_id.id)
744+ ])
745+ acc_voucher_tax_sat_obj.write(cr, uid, acc_vocuher_tax_sat.id,
746+ {'aml_ids': [(4, move_id) for move_id in move_line_to_close]})
747+ return True
748+
749\ No newline at end of file
750
751=== added file 'account_voucher_tax_sat/wizard/account_tax_sat_view.xml'
752--- account_voucher_tax_sat/wizard/account_tax_sat_view.xml 1970-01-01 00:00:00 +0000
753+++ account_voucher_tax_sat/wizard/account_tax_sat_view.xml 2013-10-25 22:36:34 +0000
754@@ -0,0 +1,39 @@
755+<?xml version="1.0" encoding="utf-8"?>
756+<openerp>
757+ <data>
758+
759+ <record id="view_account_voucher_tax_form2" model="ir.ui.view">
760+ <field name="name">account.voucher.tax.assigned.form</field>
761+ <field name="model">account.voucher.tax.assigned</field>
762+ <field name="arch" type="xml">
763+ <form string="Account Voucher Tax Assigned" version="7.0">
764+ <group col="4">
765+ <group col='1' colspan='4'>
766+ <field name='tax_ids'
767+ readonly='0'
768+ />
769+ <field name='account_ids'
770+ readonly='0'
771+ />
772+ </group>
773+ </group>
774+ <footer>
775+ <button string="Ok" name="action_account_assigned" type="object" class="oe_highlight"/>
776+ or
777+ <button string="Cancel" class="oe_link" special="cancel"/>
778+ </footer>
779+ </form>
780+ </field>
781+ </record>
782+
783+ <record id="action_view_account_voucher_tax_assigned" model="ir.actions.act_window">
784+ <field name="name">Account Voucher Tax Assigned</field>
785+ <field name="res_model">account.voucher.tax.assigned</field>
786+ <field name="view_type">form</field>
787+ <field name="view_mode">tree,form</field>
788+ <field name="view_id" ref="view_account_voucher_tax_form2"/>
789+ <field name="target">new</field>
790+ </record>
791+
792+ </data>
793+</openerp>