Merge lp:~vauxoo/addons-vauxoo/account_invoice_regular_validation_dev_luis into lp:addons-vauxoo

Proposed by Luis Torres - http://www.vauxoo.com
Status: Merged
Merged at revision: 394
Proposed branch: lp:~vauxoo/addons-vauxoo/account_invoice_regular_validation_dev_luis
Merge into: lp:addons-vauxoo
Diff against target: 194 lines (+168/-0)
5 files modified
account_invoice_regular_validation/__init__.py (+26/-0)
account_invoice_regular_validation/__openerp__.py (+46/-0)
account_invoice_regular_validation/account_invoice.py (+41/-0)
account_invoice_regular_validation/account_invoice_view.xml (+16/-0)
account_invoice_regular_validation/i18n/es.po (+39/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/account_invoice_regular_validation_dev_luis
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Approve
Luis Torres - http://www.vauxoo.com Needs Resubmitting
Julio Serna-http://www.vauxoo.com Pending
Review via email: mp+119001@code.launchpad.net

Description of the change

Se modifico el domain para que en las líneas de la factura unicamente muestre los tipos de cuenta que sean de tipo 'other', y que no se pueda validar la factura algun producto tiene una cuenta diferente a esta.

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

Luis,
Está perfecto y funcional
Ahora solo atacar los guidelines

Cambia la línea
  for lin in self.browse(cr,uid,ids)
  a
  for invoice in self.browse(cr, uid, ids, context=context)

Cambia la línea
  for lins in lin.invoice_line:
  a
  for line in invoice.invoice_line:

Para atacar el guideline fish to fish

Elimina la clase
class account_invoice_line(osv.osv):
Con agregar el domain en la vista, es suficiente.

review: Needs Fixing
Revision history for this message
Luis Torres - http://www.vauxoo.com (luis-cleto-) wrote :

Se elimino la clase account_invoice_line, que no se ocupaba, y se cambiaron los nombres a algunas variables

review: Needs Resubmitting
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_invoice_regular_validation'
2=== added file 'account_invoice_regular_validation/__init__.py'
3--- account_invoice_regular_validation/__init__.py 1970-01-01 00:00:00 +0000
4+++ account_invoice_regular_validation/__init__.py 2012-08-09 18:32:19 +0000
5@@ -0,0 +1,26 @@
6+# -*- encoding: utf-8 -*-
7+###########################################################################
8+# Module Writen to OpenERP, Open Source Management Solution
9+#
10+# Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
11+# All Rights Reserved.
12+# info Vauxoo (info@vauxoo.com)
13+############################################################################
14+# Coded by: Luis Torres (luis_t@vauxoo.com)
15+############################################################################
16+#
17+# This program is free software: you can redistribute it and/or modify
18+# it under the terms of the GNU Affero General Public License as
19+# published by the Free Software Foundation, either version 3 of the
20+# License, or (at your option) any later version.
21+#
22+# This program is distributed in the hope that it will be useful,
23+# but WITHOUT ANY WARRANTY; without even the implied warranty of
24+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+# GNU Affero General Public License for more details.
26+#
27+# You should have received a copy of the GNU Affero General Public License
28+# along with this program. If not, see <http://www.gnu.org/licenses/>.
29+#
30+##############################################################################
31+import account_invoice
32
33=== added file 'account_invoice_regular_validation/__openerp__.py'
34--- account_invoice_regular_validation/__openerp__.py 1970-01-01 00:00:00 +0000
35+++ account_invoice_regular_validation/__openerp__.py 2012-08-09 18:32:19 +0000
36@@ -0,0 +1,46 @@
37+# -*- encoding: utf-8 -*-
38+###########################################################################
39+# Module Writen to OpenERP, Open Source Management Solution
40+#
41+# Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
42+# All Rights Reserved.
43+# info Vauxoo (info@vauxoo.com)
44+############################################################################
45+# Coded by: Luis Torres (luis_t@vauxoo.com)
46+############################################################################
47+#
48+# This program is free software: you can redistribute it and/or modify
49+# it under the terms of the GNU Affero General Public License as
50+# published by the Free Software Foundation, either version 3 of the
51+# License, or (at your option) any later version.
52+#
53+# This program is distributed in the hope that it will be useful,
54+# but WITHOUT ANY WARRANTY; without even the implied warranty of
55+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56+# GNU Affero General Public License for more details.
57+#
58+# You should have received a copy of the GNU Affero General Public License
59+# along with this program. If not, see <http://www.gnu.org/licenses/>.
60+#
61+##############################################################################
62+
63+{
64+ "name" : "Invoice Regular Validation",
65+ "version" : "1.0",
66+ "author" : "Vauxoo",
67+ "category" : "Generic Modules",
68+ "description" : """
69+ This module validate that the lines don't have account type different to regular
70+ """,
71+ "website" : "http://www.vauxoo.com/",
72+ "license" : "AGPL-3",
73+ "depends" : ["base","account"
74+ ],
75+ "init_xml" : [],
76+ "demo_xml" : [],
77+ "update_xml" : [
78+ "account_invoice_view.xml",
79+ ],
80+ "installable" : True,
81+ "active" : False,
82+}
83
84=== added file 'account_invoice_regular_validation/account_invoice.py'
85--- account_invoice_regular_validation/account_invoice.py 1970-01-01 00:00:00 +0000
86+++ account_invoice_regular_validation/account_invoice.py 2012-08-09 18:32:19 +0000
87@@ -0,0 +1,41 @@
88+# -*- encoding: utf-8 -*-
89+###########################################################################
90+# Module Writen to OpenERP, Open Source Management Solution
91+#
92+# Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
93+# All Rights Reserved.
94+# info Vauxoo (info@vauxoo.com)
95+############################################################################
96+# Coded by: Luis Torres (luis_t@vauxoo.com)
97+############################################################################
98+#
99+# This program is free software: you can redistribute it and/or modify
100+# it under the terms of the GNU Affero General Public License as
101+# published by the Free Software Foundation, either version 3 of the
102+# License, or (at your option) any later version.
103+#
104+# This program is distributed in the hope that it will be useful,
105+# but WITHOUT ANY WARRANTY; without even the implied warranty of
106+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
107+# GNU Affero General Public License for more details.
108+#
109+# You should have received a copy of the GNU Affero General Public License
110+# along with this program. If not, see <http://www.gnu.org/licenses/>.
111+#
112+##############################################################################
113+from osv import fields, osv
114+from tools.translate import _
115+
116+class account_invoice(osv.osv):
117+ _inherit='account.invoice'
118+
119+ def action_move_create(self, cr, uid, ids, context=None):
120+ if not context:
121+ context={}
122+ for invoice in self.browse(cr, uid, ids, context=context):
123+ for line in invoice.invoice_line:
124+ if line.account_id.type<>'other':
125+ raise osv.except_osv(_('Error!'),_("Can not be used different types of accounts to 'other' in the lines of the invoice!"))
126+ res = super(account_invoice,self).action_move_create(cr, uid, ids, context=context)
127+ return res
128+account_invoice()
129
130=== added file 'account_invoice_regular_validation/account_invoice_view.xml'
131--- account_invoice_regular_validation/account_invoice_view.xml 1970-01-01 00:00:00 +0000
132+++ account_invoice_regular_validation/account_invoice_view.xml 2012-08-09 18:32:19 +0000
133@@ -0,0 +1,16 @@
134+<?xml version="1.0" encoding="utf-8"?>
135+<openerp>
136+ <data>
137+ <record model="ir.ui.view" id="view_account_invoice_line_inherit_account_id_form">
138+ <field name="name">view.account.invoice.line.inherit.account.id.form</field>
139+ <field name="model">account.invoice.line</field>
140+ <field name="type">form</field>
141+ <field name="inherit_id" ref="account.view_invoice_line_form"/>
142+ <field name="arch" type="xml">
143+ <xpath expr="/form/field[@name='account_id']" position="replace">
144+ <field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '=', 'other')]" name="account_id" on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/>
145+ </xpath>
146+ </field>
147+ </record>
148+ </data>
149+</openerp>
150
151=== added directory 'account_invoice_regular_validation/i18n'
152=== added file 'account_invoice_regular_validation/i18n/es.po'
153--- account_invoice_regular_validation/i18n/es.po 1970-01-01 00:00:00 +0000
154+++ account_invoice_regular_validation/i18n/es.po 2012-08-09 18:32:19 +0000
155@@ -0,0 +1,39 @@
156+# Translation of OpenERP Server.
157+# This file contains the translation of the following modules:
158+# * account_invoice_regular_validation
159+#
160+msgid ""
161+msgstr ""
162+"Project-Id-Version: OpenERP Server 6.1\n"
163+"Report-Msgid-Bugs-To: \n"
164+"POT-Creation-Date: 2012-08-08 22:50+0000\n"
165+"PO-Revision-Date: 2012-08-08 22:50+0000\n"
166+"Last-Translator: <>\n"
167+"Language-Team: \n"
168+"MIME-Version: 1.0\n"
169+"Content-Type: text/plain; charset=UTF-8\n"
170+"Content-Transfer-Encoding: \n"
171+"Plural-Forms: \n"
172+
173+#. module: account_invoice_regular_validation
174+#: code:addons/account_invoice_regular_validation/account_invoice.py:38
175+#, python-format
176+msgid "Error!"
177+msgstr "Error!"
178+
179+#. module: account_invoice_regular_validation
180+#: sql_constraint:account.invoice:0
181+msgid "Invoice Number must be unique per Company!"
182+msgstr "¡El número de factura debe ser único por compañía!"
183+
184+#. module: account_invoice_regular_validation
185+#: code:addons/account_invoice_regular_validation/account_invoice.py:38
186+#, python-format
187+msgid "Can not be used different types of accounts to 'other' in the lines of the invoice!"
188+msgstr "No se pueden utilizar tipos de cuenta diferentes a 'regular' en las líneas de la factura!"
189+
190+#. module: account_invoice_regular_validation
191+#: model:ir.model,name:account_invoice_regular_validation.model_account_invoice
192+msgid "Invoice"
193+msgstr "Factura"
194+