← Back to team overview

openobject-italia-core-devs team mailing list archive

lp:~icsergio/openobject-italia/adding_account_invoice_entry_date into lp:openobject-italia/7.0

 

Sergio Corato has proposed merging lp:~icsergio/openobject-italia/adding_account_invoice_entry_date into lp:openobject-italia/7.0.

Requested reviews:
  OpenERP Italia core devs (openobject-italia-core-devs)

For more details, see:
https://code.launchpad.net/~icsergio/openobject-italia/adding_account_invoice_entry_date/+merge/157942
-- 
https://code.launchpad.net/~icsergio/openobject-italia/adding_account_invoice_entry_date/+merge/157942
Your team OpenERP Italia core devs is requested to review the proposed merge of lp:~icsergio/openobject-italia/adding_account_invoice_entry_date into lp:openobject-italia/7.0.
=== 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	2013-04-09 19:33:19 +0000
@@ -0,0 +1,1 @@
+Paolo Chiara <p.chiara@xxxxxx>

=== 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	2013-04-09 19:33:19 +0000
@@ -0,0 +1,22 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2011 ISA s.r.l. (<http://www.isa.it>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import invoice

=== 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	2013-04-09 19:33:19 +0000
@@ -0,0 +1,36 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2011 Associazione OpenERP Italia
+#    http://www.openerp-italia.org> 
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    'name': 'Account Invoice entry Date',
+    'version': '0.1',
+    'category': 'Generic Modules/Accounting',
+    'description': """This module allows to specify the date to be used by the move created while confirming (supplier) invoice""",
+    'author': 'OpenERP Italian Community',
+    'website': 'http://www.openerp-italia.org',
+    'license': 'AGPL-3',
+    "depends" : ['account',],
+    "init_xml" : [],
+    "update_xml" : ['invoice_view.xml'],
+    "demo_xml" : [],
+    "active": False,
+    "installable": True
+}

=== 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	2013-04-09 19:33:19 +0000
@@ -0,0 +1,109 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_invoice_entry_date
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.2\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2011-09-05 10:31+0000\n"
+"PO-Revision-Date: 2011-09-05 10:31+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: account_invoice_entry_date
+#: code:addons/account_invoice_entry_date/invoice.py:163
+#, python-format
+msgid "UserError"
+msgstr "UserError"
+
+#. module: account_invoice_entry_date
+#: code:addons/account_invoice_entry_date/invoice.py:40
+#: code:addons/account_invoice_entry_date/invoice.py:81
+#, python-format
+msgid "Error !"
+msgstr "Errore !"
+
+#. module: account_invoice_entry_date
+#: code:addons/account_invoice_entry_date/invoice.py:70
+#, python-format
+msgid "Please verify the price of the invoice !\n"
+"The real total does not match the computed total."
+msgstr "Per favore verificare il prezzo della fattura!\n"
+"Il totale reale non corrisponde al totale calcolato."
+
+#. module: account_invoice_entry_date
+#: code:addons/account_invoice_entry_date/invoice.py:81
+#, python-format
+msgid "Cannot create the invoice !\n"
+"The payment term defined gives a computed amount greater than the total invoiced amount."
+msgstr "Impossibile creare la fattura!\n"
+"I termini di pagamento definiti generano un importo calcolato maggiore del totale importo fatturato."
+
+#. module: account_invoice_entry_date
+#: model:ir.module.module,description:account_invoice_entry_date.module_meta_information
+#: model:ir.module.module,shortdesc:account_invoice_entry_date.module_meta_information
+msgid "Account Invoice entry Date"
+msgstr "Account Invoice entry Date"
+
+#. module: account_invoice_entry_date
+#: help:account.invoice,registration_date:0
+msgid "Keep empty to use the current date"
+msgstr "Lasciare vuoto per utilizzare la data corrente"
+
+#. module: account_invoice_entry_date
+#: code:addons/account_invoice_entry_date/invoice.py:42
+#, python-format
+msgid "Please create some invoice lines."
+msgstr "Creare voci della fattura."
+
+#. module: account_invoice_entry_date
+#: code:addons/account_invoice_entry_date/invoice.py:40
+#, python-format
+msgid "Please define sequence on invoice journal"
+msgstr "Definire una sequenza per il giornale fatture"
+
+#. module: account_invoice_entry_date
+#: code:addons/account_invoice_entry_date/invoice.py:70
+#, python-format
+msgid "Bad total !"
+msgstr "Totale Errato !"
+
+#. module: account_invoice_entry_date
+#: code:addons/account_invoice_entry_date/invoice.py:57
+#, python-format
+msgid "The invoice date cannot be later than the date of registration!"
+msgstr "La data di fatturazione non può essere successiva alla data di registrazione!"
+
+#. module: account_invoice_entry_date
+#: model:ir.model,name:account_invoice_entry_date.model_account_invoice
+msgid "Invoice"
+msgstr "Fattura"
+
+#. module: account_invoice_entry_date
+#: code:addons/account_invoice_entry_date/invoice.py:164
+#, python-format
+msgid "Cannot create invoice move on centralised journal"
+msgstr "Impossibile creare la registrazione della fattura su un giornale centralizzato"
+
+#. module: account_invoice_entry_date
+#: code:addons/account_invoice_entry_date/invoice.py:42
+#, python-format
+msgid "No Invoice Lines !"
+msgstr "Mancano voci nella fattura  !"
+
+#. module: account_invoice_entry_date
+#: field:account.invoice,registration_date:0
+msgid "Registration Date"
+msgstr "Data di registrazione"
+
+#. module: account_invoice_entry_date
+#: code:addons/account_invoice_entry_date/invoice.py:57
+#, python-format
+msgid "Error date !"
+msgstr "Data errata !"
+

