Merge lp:~icsergio/openobject-italia/adding_account_invoice_entry_date into lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0

Proposed by Sergio Corato
Status: Merged
Merged at revision: 211
Proposed branch: lp:~icsergio/openobject-italia/adding_account_invoice_entry_date
Merge into: lp:~openobject-italia-core-devs/openobject-italia/italian-addons-7.0
Diff against target: 317 lines (+286/-0)
6 files modified
account_invoice_entry_date/AUTHORS.txt (+2/-0)
account_invoice_entry_date/__init__.py (+24/-0)
account_invoice_entry_date/__openerp__.py (+35/-0)
account_invoice_entry_date/i18n/it.po (+109/-0)
account_invoice_entry_date/invoice.py (+77/-0)
account_invoice_entry_date/invoice_view.xml (+39/-0)
To merge this branch: bzr merge lp:~icsergio/openobject-italia/adding_account_invoice_entry_date
Reviewer Review Type Date Requested Status
OpenERP Italia core devs Pending
Review via email: mp+157942@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) wrote :

Grazie.

Potresti aggiungere il copyright dell'associazione nei file dove non è presente?

211. By Sergio Corato

[FIX] Copyright

212. By Sergio Corato

[FIX] code for 7.0

Revision history for this message
Sergio Corato (icsergio) wrote :

> Grazie.
>
> Potresti aggiungere il copyright dell'associazione nei file dove non è
> presente?

