Merge lp:~openobject-italia-core-devs/openobject-italia/add_account_invoice_entry_date into lp:~openobject-italia-core-devs/openobject-italia/italian-addons

Proposed by Lorenzo Battistini
Status: Merged
Merged at revision: 126
Proposed branch: lp:~openobject-italia-core-devs/openobject-italia/add_account_invoice_entry_date
Merge into: lp:~openobject-italia-core-devs/openobject-italia/italian-addons
Diff against target: 315 lines (+284/-0)
6 files modified
account_invoice_entry_date/AUTHORS.txt (+1/-0)
account_invoice_entry_date/__init__.py (+22/-0)
account_invoice_entry_date/__openerp__.py (+36/-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:~openobject-italia-core-devs/openobject-italia/add_account_invoice_entry_date
Reviewer Review Type Date Requested Status
Lorenzo Battistini Approve
Review via email: mp+74888@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'account_invoice_entry_date'
=== added file 'account_invoice_entry_date/AUTHORS.txt'
--- account_invoice_entry_date/AUTHORS.txt 1970-01-01 00:00:00 +0000
+++ account_invoice_entry_date/AUTHORS.txt 2011-09-10 17:22:22 +0000
@@ -0,0 +1,1 @@
1Paolo Chiara <p.chiara@isa.it>
02
=== added file 'account_invoice_entry_date/__init__.py'
--- account_invoice_entry_date/__init__.py 1970-01-01 00:00:00 +0000
+++ account_invoice_entry_date/__init__.py 2011-09-10 17:22:22 +0000
@@ -0,0 +1,22 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011 ISA s.r.l. (<http://www.isa.it>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import invoice
023
=== added file 'account_invoice_entry_date/__openerp__.py'
--- account_invoice_entry_date/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_invoice_entry_date/__openerp__.py 2011-09-10 17:22:22 +0000
@@ -0,0 +1,36 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2011 Associazione OpenERP Italia
6# http://www.openerp-italia.org>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22{
23 'name': 'Account Invoice entry Date',
24 'version': '0.1',
25 'category': 'Generic Modules/Accounting',
26 'description': """Account Invoice entry Date""",
27 'author': 'OpenERP Italian Community',
28 'website': 'http://www.openerp-italia.org',
29 'license': 'AGPL-3',
30 "depends" : ['account',],
31 "init_xml" : [],
32 "update_xml" : ['invoice_view.xml'],
33 "demo_xml" : [],
34 "active": False,
35 "installable": True
36}
037
=== added directory 'account_invoice_entry_date/i18n'
=== added file 'account_invoice_entry_date/i18n/it.po'
--- account_invoice_entry_date/i18n/it.po 1970-01-01 00:00:00 +0000
+++ account_invoice_entry_date/i18n/it.po 2011-09-10 17:22:22 +0000
@@ -0,0 +1,109 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * account_invoice_entry_date
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.0.2\n"
8"Report-Msgid-Bugs-To: support@openerp.com\n"
9"POT-Creation-Date: 2011-09-05 10:31+0000\n"
10"PO-Revision-Date: 2011-09-05 10:31+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: account_invoice_entry_date
19#: code:addons/account_invoice_entry_date/invoice.py:163
20#, python-format
21msgid "UserError"
22msgstr "UserError"
23
24#. module: account_invoice_entry_date
25#: code:addons/account_invoice_entry_date/invoice.py:40
26#: code:addons/account_invoice_entry_date/invoice.py:81
27#, python-format
28msgid "Error !"
29msgstr "Errore !"
30
31#. module: account_invoice_entry_date
32#: code:addons/account_invoice_entry_date/invoice.py:70
33#, python-format
34msgid "Please verify the price of the invoice !\n"
35"The real total does not match the computed total."
36msgstr "Per favore verificare il prezzo della fattura!\n"
37"Il totale reale non corrisponde al totale calcolato."
38
39#. module: account_invoice_entry_date
40#: code:addons/account_invoice_entry_date/invoice.py:81
41#, python-format
42msgid "Cannot create the invoice !\n"
43"The payment term defined gives a computed amount greater than the total invoiced amount."
44msgstr "Impossibile creare la fattura!\n"
45"I termini di pagamento definiti generano un importo calcolato maggiore del totale importo fatturato."
46
47#. module: account_invoice_entry_date
48#: model:ir.module.module,description:account_invoice_entry_date.module_meta_information
49#: model:ir.module.module,shortdesc:account_invoice_entry_date.module_meta_information
50msgid "Account Invoice entry Date"
51msgstr "Account Invoice entry Date"
52
53#. module: account_invoice_entry_date
54#: help:account.invoice,registration_date:0
55msgid "Keep empty to use the current date"
56msgstr "Lasciare vuoto per utilizzare la data corrente"
57
58#. module: account_invoice_entry_date
59#: code:addons/account_invoice_entry_date/invoice.py:42
60#, python-format
61msgid "Please create some invoice lines."
62msgstr "Creare voci della fattura."
63
64#. module: account_invoice_entry_date
65#: code:addons/account_invoice_entry_date/invoice.py:40
66#, python-format
67msgid "Please define sequence on invoice journal"
68msgstr "Definire una sequenza per il giornale fatture"
69
70#. module: account_invoice_entry_date
71#: code:addons/account_invoice_entry_date/invoice.py:70
72#, python-format
73msgid "Bad total !"
74msgstr "Totale Errato !"
75
76#. module: account_invoice_entry_date
77#: code:addons/account_invoice_entry_date/invoice.py:57
78#, python-format
79msgid "The invoice date cannot be later than the date of registration!"
80msgstr "La data di fatturazione non può essere successiva alla data di registrazione!"
81
82#. module: account_invoice_entry_date
83#: model:ir.model,name:account_invoice_entry_date.model_account_invoice
84msgid "Invoice"
85msgstr "Fattura"
86
87#. module: account_invoice_entry_date
88#: code:addons/account_invoice_entry_date/invoice.py:164
89#, python-format
90msgid "Cannot create invoice move on centralised journal"
91msgstr "Impossibile creare la registrazione della fattura su un giornale centralizzato"
92
93#. module: account_invoice_entry_date
94#: code:addons/account_invoice_entry_date/invoice.py:42
95#, python-format
96msgid "No Invoice Lines !"
97msgstr "Mancano voci nella fattura !"
98
99#. module: account_invoice_entry_date
100#: field:account.invoice,registration_date:0
101msgid "Registration Date"
102msgstr "Data di registrazione"
103
104#. module: account_invoice_entry_date
105#: code:addons/account_invoice_entry_date/invoice.py:57
106#, python-format
107msgid "Error date !"
108msgstr "Data errata !"
109
0110
=== added file 'account_invoice_entry_date/invoice.py'
--- account_invoice_entry_date/invoice.py 1970-01-01 00:00:00 +0000
+++ account_invoice_entry_date/invoice.py 2011-09-10 17:22:22 +0000
@@ -0,0 +1,77 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2010 ISA srl (<http://www.isa.it>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import time
23from osv import fields, osv, orm
24from tools.translate import _
25from datetime import datetime
26
27class account_invoice(osv.osv):
28
29 _inherit = 'account.invoice'
30 _columns = {
31 '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"),
32 }
33
34 def action_move_create(self, cr, uid, ids, *args):
35
36 super(account_invoice,self).action_move_create(cr, uid, ids,*args)
37
38 for inv in self.browse(cr, uid, ids):
39
40 date_invoice=inv.date_invoice
41
42 reg_date = inv.registration_date
43 if not inv.registration_date :
44 if not inv.date_invoice:
45 reg_date = time.strftime('%Y-%m-%d')
46 else : reg_date = inv.date_invoice
47
48 if date_invoice and reg_date :
49 if (date_invoice > reg_date) :
50 raise osv.except_osv(_('Error date !'), _('The invoice date cannot be later than the date of registration!'))
51
52 #periodo
53 date_start = inv.registration_date or inv.date_invoice or time.strftime('%Y-%m-%d')
54 date_stop = inv.registration_date or inv.date_invoice or time.strftime('%Y-%m-%d')
55
56 period_ids = self.pool.get('account.period').search(cr, uid, [('date_start','<=',date_start),('date_stop','>=',date_stop), ('company_id', '=', inv.company_id.id)])
57 if period_ids:
58 period_id = period_ids[0]
59
60 self.write(cr, uid, [inv.id], {'registration_date':reg_date,'period_id':period_id,})
61
62 mov_date = reg_date or inv.date_invoice or time.strftime('%Y-%m-%d')
63
64 self.pool.get('account.move').write(cr, uid, [inv.move_id.id], {'state':'draft'})
65
66 sql="update account_move_line set period_id="+str(period_id)+",date='"+mov_date+"' where move_id = "+str(inv.move_id.id)
67
68 cr.execute(sql)
69
70 self.pool.get('account.move').write(cr, uid, [inv.move_id.id], {'period_id':period_id,'date':mov_date})
71
72 self.pool.get('account.move').write(cr, uid, [inv.move_id.id], {'state':'posted'})
73
74 self._log_event(cr, uid, ids)
75 return True
76
77account_invoice()
078
=== added file 'account_invoice_entry_date/invoice_view.xml'
--- account_invoice_entry_date/invoice_view.xml 1970-01-01 00:00:00 +0000
+++ account_invoice_entry_date/invoice_view.xml 2011-09-10 17:22:22 +0000
@@ -0,0 +1,39 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <record id="invoice_form_reg_date" model="ir.ui.view">
5 <field name="name">account.invoice.form.reg_date</field>
6 <field name="model">account.invoice</field>
7 <field name="inherit_id" ref="account.invoice_form"/>
8 <field name="arch" type="xml">
9 <field name="date_invoice" position="after">
10 <field name="registration_date"></field>
11 </field>
12 </field>
13 </record>
14
15 <record id="invoice_tree_reg_date" model="ir.ui.view">
16 <field name="name">account.invoice.tree.reg_date</field>
17 <field name="model">account.invoice</field>
18 <field name="inherit_id" ref="account.invoice_tree"/>
19 <field name="arch" type="xml">
20 <field name="date_invoice" position="after">
21 <field name="registration_date"></field>
22 </field>
23 </field>
24 </record>
25
26 <record id="invoice_supplier_form_reg_date" model="ir.ui.view">
27 <field name="name">account.invoice.supplier.form.reg_date</field>
28 <field name="model">account.invoice</field>
29 <field name="inherit_id" ref="account.invoice_supplier_form"/>
30 <field name="arch" type="xml">
31 <field name="date_invoice" position="after">
32 <field name="registration_date"></field>
33 </field>
34 </field>
35 </record>
36
37
38 </data>
39</openerp>