=== 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	2013-04-09 19:33:19 +0000
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 ISA srl (<http://www.isa.it>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from osv import fields, osv, orm
+from tools.translate import _
+from datetime import datetime
+
+class account_invoice(osv.osv):
+    
+    _inherit = 'account.invoice'
+    _columns = {
+        '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"),
+    }
+        
+    def action_move_create(self, cr, uid, ids, *args):
+        
+        super(account_invoice,self).action_move_create(cr, uid, ids,*args)
+        
+        for inv in self.browse(cr, uid, ids):
+            
+            date_invoice=inv.date_invoice
+                
+            reg_date = inv.registration_date
+            if not inv.registration_date :
+                if not inv.date_invoice:
+                    reg_date = time.strftime('%Y-%m-%d')
+                else : reg_date = inv.date_invoice
+
+            if date_invoice and reg_date :
+                if (date_invoice > reg_date) :
+                    raise osv.except_osv(_('Error date !'), _('The invoice date cannot be later than the date of registration!'))
+
+            #periodo
+            date_start = inv.registration_date or inv.date_invoice or time.strftime('%Y-%m-%d')
+            date_stop = inv.registration_date or inv.date_invoice or time.strftime('%Y-%m-%d')
+            
+            period_ids = self.pool.get('account.period').search(cr, uid, [('date_start','<=',date_start),('date_stop','>=',date_stop), ('company_id', '=', inv.company_id.id)])
+            if period_ids:
+                period_id = period_ids[0]
+            
+            self.write(cr, uid, [inv.id], {'registration_date':reg_date,'period_id':period_id,})
+            
+            mov_date = reg_date or inv.date_invoice or time.strftime('%Y-%m-%d')           
+
+            self.pool.get('account.move').write(cr, uid, [inv.move_id.id], {'state':'draft'})
+
+            sql="update account_move_line set period_id="+str(period_id)+",date='"+mov_date+"' where move_id = "+str(inv.move_id.id)
+                      
+            cr.execute(sql)
+            
+            self.pool.get('account.move').write(cr, uid, [inv.move_id.id], {'period_id':period_id,'date':mov_date})           
+            
+            self.pool.get('account.move').write(cr, uid, [inv.move_id.id], {'state':'posted'})
+            
+        self._log_event(cr, uid, ids)
+        return True
+                
+account_invoice()

=== 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	2013-04-09 19:33:19 +0000
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="invoice_form_reg_date" model="ir.ui.view">
+            <field name="name">account.invoice.form.reg_date</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_form"/>
+            <field name="arch" type="xml">
+                <field name="date_invoice" position="after">
+                    <field name="registration_date"></field>
+                </field>
+            </field>
+        </record>
+        
+        <record id="invoice_tree_reg_date" model="ir.ui.view">
+            <field name="name">account.invoice.tree.reg_date</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_tree"/>
+            <field name="arch" type="xml">
+                <field name="date_invoice" position="after">
+                    <field name="registration_date"></field>
+                </field>
+            </field>
+        </record>
+        
+        <record id="invoice_supplier_form_reg_date" model="ir.ui.view">
+            <field name="name">account.invoice.supplier.form.reg_date</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_supplier_form"/>
+            <field name="arch" type="xml">
+                <field name="date_invoice" position="after">
+                    <field name="registration_date"></field>
+                </field>
+            </field>
+        </record>
+        
+        
+     </data>
+</openerp>


Follow ups