Adesso dovrebbe essere tutto a posto, non ho fatto un test però

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'account_invoice_entry_date'
2=== added file 'account_invoice_entry_date/AUTHORS.txt'
3--- account_invoice_entry_date/AUTHORS.txt 1970-01-01 00:00:00 +0000
4+++ account_invoice_entry_date/AUTHORS.txt 2013-04-20 22:58:27 +0000
5@@ -0,0 +1,2 @@
6+Paolo Chiara <p.chiara@isa.it>
7+Sergio Corato <info@icstools.it>
8
9=== added file 'account_invoice_entry_date/__init__.py'
10--- account_invoice_entry_date/__init__.py 1970-01-01 00:00:00 +0000
11+++ account_invoice_entry_date/__init__.py 2013-04-20 22:58:27 +0000
12@@ -0,0 +1,24 @@
13+# -*- encoding: utf-8 -*-
14+##############################################################################
15+#
16+# OpenERP, Open Source Management Solution
17+# Copyright (C) 2011 ISA s.r.l. (<http://www.isa.it>).
18+# Copyright (C) 2013 Associazione OpenERP Italia
19+# http://www.openerp-italia.org>
20+#
21+# This program is free software: you can redistribute it and/or modify
22+# it under the terms of the GNU Affero General Public License as
23+# published by the Free Software Foundation, either version 3 of the
24+# License, or (at your option) any later version.
25+#
26+# This program is distributed in the hope that it will be useful,
27+# but WITHOUT ANY WARRANTY; without even the implied warranty of
28+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29+# GNU Affero General Public License for more details.
30+#
31+# You should have received a copy of the GNU Affero General Public License
32+# along with this program. If not, see <http://www.gnu.org/licenses/>.
33+#
34+##############################################################################
35+
36+import invoice
37
38=== added file 'account_invoice_entry_date/__openerp__.py'
39--- account_invoice_entry_date/__openerp__.py 1970-01-01 00:00:00 +0000
40+++ account_invoice_entry_date/__openerp__.py 2013-04-20 22:58:27 +0000
41@@ -0,0 +1,35 @@
42+# -*- encoding: utf-8 -*-
43+##############################################################################
44+#
45+# OpenERP, Open Source Management Solution
46+# Copyright (C) 2011 Associazione OpenERP Italia
47+# http://www.openerp-italia.org>
48+#
49+# This program is free software: you can redistribute it and/or modify
50+# it under the terms of the GNU Affero General Public License as
51+# published by the Free Software Foundation, either version 3 of the
52+# License, or (at your option) any later version.
53+#
54+# This program is distributed in the hope that it will be useful,
55+# but WITHOUT ANY WARRANTY; without even the implied warranty of
56+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
57+# GNU Affero General Public License for more details.
58+#
59+# You should have received a copy of the GNU Affero General Public License
60+# along with this program. If not, see <http://www.gnu.org/licenses/>.
61+#
62+##############################################################################
63+{
64+ 'name': 'Account Invoice entry Date',
65+ 'version': '0.1',
66+ 'category': 'Generic Modules/Accounting',
67+ 'description': """This module allows to specify the date to be used by the move created while confirming (supplier) invoice""",
68+ 'author': 'OpenERP Italian Community',
69+ 'website': 'http://www.openerp-italia.org',
70+ 'license': 'AGPL-3',
71+ "depends" : ['account',],
72+ "data" : ['invoice_view.xml'],
73+ "demo" : [],
74+ "active": False,
75+ "installable": True
76+}
77
78=== added directory 'account_invoice_entry_date/i18n'
79=== added file 'account_invoice_entry_date/i18n/it.po'
80--- account_invoice_entry_date/i18n/it.po 1970-01-01 00:00:00 +0000
81+++ account_invoice_entry_date/i18n/it.po 2013-04-20 22:58:27 +0000
82@@ -0,0 +1,109 @@
83+# Translation of OpenERP Server.
84+# This file contains the translation of the following modules:
85+# * account_invoice_entry_date
86+#
87+msgid ""
88+msgstr ""
89+"Project-Id-Version: OpenERP Server 6.0.2\n"
90+"Report-Msgid-Bugs-To: support@openerp.com\n"
91+"POT-Creation-Date: 2011-09-05 10:31+0000\n"
92+"PO-Revision-Date: 2011-09-05 10:31+0000\n"
93+"Last-Translator: <>\n"
94+"Language-Team: \n"
95+"MIME-Version: 1.0\n"
96+"Content-Type: text/plain; charset=UTF-8\n"
97+"Content-Transfer-Encoding: \n"
98+"Plural-Forms: \n"
99+
100+#. module: account_invoice_entry_date
101+#: code:addons/account_invoice_entry_date/invoice.py:163
102+#, python-format
103+msgid "UserError"
104+msgstr "UserError"
105+
106+#. module: account_invoice_entry_date
107+#: code:addons/account_invoice_entry_date/invoice.py:40
108+#: code:addons/account_invoice_entry_date/invoice.py:81
109+#, python-format
110+msgid "Error !"
111+msgstr "Errore !"
112+
113+#. module: account_invoice_entry_date
114+#: code:addons/account_invoice_entry_date/invoice.py:70
115+#, python-format
116+msgid "Please verify the price of the invoice !\n"
117+"The real total does not match the computed total."
118+msgstr "Per favore verificare il prezzo della fattura!\n"
119+"Il totale reale non corrisponde al totale calcolato."
120+
121+#. module: account_invoice_entry_date
122+#: code:addons/account_invoice_entry_date/invoice.py:81
123+#, python-format
124+msgid "Cannot create the invoice !\n"
125+"The payment term defined gives a computed amount greater than the total invoiced amount."
126+msgstr "Impossibile creare la fattura!\n"
127+"I termini di pagamento definiti generano un importo calcolato maggiore del totale importo fatturato."
128+
129+#. module: account_invoice_entry_date
130+#: model:ir.module.module,description:account_invoice_entry_date.module_meta_information
131+#: model:ir.module.module,shortdesc:account_invoice_entry_date.module_meta_information
132+msgid "Account Invoice entry Date"
133+msgstr "Account Invoice entry Date"
134+
135+#. module: account_invoice_entry_date
136+#: help:account.invoice,registration_date:0
137+msgid "Keep empty to use the current date"
138+msgstr "Lasciare vuoto per utilizzare la data corrente"
139+
140+#. module: account_invoice_entry_date
141+#: code:addons/account_invoice_entry_date/invoice.py:42
142+#, python-format
143+msgid "Please create some invoice lines."
144+msgstr "Creare voci della fattura."
145+
146+#. module: account_invoice_entry_date
147+#: code:addons/account_invoice_entry_date/invoice.py:40
148+#, python-format
149+msgid "Please define sequence on invoice journal"
150+msgstr "Definire una sequenza per il giornale fatture"
151+
152+#. module: account_invoice_entry_date
153+#: code:addons/account_invoice_entry_date/invoice.py:70
154+#, python-format
155+msgid "Bad total !"
156+msgstr "Totale Errato !"
157+
158+#. module: account_invoice_entry_date
159+#: code:addons/account_invoice_entry_date/invoice.py:57
160+#, python-format
161+msgid "The invoice date cannot be later than the date of registration!"
162+msgstr "La data di fatturazione non può essere successiva alla data di registrazione!"
163+
164+#. module: account_invoice_entry_date
165+#: model:ir.model,name:account_invoice_entry_date.model_account_invoice
166+msgid "Invoice"
167+msgstr "Fattura"
168+
169+#. module: account_invoice_entry_date
170+#: code:addons/account_invoice_entry_date/invoice.py:164
171+#, python-format
172+msgid "Cannot create invoice move on centralised journal"
173+msgstr "Impossibile creare la registrazione della fattura su un giornale centralizzato"
174+
175+#. module: account_invoice_entry_date
176+#: code:addons/account_invoice_entry_date/invoice.py:42
177+#, python-format
178+msgid "No Invoice Lines !"
179+msgstr "Mancano voci nella fattura !"
180+
181+#. module: account_invoice_entry_date
182+#: field:account.invoice,registration_date:0
183+msgid "Registration Date"
184+msgstr "Data di registrazione"
185+
186+#. module: account_invoice_entry_date
187+#: code:addons/account_invoice_entry_date/invoice.py:57
188+#, python-format
189+msgid "Error date !"
190+msgstr "Data errata !"
191+
192
193=== added file 'account_invoice_entry_date/invoice.py'
194--- account_invoice_entry_date/invoice.py 1970-01-01 00:00:00 +0000
195+++ account_invoice_entry_date/invoice.py 2013-04-20 22:58:27 +0000
196@@ -0,0 +1,77 @@
197+# -*- coding: utf-8 -*-
198+##############################################################################
199+#
200+# OpenERP, Open Source Management Solution
201+# Copyright (C) 2004-2010 ISA srl (<http://www.isa.it>).
202+# Copyright (C) 2013 Associazione OpenERP Italia
203+# http://www.openerp-italia.org>
204+#
205+# This program is free software: you can redistribute it and/or modify
206+# it under the terms of the GNU Affero General Public License as
207+# published by the Free Software Foundation, either version 3 of the
208+# License, or (at your option) any later version.
209+#
210+# This program is distributed in the hope that it will be useful,
211+# but WITHOUT ANY WARRANTY; without even the implied warranty of
212+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
213+# GNU Affero General Public License for more details.
214+#
215+# You should have received a copy of the GNU Affero General Public License
216+# along with this program. If not, see <http://www.gnu.org/licenses/>.
217+#
218+##############################################################################
219+
220+import time
221+from openerp.osv import fields, orm
222+from tools.translate import _
223+from datetime import datetime
224+
225+class account_invoice(orm.Model):
226+
227+ _inherit = 'account.invoice'
228+ _columns = {
229+ 'registration_date':fields.date('Registration Date', states={'paid':[('readonly',True)], 'open':[('readonly',True)], 'close':[('readonly',True)]}, select=True, help="Keep empty to use the current date"),
230+ }
231+
232+ def action_move_create(self, cr, uid, ids, *args):
233+
234+ super(account_invoice,self).action_move_create(cr, uid, ids,*args)
235+
236+ for inv in self.browse(cr, uid, ids):
237+
238+ date_invoice=inv.date_invoice
239+
240+ reg_date = inv.registration_date
241+ if not inv.registration_date :
242+ if not inv.date_invoice:
243+ reg_date = time.strftime('%Y-%m-%d')
244+ else : reg_date = inv.date_invoice
245+
246+ if date_invoice and reg_date :
247+ if (date_invoice > reg_date) :
248+ raise orm.except_orm(_('Error date !'), _('The invoice date cannot be later than the date of registration!'))
249+
250+ #periodo
251+ date_start = inv.registration_date or inv.date_invoice or time.strftime('%Y-%m-%d')
252+ date_stop = inv.registration_date or inv.date_invoice or time.strftime('%Y-%m-%d')
253+
254+ period_ids = self.pool.get('account.period').search(cr, uid, [('date_start','<=',date_start),('date_stop','>=',date_stop), ('company_id', '=', inv.company_id.id)])
255+ if period_ids:
256+ period_id = period_ids[0]
257+
258+ self.write(cr, uid, [inv.id], {'registration_date':reg_date,'period_id':period_id,})
259+
260+ mov_date = reg_date or inv.date_invoice or time.strftime('%Y-%m-%d')
261+
262+ self.pool.get('account.move').write(cr, uid, [inv.move_id.id], {'state':'draft'})
263+
264+ sql="update account_move_line set period_id="+str(period_id)+",date='"+mov_date+"' where move_id = "+str(inv.move_id.id)
265+
266+ cr.execute(sql)
267+
268+ self.pool.get('account.move').write(cr, uid, [inv.move_id.id], {'period_id':period_id,'date':mov_date})
269+
270+ self.pool.get('account.move').write(cr, uid, [inv.move_id.id], {'state':'posted'})
271+
272+ self._log_event(cr, uid, ids)
273+ return True
274
275=== added file 'account_invoice_entry_date/invoice_view.xml'
276--- account_invoice_entry_date/invoice_view.xml 1970-01-01 00:00:00 +0000
277+++ account_invoice_entry_date/invoice_view.xml 2013-04-20 22:58:27 +0000
278@@ -0,0 +1,39 @@
279+<?xml version="1.0" encoding="utf-8"?>
280+<openerp>
281+ <data>
282+ <record id="invoice_form_reg_date" model="ir.ui.view">
283+ <field name="name">account.invoice.form.reg_date</field>
284+ <field name="model">account.invoice</field>
285+ <field name="inherit_id" ref="account.invoice_form"/>
286+ <field name="arch" type="xml">
287+ <field name="date_invoice" position="after">
288+ <field name="registration_date"></field>
289+ </field>
290+ </field>
291+ </record>
292+
293+ <record id="invoice_tree_reg_date" model="ir.ui.view">
294+ <field name="name">account.invoice.tree.reg_date</field>
295+ <field name="model">account.invoice</field>
296+ <field name="inherit_id" ref="account.invoice_tree"/>
297+ <field name="arch" type="xml">
298+ <field name="date_invoice" position="after">
299+ <field name="registration_date"></field>
300+ </field>
301+ </field>
302+ </record>
303+
304+ <record id="invoice_supplier_form_reg_date" model="ir.ui.view">
305+ <field name="name">account.invoice.supplier.form.reg_date</field>
306+ <field name="model">account.invoice</field>
307+ <field name="inherit_id" ref="account.invoice_supplier_form"/>
308+ <field name="arch" type="xml">
309+ <field name="date_invoice" position="after">
310+ <field name="registration_date"></field>
311+ </field>
312+ </field>
313+ </record>
314+
315+
316+ </data>
317+</openerp>

Subscribers

People subscribed via source and target branches