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

Proposed by Luis Torres - http://www.vauxoo.com
Status: Needs review
Proposed branch: lp:~vauxoo/addons-vauxoo/currency_rounding_constrain_dev_luis
Merge into: lp:addons-vauxoo
Diff against target: 179 lines (+153/-0)
5 files modified
currency_rounding_constrain/__init__.py (+26/-0)
currency_rounding_constrain/__openerp__.py (+44/-0)
currency_rounding_constrain/i18n/es.po (+32/-0)
currency_rounding_constrain/res_currency.py (+35/-0)
currency_rounding_constrain/res_currency_view.xml (+16/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/currency_rounding_constrain_dev_luis
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Needs Fixing
Review via email: mp+118433@code.launchpad.net

Description of the change

Se agrego un sql_constraint para que no se pueda colocar un rounding menor a 0, o nulo

To post a comment you must log in.
387. By Luis Torres - http://www.vauxoo.com

[IMP]Change field rounding to required=True

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

Luis,

La palabra contrain va con "t" al final (contraint)
De una vez, como vas a cambiar el nombre del módulo, renombra todo a:

currency_rounding_nonzero

Hacer el replace en todos lados, incluso en el PO
Utilizar "bzr rename"

Pon el rounding a:
CHECK (rounding<>0)
Es decir, asignar un operador "diferente" <> tal vez sea !=
You can not assigned Rounding Factor = 0! Please set Rounding Factor!

review: Needs Fixing

Unmerged revisions

387. By Luis Torres - http://www.vauxoo.com

[IMP]Change field rounding to required=True

386. By Luis Torres - http://www.vauxoo.com

[IMP]Change constraint to sql_constraint

385. By Luis Torres - http://www.vauxoo.com

[ADD][currency_rounding_constrain]Add constrain to rounding factor

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'currency_rounding_constrain'
2=== added file 'currency_rounding_constrain/__init__.py'
3--- currency_rounding_constrain/__init__.py 1970-01-01 00:00:00 +0000
4+++ currency_rounding_constrain/__init__.py 2012-08-06 22:47: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 res_currency
32
33=== added file 'currency_rounding_constrain/__openerp__.py'
34--- currency_rounding_constrain/__openerp__.py 1970-01-01 00:00:00 +0000
35+++ currency_rounding_constrain/__openerp__.py 2012-08-06 22:47:19 +0000
36@@ -0,0 +1,44 @@
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+ "name" : "Currency Rounding Constrain",
64+ "version" : "1.0",
65+ "author" : "Vauxoo",
66+ "category" : "Generic Modules",
67+ "description" : """
68+ Add constrain for can not be the currency rounding=0 or Null
69+ """,
70+ "website" : "http://www.vauxoo.com/",
71+ "license" : "AGPL-3",
72+ "depends" : ["base",
73+ ],
74+ "init_xml" : [],
75+ "demo_xml" : [],
76+ "update_xml" : [
77+ ],
78+ "installable" : True,
79+ "active" : False,
80+}
81
82=== added directory 'currency_rounding_constrain/i18n'
83=== added file 'currency_rounding_constrain/i18n/es.po'
84--- currency_rounding_constrain/i18n/es.po 1970-01-01 00:00:00 +0000
85+++ currency_rounding_constrain/i18n/es.po 2012-08-06 22:47:19 +0000
86@@ -0,0 +1,32 @@
87+# Translation of OpenERP Server.
88+# This file contains the translation of the following modules:
89+# * currency_rounding_constrain
90+#
91+msgid ""
92+msgstr ""
93+"Project-Id-Version: OpenERP Server 6.1\n"
94+"Report-Msgid-Bugs-To: \n"
95+"POT-Creation-Date: 2012-08-06 22:42+0000\n"
96+"PO-Revision-Date: 2012-08-06 22:42+0000\n"
97+"Last-Translator: <>\n"
98+"Language-Team: \n"
99+"MIME-Version: 1.0\n"
100+"Content-Type: text/plain; charset=UTF-8\n"
101+"Content-Transfer-Encoding: \n"
102+"Plural-Forms: \n"
103+
104+#. module: currency_rounding_constrain
105+#: model:ir.model,name:currency_rounding_constrain.model_res_currency
106+msgid "Currency"
107+msgstr "Divisa"
108+
109+#. module: currency_rounding_constrain
110+#: sql_constraint:res.currency:0
111+msgid "The currency code must be unique per company!"
112+msgstr "El código de la moneda debe ser único por empresa!"
113+
114+#. module: currency_rounding_constrain
115+#: sql_constraint:res.currency:0
116+msgid "You can not assigned Rounding Factor < 0 ! Please set Rounding Factor !"
117+msgstr "No se puede asignar Rounding Factor < 0 ! Por favor inserte otro valor a Rounding Factor !"
118+
119
120=== added file 'currency_rounding_constrain/res_currency.py'
121--- currency_rounding_constrain/res_currency.py 1970-01-01 00:00:00 +0000
122+++ currency_rounding_constrain/res_currency.py 2012-08-06 22:47:19 +0000
123@@ -0,0 +1,35 @@
124+# -*- encoding: utf-8 -*-
125+###########################################################################
126+# Module Writen to OpenERP, Open Source Management Solution
127+#
128+# Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
129+# All Rights Reserved.
130+# info Vauxoo (info@vauxoo.com)
131+############################################################################
132+# Coded by: Luis Torres (luis_t@vauxoo.com)
133+############################################################################
134+#
135+# This program is free software: you can redistribute it and/or modify
136+# it under the terms of the GNU Affero General Public License as
137+# published by the Free Software Foundation, either version 3 of the
138+# License, or (at your option) any later version.
139+#
140+# This program is distributed in the hope that it will be useful,
141+# but WITHOUT ANY WARRANTY; without even the implied warranty of
142+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
143+# GNU Affero General Public License for more details.
144+#
145+# You should have received a copy of the GNU Affero General Public License
146+# along with this program. If not, see <http://www.gnu.org/licenses/>.
147+#
148+##############################################################################
149+from osv import osv,fields
150+
151+class account_invoice(osv.osv):
152+ _inherit = 'res.currency'
153+ _columns = {
154+ 'rounding': fields.float('Rounding Factor', digits=(12,6),required=True),
155+ }
156+ _sql_constraints = [
157+ ('currency_rounding', 'CHECK (rounding>0)', 'You can not assigned Rounding Factor < 0 ! Please set Rounding Factor !'),
158+ ]
159
160=== added file 'currency_rounding_constrain/res_currency_view.xml'
161--- currency_rounding_constrain/res_currency_view.xml 1970-01-01 00:00:00 +0000
162+++ currency_rounding_constrain/res_currency_view.xml 2012-08-06 22:47:19 +0000
163@@ -0,0 +1,16 @@
164+<?xml version="1.0" encoding="utf-8"?>
165+<openerp>
166+ <data>
167+ <record model="ir.ui.view" id="view_res_currency_inherit_rounding_form">
168+ <field name="name">view.res.currency.inherit.rounding.form</field>
169+ <field name="model">res.company</field>
170+ <field name="type">form</field>
171+ <field name="inherit_id" ref="base.view_currency_form"/>
172+ <field name="arch" type="xml">
173+ <xpath expr="/form/group/group/field[@name='rounding']" position="replace">
174+ <field name="rounding">
175+ </xpath>
176+ </field>
177+ </record>
178+ </data>
179+</openerp>