← Back to team overview

savoirfairelinux-openerp team mailing list archive

[Merge] lp:~savoirfairelinux-openerp/c2c-rd-addons/c2c-rd-addons into lp:c2c-rd-addons

 

David Cormier has proposed merging lp:~savoirfairelinux-openerp/c2c-rd-addons/c2c-rd-addons into lp:c2c-rd-addons.

Requested reviews:
  Camptocamp (camptocamp)
Related bugs:
  Bug #1199994 in Camptocamp R&D Addons: "Cannot override landed cost distribution in landed cost line"
  https://bugs.launchpad.net/c2c-rd-addons/+bug/1199994

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/c2c-rd-addons/c2c-rd-addons/+merge/174065

Fixes #1199994

Adds a default landed cost distribution type when landed cost product is created from the one2many list
-- 
The attached diff has been truncated due to its size.
https://code.launchpad.net/~savoirfairelinux-openerp/c2c-rd-addons/c2c-rd-addons/+merge/174065
Your team Savoir-faire Linux' OpenERP is subscribed to branch lp:~savoirfairelinux-openerp/c2c-rd-addons/c2c-rd-addons.
=== modified file 'account_bank_statement_defaults/__init__.py'
--- account_bank_statement_defaults/__init__.py	2012-12-20 15:30:00 +0000
+++ account_bank_statement_defaults/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,7 +1,11 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
 #
+<<<<<<< TREE
 # Copyright (c) 2010 Camptocamp (http://www.camptocamp.com) 
+=======
+# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
+>>>>>>> MERGE-SOURCE
 # All Right Reserved
 #
 # Author : Nicolas Bessi (Camptocamp)

=== modified file 'account_bank_statement_defaults/__openerp__.py'
--- account_bank_statement_defaults/__openerp__.py	2012-12-20 15:30:00 +0000
+++ account_bank_statement_defaults/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -1,10 +1,18 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
 #
+<<<<<<< TREE
 # Copyright (c) 2010 Camptocamp (http://www.camptocamp.com) 
+=======
+# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
+>>>>>>> MERGE-SOURCE
 # All Right Reserved
 #
+<<<<<<< TREE
 # Author : Ferdinand GAssauer (Camptocamp)
+=======
+# Author : Ferdinand Gassauer (Camptocamp Austria)
+>>>>>>> MERGE-SOURCE
 #
 # WARNING: This program as such is intended to be used by professional
 # programmers who take the whole responsability of assessing all potential
@@ -33,9 +41,14 @@
 , "version"      : "0.9"
 , "depends"      : ["account"]
 , "category"     : "Accounting & Finance"
+<<<<<<< TREE
 , "author"       : "Camptocamp"
+=======
+, "author"       : "Camptocamp Austria"
+>>>>>>> MERGE-SOURCE
 , "website"      : "http://www.camptocamp.com/";
 , "data"         : ["bank_statement_line_view.xml"]
 , "installable"  : True
+, 'application'  : False
 , "auto_install" : False
 }

=== modified file 'account_bank_statement_defaults/bank_statement_line.py'
--- account_bank_statement_defaults/bank_statement_line.py	2012-12-20 15:30:00 +0000
+++ account_bank_statement_defaults/bank_statement_line.py	2013-07-10 21:51:25 +0000
@@ -26,11 +26,11 @@
     _inherit = "account.bank.statement.line"
 
     def _get_statement_date(self, cursor, user, ids,  context=None):
-        res = {}        
+        res = {}
         for line in self.browse(cursor, user, ids, context=context):
             if line and line.statement_id:
                 res[line.id] = line.statement_id.date or ''
-        return res    
+        return res
 
     _defaults = {
         #'date': lambda self, cr, uid, context: context.get('date', False),
@@ -38,4 +38,4 @@
     }
 
 
-account_bank_statement_line()
\ No newline at end of file
+account_bank_statement_line()

=== modified file 'account_cash_discount_61/__init__.py'
--- account_cash_discount_61/__init__.py	2012-12-20 15:30:00 +0000
+++ account_cash_discount_61/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #    Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
@@ -16,12 +16,12 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 
 
-import payment_term 
+import payment_term
 import account
 
 

=== modified file 'account_cash_discount_61/__openerp__.py'
--- account_cash_discount_61/__openerp__.py	2012-12-20 15:30:00 +0000
+++ account_cash_discount_61/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -31,7 +31,7 @@
 
 Manual:
 * Define cash discount in Payment Terms
-** one line percent with discount - you should enter 2 for 2% 
+** one line percent with discount - you should enter 2 for 2%
 ** one line balance
 this will create  account moves as usual
 
@@ -43,7 +43,7 @@
 
 ALWAYS choose "Reconcile with Write-Off"
 
-The reconciliation will 
+The reconciliation will
 * gnerate aliquot(!) move lines to correct tax base and tax amount (required)
 ** this may generate unexpected discount/write off amounts if one partner has invoices with and without cash discount
 ** the situation many be become very complex if many payments, invocies with and without discounts are reconciled
@@ -54,7 +54,7 @@
 * pay invoice: automatically select all move_lines of an invoice if invoice payment term has is_discount flag set
 * invoice lines: allow to specify amount for discount if not total line amount is subject to cash discount
 * create analytic lines for discount - using the anlalytic accounts of the invoice
-* mapping for accounts (fiscal position) 
+* mapping for accounts (fiscal position)
 * automatic reconciliation
 * multi currency
 * reconcile invoice while entering bank statement line (IMHO does [again] not work as expected)

=== modified file 'account_cash_discount_61/account.py'
--- account_cash_discount_61/account.py	2012-12-20 15:30:00 +0000
+++ account_cash_discount_61/account.py	2013-07-10 21:51:25 +0000
@@ -30,7 +30,7 @@
 class account_voucher(osv.osv):
     _inherit = 'account.voucher'
     _logger = logging.getLogger(__name__)
- 
+
 
     def writeoff_move_line_get(self, cr, uid, voucher_id, line_total, move_id, name, company_currency, current_currency, context=None):
         res = super(account_voucher,self).writeoff_move_line_get(cr, uid, voucher_id, line_total, move_id, name, company_currency, current_currency, context=None)
@@ -48,8 +48,8 @@
         for voucher in self.browse(cr, uid, ids):
             lines = move_line_obj.search(cr, uid, [('move_id','=', voucher.move_id.id)])
             move_line_obj.reconcile_cash_discount(cr, uid, ids, voucher.move_id.id, lines, None, context)
-        return res        
-    
+        return res
+
 account_voucher()
 
 
@@ -58,7 +58,7 @@
     _logger = logging.getLogger(__name__)
 
     _columns = {
-         'is_write_off' : fields.boolean('Is Write Off move line'), 
+         'is_write_off' : fields.boolean('Is Write Off move line'),
     }
 
     def _update_check(self, cr, uid, ids, context=None):
@@ -70,7 +70,7 @@
 
     def reconcile_cash_discount(self, cr, uid, ids, move_ids, lines, write_off_ids=None, context=None):
         if not context:
-           context = {}
+            context = {}
         self._logger.debug('reconcile - action_move_line_create  voucher ids, context %s,%s' % (ids, context))
         move_obj = self.pool.get('account.move')
         move_line_obj = self.pool.get('account.move.line')
@@ -86,23 +86,24 @@
         write_off_debit = 0.0
         write_off_credit = 0.0
         partner_id = ''
+        write_off_id = ''
         # collect necessary data
         for line in move_line_obj.browse(cr, uid, lines):
             self._logger.debug('reconcile voucher reconcile_id, acc_id, partner_id %s,%s %s %s' % (line.reconcile_id.id, line.account_id.id, line.partner_id.id, line.name))
-                
+
             # search move_ids which are reconciled
-              
+
             if line.reconcile_id and line.reconcile_id.id not in reconcile_ids:
                 reconcile_ids.append(line.reconcile_id.id)
                 if not partner_id and line.partner_id:
                     partner_id = line.partner_id.id
-                if not reconcile_base_id: 
+                if not reconcile_base_id:
                     reconcile_base_id = line.reconcile_id.id
-                    
+
             if line.is_write_off:
                 write_off_debit += line.debit
                 write_off_credit += line.credit
-                write_off_id = line.id        
+                write_off_id = line.id
         if not reconcile_ids:
             return True
         self._logger.debug('reconcile - partner_id, line_ids, reconcile_ids: %s %s %s' % (partner_id,lines, reconcile_ids))
@@ -125,7 +126,7 @@
         invoice_ids = invoice_obj.search(cr, uid, [('move_id','in', reconciled_move_ids)])
         if not isinstance(invoice_ids, list):
             invoice_ids = [invoice_ids]
-        invoice_discount_ids = []    
+        invoice_discount_ids = []
         invoice_total = 0.0
         invoice_discount_total = 0.0
         invoice_discount_net = 0.0
@@ -148,25 +149,25 @@
             #for tax in invoice_tax_obj.browse(cr, uid, invoice_tax_ids):
             #    tax_base_total += tax.base_amount
             #    tax_total += tax.tax_amount
-             
+            factor = 0
             if write_off_debit > 0:
                 factor = write_off_debit / invoice_total
-            else:
+            elif write_off_credit > 0:
                 factor = write_off_credit / invoice_total
             self._logger.debug('reconcile - compare: %s invoice_discount_net= %s, factor : %s' % (invoice_discount_net, tax_base_total, factor))
             #if not float_is_zero(invoice_discount_net - tax_base_total, prec):
             factor = factor * (tax_base_total / invoice_discount_net)
             self._logger.debug('reconcile - recalculate factor %s' % factor)
             self._logger.debug('reconcile - invoice_discount_ids: %s invoice_discount_total= %s, factor: %s' % (invoice_discount_ids, invoice_discount_total, factor))
-            
+
             invoice_discount_ids2 = ','.join([str(id) for id in invoice_discount_ids])
-            # group 
+            # group
             cr.execute("""
                       select tax_code_id, payment_term,
                        split_part(pi.value_reference,',',2)::int as discount_income_account_id,
                        split_part(pe.value_reference,',',2)::int as discount_expense_account_id,
                        t.account_id,
-                       t.tax_code_id, t.base_code_id, 
+                       t.tax_code_id, t.base_code_id,
                        sum(base_amount) as base_amount, sum(tax_amount) as tax_amount,
                        sum(tax_amount) * %s as tax_discount_amount,
                        sum(base_amount) * %s as base_discount_amount
@@ -192,73 +193,74 @@
             self._logger.debug('reconcile - tax_moves: %s' % tax_moves)
             # get interesting data from write off record, which later will be deleted
             #tax_cum_amount=0.0
-            for r_line in move_line_obj.browse(cr, uid, [write_off_id]):
-                ml = {
-                   'move_id' : r_line.move_id.id,
-                   'journal_id' : r_line.journal_id.id,
-                   'period_id' : r_line.period_id.id,
-                   'date' : r_line.date ,
-                   'name' : r_line.name,
-                   'debit' : 0.0,
-                   'credit' : 0.0,
-                   'company_id' : r_line.company_id.id,
-                   'name' : _('Discount'),
-                }
-
-            for tax_move in tax_moves:
-                # FIXME code can be simplified / condensed
-                #base
-                mlt = dict(ml)
-                if write_off_debit > 0.0:
-                    mlt.update({
-                       'debit' : tax_move['base_discount_amount'],
-                       'credit':0.0,
-                       'account_id' : tax_move['discount_expense_account_id'],
-                       'tax_code_id' : tax_move['base_code_id'],
-                       'tax_amount' : tax_move['base_discount_amount'],
-                    })
-                    write_off_debit -= tax_move['base_discount_amount']
-                else:
-                    mlt.update({
-                       'debit' : 0.0,
-                       'credit' : tax_move['base_discount_amount'],
-                       'account_id' : tax_move['discount_income_account_id'],
-                       'tax_code_id' : tax_move['base_code_id'],
-                       'tax_amount' : tax_move['base_discount_amount'],
-                    })
-                    write_off_credit -= tax_move['base_discount_amount']
-                self._logger.debug('reconcile - base credit: %s' % mlt)
-                move_line_obj.create(cr, uid, mlt)
-                # tax
-                mlt = dict(ml)
-                if write_off_debit > 0.0:
-                    mlt.update({
-                       'debit' : tax_move['tax_discount_amount'],
-                       'credit':0.0,
-                       'account_id' : tax_move['account_id'],
-                       'analytic_account_id' : False,
-                       'tax_code_id' : tax_move['tax_code_id'],
-                       'tax_amount' : tax_move['tax_discount_amount'],
-                    })
-                    write_off_debit -= tax_move['tax_discount_amount']
-                else:
-                    mlt.update({
-                       'debit' : 0.0,
-                       'credit' : tax_move['tax_discount_amount'],
-                       'account_id' : tax_move['account_id'],
-                       'analytic_account_id' : False,
-                       'tax_code_id' : tax_move['tax_code_id'],
-                       'tax_amount' : tax_move['tax_discount_amount'],
-                    })
-                    write_off_credit -= tax_move['tax_discount_amount']
-                move_line_obj.create(cr, uid, mlt)
-
-            # create move lines for remaining not discountable amount 
+            if write_off_id:
+                for r_line in move_line_obj.browse(cr, uid, [write_off_id]):
+                    ml = {
+                       'move_id' : r_line.move_id.id,
+                       'journal_id' : r_line.journal_id.id,
+                       'period_id' : r_line.period_id.id,
+                       'date' : r_line.date ,
+                       'name' : r_line.name,
+                       'debit' : 0.0,
+                       'credit' : 0.0,
+                       'company_id' : r_line.company_id.id,
+                       'name' : _('Discount'),
+                    }
+
+                for tax_move in tax_moves:
+                    # FIXME code can be simplified / condensed
+                    #base
+                    mlt = dict(ml)
+                    if write_off_debit > 0.0:
+                        mlt.update({
+                           'debit' : tax_move['base_discount_amount'],
+                           'credit':0.0,
+                           'account_id' : tax_move['discount_expense_account_id'],
+                           'tax_code_id' : tax_move['base_code_id'],
+                           'tax_amount' : tax_move['base_discount_amount'],
+                        })
+                        write_off_debit -= tax_move['base_discount_amount']
+                    elif write_off_credit > 0.0:
+                        mlt.update({
+                           'debit' : 0.0,
+                           'credit' : tax_move['base_discount_amount'],
+                           'account_id' : tax_move['discount_income_account_id'],
+                           'tax_code_id' : tax_move['base_code_id'],
+                           'tax_amount' : tax_move['base_discount_amount'],
+                        })
+                        write_off_credit -= tax_move['base_discount_amount']
+                    self._logger.debug('reconcile - base credit: %s' % mlt)
+                    move_line_obj.create(cr, uid, mlt)
+                    # tax
+                    mlt = dict(ml)
+                    if write_off_debit > 0.0:
+                        mlt.update({
+                           'debit' : tax_move['tax_discount_amount'],
+                           'credit':0.0,
+                           'account_id' : tax_move['account_id'],
+                           'analytic_account_id' : False,
+                           'tax_code_id' : tax_move['tax_code_id'],
+                           'tax_amount' : tax_move['tax_discount_amount'],
+                        })
+                        write_off_debit -= tax_move['tax_discount_amount']
+                    else:
+                        mlt.update({
+                           'debit' : 0.0,
+                           'credit' : tax_move['tax_discount_amount'],
+                           'account_id' : tax_move['account_id'],
+                           'analytic_account_id' : False,
+                           'tax_code_id' : tax_move['tax_code_id'],
+                           'tax_amount' : tax_move['tax_discount_amount'],
+                        })
+                        write_off_credit -= tax_move['tax_discount_amount']
+                    move_line_obj.create(cr, uid, mlt)
+
+            # create move lines for remaining not discountable amount
             self._logger.debug('reconcile - writeoff deb/cred remaining: %s/%s ' % (write_off_debit,write_off_credit))
             if not float_is_zero(write_off_debit, prec):
                 self._logger.debug('reconcile - write_off_debit: %s' % write_off_debit)
                 if not context.get('writeoff_acc_id',False):
-                     raise osv.except_osv (_('Error !'), _('No write off account defined.'))
+                    raise osv.except_osv (_('Error !'), _('No write off account defined.'))
                 mlt = dict(ml)
                 mlt.update({
                        'debit' : write_off_debit,
@@ -268,10 +270,10 @@
                        'tax_amount' : False,
                     })
                 move_line_obj.create(cr, uid, mlt)
-            if not float_is_zero(write_off_credit, prec): 
+            if not float_is_zero(write_off_credit, prec):
                 self._logger.debug('reconcile - write_off_credit: %s' % write_off_credit)
                 if not context.get('writeoff_acc_id',False):
-                     raise osv.except_osv (_('Error !'), _('No write off account defined.'))
+                    raise osv.except_osv (_('Error !'), _('No write off account defined.'))
                 mlt = dict(ml)
                 mlt.update({
                        'credit' : write_off_credit,
@@ -281,22 +283,23 @@
                        'tax_amount' : False,
                     })
                 move_line_obj.create(cr, uid, mlt)
-            
+
             # delete originial move
-            move_line_obj.unlink(cr, uid,  [write_off_id], context)
+            if write_off_id:
+                move_line_obj.unlink(cr, uid,  [write_off_id], context)
             # set only ONE reconcile_id (instead of 2 or more)
             reconcile_lines_to_update = move_line_obj.search(cr, uid, [('reconcile_id','in',reconcile_ids),('reconcile_id','!=',reconcile_base_id)])
-            move_line_obj.write(cr, uid, reconcile_lines_to_update,{'reconcile_id':reconcile_base_id}, context)    
+            move_line_obj.write(cr, uid, reconcile_lines_to_update,{'reconcile_id':reconcile_base_id}, context)
             # delete unused recocile lines
-            reconcile_ids_to_delete = [] 
+            reconcile_ids_to_delete = []
             for r_id in reconcile_ids:
                 if r_id != reconcile_base_id:
                     reconcile_ids_to_delete.append(r_id)
             move_reconcile_obj.unlink(cr, uid, reconcile_ids_to_delete)
-                
-        return True 
-        
-    
+
+        return True
+
+
     def reconcile(self, cr, uid, ids, type='auto', writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False, context=None):
         if not context :
             context = {}
@@ -310,7 +313,7 @@
 
         res = super(account_move_line, self).reconcile(cr, uid, ids, type, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context)
         if not lines_selected:
-            return res 
+            return res
         lines_ids_returned = list(context.get('active_ids'))
         self._logger.debug('FGF reconcile  lines_selected %s, lines_ids_returned %s' % (lines_selected, lines_ids_returned))
 
@@ -325,7 +328,7 @@
             move_ids.append(move_line.move_id.id)
         lines = move_line_obj.search(cr, uid, [('move_id','in', move_ids)])
         lines_up = move_line_obj.search(cr, uid, [('move_id','in', move_ids),('id','not in',write_off_line_ids)])
-        
+
         context['is_discount'] = True # to avoid _check_update which prohibits altering reconciled lines - of this transaction
         move_line_obj.write(cr, uid, lines_up, {'is_write_off' : True});
         move_line_obj.reconcile_cash_discount(cr, uid, ids, move_ids, lines, write_off_line_ids, context)
@@ -335,4 +338,3 @@
 
 
 account_move_line()
-    

=== modified file 'account_cash_discount_61/payment_term.py'
--- account_cash_discount_61/payment_term.py	2012-12-20 15:30:00 +0000
+++ account_cash_discount_61/payment_term.py	2013-07-10 21:51:25 +0000
@@ -28,8 +28,8 @@
          'is_discount': fields.boolean('Is Cash Discount', help="Check this box if this payment term is a cash discount. If cash discount is used the remaining amount of the invoice will not be paid")
     }
 account_payment_term()
-    
-    
+
+
 class account_payment_term_line(osv.osv):
     _inherit = "account.payment.term.line"
 
@@ -40,12 +40,12 @@
               help="This account will be used to post the cash discount income"),
         'discount_expense_account_id': fields.property('account.account', type='many2one', relation='account.account', string='Discount Expense Account',  view_load=True,
               help="This account will be used to post the cash discount expense"),
-    }    
+    }
 
     def onchange_discount(self, cr, uid, ids, discount):
         if not discount: return {}
         result = {}
         result = {'value': { 'value_amount': round(1-(discount/100.0),2), }}
         return result
-        
+
 account_payment_term_line()

=== modified file 'account_cash_discount_61/payment_term_view.xml'
--- account_cash_discount_61/payment_term_view.xml	2012-08-13 21:14:02 +0000
+++ account_cash_discount_61/payment_term_view.xml	2013-07-10 21:51:25 +0000
@@ -22,7 +22,7 @@
             <field name="inherit_id" ref="account.view_payment_term_form"/>
             <field name="type">form</field>
             <field name="arch" type="xml">
-               <xpath expr="/form/field[@name='name']" position="after">
+               <xpath expr="/form/group/field[@name='name']" position="after">
                        <field name="is_discount"/>
                 </xpath>
             </field>

=== modified file 'account_cash_register_webkit/__init__.py'
--- account_cash_register_webkit/__init__.py	2012-12-20 15:30:00 +0000
+++ account_cash_register_webkit/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,7 +1,11 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
 #
+<<<<<<< TREE
 # Copyright (c) 2010 Camptocamp (http://www.camptocamp.com) 
+=======
+# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
+>>>>>>> MERGE-SOURCE
 # All Right Reserved
 #
 # Author : Ferdinand Gassauer (Camptocamp)
@@ -29,5 +33,5 @@
 #
 ##############################################################################
 import account_bankstatement
-import wizard
+#import wizard
 import report

=== modified file 'account_cash_register_webkit/__openerp__.py'
--- account_cash_register_webkit/__openerp__.py	2012-12-20 15:30:00 +0000
+++ account_cash_register_webkit/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -1,10 +1,18 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
 #
+<<<<<<< TREE
 # Copyright (c) 2010 Camptocamp (http://www.camptocamp.com) 
+=======
+# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
+>>>>>>> MERGE-SOURCE
 # All Right Reserved
 #
+<<<<<<< TREE
 # Author : Ferdinand GAssauer (Camptocamp)
+=======
+# Author : Ferdinand Gassauer (Camptocamp Austria)
+>>>>>>> MERGE-SOURCE
 #
 # WARNING: This program as such is intended to be used by professional
 # programmers who take the whole responsability of assessing all potential
@@ -33,9 +41,14 @@
 , "version"      : "1.0"
 , "depends"      : ["account", "report_webkit", "one2many_sorted"]
 , "category"     : "Accounting & Finance"
+<<<<<<< TREE
 , "author"       : "Camptocamp"
+=======
+, "author"       : "Camptocamp Austria"
+>>>>>>> MERGE-SOURCE
 , "website"      : "http://www.camptocamp.com/";
 , "data"         : ["account_cash_register_webkit_view.xml"]
 , "installable"  : True
+, 'application'  : False
 , "auto_install" : False
 }

=== modified file 'account_cash_register_webkit/account_bankstatement.py'
--- account_cash_register_webkit/account_bankstatement.py	2012-12-20 15:30:00 +0000
+++ account_cash_register_webkit/account_bankstatement.py	2013-07-10 21:51:25 +0000
@@ -34,6 +34,6 @@
         , states={'draft': [('readonly', False)]}
         , order  = 'name, id'
         )
-        
+
     }
 account_bank_statement()

=== modified file 'account_cash_register_webkit/report/__init__.py'
--- account_cash_register_webkit/report/__init__.py	2012-12-20 15:30:00 +0000
+++ account_cash_register_webkit/report/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,10 +1,18 @@
  #-*- coding: utf-8 -*-
 ##############################################################################
 #
+<<<<<<< TREE
 # Copyright (c) 2010 Camptocamp (http://www.camptocamp.com) 
+=======
+# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
+>>>>>>> MERGE-SOURCE
 # All Right Reserved
 #
+<<<<<<< TREE
 # Author : Ferdinand GAssauer (Camptocamp)
+=======
+# Author : Ferdinand Gassauer (Camptocamp Austria)
+>>>>>>> MERGE-SOURCE
 #
 # WARNING: This program as such is intended to be used by professional
 # programmers who take the whole responsability of assessing all potential
@@ -29,4 +37,4 @@
 #
 ##############################################################################
 
-import report_webkit_html
\ No newline at end of file
+import report_webkit_html

=== modified file 'account_cash_register_webkit/report/account_cash_register_webkit.mako'
--- account_cash_register_webkit/report/account_cash_register_webkit.mako	2012-04-10 21:05:26 +0000
+++ account_cash_register_webkit/report/account_cash_register_webkit.mako	2013-07-10 21:51:25 +0000
@@ -14,7 +14,8 @@
     cellspacing="0";
     font-size:12px;
     }
-    td { margin: 0px; padding: 3px; border: 1px solid lightgrey;  vertical-align: top; }
+    tr { page-break-inside : avoid; vertical-align: top;}
+    td { margin: 0px; padding: 3px; border: 1px solid lightgrey; vertical-align: top; }
     pre {font-family:helvetica; font-size:15;}
     </style>
     
@@ -37,17 +38,28 @@
         
         <th style="text-align:left;white-space:nowrap">${_("Partner Account")}</th>
         <th style="text-align:left;white-space:nowrap">${_("Tax")}</th>
-        <th style="text-align:right;white-space:normal">${voucher.balance_start}</th>
+        <th style="text-align:right;white-space:normal">${formatLang(voucher.balance_start)}</th>
         </tr>
         </thead>
+        <%
+        running_tot = 0
+         %>
         %for line in voucher.line_ids_sorted:
             <tbody>
             <tr>
             <td style="text-align:left;white-space:nowrap">${line.name or ''}</td>
             <td style="white-space:nowrap">${line.date}</td>
-            <td>${line.partner_id.name or line.account_id.name}</td>
-            <td>${line.tax_id.name or ''}</td>
+            <td>${line.partner_id.name or (line.account_id.code +' '+ line.account_id.name )}</td>
+
+            %if 'tax_id' in line._columns: 
+               <td>${line.tax_id.name or ''}</td>
+            %else:
+               <td/>
+            %endif
             <td style="text-align:right;white-space:nowrap">${line.amount}</td>
+            <%
+             running_tot += line.amount
+             %>
             </tr>
             </tbody>
             %endfor
@@ -55,8 +67,13 @@
             <tr>
             <th colspan="3"> </th>
             <th style="text-align:right">${_("Ending Balance")}</th>
-            <th style="text-align:right;white-space:nowrap">${voucher.balance_end_real}</th>
+            <th style="text-align:right;white-space:nowrap">${formatLang(voucher.balance_end_real)}</th>
             </tr>
+            %if running_tot != balance_end_real:
+            <th colspan="3"> </th>
+            <th style="text-align:right">${_("Computed Balance")}</th>
+            <th style="text-align:right;white-space:nowrap">${formatLang(running_tot)}</th>
+            %endif
             </tfoot>
             </table>
             
@@ -66,4 +83,4 @@
             </body>
             
             </html>
-            
+

=== modified file 'account_cash_register_webkit/report/report_webkit_html.py'
--- account_cash_register_webkit/report/report_webkit_html.py	2012-12-20 15:30:00 +0000
+++ account_cash_register_webkit/report/report_webkit_html.py	2013-07-10 21:51:25 +0000
@@ -32,7 +32,7 @@
             'cr':cr,
             'uid': uid,
         })
-        
+
 report_sxw.report_sxw('report.account.cash.register.webkit',
                        'account.bank.statement',
                        'addons/account_cash_register_webkit/report/account_cash_register_webkit.mako',

=== modified file 'account_financial_report/__openerp__.py'
--- account_financial_report/__openerp__.py	2012-12-20 15:30:00 +0000
+++ account_financial_report/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -42,11 +42,12 @@
 201101 ported to v6 by Camptocamp
 """
 , "init_xml" : []
-, "demo_xml" : []
+, "demo"     : []
 , "update_xml" : 
   [ "account_report_report.xml"
-  , "account_report_wizard.xml"
+#  , "account_report_wizard.xml"
   ]
 , "auto_install": False
 , "installable": True
+, 'application'  : False
 }

=== modified file 'account_financial_report/wizard/__init__.py'
--- account_financial_report/wizard/__init__.py	2011-09-18 18:37:34 +0000
+++ account_financial_report/wizard/__init__.py	2013-07-10 21:51:25 +0000
@@ -21,9 +21,9 @@
 #
 ##############################################################################
 
-import wizard_account_balance_report
-import wizard_account_chart
-import wizard_general_ledger_report
-import wizard_invoice_list_report
-import wizard_print_journal_entries
+#import wizard_account_balance_report
+#import wizard_account_chart
+#import wizard_general_ledger_report
+#import wizard_invoice_list_report
+#import wizard_print_journal_entries
 

=== modified file 'account_financial_report/wizard/wizard_account_balance_report.py'
--- account_financial_report/wizard/wizard_account_balance_report.py	2012-08-13 21:14:02 +0000
+++ account_financial_report/wizard/wizard_account_balance_report.py	2013-07-10 21:51:25 +0000
@@ -22,7 +22,7 @@
 #
 ##############################################################################
 
-import wizard
+#import wizard
 import pooler
 import time
 from tools.translate import _

=== modified file 'account_fiscalyear_info/__init__.py'
--- account_fiscalyear_info/__init__.py	2012-12-20 15:30:00 +0000
+++ account_fiscalyear_info/__init__.py	2013-07-10 21:51:25 +0000
@@ -29,5 +29,5 @@
 #
 ##############################################################################
 import fiscalyear
-import wizard
+#import wizard
 import report

=== modified file 'account_fiscalyear_info/__openerp__.py'
--- account_fiscalyear_info/__openerp__.py	2012-12-20 15:30:00 +0000
+++ account_fiscalyear_info/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -4,7 +4,11 @@
 # Copyright (c) 2012 Camptocamp (http://www.camptocamp.com)
 # All Right Reserved
 #
+<<<<<<< TREE
 # Author : Ferdinand GAssauer (Camptocamp)
+=======
+# Author : Ferdinand Gassauer (Camptocamp Austria)
+>>>>>>> MERGE-SOURCE
 #
 # WARNING: This program as such is intended to be used by professional
 # programmers who take the whole responsability of assessing all potential
@@ -47,5 +51,6 @@
 , "website"      : "http://www.camptocamp.com/";
 , "data"         : ["fiscalyear_view.xml"]
 , "installable"  : True
+, 'application'  : False
 , "auto_install" : False
 }

=== modified file 'account_invoice_2_move/account_invoice_view.xml'
--- account_invoice_2_move/account_invoice_view.xml	2012-08-03 04:28:43 +0000
+++ account_invoice_2_move/account_invoice_view.xml	2013-07-10 21:51:25 +0000
@@ -8,7 +8,7 @@
             <field name="type">search</field>
             <field name="inherit_id" ref="account.view_account_move_line_filter"/>
             <field name="arch" type="xml">
-              <xpath expr="/search/group/filter[@string='Unreconciled']" position="after">
+              <xpath expr="/search/filter[@string='Unreconciled']" position="after">
                   <separator orientation="vertical"/>
                 <filter name="filter_receivable" icon="terp-sale" string="Receivable Accounts" domain="[('account_id.type','=','receivable')]"/>
                 <filter name="filter_payable" icon="terp-purchase" string="Payable Accounts" domain="[('account_id.type','=','payable')]"/>

=== added directory 'account_invoice_ebInterface'
=== added file 'account_invoice_ebInterface/__init__.py'
--- account_invoice_ebInterface/__init__.py	1970-01-01 00:00:00 +0000
+++ account_invoice_ebInterface/__init__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+##############################################
+#
+# Swing Entwicklung betrieblicher Informationssysteme GmbH
+# (<http://www.swing-system.com>)
+# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
+# all rights reserved
+#    31-DEC-2012 (GK) created
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs.
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly advised to contract a Free Software
+# Service Company.
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/> or
+# write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+###############################################
+import account_invoice
+import installer
+

=== added file 'account_invoice_ebInterface/__openerp__.py'
--- account_invoice_ebInterface/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_invoice_ebInterface/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+##############################################
+#
+# Swing Entwicklung betrieblicher Informationssysteme GmbH
+# (<http://www.swing-system.com>)
+# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
+# all rights reserved
+#    31-DEC-2012 (GK) created
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs.
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly advised to contract a Free Software
+# Service Company.
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/> or
+# write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA  02111-1.17, USA.
+#
+###############################################
+{ "name"        : "Austrian electronic invoicing standard"
+, "version"     : "1.0"
+, "author"      : "Swing Entwicklung betrieblicher Informationssysteme GmbH"
+, "website"     : "http://www.swing-system.com";
+, "description" : 
+"""
+ebInterface is a standardization of the Austrian governement.
+
+This module generates a XML-file per invoice and attaches it to the invoice.
+
+"""
+, "category"    : "Accounting & Finance"
+, "depends"     : 
+    [ "account"
+    , "xml_template"
+    ]
+, "init_xml"    : ["ebInterfaceV4.0.xml"]
+, "demo_xml"    : []
+, "update_xml"  : ["installer_view.xml"]
+, "test"        : []
+, "auto_install": False
+, "installable" : True
+, 'application'  : False
+}

=== added file 'account_invoice_ebInterface/account_invoice.py'
--- account_invoice_ebInterface/account_invoice.py	1970-01-01 00:00:00 +0000
+++ account_invoice_ebInterface/account_invoice.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+##############################################
+#
+# Swing Entwicklung betrieblicher Informationssysteme GmbH
+# (<http://www.swing-system.com>)
+# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
+# all rights reserved
+#    31-DEC-2012 (GK) created
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs.
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly advised to contract a Free Software
+# Service Company.
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/> or
+# write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+###############################################
+from osv import fields, osv
+from tools.translate import _
+
+class account_invoice(osv.osv) :
+    _inherit = "account.invoice"
+
+    def invoice_validate(self, cr, uid, ids, context=None):
+        self.generate_ebInterface(cr , uid, ids, context=context)
+        return super(account_invoice,self).invoice_validate(cr, uid, ids, context=context)
+#   def invoice_validate
+
+    def generate_ebInterface(self, cr , uid, ids, context=None):
+        for invoice in self.browse(cr, uid, ids) :
+            template_obj  = self.pool.get("xml.template")
+            template_ids  = template_obj.search(cr, uid, [("name", "=", "ebInterface V4.0")])
+            if not template_ids :
+                raise osv.except_osv \
+                    ( _("Customization Error !")
+                    , _("No Template '%s' defined") % template_name
+                    )
+            template_id = template_ids[0]
+            xml = template_obj.generate_xml \
+                (cr, uid
+                , template_id
+                , invoice = invoice
+                )
+            template_obj.attach_xml \
+                ( cr, uid
+                , template_id
+                , attach_to   = invoice
+                , xml         = xml
+                , name        = invoice.number + "_ebInterface"
+                , fname       = invoice.number + "_ebInterface" + ".xml"
+                , description = "ebInterface for invoice"
+                , context     = None
+                )
+    # end def generate_ebInterface
+# end class account_invoice
+account_invoice()

=== added file 'account_invoice_ebInterface/ebInterfaceV4.0.xml'
--- account_invoice_ebInterface/ebInterfaceV4.0.xml	1970-01-01 00:00:00 +0000
+++ account_invoice_ebInterface/ebInterfaceV4.0.xml	2013-07-10 21:51:25 +0000
@@ -0,0 +1,78 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<openerp>
+  <data noupdate="1">
+    <record model="xml.template" id="xml_template_ebInterfaceV4_0" forcecreate="True">
+      <field name="name">ebInterface V4.0</field>
+      <field name="schema">http://www.ebinterface.at/schema/4p0/</field>
+      <field name="content" type="xml">
+        <!-- Language Codes according to ISO 639-2 -->
+        <Invoice 
+            xmlns="http://www.ebinterface.at/schema/4p0/"; 
+            xmlns:n1="http://www.ebinterface.at/schema/4p0/"; 
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+            n1:ManualProcessing="true" 
+            n1:GeneratingSystem="OpenERP" 
+            xsi:schemaLocation="http://www.ebinterface.at/schema/4p0/ http://www.ebinterface.at/schema/4p0/";
+            attr-name1="n1:DocumentTitle" attr-eval1="invoice.name" 
+            attr-name2="n1:InvoiceCurrency" attr-eval2="invoice.company_id.currency_id.name"
+            attr-name3="n1:DocumentType" attr-eval3="'SubsequentDebit'"
+            attr-name4="n1:Language" attr-eval4="'ger'">
+          <InvoiceNumber text-eval="invoice.number"/>
+          <InvoiceDate text-eval="invoice.date_invoice"/>
+          <Biller>
+            <VATIdentificationNumber text-eval="invoice.company_id.partner_id.vat"/>
+            <Address>
+              <Name text-eval="invoice.company_id.name"/>
+              <Street text-eval="invoice.company_id.street or ''"/>
+              <Town text-eval="invoice.company_id.city or''"/>
+              <ZIP text-eval="invoice.company_id.zip or ''"/>
+              <Country 
+                  attr-name="n1:CountryCode" 
+                  attr-eval="invoice.company_id.country_id.code"/>
+              <Phone text-eval="invoice.company_id.phone or ''"/>
+              <Email text-eval="invoice.company_id.email or ''"/>
+              <Contact text-eval="invoice.company_id.partner_id.name"/>
+            </Address>
+          </Biller>
+          <InvoiceRecipient>
+            <VATIdentificationNumber text-eval="invoice.partner_id.vat if invoice.partner_id.vat else '00000000'"/>
+            <BillersInvoiceRecipientID text-eval="invoice.partner_id.ref"/>
+            <Address>
+              <Name text-eval="invoice.partner_id.name"/>
+              <Street text-eval="invoice.address_invoice_id.street or ''"/>
+              <Town text-eval="invoice.address_invoice_id.city or''"/>
+              <ZIP text-eval="invoice.address_invoice_id.zip or ''"/>
+              <Country 
+                  attr-name="n1:CountryCode" 
+                  attr-eval="invoice.address_invoice_id.country_id.code"/>
+            </Address>
+          </InvoiceRecipient>
+          <Details>
+            <ItemList loop-eval="sorted(invoice.invoice_line, key=lambda x: x.name)" var="l">
+              <ListLineItem>
+                <Description text-eval="l.name"/>
+                <Quantity attr-name1="Unit" attr-eval1="l.product_id.uom_id.name" text-eval="l.quantity"/>
+                <UnitPrice text-eval="l.price_unit"/>
+                <TaxRate>0</TaxRate>
+                <LineItemAmount text-eval="l.price_subtotal"/>
+              </ListLineItem>
+            </ItemList>
+          </Details>
+          <Tax>
+            <VAT loop-eval="[1] if not invoice.tax_line else []" var="tax">
+              <TaxExemption text-eval="'Par.19 UStG'"/>
+            </VAT>
+            <VAT loop-eval="invoice.tax_line if invoice.tax_line else []" var="tax">
+              <Item>
+                <TaxedAmount text-eval="invoice.amount_untaxed"/>
+                <TaxRate attr-name1="TaxCode" attr-eval1="tax.tax_code_id.code" text-eval="int(tax.amount * 100)"/>
+                <Amount text-eval="invoice.amount_tax"/>
+              </Item>
+            </VAT>
+          </Tax>
+          <TotalGrossAmount text-eval="invoice.amount_total"/>
+        </Invoice>
      </field>
+    </record>
+  </data>
+</openerp>
+

=== added directory 'account_invoice_ebInterface/i18n'
=== added file 'account_invoice_ebInterface/installer.py'
--- account_invoice_ebInterface/installer.py	1970-01-01 00:00:00 +0000
+++ account_invoice_ebInterface/installer.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+##############################################
+#
+# Swing Entwicklung betrieblicher Informationssysteme GmbH
+# (<http://www.swing-system.com>)
+# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
+# all rights reserved
+#    31-DEC-2012 (GK) created
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs.
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly advised to contract a Free Software
+# Service Company.
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/> or
+# write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA  02111-1.17, USA.
+#
+###############################################
+from osv import fields, osv
+
+class invoice_ebInterface_installer(osv.osv_memory):
+    _name    = 'account.invoice.ebinterface.installer'
+    _inherit = 'res.config.installer'
+
+    def execute(self, cr, uid, ids, context=None):
+        self.execute_simple(cr, uid, ids, context)
+        super(invoice_ebInterface_installer, self).execute(cr, uid, ids, context=context)
+    # end def execute
+
+    def execute_simple(self, cr, uid, ids, context=None) :
+        inv_obj = self.pool.get('account.invoice')
+        inv_ids = inv_obj.search(cr, uid, [("state", "in", ("open", "paid"))])
+        inv_obj.generate_ebInterface(cr , uid, inv_ids, context=context)
+    # end def execute_simple
+# end class invoice_ebInterface_installer
+invoice_ebInterface_installer()
+

=== added file 'account_invoice_ebInterface/installer_view.xml'
--- account_invoice_ebInterface/installer_view.xml	1970-01-01 00:00:00 +0000
+++ account_invoice_ebInterface/installer_view.xml	2013-07-10 21:51:25 +0000
@@ -0,0 +1,34 @@
+<openerp>
+  <data>
+    <record id="account_invoice_ebInterface_installer_form" model="ir.ui.view">
+      <field name="name">account.invoice.ebInterface.installer.form</field>
+      <field name="model">account.invoice.ebinterface.installer</field>
+      <field name="type">form</field>
+      <field name="inherit_id" ref="base.res_config_installer"/>
+      <field name="arch" type="xml">
+        <data>
+          <form position="attributes">
+            <attribute name="string">Add ebInterface to Invoice</attribute>
+          </form>
+          <separator string="title" position="attributes">
+            <attribute name="string">Create an ebInterface to all 'open'/'paid' invoices</attribute>
+          </separator>
+        </data>
+      </field>
+    </record>
+    <record id="action_account_invoice_ebInterface_installer" model="ir.actions.act_window">
+      <field name="name">Add ebInterface to Invoice</field>
+      <field name="type">ir.actions.act_window</field>
+      <field name="res_model">account.invoice.ebinterface.installer</field>
+      <field name="view_id" ref="account_invoice_ebInterface_installer_form"/>
+      <field name="view_type">form</field>
+      <field name="view_mode">form</field>
+      <field name="target">new</field>
+    </record>
+    <record id="account_invoice_ebInterface_installer_todo" model="ir.actions.todo">
+      <field name="action_id" ref="action_account_invoice_ebInterface_installer"/>
+      <field name="type">automatic</field>
+    </record>
+  </data>
+</openerp>
+

=== added directory 'account_invoice_iban_qr_at'
=== added file 'account_invoice_iban_qr_at/__init__.py'
--- account_invoice_iban_qr_at/__init__.py	1970-01-01 00:00:00 +0000
+++ account_invoice_iban_qr_at/__init__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
+# All Right Reserved
+#
+# Author : Nicolas Bessi (Camptocamp)
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+import account_invoice
+#import wizard
+import report

=== added file 'account_invoice_iban_qr_at/__openerp__.py'
--- account_invoice_iban_qr_at/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_invoice_iban_qr_at/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
+# All Right Reserved
+#
+# Author : Ferdinand GAssauer (Camptocamp Austria)
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+{ "name"         : "Invoice IBAN QR CODE (AT) "
+, "description"  : """
+Adds an image datafeld to invoice with IBAN BIC Information according to
+http://www.stuzza.at/11250_DE.6858781c0841bfb08be3ce61a7d21fb40e0f0830
+"""
+, "version"      : "0.9"
+, "depends"      :
+    [ "account"
+    ]
+, "category"     : "Accounting & Finance"
+, "author"       : "Camptocamp Austria"
+, "website"      : "http://www.camptocamp.com/";
+, "data"         : ["account_qrcode_view.xml"]
+, "installable"  : True
+, 'application'  : False
+, "auto_install" : False
+}

=== added file 'account_invoice_iban_qr_at/account_invoice.py'
--- account_invoice_iban_qr_at/account_invoice.py	1970-01-01 00:00:00 +0000
+++ account_invoice_iban_qr_at/account_invoice.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,107 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2011 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2011 Camptocamp Austria (<http://www.camptocamp.com>).
+#
+#    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/>.
+#
+##############################################################################
+from osv import fields, osv, orm
+from tools.translate import _
+import tempfile
+import base64
+from PIL import Image
+import io, StringIO
+
+
+import logging
+
+try:
+    import qrcode
+    qr_mod = True
+except:
+    qr_mod = False
+
+class account_invoice(osv.osv):
+    _inherit = "account.invoice"
+
+    def _iban_qrcode(self, cr, uid, ids, name, args, context=None):
+        _logger = logging.getLogger(__name__)
+
+        res = {}
+        min_size = 150
+        size = min_size, min_size
+        for inv in self.browse(cr, uid, ids, context=context):
+            if inv.type == 'out_invoice' and inv.number and qr_mod == True:
+                service = 'BCD'
+                version = '001'
+                code    = '1'
+                function = 'SCT'
+                bic     = inv.company_id.company_bank_id and inv.company_id.company_bank_id.bank.bic or ''
+                partner = inv.company_id.name
+                iban    = inv.company_id.company_bank_id and inv.company_id.company_bank_id.acc_number.replace(' ','') or ''
+                currency = ''.join([inv.currency_id.name, str(inv.residual)])
+                usage  = ''
+                ref    = ', '.join([inv.number, inv.date_invoice or ''])
+                display = _('This QR-Code will be used to initialize bank payment, you will need to confirm this payment using your E-banking system')
+
+                lf ='\n'
+                qr_string = lf.join([service,version,code,function,bic,partner,iban,currency,usage,ref,display])
+                _logger.debug('FGF QR string %s', qr_string)
+                if len(qr_string) > 331:
+                    raise osv.except_osv (_('Error'), _('QR string "%s" length %s exceeds 331 bytes') % (qr_string, len(qr_string)))
+                #qr = qrencode.encode_scaled(qr_string,min_size,2)
+                #f = tempfile.TemporaryFile(mode="r+")
+                #qrCode = qr[2]
+                #qrCode.save(f,'png')
+                #f.seek(0)
+                #qr_pic = base64.encodestring(f.read())            
+                qr = qrcode.QRCode(
+                    version=1,
+                    error_correction=qrcode.constants.ERROR_CORRECT_M,
+                    box_size=5,
+                    border=4,
+                )
+                qr.add_data(qr_string)
+                qr.make(fit=True)
+
+                qr_pic = qr.make_image()
+                _logger.debug('FGF QR pic %s', qr_pic)
+                f = tempfile.TemporaryFile(mode="r+")
+                qr_pic.save(f,'png')
+                f.seek(0)
+                qr_pic1 = base64.encodestring(f.read())            
+
+
+                #image_stream = io.BytesIO(qr_pic.decode('base64'))
+                #image_stream = qr_pic
+                #img = Image.open()
+                #img.thumbnail((120, 100), Image.ANTIALIAS)
+                #img_stream = StringIO.StringIO()
+                #img.save(img_stream, "JPEG")
+                #res[inv.id] = img_stream.getvalue().encode('base64')
+
+                
+                res[inv.id] = qr_pic1
+            else:
+                res[inv.id] = False
+        return res
+
+
+    _columns = {
+        'iban_qr_code': fields.function(_iban_qrcode, method=True, string='IBAN QR', type='binary'),
+    }
+account_invoice()

=== added file 'account_invoice_iban_qr_at/account_qrcode_view.xml'
--- account_invoice_iban_qr_at/account_qrcode_view.xml	1970-01-01 00:00:00 +0000
+++ account_invoice_iban_qr_at/account_qrcode_view.xml	2013-07-10 21:51:25 +0000
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+  <data>
+
+  </data>
+</openerp>

=== added directory 'account_invoice_iban_qr_at/i18n'
=== added file 'account_invoice_iban_qr_at/i18n/account_invoice_iban_qr_at.pot'
--- account_invoice_iban_qr_at/i18n/account_invoice_iban_qr_at.pot	1970-01-01 00:00:00 +0000
+++ account_invoice_iban_qr_at/i18n/account_invoice_iban_qr_at.pot	2013-07-10 21:51:25 +0000
@@ -0,0 +1,75 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* account_invoice_iban_qr_at
+# <> <>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-10-31 20:50+0000\n"
+"PO-Revision-Date: 2012-10-31 21:58+0100\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_iban_qr_at
+#: constraint:account.invoice:0
+msgid "Error: \"Reference\" is missing"
+msgstr ""
+
+#. module: account_invoice_iban_qr_at
+#: field:account.invoice,iban_qr_code:0
+msgid "IBAN QR"
+msgstr ""
+
+#. module: account_invoice_iban_qr_at
+#: constraint:account.invoice:0
+msgid "Error ! Violating product coding guideline "
+msgstr ""
+
+#. module: account_invoice_iban_qr_at
+#: model:ir.actions.report.xml,name:account_invoice_iban_qr_at.account_invoice_webkit
+msgid "WebKit Invoice"
+msgstr ""
+
+#. module: account_invoice_iban_qr_at
+#: constraint:account.invoice:0
+msgid "You must not define an analytic account."
+msgstr ""
+
+#. module: account_invoice_iban_qr_at
+#: sql_constraint:account.invoice:0
+msgid "Invoice Number must be unique per Company!"
+msgstr ""
+
+#. module: account_invoice_iban_qr_at
+#: constraint:account.invoice:0
+msgid "Error: Invalid \"Customer Data\" [numeric12]"
+msgstr ""
+
+#. module: account_invoice_iban_qr_at
+#: model:ir.model,name:account_invoice_iban_qr_at.model_account_invoice
+msgid "Invoice"
+msgstr ""
+
+#. module: account_invoice_iban_qr_at
+#: code:addons/account_invoice_iban_qr_at/account_invoice.py:59
+#, python-format
+msgid ""
+"This QR-Code will be used to initialize bank payment, you will need to "
+"confirm this payment using your E-banking system"
+msgstr ""
+
+#. module: account_invoice_iban_qr_at
+#: constraint:account.invoice:0
+msgid "You must not alter a fixed analytic account."
+msgstr ""
+
+#. module: account_invoice_iban_qr_at
+#: constraint:account.invoice:0
+msgid "You must assign an analytic account.(invoice)"
+msgstr ""

=== added file 'account_invoice_iban_qr_at/i18n/de.po'
--- account_invoice_iban_qr_at/i18n/de.po	1970-01-01 00:00:00 +0000
+++ account_invoice_iban_qr_at/i18n/de.po	2013-07-10 21:51:25 +0000
@@ -0,0 +1,77 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* account_invoice_iban_qr_at
+# <> <>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-10-31 20:50+0000\n"
+"PO-Revision-Date: 2012-10-31 21:58+0100\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_iban_qr_at
+#: constraint:account.invoice:0
+msgid "Error: \"Reference\" is missing"
+msgstr "Fehler: \"Referenz\" fehlt"
+
+#. module: account_invoice_iban_qr_at
+#: field:account.invoice,iban_qr_code:0
+msgid "IBAN QR"
+msgstr "IBAN QR"
+
+#. module: account_invoice_iban_qr_at
+#: constraint:account.invoice:0
+msgid "Error ! Violating product coding guideline "
+msgstr "Fehler ! Produkt Code"
+
+#. module: account_invoice_iban_qr_at
+#: model:ir.actions.report.xml,name:account_invoice_iban_qr_at.account_invoice_webkit
+msgid "WebKit Invoice"
+msgstr "WebKit Rechnung"
+
+#. module: account_invoice_iban_qr_at
+#: constraint:account.invoice:0
+msgid "You must not define an analytic account."
+msgstr "Es darf kein analytisches Konto definiert werden"
+
+#. module: account_invoice_iban_qr_at
+#: sql_constraint:account.invoice:0
+msgid "Invoice Number must be unique per Company!"
+msgstr "Die Rechnungsnummer muss je Firma eindeutig sein"
+
+#. module: account_invoice_iban_qr_at
+#: constraint:account.invoice:0
+msgid "Error: Invalid \"Customer Data\" [numeric12]"
+msgstr "Fehler: ungültige \"Kundendaten\" [numerisch 12]"
+
+#. module: account_invoice_iban_qr_at
+#: model:ir.model,name:account_invoice_iban_qr_at.model_account_invoice
+msgid "Invoice"
+msgstr "Rechnung"
+
+#. module: account_invoice_iban_qr_at
+#: code:addons/account_invoice_iban_qr_at/account_invoice.py:59
+#, python-format
+msgid ""
+"This QR-Code will be used to initialize bank payment, you will need to "
+"confirm this payment using your E-banking system"
+msgstr ""
+"Dieser QR-Code kann eine Bankzahlung initialisieren, Sie müssen die Zahlung "
+"mit Ihrem E-Banking System bestätigen"
+
+#. module: account_invoice_iban_qr_at
+#: constraint:account.invoice:0
+msgid "You must not alter a fixed analytic account."
+msgstr "Sie dürfen kein Analysekonto ändern"
+
+#. module: account_invoice_iban_qr_at
+#: constraint:account.invoice:0
+msgid "You must assign an analytic account.(invoice)"
+msgstr "Sie müssen ein Analysekonto definieren"

=== modified file 'account_invoice_refund/account_invoice_view.xml'
--- account_invoice_refund/account_invoice_view.xml	2012-06-25 07:58:38 +0000
+++ account_invoice_refund/account_invoice_view.xml	2013-07-10 21:51:25 +0000
@@ -7,7 +7,7 @@
             <field name="model">account.invoice</field>
             <field name="inherit_id" ref="account.invoice_form"/>
             <field name="arch" type="xml">
-                <field name="name" position="after">
+                <field name="date_invoice" position="after">
                    <field name="reference"/>
                 </field>
             </field>

=== modified file 'account_invoice_reopen/__init__.py'
--- account_invoice_reopen/__init__.py	2012-03-22 12:17:51 +0000
+++ account_invoice_reopen/__init__.py	2013-07-10 21:51:25 +0000
@@ -22,4 +22,4 @@
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
 import account
-import account_invoice
\ No newline at end of file
+import account_invoice

=== modified file 'account_invoice_reopen/account.py'
--- account_invoice_reopen/account.py	2012-12-20 15:30:00 +0000
+++ account_invoice_reopen/account.py	2013-07-10 21:51:25 +0000
@@ -21,7 +21,7 @@
 ##############################################################################
 
 # FIXME remove logger lines or change to debug
- 
+
 from osv import fields, osv
 
 
@@ -31,7 +31,5 @@
     _columns = {
        'reopen_posted':  fields.boolean('Allow Update of Posted Entries', help="Allows to reopen posted invoices, sets the move state to unposted"),
         }
-    
+
 account_journal()
-
-    

=== modified file 'account_invoice_reopen/account_invoice.py'
--- account_invoice_reopen/account_invoice.py	2012-12-20 15:30:00 +0000
+++ account_invoice_reopen/account_invoice.py	2013-07-10 21:51:25 +0000
@@ -27,13 +27,13 @@
 
 class account_invoice(osv.osv):
     _inherit = "account.invoice"
- 
+
 #   def _get_state(self, cr, uid, ids, context=None):
 
 #       res = list(super(account_invoice, self)._columns['state'].selection)
 #       res.append(('draft_reset','Reset to draft'))
 
-#       return res 
+#       return res
 
 #   _columns ={
 # FIXME the _get_state raises error
@@ -76,7 +76,7 @@
         _logger.debug('FGF reopen invoices %s' % (invoices))
 
         wf_service = netsvc.LocalService("workflow")
-        
+
         move_ids = [] # ones that we will need to update
         now = ' ' + _('Invalid') + time.strftime(' [%Y%m%d %H%M%S]')
         for i in invoices:
@@ -86,7 +86,7 @@
                 for move in account_move_obj.browse(cr, uid, move_ids):
                     if not move.journal_id.reopen_posted:
                         raise osv.except_osv(_('Error !'), _('You can not reopen invoice of this journal [%s]! You need to need to set "Allow Update Posted Entries" first')%(move.journal_id.name))
-                    
+
             if i['payment_ids']:
                 pay_ids = account_move_line_obj.browse(cr, uid, i['payment_ids'])
                 for move_line in pay_ids:
@@ -102,22 +102,22 @@
         for inv in invoice_obj.browse(cr, uid, ids):
             report_ids = report_xml_obj.search(cr, uid, [('model','=', 'account.invoice'), ('attachment','!=', False)])
             for report in report_xml_obj.browse(cr, uid, report_ids):
-              if report.attachment:
-                aname = report.attachment.replace('object','inv')
-                if eval(aname):
-                  aname = eval(aname)+'.pdf'
-                  attachment_ids = attachment_obj.search(cr, uid, [('res_model','=','account.invoice'),('datas_fname', '=', aname),('res_id','=',inv.id)])
-                  for a in attachment_obj.browse(cr, uid, attachment_ids):
-                    vals = {
-                        'name': a.name.replace('.pdf', now+'.pdf'),
-                        'datas_fname': a.datas_fname.replace('.pdf.pdf', now+'.pdf.pdf')
-                           }
-                    attachment_obj.write(cr, uid, a.id, vals)
+                if report.attachment:
+                    aname = report.attachment.replace('object','inv')
+                    if eval(aname):
+                        aname = eval(aname)+'.pdf'
+                        attachment_ids = attachment_obj.search(cr, uid, [('res_model','=','account.invoice'),('datas_fname', '=', aname),('res_id','=',inv.id)])
+                        for a in attachment_obj.browse(cr, uid, attachment_ids):
+                            vals = {
+                                'name': a.name.replace('.pdf', now+'.pdf'),
+                                'datas_fname': a.datas_fname.replace('.pdf.pdf', now+'.pdf.pdf')
+                                   }
+                            attachment_obj.write(cr, uid, a.id, vals)
 
-        # unset set the invoices move_id 
+        # unset set the invoices move_id
         self.write(cr, uid, ids, {'move_id': False})
-        
-        
+
+
         if move_ids:
 
             for move in account_move_obj.browse(cr , uid, move_ids):
@@ -125,18 +125,18 @@
                 account_move_obj.write(cr, uid, [move.id], {'name':name})
                 _logger.debug('FGF reopen move_copy moveid %s' % (move.id) )
                 if move.journal_id.entry_posted:
-                     raise osv.except_osv(_('Error !'), _('You can not reopen an invoice if the journal is set to skip draft!'))
+                    raise osv.except_osv(_('Error !'), _('You can not reopen an invoice if the journal is set to skip draft!'))
                 move_copy_id = account_move_obj.copy(cr, uid, move.id)
                 _logger.debug('FGF reopen move_copy_id %s' % (move_copy_id))
                 name = name + '*'
                 cr.execute("""update account_move_line
-                                 set debit=credit, credit=debit
+                                 set debit=credit, credit=debit, tax_amount= -tax_amount
                                where move_id = %s;""" % (move_copy_id))
                 account_move_obj.write(cr, uid, [move_copy_id], {'name':name})
                 _logger.debug('FGF reopen move_copy_id validate' )
                 account_move_obj.button_validate(cr, uid, [move_copy_id], context=None)
                 _logger.debug('FGF reopen move_copy_id validated' )
-                # reconcile 
+                # reconcile
                 r_id = self.pool.get('account.move.reconcile').create(cr, uid, {'type': 'auto'})
                 _logger.debug('FGF reopen reconcile_id %s' % (r_id))
                 line_ids = account_move_line_obj.search(cr, uid, [('move_id','in',[move_copy_id, move.id])])
@@ -144,9 +144,9 @@
                 lines_to_reconile = []
                 for ltr in account_move_line_obj.browse(cr, uid, line_ids):
                     if ltr.account_id.id in (ltr.partner_id.property_account_payable.id, ltr.partner_id.property_account_receivable.id):
-                         lines_to_reconile.append(ltr.id)
+                        lines_to_reconile.append(ltr.id)
                 account_move_line_obj.write(cr, uid, lines_to_reconile, {'reconcile_id':r_id})
-              
+
         self._log_event(cr, uid, ids, -1.0, 'Reopened Invoice')
 
         return True

=== modified file 'account_invoice_reopen/account_invoice_workflow.xml'
--- account_invoice_reopen/account_invoice_workflow.xml	2012-08-13 21:14:02 +0000
+++ account_invoice_reopen/account_invoice_workflow.xml	2013-07-10 21:51:25 +0000
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <openerp>
     <data>
+        <!--
         <record id="act_reopen" model="workflow.activity">
             <field name="wkf_id" ref="account.wkf"/>
             <field name="name">reopen</field>
@@ -28,6 +29,7 @@
             <field name="act_to" ref="account.act_cancel"/>
             <field name="signal">invoice_cancel</field>
         </record>
+        -->
         <!-- new -->
         <!-- 20120502
    <record id="trans_open_draft" model="workflow.transition">

=== modified file 'account_invoice_reopen/account_reopen_view.xml'
--- account_invoice_reopen/account_reopen_view.xml	2012-04-14 21:33:14 +0000
+++ account_invoice_reopen/account_reopen_view.xml	2013-07-10 21:51:25 +0000
@@ -19,7 +19,7 @@
             <field name="type">form</field>
             <field name="inherit_id" ref="account.invoice_form"/>
             <field name="arch" type="xml">
-                <xpath expr="/form/notebook/page/group/group/button[@name='invoice_cancel']" position="after">
+                <xpath expr="/form/header/button[@name='invoice_cancel']" position="after">
                     <button name="action_reopen" type="object" states="open" string="Reset to Draft" icon="gtk-convert" groups="account.group_account_invoice"/>
                 </xpath>
             </field>
@@ -55,7 +55,7 @@
             <field name="type">form</field>
             <field name="inherit_id" ref="account.invoice_supplier_form"/>
             <field name="arch" type="xml">
-                <xpath expr="/form/notebook/page/group/group/button[@name='invoice_cancel']" position="after">
+                <xpath expr="/form/header/button[@name='invoice_cancel']" position="after">
                     <button name="action_reopen" type="object" states="open" string="Reset To Draft" icon="gtk-convert" groups="account.group_account_invoice"/>
                 </xpath>
             </field>

=== modified file 'account_invoice_webkit/__init__.py'
--- account_invoice_webkit/__init__.py	2012-12-20 15:30:00 +0000
+++ account_invoice_webkit/__init__.py	2013-07-10 21:51:25 +0000
@@ -29,5 +29,5 @@
 #
 ##############################################################################
 import account_invoice
-import wizard
+#import wizard
 import report

=== modified file 'account_invoice_webkit/__openerp__.py'
--- account_invoice_webkit/__openerp__.py	2012-12-20 15:30:00 +0000
+++ account_invoice_webkit/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -4,7 +4,11 @@
 # Copyright (c) 2010 Camptocamp (http://www.camptocamp.com) 
 # All Right Reserved
 #
+<<<<<<< TREE
 # Author : Ferdinand GAssauer (Camptocamp)
+=======
+# Author : Ferdinand Gassauer (Camptocamp Austria)
+>>>>>>> MERGE-SOURCE
 #
 # WARNING: This program as such is intended to be used by professional
 # programmers who take the whole responsability of assessing all potential
@@ -36,6 +40,8 @@
 using address label field with addressee's country specific zip position
 
 top margin of webkit header must be set to 35mm to get correctly positioned folding marks
+
+set "print code" in company to print internal product code on sale_order,icking and invoice
 """
 , "version"      : "0.9"
 , "depends"      : 
@@ -45,11 +51,17 @@
     , "picking_invoice_rel"
     , "stock_packing_webkit"
     , "one2many_sorted"
+    , "account_invoice_iban_qr_at"
     ]
 , "category"     : "Accounting & Finance"
+<<<<<<< TREE
 , "author"       : "Camptocamp - NBessi, Ferdinand Gassauer"
+=======
+, "author"       : "Camptocamp SA - NBessi, Camptocamp Austria"
+>>>>>>> MERGE-SOURCE
 , "website"      : "http://www.camptocamp.com/";
 , "data"         : ["account_invoice_webkit_view.xml"]
 , "installable"  : True
+, 'application'  : False
 , "auto_install" : False
 }

=== modified file 'account_invoice_webkit/account_invoice.py'
--- account_invoice_webkit/account_invoice.py	2012-12-20 15:30:00 +0000
+++ account_invoice_webkit/account_invoice.py	2013-07-10 21:51:25 +0000
@@ -26,7 +26,7 @@
 
 class account_invoice(osv.osv):
     _inherit = "account.invoice"
-         
+
     def _amount_discount(self, cr, uid, ids, name, args, context=None):
         res = {}
         amount_discount = 0.0
@@ -66,7 +66,7 @@
         res = {}
         for inv in self.browse(cr, uid, ids, context=context):
           print_code = False
-          if inv.invoice_line:
+          if inv.invoice_line and inv.company_id.print_code:
             for line in inv.invoice_line:
                 if line.product_id.default_code:
                    print_code = True
@@ -92,11 +92,15 @@
 
 
     _columns = {
+        'note' : fields.text('Notes'),
         'amount_discount': fields.function(_amount_discount, method=True, digits_compute=dp.get_precision('Account'), string='Total Discount',),
         'print_price_unit_id': fields.function(_print_price_unit_id, method=True, type='boolean', string='Print column price unit id if not 1',),
         'print_ean': fields.function(_print_ean, method=True, type='boolean', string='Print EAN if available',),
         'print_code': fields.function(_print_code, method=True, type='boolean', string='Print code if available',),
         'cols': fields.function(_get_cols, method=True, type='integer', string='No of columns before totals',),
+        'print_address_info': fields.related('company_id', 'print_address_info', type ='boolen', relation='res.company', string="Print Address Info", readonly = True),
+        'print_cell_borders': fields.related('company_id', 'print_cell_borders', type ='boolen', relation='res.company', string="Print Cell Borders", readonly = True),
+        'document_label_position': fields.related('company_id', 'document_label_position', type ='boolen', relation='res.company', string="Document Label Position", readonly = True),
         'invoice_line_sorted' : one2many_sorted.one2many_sorted
         ( 'account.invoice.line'
         , 'invoice_id'
@@ -107,3 +111,11 @@
         
     }
 account_invoice()
+
+class account_invoice_line(osv.osv):
+    _inherit = "account.invoice.line"
+    _columns = {
+        'note' : fields.text('Notes'),
+        }
+
+account_invoice_line()

=== modified file 'account_invoice_webkit/account_invoice_webkit_view.xml'
--- account_invoice_webkit/account_invoice_webkit_view.xml	2011-07-03 07:20:55 +0000
+++ account_invoice_webkit/account_invoice_webkit_view.xml	2013-07-10 21:51:25 +0000
@@ -9,5 +9,39 @@
       name="account.invoice.webkit"
       report_type="webkit"
       string="WebKit Invoice"/>
-  </data>
+
+    <record id="invoice_note_form" model="ir.ui.view">
+            <field name="name">account.invoice.note.form</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_form"/>
+            <field name="arch" type="xml">
+            <data>
+              <xpath expr="/form/sheet/notebook/page[@string='Other Info']" position="after">
+                  <page string="Notes">
+                       <field colspan="4" name="note"/>
+                  </page>
+              </xpath>
+              <xpath expr="/form/sheet/notebook/page[@string='Invoice Lines']" position="after">
+                       <label for="note"/>
+                       <field name="note"/>
+              </xpath>
+            </data>
+           </field>
+    </record>
+
+<!-- FIXME print became an object
+       <record id="invoice_button_form" model="ir.ui.view">
+            <field name="name">account.invoice.button.form</field>
+            <field name="model">account.invoice</field>
+            <field name="type">form</field>
+            <field name="inherit_id" ref="account.invoice_form"/>
+            <field name="arch" type="xml">
+              <xpath expr="/form/notebook/page[@string='Invoice']/group/group/button[@string='Print Invoice']" position="replace">
+                  <button name="%(account_invoice_webkit)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,proforma,sale,proforma2"/>
+              </xpath>
+        </field>
+    </record>
+-->
+
+ </data>
 </openerp>

=== modified file 'account_invoice_webkit/i18n/de.po'
--- account_invoice_webkit/i18n/de.po	2013-07-04 05:41:12 +0000
+++ account_invoice_webkit/i18n/de.po	2013-07-10 21:51:25 +0000
@@ -1,21 +1,28 @@
 # German translation for c2c-rd-addons
 # Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
 # This file is distributed under the same license as the c2c-rd-addons package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
 #
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012, 2013.
 msgid ""
 msgstr ""
 "Project-Id-Version: c2c-rd-addons\n"
 "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
 "POT-Creation-Date: 2012-06-19 15:26+0000\n"
-"PO-Revision-Date: 2012-01-24 07:36+0000\n"
-"Last-Translator: Ferdinand @ Camptocamp <Unknown>\n"
-"Language-Team: German <de@xxxxxx>\n"
+"PO-Revision-Date: 2013-02-15 21:42+0100\n"
+"Last-Translator: Ferdinand Gassauer\n"
+"Language-Team: German <kde-i18n-doc@xxxxxxx>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
+<<<<<<< TREE
 "X-Launchpad-Export-Date: 2013-07-04 05:40+0000\n"
 "X-Generator: Launchpad (build 16692)\n"
+=======
+"X-Launchpad-Export-Date: 2012-10-23 05:13+0000\n"
+"X-Generator: Lokalize 1.5\n"
+"Language: de\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+>>>>>>> MERGE-SOURCE
 
 #. module: account_invoice_webkit
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:243
@@ -72,7 +79,7 @@
 #. module: account_invoice_webkit
 #: field:account.invoice,print_ean:0
 msgid "Print EAN if available"
-msgstr ""
+msgstr "Drucke EAN wenn verfügbar"
 
 #. module: account_invoice_webkit
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:50
@@ -113,7 +120,7 @@
 #. module: account_invoice_webkit
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:139
 msgid "Refund Date"
-msgstr ""
+msgstr "Datum Rückvergütung"
 
 #. module: account_invoice_webkit
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:45
@@ -139,17 +146,17 @@
 #. module: account_invoice_webkit
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:144
 msgid "Due Date"
-msgstr ""
+msgstr "Datum Fälligkeit"
 
 #. module: account_invoice_webkit
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:130
 msgid "Customer Ref"
-msgstr ""
+msgstr "Kunden Ref."
 
 #. module: account_invoice_webkit
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:217
 msgid "Net Total"
-msgstr ""
+msgstr "Netto Summe"
 
 #. module: account_invoice_webkit
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:173
@@ -166,17 +173,17 @@
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:60
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:91
 msgid "VAT"
-msgstr "USt."
+msgstr "UID"
 
 #. module: account_invoice_webkit
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:226
 msgid "Total"
-msgstr ""
+msgstr "Gessamtsumme"
 
 #. module: account_invoice_webkit
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:133
 msgid "Origin"
-msgstr ""
+msgstr "Ursprung"
 
 #. module: account_invoice_webkit
 #: sql_constraint:account.invoice:0
@@ -232,10 +239,11 @@
 #. module: account_invoice_webkit
 #: field:account.invoice,invoice_line_sorted:0
 msgid "Invoice Lines Sorted"
-msgstr ""
+msgstr "Sortierte Zeilen"
 
 #. module: account_invoice_webkit
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:175
 #: report:addons/account_invoice_webkit/report/account_invoice_webkit.mako:204
 msgid "Unit"
 msgstr "ME"
+

=== modified file 'account_invoice_webkit/report/__init__.py'
--- account_invoice_webkit/report/__init__.py	2012-12-20 15:30:00 +0000
+++ account_invoice_webkit/report/__init__.py	2013-07-10 21:51:25 +0000
@@ -4,7 +4,11 @@
 # Copyright (c) 2010 Camptocamp (http://www.camptocamp.com) 
 # All Right Reserved
 #
+<<<<<<< TREE
 # Author : Ferdinand GAssauer (Camptocamp)
+=======
+# Author : Ferdinand Gassauer (Camptocamp Austria)
+>>>>>>> MERGE-SOURCE
 #
 # WARNING: This program as such is intended to be used by professional
 # programmers who take the whole responsability of assessing all potential
@@ -29,4 +33,4 @@
 #
 ##############################################################################
 
-import report_webkit_html
\ No newline at end of file
+import report_webkit_html

=== modified file 'account_invoice_webkit/report/account_invoice_webkit.mako'
--- account_invoice_webkit/report/account_invoice_webkit.mako	2012-07-02 13:27:14 +0000
+++ account_invoice_webkit/report/account_invoice_webkit.mako	2013-07-10 21:51:25 +0000
@@ -15,7 +15,8 @@
        cellspacing="0";
        font-size:12px;
            }
-     td { margin: 0px; padding: 3px; border: 1px solid lightgrey;  vertical-align: top; }
+
+     th { margin: 0px; padding: 3px; border: 1px solid Grey;  vertical-align: top; }
      pre {font-family:helvetica; font-size:15;}
     </style>
     <%
@@ -24,6 +25,15 @@
     %>
 
     %for inv in objects :
+    
+    <style  type="text/css">
+    %if inv.print_cell_borders:
+       td { margin: 0px; padding: 3px; border: 1px solid #E3E3E3;  vertical-align: top; }
+    %else:
+       td { margin: 0px; padding: 3px; border: 1px solid White;  vertical-align: top; }
+    %endif    
+    </style>
+    
     <% setLang(inv.partner_id.lang) %>
 <br>
     <table  >
@@ -34,36 +44,51 @@
         %if inv.company_id.address_label_position == 'left':
          <tr>
          <td style="width:50%;height:35mm;font-size:130%;padding-left:5mm;padding-top:3mm">
-%if inv.type in ('in_invoice','in_refund'):
-${_("Supplier Address")}
-<hr>
-%endif
-${inv.address_invoice_id.address_label|carriage_returns}
+            %if inv.type in ('in_invoice','in_refund'):
+            ${_("Supplier Address")}
+            <hr>
+            %endif
+            ${inv.partner_id.address_label|carriage_returns}
          </td>
-         <td style="width:50%;padding:0px;font-size:100%;padding-left:5mm;padding-top:3mm">
+
+         <td style="width:max;padding:0px;font-size:100%;padding-left:5mm;padding-top:3mm">
+         %if inv.print_address_info:
+         
 <table  style="padding:0px;" >
-         %if inv.address_invoice_id.phone :
-<tr>
-<td style="border:none"> ${_("Phone")}</td><td style="border:none"> ${inv.address_invoice_id.phone|entity} </td
-</tr>
-        %endif
-        %if inv.address_invoice_id.fax :
-<tr>
-<td style="border:none">${_("Fax")}</td><td style="border:none"> ${inv.address_invoice_id.fax|entity} </td>
-</tr>
-        %endif
-        %if inv.address_invoice_id.email :
-<tr>
-<td style="border:none">${_("Mail")}</td><td style="border:none">${inv.address_invoice_id.email|entity} </td>
-</tr>
-        %endif
+         
+        %if inv.partner_id.phone :
+            <tr>
+            <td style="border:none"> ${_("Phone")}</td><td style="border:none"> ${inv.partner_id.phone|entity} </td>
+            </tr>
+        %endif
+        
+        %if inv.partner_id.fax :
+            <tr>
+            <td style="border:none">${_("Fax")}</td><td style="border:none"> ${inv.partner_id.fax|entity} </td>
+            </tr>
+        %endif
+        
+        %if inv.partner_id.email :
+            <tr>
+            <td style="border:none">${_("Mail")}</td><td style="border:none">${inv.partner_id.email|entity} </td>
+            </tr>
+        %endif
+        
         %if inv.partner_id.vat :
-<tr>
-<td style="border:none">${_("VAT")}</td><td style="border:none"> ${inv.partner_id.vat|entity} </td>
-</tr>
+            <tr>
+            <td style="border:none">${_("VAT")}</td><td style="border:none"> ${inv.partner_id.vat|entity} </td>
+            </tr>
         %endif
 </table>
+        %endif
          </td>
+         
+         
+         %if 'iban_qr_code' in inv._columns and inv.iban_qr_code:
+            <td  style="width:150px">
+            ${helper.embed_image('png',inv.iban_qr_code, width=100)}
+            </td>
+         %endif
         </tr>
         %endif
 <!-- 
@@ -72,27 +97,35 @@
 ******************************-->
         %if inv.company_id.address_label_position == 'right' or not inv.company_id.address_label_position:
          <tr>
-         <td style="width:50%">
+        %if 'iban_qr_code' in inv._columns and inv.iban_qr_code:
+         <td  style="width:150px">
+            ${helper.embed_image('png',inv.iban_qr_code, width=150)}
+         </td>
+        %endif
+         <td>
+         %if inv.print_address_info:
 <table {border:none} >
-         %if inv.address_invoice_id.phone :
-<tr>
-<td> ${_("Phone")}</td><td> ${inv.address_invoice_id.phone|entity} </td
-</tr>
-        %endif
-        %if inv.address_invoice_id.fax :
-<tr>
-<td>${_("Fax")}</td><td> ${inv.address_invoice_id.fax|entity} </td>
-</tr>
-        %endif
-        %if inv.address_invoice_id.email :
-<tr>
-<td>${_("Mail")}</td><td>${inv.address_invoice_id.email|entity} </td>
-</tr>
+         %if inv.partner_id.phone :
+            
+            <tr>
+            <td> ${_("Phone")}</td><td> ${inv.partner_id.phone|entity} </td>
+            </tr>
+        %endif
+        %if inv.partner_id.fax :
+            <tr>
+            <td>${_("Fax")}</td><td> ${inv.partner_id.fax|entity} </td>
+            </tr>
+        %endif
+        %if inv.partner_id.email :
+            <tr>
+            <td>${_("Mail")}</td><td>${inv.partner_id.email|entity} </td>
+            </tr>
         %endif
         %if inv.partner_id.vat :
-<tr>
-<td>${_("VAT")}</td><td> ${inv.partner_id.vat|entity} </td>
-</tr>
+            <tr>
+            <td>${_("VAT")}</td><td> ${inv.partner_id.vat|entity} </td>
+            </tr>
+        %endif
         %endif
 </table>
          </td>
@@ -101,7 +134,7 @@
 ${_("Supplier Address")}
 <hr>
 %endif
-${inv.address_invoice_id.address_label|carriage_returns}
+${inv.partner_id.address_label|carriage_returns}
          </td>
         </tr>
         %endif
@@ -121,9 +154,14 @@
     <h1 style="clear:both;">${_("ProForma")}</h1> 
     %endif
 
-<table style="width:auto;float:right;font-weight:bold;font-size:140%">
+%if inv.document_label_position == 'right':
+   <table style="width:auto;float:right;font-weight:bold;font-size:140%">
+%else:
+   <table style="width:auto;float:left;font-weight:bold;font-size:140%">
+%endif
+
 <tr>
-  <td style="text-align:right">
+  <td style='text-align:right'>
     %if inv.type == 'out_invoice' :
       ${_("Customer Invoice")} 
     %elif inv.type == 'in_invoice' :
@@ -136,7 +174,6 @@
    </td>
    <td  style="text-align:right;">${inv.number or ''|entity}
    </td>
-   
 </tr>
 <tr>
     <td style="text-align:right;">${_("Datum")} </td><td  style="text-align:right;"> ${formatLang(inv.date_invoice, date=True)|entity}</td>
@@ -145,7 +182,9 @@
 <td style="border:none"></td>
 </tr>
 </table>
-<br>
+
+
+<br/>
     %if inv.state == 'cancel' :
     <h1 style="clear:both;">${inv.state}</h1> 
     <br/>
@@ -153,21 +192,21 @@
     <table >
         <tr>
           %if inv.name :
-            <td>${_("Customer Ref")}</td>
+            <th>${_("Customer Ref")}</th>
           %endif
           %if not inv.picking_ids and inv.origin:
-            <td>${_("Origin")}</td>
+            <th>${_("Origin")}</td>
           %endif
           %if inv.picking_ids:
-            <td>${_("Pickings/Order")}</td>
+            <th>${_("Pickings/Order")}</th>
           %endif
           %if inv.reference:
-            <td>${_("Reference")}</td>
+            <th>${_("Reference")}</th>
           %endif
 
-            <td style="white-space:nowrap">${_("Payment Term")}</td>
-            <td style="white-space:nowrap">${_("Due Date")}</td>
-            <td>${_("Curr")}</td>
+            <th >${_("Payment Term")}</th>
+            <th >${_("Due Date")}</th>
+            <th>${_("Curr")}</th>
         </tr>
         <tr>
           %if inv.name :
@@ -182,7 +221,7 @@
             <td style="padding:0px;">
            <table style="border:none;">
           %for pick in inv.picking_ids:
-            <tr style="white-space:nowrap;border:none">
+            <tr style="border:none">
              <td style="border:none">${pick.name} / ${formatLang(pick.date, date=True)|entity}</td>
              %if pick.sale_id:
 	     <td style="border:none">${pick.sale_id.name} / ${formatLang(pick.sale_id.date_order, date=True)|entity}</td>
@@ -233,7 +272,7 @@
 %if inv.print_code:
            <td>${line.product_id.default_code or ''|entity}</td>
 %endif
-           <td>${line.product_id.name or line.name|entity}
+           <td>${line.name or line.product_id.name |entity}
 
 %if line.note and len(line.note.replace('\n','')) > 0 :
 <br>
@@ -266,7 +305,7 @@
         </tr>
         <tr>
            <td colspan="${inv.cols}" style="border-style:none"/>
-           <td style="border-style:none"><b>${_("Taxes")}:</b></td>
+           <td ><b>${_("Taxes")}:</b></td>
            <td style="text-align:right">${formatLang(inv.amount_tax)}</td></tr>
         <tr> 
            <td colspan="${inv.cols}" style="border-style:none"/>
@@ -276,21 +315,30 @@
     </table>
 <br>
        %if inv.tax_line :
-    <table class="list_table" style="width:40%;border:1px solid grey">
-        <tr><th>${_("Tax")}</th><th style="text-align:left;">${_("Base")}</th><th style="text-align:left;">${_("Amount")}</th></tr>
+    <table style="width:40%;border:1px solid;page-break-inside:avoid;">
+       <thead>
+          <tr style=" border-width:1px; border-style:solid;">
+        <th style="text-align:center;border-width:1px; border-style:solid;">${_("Tax")}</th>
+        <th style="text-align:center;border-width:1px; border-style:solid;">${_("Base")}</th>
+        <th style="text-align:center;border-width:1px; border-style:solid;">${_("Amount")}</th>
+        </tr>
+       </thead>
+       <tbody style=" border-width:0px; border-style:none;">
         %for t in inv.tax_line :
-        <tr>
-            <td style="border:1px solid grey">${ t.name|entity } </td>
-            <td style="text-align:right;border:1px solid grey;white-space:nowrap">${ formatLang(t.base)}</td>
-            <td style="text-align:right;border:1px solid grey;white-space:nowrap">${ formatLang(t.amount) }</td>
+
+          
+            <td>${ t.name|entity } </td>
+            <td style="text-align:right;white-space:nowrap">${ formatLang(t.base)}</td>
+            <td style="text-align:right;white-space:nowrap">${ formatLang(t.amount) }</td>
         </tr>
         %endfor
-        <tr>
-            <td style="border-style:none"/>
-            <td style="border-top:0px solid;text-align:right;white-space:nowrap"><b>${_("Total Tax:")}</b></td>
-            <td style="border-top:0px solid;text-align:right;white-space:nowrap">${ formatLang(inv.amount_tax) }</td>
+          <tr style=" border-width:0px; border-style:none;">
+            <td style="border:1px solid White"/>
+            <td style="border:2px solid;text-align:right;white-space:nowrap"><b>${_("Total Tax:")}</b></td>
+            <td style="border:2px solid;text-align:right;white-space:nowrap">${ formatLang(inv.amount_tax) }</td>
         </tr>
         %endif
+       </tbody>
     </table>        
     %if inv.comment:
      <br>  ${inv.comment|carriage_returns}

=== modified file 'account_payment_customer_data/__openerp__.py'
--- account_payment_customer_data/__openerp__.py	2012-08-07 08:53:39 +0000
+++ account_payment_customer_data/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -44,9 +44,10 @@
 , "category"    : "Generic Modules/Payment"
 , "depends"     : ["account"]
 , "init_xml"    : []
-, "demo_xml"    : []
+, "demo"        : []
 , "update_xml"  : ["account_invoice_view.xml"]
 , "test"        : []
 , "auto_install": False
 , "installable" : True
+, 'application'  : False
 }

=== modified file 'account_payment_customer_data/account_invoice_view.xml'
--- account_payment_customer_data/account_invoice_view.xml	2012-10-08 15:29:08 +0000
+++ account_payment_customer_data/account_invoice_view.xml	2013-07-10 21:51:25 +0000
@@ -7,7 +7,7 @@
       <field name="type">form</field>
       <field name="inherit_id" ref="account.invoice_supplier_form"/>
       <field name="arch" type="xml">
-        <xpath expr="/form/notebook/page[@string='Invoice']/field[@name='date_due']" position="after">
+        <xpath expr="/form/sheet/group/group/field[@name='date_due']" position="after">
           <field name="customer_data"/>
         </xpath>
       </field>

=== modified file 'account_payment_edifact/__init__.py'
--- account_payment_edifact/__init__.py	2012-08-09 07:28:48 +0000
+++ account_payment_edifact/__init__.py	2013-07-10 21:51:25 +0000
@@ -33,6 +33,5 @@
 import unicode2ascii
 import res_bank
 import payment_line
-import payment_mode
 import payment_order
 import wizard

=== modified file 'account_payment_edifact/__openerp__.py'
--- account_payment_edifact/__openerp__.py	2012-08-09 07:28:48 +0000
+++ account_payment_edifact/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -72,14 +72,14 @@
     , "account_payment_customer_data"
     ]
 , "init_xml"    : []
-, "demo_xml"    : []
+, "demo"        : []
 , "update_xml"  : 
-    [ 'payment_mode_view.xml'
-    , 'payment_iban.xml'
+    [ 'payment_iban.xml'
     , 'res_bank_view.xml'
     , 'wizard/generate_edifact_view.xml'
     ]
 , "test"        : []
 , "auto_install": False
 , "installable" : True
+, 'application'  : False
 }

=== modified file 'account_payment_edifact/payment_iban.xml'
--- account_payment_edifact/payment_iban.xml	2012-02-03 16:54:33 +0000
+++ account_payment_edifact/payment_iban.xml	2013-07-10 21:51:25 +0000
@@ -8,7 +8,7 @@
       <field name="type">tree</field>
       <field name="arch" type="xml">
         <field name="bank_id" position="after">
-          <field name="bank_account_type" select="2"/>
+          <field name="bank_account_type" />
         </field>
       </field>
     </record>
@@ -19,27 +19,28 @@
       <field name="type">form</field>
       <field name="arch" type="xml">
         <field name="bank_id" position="after">
-          <field name="bank_account_type" select="2"/>
+          <field name="bank_account_type" />
         </field>
       </field>
     </record>
+<!--
     <record model="ir.ui.view" id="view_payment_order_form2_bank_account_type">
       <field name="name">payment.order.form2.bank_account_type</field>
       <field name="model">payment.order</field>
       <field name="inherit_id" ref="account_payment.view_payment_order_form"/>
       <field name="type">form</field>
       <field name="arch" type="xml">
-        <xpath expr="/form/field/tree" position="replace">
+        <xpath expr="/form/sheet/field/tree" position="replace">
           <tree string="Payment Line" colors="blue:bank_account_type != 'iban'">
             <field name="ml_inv_ref"/>
-            <field name="partner_id" select="1"/>
+            <field name="partner_id" />
             <field
               domain="[('partner_id', '=', partner_id)]"
               name="bank_id"/>
             <field name="bank_account_type"/>
             <field name="ml_maturity_date"/>
             <field name="date"/>
-            <field name="amount_currency" select="2" string="Amount"/>
+            <field name="amount_currency"  string="Amount"/>
             <field name="currency"/>
             <field name="name"/>
             <field name="amount" sum="Total in Company Currency" invisible="1"/>
@@ -47,5 +48,6 @@
         </xpath>
       </field>
     </record>
+-->
   </data>
 </openerp>

=== removed file 'account_payment_edifact/payment_mode.py'
--- account_payment_edifact/payment_mode.py	2012-10-11 06:50:33 +0000
+++ account_payment_edifact/payment_mode.py	1970-01-01 00:00:00 +0000
@@ -1,83 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################
-#
-# Swing Entwicklung betrieblicher Informationssysteme GmbH
-# (<http://www.swing-system.com>)
-# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
-# all rights reserved
-#    05-AUG-2010 (GK) created
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsibility of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs.
-# End users who are looking for a ready-to-use solution with commercial
-# guarantees and support are strongly advised to contract a Free Software
-# Service Company.
-#
-# 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/> or
-# write to the Free Software Foundation, Inc.,
-# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
-###############################################
-from osv import fields, osv
-from tools.translate import _
-
-class payment_mode(osv.osv) :
-    _inherit = "payment.mode"
-    # http://www.unece.org/trade/untdid/d00a/tred/tred4471.htm
-    _columns = \
-        { 'charges_alloc' : fields.selection
-            ([ ( '1', _('Bill back'))
-             , ( '2', _('Off invoice'))
-             , ( '3', _('Vendor check to customer'))
-             , ( '4', _('Credit customer account'))
-             , ( '5', _('Charge to be paid by vendor'))
-             , ( '6', _('Charge to be paid by customer'))
-             , ( '7', _('Optional'))
-             , ( '8', _('Off gross quantity invoiced'))
-             , ( '9', _('Electric cost recovery factor'))
-             , ('10', _('Gas cost recovery factor'))
-             , ('11', _('Prior credit balance'))
-             , ('12', _('Non-dutiable'))
-             , ('13', _('All charges borne by payee'))
-             , ('14', _('Each pay own cost'))
-             , ('15', _('All charges borne by payor'))
-             , ('16', _('All bank charges to be borne by applicant'))
-             , ('17', _('All bank charges except confirmation commission to be borne by applicant'))
-             , ('18', _('All bank charges to be borne by beneficiary'))
-             , ('20', _('Amendment charges to be borne by applicant'))
-             , ('21', _('Amendment charges to be borne by beneficiary'))
-             , ('22', _('Discount charges to be borne by applicant'))
-             , ('23', _('Discount charges to be borne by beneficiary'))
-             , ('24', _('All bank charges other than those of the issuing bank to be borne by beneficiary'))
-             , ('25', _('Amendment charges other than those of the issuing bank to be borne by beneficiary'))
-             , ('26', _('All charges to be paid by the principal of the collection'))
-             , ('27', _('All charges to be paid by the drawee of the collection'))
-             , ('28', _('All charges to be borne by the drawee except those levied by the remitting bank, to be paid by principal'))
-             , ('29', _('All bank charges are to be paid by the principal of the documentary credit collection'))
-             , ('30', _('All bank charges to be borne by receiving bank'))
-             , ('31', _('All bank charges to be borne by sending bank'))
-             , ('32', _('Charges levied by a third bank'))
-             , ('33', _('Information charges levied by a third bank'))
-             , ('34', _('Total payment borne by patient'))
-             , ('35', _('Part payment borne by patient')) 
-             , ('ZZZ', _('Mutually defined'))
-             ]
-            , 'Financial Charges Allocation'
-            , required=True
-            )
-        }
-    _defaults = {'charges_alloc'    : lambda *a: '14'}
-# end class payment_mode
-payment_mode()

=== removed file 'account_payment_edifact/payment_mode_view.xml'
--- account_payment_edifact/payment_mode_view.xml	2012-02-03 15:24:46 +0000
+++ account_payment_edifact/payment_mode_view.xml	1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<openerp>
-  <data>
-    <record id="view_payment_mode_edifact_form" model="ir.ui.view">
-      <field name="name">payment.mode.edifact.form</field>
-      <field name="model">payment.mode</field>
-      <field name="type">form</field>
-      <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
-      <field name="arch" type="xml">
-        <field name="bank_id" position="after">
-          <field name="charges_alloc"/>
-        </field>
-      </field>
-    </record>
-  </data>
-</openerp>

=== modified file 'account_payment_edifact/payment_order.py'
--- account_payment_edifact/payment_order.py	2012-10-25 18:56:20 +0000
+++ account_payment_edifact/payment_order.py	2013-07-10 21:51:25 +0000
@@ -150,9 +150,12 @@
             s.append("RFF+PQ:%(move_name)s'" % l)
         if l['customer_data'] and not interntl :
             s.append("RFF+AEF:%(customer_data)s'" % l)
-#        s.append("FCA+%(fca)s'" % l)
 #        s.append("FII+BF+%(iban)s:%(name)s+%(bic)s:25:5'" % l)
-        s.append("FII+BF+%(iban)s:%(name)s'" % l)
+        if interntl :
+            s.append("FCA+14'")
+            s.append("FII+BF+%(iban)s:%(name)s:25:5'" % l)
+        else :
+            s.append("FII+BF+%(iban)s:%(name)s'" % l)
         s.append("NAD+BE+++%(name)s+%(street)s+%(city)s+%(zip)s+%(country)s'" % l) # sgr3
         s.append("PRC+11'")
         s.append("FTX+PMD+++%(reference)s'" % l)
@@ -191,6 +194,8 @@
                         own_ref.append(self._u2a(invoice.reference).upper())
                     if l.communication != "/" :
                         customer_ref.append(self._u2a(l.communication).upper())
+                    else:
+                        customer_ref.append(self._u2a(invoice.number).upper())
                     if l.communication2 :
                         customer_ref.append(self._u2a(l.communication2).upper())
                     if not customer_ref :
@@ -211,7 +216,6 @@
                     , 'currency'  : line.currency.name
                     , 'move_name' : (" ".join(customer_ref))[0:35]
                     , 'customer_data' : None
-                    , 'fca'       : order.mode.charges_alloc
                     , 'name'      : self._u2a(line.partner_id.name).upper()[0:35]
                     , 'street'    : self._u2a(p_address.street).upper()[0:35]
                     , 'city'      : self._u2a(p_address.city).upper()[0:35]
@@ -234,6 +238,8 @@
                         own_ref.append(self._u2a(invoice.reference).upper())
                     if line.communication != "/" :
                         customer_ref.append(self._u2a(line.communication).upper())
+                    else:
+                        customer_ref.append(self._u2a(invoice.number).upper())
                     if line.communication2 :
                         customer_ref.append(self._u2a(line.communication2).upper())
                     if invoice.customer_data :
@@ -256,7 +262,6 @@
                         , 'currency'  : line.currency.name
                         , 'move_name' : (" ".join(customer_ref))[0:28] # smaller for AEF
                         , 'customer_data' : customer_data
-                        , 'fca'       : order.mode.charges_alloc
                         , 'name'      : self._u2a(line.partner_id.name).upper()[0:35]
                         , 'street'    : self._u2a(p_address.street).upper()[0:35]
                         , 'city'      : self._u2a(p_address.city).upper()[0:35]

=== modified file 'account_payment_edifact/res_bank_view.xml'
--- account_payment_edifact/res_bank_view.xml	2012-01-18 09:12:28 +0000
+++ account_payment_edifact/res_bank_view.xml	2013-07-10 21:51:25 +0000
@@ -9,7 +9,7 @@
       <field name="type">form</field>
       <field name="arch" type="xml">
         <field name="country" position="replace">
-          <field name="country" select="2" required="1"/>
+          <field name="country"  required="1"/>
         </field>
       </field>
     </record>

=== modified file 'account_payment_extension/__openerp__.py'
--- account_payment_extension/__openerp__.py	2012-10-22 16:58:57 +0000
+++ account_payment_extension/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -20,7 +20,7 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
-{ "name" : "Account Payment Extension"
+{ "name" : "Account Payment Extension - DO NOT INSTALL along with c2c_account_payment_extension"
 , "version" : "1.1"
 , "author" : "Zikzakmedia SL"
 , "category" : "Generic Modules/Accounting"
@@ -46,7 +46,7 @@
     , "account_payment"
     ]
 , "init_xml" : []
-, "demo_xml" : []
+, "demo"     : []
 , "update_xml" : 
     [ 'security/ir.model.access.csv'
     , "payment_wizard.xml"
@@ -55,5 +55,6 @@
     ]
 , "auto_install": False
 , "installable": False
+, 'application'  : False
 }
 

=== modified file 'account_payment_extension/payment_view.xml'
--- account_payment_extension/payment_view.xml	2012-05-30 12:52:46 +0000
+++ account_payment_extension/payment_view.xml	2013-07-10 21:51:25 +0000
@@ -98,10 +98,10 @@
         <field name="type">form</field>
         <field name="arch" type="xml">
             <form string="Payment Type">
-                <field name="name" select="1"/>
-                <field name="code" select="1"/>
-                <field name="active" select="1"/>
-                <field name="company_id" select="1" widget='selection' groups="base.group_multi_company"/>
+                <field name="name" />
+                <field name="code" />
+                <field name="active" />
+                <field name="company_id"  widget='selection' groups="base.group_multi_company"/>
                 <separator string="Description" colspan="4"/>
                 <field name="note" nolabel="1" colspan="4"/>
                 <separator string="Suitable Bank Types" colspan="4"/>
@@ -199,7 +199,7 @@
             <separator string="Reconciliation" position="before">
                 <group col="2" colspan="2">
                     <separator colspan="2" string="Payment"/>
-                    <field name="payment_type" select="1" widget="selection"/>
+                    <field name="payment_type"  widget="selection"/>
                     <field name="partner_bank_id" domain="[('partner_id','=',partner_id)]"/>
                     <field name="received_check"/>
                 </group>
@@ -250,7 +250,7 @@
         <field name="arch" type="xml">
             <field name="move_line_id" position="replace">
             <group col="6" colspan="4">
-                <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_scheduled,currency,company_currency,context)" select="1"/>
+                <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_scheduled,currency,company_currency,context)" />
                 <field name="account_id"/>
                 <field name="payment_move_id"/>
             </group>
@@ -277,9 +277,9 @@
         <field name="inherit_id" ref="account_payment.view_payment_line_form"/>
         <field name="arch" type="xml">
             <field name="move_line_id" position="replace">
-                <!--<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_scheduled,currency,company_currency,context)" select="1"/>-->
+                <!--<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_scheduled,currency,company_currency,context)" />-->
             <group col="6" colspan="4">
-                <field name="move_line_id" on_change="onchange_move_line(move_line_id, False, currency, company_currency)" select="1"/>
+                <field name="move_line_id" on_change="onchange_move_line(move_line_id, False, currency, company_currency)" />
                 <field name="account_id"/>
                 <field name="payment_move_id"/>
             </group>

=== modified file 'account_payment_sepa/__openerp__.py'
--- account_payment_sepa/__openerp__.py	2012-08-09 07:28:48 +0000
+++ account_payment_sepa/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -37,7 +37,7 @@
 , "description" : 
 """
 SEPA (Single European Payment Area) is a standardization of the ECBS (European Commitee for Banking Standards).
-It conforms to the ISO 20022 standard (Finmancial services - universal financial industry message scheme).
+It conforms to the ISO 20022 standard (Financial services - universal financial industry message scheme).
 
 This module implements the credit transfer (ISO.pain.001.101).
 It generates an XML-file per payment-order and attaches it to the payment order at the time of payment_order.action_open.
@@ -53,10 +53,14 @@
     , "xml_template"
     , "account_payment_customer_data"
     ]
-, "init_xml"    : []
-, "demo_xml"    : []
+, "init_xml"    : 
+    [ "pain_001_001_03_austrian_001.xml"
+    , "pain_001_001_02_austrian_002.xml"
+    ]
+, "demo"        : []
 , "update_xml"  : ["wizard/generate_sepa_view.xml"]
 , "test"        : []
 , "auto_install": False
 , "installable" : True
+, 'application'  : False
 }

=== modified file 'account_payment_sepa/pain_001_001_02_austrian_002.xml'
--- account_payment_sepa/pain_001_001_02_austrian_002.xml	2012-02-04 08:01:12 +0000
+++ account_payment_sepa/pain_001_001_02_austrian_002.xml	2013-07-10 21:51:25 +0000
@@ -1,8 +1,15 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<openerp>
+  <data noupdate="1">
+    <record model="xml.template" id="xml_template_sepa_pain_001_001_02_austrian_002" forcecreate="True">
+      <field name="name">pain_001_001_02_austrian_002</field>
+      <field name="schema">http://www.stuzza.at/schemata/ISO.pain.001.001.02.austrian.002.xsd</field>
+      <field name="content" type="xml">
 <Document>
   <pain.001.001.02>
     <GrpHdr>
-      <MsgId text-eval="time.strftime('%Y%m%d%H%M%S')"/>
-      <CreDtTm text-eval="time.strftime('%Y-%m-%dT%H:%M:%S')"/>
+      <MsgId text-eval="time1"/>
+      <CreDtTm text-eval="time2"/>
       <NbOfTxs text-eval="sum(len(l) for date,l in sepa_payments(order,company).iteritems())"/>
       <CtrlSum text-eval="order.total"/>
       <Grpg text-eval="'MIXD'"/>
@@ -14,8 +21,8 @@
         </Id>
       </InitgPty>
     </GrpHdr>
-    <PmtInf var="date,p_banks" loop-eval="sepa_payments(order,company).iteritems()">
-      <PmtInfId text-eval="time.strftime('%Y%m%d%H%M%S')"/>
+    <PmtInf var="date" seq-eval="sepa_payments(order,company)">
+      <PmtInfId text-eval="date.replace('-', '')"/>
       <PmtMtd text-eval="'TRF'"/>
       <PmtTpInf>
         <SvcLvl>
@@ -37,7 +44,7 @@
           <BIC text-eval="order.mode.bank_id.bank.bic.replace(' ','').upper()"/>
         </FinInstnId>
       </DbtrAgt>
-      <CdtTrfTxInf var="line" seq-eval="p_banks">
+      <CdtTrfTxInf var="line" seq-eval="p_sepa_payments(order,company)[date]">
         <PmtId>
           <EndToEndId text-eval="line.customer_data[0:35]"/>
         </PmtId>
@@ -63,4 +70,9 @@
       </CdtTrfTxInf>
     </PmtInf>
   </pain.001.001.02>
-</Document>
\ No newline at end of file
+</Document>
+      </field>
+    </record>
+  </data>
+</openerp>
+

=== modified file 'account_payment_sepa/pain_001_001_03_austrian_001.xml'
--- account_payment_sepa/pain_001_001_03_austrian_001.xml	2012-02-04 08:01:12 +0000
+++ account_payment_sepa/pain_001_001_03_austrian_001.xml	2013-07-10 21:51:25 +0000
@@ -1,8 +1,15 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<openerp>
+  <data noupdate="1">
+    <record model="xml.template" id="xml_template_sepa_pain_001_001_03_austrian_001" forcecreate="True">
+      <field name="name">pain_001_001_03_austrian_001</field>
+      <field name="schema">http://www.stuzza.at/schemata/ISO.pain.001.001.02.austrian.001.xsd</field>
+      <field name="content" type="xml">
 <Document>
   <CstmrCdtTrfInitn>
     <GrpHdr>
-      <MsgId text-eval="time.strftime('%Y%m%d%H%M%S')"/>
-      <CreDtTm text-eval="time.strftime('%Y-%m-%dT%H:%M:%S')"/>
+      <MsgId text-eval="time1"/>
+      <CreDtTm text-eval="time2"/>
       <NbOfTxs text-eval="sum(len(l) for date,l in sepa_payments(order,company).iteritems())"/>
       <CtrlSum text-eval="order.total"/>
       <InitgPty>
@@ -10,7 +17,7 @@
       </InitgPty>
     </GrpHdr>
     <PmtInf var="date,p_banks" loop-eval="sepa_payments(order,company).iteritems()">
-      <PmtInfId text-eval="time.strftime('%Y%m%d%H%M%S')"/>
+      <PmtInfId text-eval="time1"/>
       <PmtMtd text-eval="'TRF'"/>
       <CtrlSum text-eval="sum(line.amount for line in p_banks)"/>
       <ReqdExctnDt text-eval="date"/>
@@ -59,4 +66,9 @@
       </CdtTrfTxInf>
     </PmtInf>
   </CstmrCdtTrfInitn>
-</Document>
\ No newline at end of file
+</Document>
+      </field>
+    </record>
+  </data>
+</openerp>
+

=== modified file 'account_payment_sepa/payment_order.py'
--- account_payment_sepa/payment_order.py	2012-08-09 07:28:48 +0000
+++ account_payment_sepa/payment_order.py	2013-07-10 21:51:25 +0000
@@ -77,9 +77,12 @@
 
 class _Record (object) :
     def __init__ (self, **kw):
-        self.__dict__ ["_kw"] = kw.copy ()
+        self.__dict__["_kw"] = kw.copy()
     # end def __init__
     
+    def __repr__(self):
+        return str(self.__dict__["_kw"])
+
     def copy (self, **kw):
         result = self.__class__ (** self._kw)
         result._kw.update (kw)
@@ -167,7 +170,7 @@
             elif p_bank not in dates[date] :
                 dates[date].add(P_Bank(p_bank, line))
             else :
-                dates[date].append(p_banks, line)
+                dates[date].append(p_bank, line)
 
         for date, p_banks in dates.iteritems() :
             for p_bank, lines in p_banks.iteritems() :
@@ -267,7 +270,7 @@
             protocol = template_ref.xml_template_id.name
             template_obj = self.pool.get("xml.template")
             namespaces = \
-                { None  : "urn:iso:std:iso:20022:tech:xsd:pain.001.001.02"
+                { None  : "APC:STUZZA:payments:ISO:pain:001:001:02:austrian:002"
                 , "xsi" : "http://www.w3.org/2001/XMLSchema-instance";
                 }
             xml = template_obj.generate_xml \
@@ -276,7 +279,8 @@
                 , nsmap     = namespaces
                 , order     = order
                 , company   = company
-                , time      = time
+                , time1     = time.strftime('%Y%m%d%H%M%S')
+                , time2     = time.strftime('%Y-%m-%dT%H:%M:%S')
                 , sepa_payments = self.sepa_payments
                 )
             template_obj.attach_xml \
@@ -284,7 +288,7 @@
                 , template_ref.xml_template_id.id
                 , attach_to   = order
                 , xml         = xml
-                , name        = order.reference + " " + protocol
+                , name        = "SEPA_" + order.reference
                 , fname       = self._sepa_strip(order.reference).upper()
                 , description = "SEPA credit transfer " + protocol
                 , context     = None

=== modified file 'account_payment_sepa/wizard/generate_sepa_view.xml'
--- account_payment_sepa/wizard/generate_sepa_view.xml	2012-02-22 09:40:11 +0000
+++ account_payment_sepa/wizard/generate_sepa_view.xml	2013-07-10 21:51:25 +0000
@@ -27,15 +27,5 @@
       target="new"
       key2="client_action_multi"
       id="generate_sepa_act_window"/>
-    <!-- 
-    <record id="action_payment_order_sepa" model="ir.actions.act_window">
-      <field name="name">Generate SEPA</field>
-      <field name="res_model">payment.order.sepa</field>
-      <field name="view_type">form</field>
-      <field name="view_mode">form</field>
-      <field name="view_id" ref="payment_order_sepa_form_view"/>
-      <field name="target">new</field>
-    </record>
-    -->
   </data>
-</openerp>
\ No newline at end of file
+</openerp>

=== added directory 'account_period_U30_at'
=== added file 'account_period_U30_at/U30.xml'
--- account_period_U30_at/U30.xml	1970-01-01 00:00:00 +0000
+++ account_period_U30_at/U30.xml	2013-07-10 21:51:25 +0000
@@ -0,0 +1,92 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<openerp>
+  <data noupdate="1">
+    <record model="xml.template" id="xml_template_U30" forcecreate="True">
+      <field name="name">U30 VAT declaration</field>
+      <field name="schema">http://www.bmf.gv.at/EGovernment/FINANZOnline/InformationenfrSoft_3165/Umsatzsteuervoranme_11373/ERKLAERUNGS_UEBERMITTLUNG_U30(2).xsd</field>
+      <field name="content" type="xml">
+        <!-- Umsatzsteuervoranmeldung ab 01/2009 - Stand: 11.01.2013-->
+        <ERKLAERUNGS_UEBERMITTLUNG>
+          <INFO_DATEN>
+            <ART_IDENTIFIKATIONSBEGRIFF text-eval="'FASTNR'"/>
+            <IDENTIFIKATIONSBEGRIFF text-eval="tax_nr"/>
+            <PAKET_NR text-eval="paket_nr"/>
+            <DATUM_ERSTELLUNG type="datum" text-eval="datum"/>
+            <UHRZEIT_ERSTELLUNG type="uhrzeit" text-eval="uhrzeit"/>
+            <ANZAHL_ERKLAERUNGEN text-eval="1"/>
+          </INFO_DATEN>
+          <ERKLAERUNG art="U30">
+            <SATZNR text-eval="paket_nr"/>
+            <ALLGEMEINE_DATEN>
+              <ANBRINGEN text-eval="'U30'"/>
+              <ZRVON type="jahrmonat" text-eval="beginn"/>
+              <ZRBIS type="jahrmonat" text-eval="ende"/>
+              <FASTNR text-eval="tax_nr"/>
+              <KUNDENINFO text-eval="period.company_id.name"/>
+            </ALLGEMEINE_DATEN>
+            <LIEFERUNGEN_LEISTUNGEN_EIGENVERBRAUCH>
+              <KZ000 type="kz" text-eval="kz(period, 'KZ000')"/>
+              <KZ001 type="kz" text-eval="kz(period, 'KZ001')"/>
+              <KZ021 type="kz" text-eval="kz(period, 'KZ021')"/>
+              <STEUERFREI>
+                <KZ011 type="kz" text-eval="kz(period, 'KZ011')"/>
+                <KZ012 type="kz" text-eval="kz(period, 'KZ012')"/>
+                <KZ015 type="kz" text-eval="kz(period, 'KZ015')"/>
+                <KZ017 type="kz" text-eval="kz(period, 'KZ017')"/>
+                <KZ018 type="kz" text-eval="kz(period, 'KZ018')"/>
+                <KZ019 type="kz" text-eval="kz(period, 'KZ019')"/>
+                <KZ016 type="kz" text-eval="kz(period, 'KZ016')"/>
+                <VST text-eval="vst"/>
+                <KZ020 type="kz" text-eval="kz(period, 'KZ020')"/>
+              </STEUERFREI>
+              <VERSTEUERT>
+                <KZ022 type="kz" text-eval="kz(period, 'KZ022')"/>
+                <KZ029 type="kz" text-eval="kz(period, 'KZ029')"/>
+                <KZ025 type="kz" text-eval="kz(period, 'KZ025')"/>
+                <KZ037 type="kz" text-eval="kz(period, 'KZ037')"/>
+                <KZ052 type="kz" text-eval="kz(period, 'KZ052')"/>
+                <KZ038 type="kz" text-eval="kz(period, 'KZ038')"/>
+                <KZ056 type="kz" text-eval="kz(period, 'KZ056')"/>
+                <KZ057 type="kz" text-eval="kz(period, 'KZ057')"/>
+                <KZ048 type="kz" text-eval="kz(period, 'KZ048')"/>
+                <KZ044 type="kz" text-eval="kz(period, 'KZ044')"/>
+                <KZ032 type="kz" text-eval="kz(period, 'KZ032')"/>
+              </VERSTEUERT>
+            </LIEFERUNGEN_LEISTUNGEN_EIGENVERBRAUCH>
+            <INNERGEMEINSCHAFTLICHE_ERWERBE>
+              <KZ070 type="kz" text-eval="kz(period, 'KZ070')"/>
+              <KZ071 type="kz" text-eval="kz(period, 'KZ071')"/>
+              <VERSTEUERT_IGE>
+                <KZ072 type="kz" text-eval="kz(period, 'KZ072')"/>
+                <KZ073 type="kz" text-eval="kz(period, 'KZ073')"/>
+                <KZ088 type="kz" text-eval="kz(period, 'KZ088')"/>
+                <KZ076 type="kz" text-eval="kz(period, 'KZ076')"/>
+                <KZ077 type="kz" text-eval="kz(period, 'KZ077')"/>
+              </VERSTEUERT_IGE>
+            </INNERGEMEINSCHAFTLICHE_ERWERBE>
+            <VORSTEUER>
+              <KZ060 type="kz" text-eval="kz(period, 'KZ060')"/>
+              <KZ061 type="kz" text-eval="kz(period, 'KZ061')"/>
+              <KZ083 type="kz" text-eval="kz(period, 'KZ083')"/>
+              <KZ065 type="kz" text-eval="kz(period, 'KZ065')"/>
+              <KZ066 type="kz" text-eval="kz(period, 'KZ066')"/>
+              <KZ082 type="kz" text-eval="kz(period, 'KZ082')"/>
+              <KZ087 type="kz" text-eval="kz(period, 'KZ087')"/>
+              <KZ089 type="kz" text-eval="kz(period, 'KZ089')"/>
+              <KZ064 type="kz" text-eval="kz(period, 'KZ064')"/>
+              <KZ062 type="kz" text-eval="kz(period, 'KZ062')"/>
+              <KZ063 type="kz" text-eval="kz(period, 'KZ063')"/>
+              <KZ067 type="kz" text-eval="kz(period, 'KZ067')"/>
+              <KZ027 type="kz" text-eval="kz(period, 'KZ027')"/>
+              <KZ028 type="kz" text-eval="kz(period, 'KZ028')"/>
+              <KZ090 type="kz" text-eval="kz(period, 'KZ090')"/>
+              <ARE text-eval="are"/>
+              <REPO text-eval="repo"/>
+            </VORSTEUER>
+          </ERKLAERUNG>
+        </ERKLAERUNGS_UEBERMITTLUNG>
+      </field>
+    </record>
+  </data>
+</openerp>
+

=== added file 'account_period_U30_at/__init__.py'
--- account_period_U30_at/__init__.py	1970-01-01 00:00:00 +0000
+++ account_period_U30_at/__init__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+##############################################
+#
+# Swing Entwicklung betrieblicher Informationssysteme GmbH
+# (<http://www.swing-system.com>)
+# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
+# all rights reserved
+#    23-Jan-2013 (GK) created
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs.
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly advised to contract a Free Software
+# Service Company.
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/> or
+# write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+###############################################
+import account_period
+import installer
+

=== added file 'account_period_U30_at/__openerp__.py'
--- account_period_U30_at/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_period_U30_at/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+##############################################
+#
+# Swing Entwicklung betrieblicher Informationssysteme GmbH
+# (<http://www.swing-system.com>)
+# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
+# all rights reserved
+#    23-Jan-2013 (GK) created
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs.
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly advised to contract a Free Software
+# Service Company.
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/> or
+# write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA  02111-1.17, USA.
+#
+###############################################
+{ "name"        : "Austrian VAT declaration"
+, "version"     : "1.0"
+, "author"      : "Swing Entwicklung betrieblicher Informationssysteme GmbH"
+, "website"     : "http://www.swing-system.com";
+, "description" : 
+"""
+U30 is a XML-type VAT declaration for the Austrian governement.
+
+This module generates a XML-file per account period attaches it to the period.
+
+"""
+, "category"    : "Accounting & Finance"
+, "depends"     : 
+    [ "account"
+    , "xml_template"
+    ]
+, "init_xml"    : ["U30.xml"]
+, "demo_xml"    : []
+, "update_xml"  : ["installer_view.xml"]
+, "test"        : []
+, "auto_install": False
+, "installable" : True
+}
+

=== added file 'account_period_U30_at/account_period.py'
--- account_period_U30_at/account_period.py	1970-01-01 00:00:00 +0000
+++ account_period_U30_at/account_period.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,92 @@
+# -*- coding: utf-8 -*-
+##############################################
+#
+# Swing Entwicklung betrieblicher Informationssysteme GmbH
+# (<http://www.swing-system.com>)
+# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
+# all rights reserved
+#    23-Jan-2013 (GK) created
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs.
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly advised to contract a Free Software
+# Service Company.
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/> or
+# write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+###############################################
+from osv import fields, osv
+import time
+from tools.translate import _
+
+class account_period(osv.osv) :
+    _inherit = "account.period"
+
+    def kz(self, period, code) :
+        cr      = self.cr
+        uid     = self.uid
+        aml_obj = self.pool.get("account.move.line")
+        atc_obj = self.pool.get("account.tax.code")
+        atc_ids = atc_obj.search(cr, uid, [("code", "=", code.replace("KZ", ""))])
+        aml_ids = aml_obj.search(cr, uid, [("period_id", "=", period.id), ("tax_code_id", "in", tuple(atc_ids))])  # vereinbarte entgelte, hängt von Firmenart ab, currency_id
+        if not aml_ids :
+            return "0.00"
+        else :
+            return "%f0.2" % sum(l.tax_amount for l in aml_obj.browse(cr, uid, aml_ids))
+    # end def kz
+
+    def generate_u30(self, cr , uid, ids, context=None):
+        self.cr  = cr
+        self.uid = uid
+        for period in self.browse(cr, uid, ids) :
+            template_obj  = self.pool.get("xml.template")
+            template_ids  = template_obj.search(cr, uid, [("name", "=", "U30 VAT declaration")])
+            if not template_ids :
+                raise osv.except_osv \
+                    ( _("Customization Error !")
+                    , _("No Template '%s' defined") % template_name
+                    )
+            template_id = template_ids[0]
+            xml = template_obj.generate_xml \
+                (cr, uid
+                , template_id
+                , period   = period
+                , paket_nr = time.strftime("%y%m%d%H")
+                , datum    = time.strftime("%Y-%m-%d")
+                , uhrzeit  = time.strftime("%H:%M:%S")
+                , beginn   = period.date_start[0:7]
+                , ende     = period.date_stop[0:7]
+                , vst      = "000"
+                , are      = "J"
+                , repo     = "J"
+                , kz       = self.kz
+                , tax_nr   = "123456789"
+                )
+            template_obj.attach_xml \
+                ( cr, uid
+                , template_id
+                , attach_to   = period
+                , xml         = xml
+                , name        = period.code + "_U30"
+                , fname       = period.code + "_U30" + ".xml"
+                , description = "U30 VAT declaration for period"
+                , context     = None
+                )
+    # end def generate_u30
+# end class account_period
+account_period()

=== added directory 'account_period_U30_at/i18n'
=== added file 'account_period_U30_at/installer.py'
--- account_period_U30_at/installer.py	1970-01-01 00:00:00 +0000
+++ account_period_U30_at/installer.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+##############################################
+#
+# Swing Entwicklung betrieblicher Informationssysteme GmbH
+# (<http://www.swing-system.com>)
+# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
+# all rights reserved
+#    23-Jan-2013 (GK) created
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs.
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly advised to contract a Free Software
+# Service Company.
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/> or
+# write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA  02111-1.17, USA.
+#
+###############################################
+from osv import fields, osv
+
+class period_u30_installer(osv.osv_memory):
+    _name    = 'account.period.u30.installer'
+    _inherit = 'res.config.installer'
+
+    def execute(self, cr, uid, ids, context=None):
+        self.execute_simple(cr, uid, ids, context)
+        super(period_u30_installer, self).execute(cr, uid, ids, context=context)
+    # end def execute
+
+    def execute_simple(self, cr, uid, ids, context=None) :
+        period_obj = self.pool.get('account.period')
+        period_ids = period_obj.search(cr, uid, [])
+        period_obj.generate_u30(cr, uid, period_ids, context=context)
+    # end def execute_simple
+# end class period_u30_installer
+period_u30_installer()
+

=== added file 'account_period_U30_at/installer_view.xml'
--- account_period_U30_at/installer_view.xml	1970-01-01 00:00:00 +0000
+++ account_period_U30_at/installer_view.xml	2013-07-10 21:51:25 +0000
@@ -0,0 +1,34 @@
+<openerp>
+  <data>
+    <record id="account_period_u30_installer_form" model="ir.ui.view">
+      <field name="name">account.period.u30.installer.form</field>
+      <field name="model">account.period.u30.installer</field>
+      <field name="type">form</field>
+      <field name="inherit_id" ref="base.res_config_installer"/>
+      <field name="arch" type="xml">
+        <data>
+          <form position="attributes">
+            <attribute name="string">Add U30 VAT declaration to account period</attribute>
+          </form>
+          <separator string="title" position="attributes">
+            <attribute name="string">Add U30 VAT decalaration to all account periods</attribute>
+          </separator>
+        </data>
+      </field>
+    </record>
+    <record id="action_account_period_u30_installer" model="ir.actions.act_window">
+      <field name="name">Add U30 VAT declaration to account period</field>
+      <field name="type">ir.actions.act_window</field>
+      <field name="res_model">account.period.u30.installer</field>
+      <field name="view_id" ref="account_period_u30_installer_form"/>
+      <field name="view_type">form</field>
+      <field name="view_mode">form</field>
+      <field name="target">new</field>
+    </record>
+    <record id="account_period_U30_installer_todo" model="ir.actions.todo">
+      <field name="action_id" ref="action_account_period_u30_installer"/>
+      <field name="type">automatic</field>
+    </record>
+  </data>
+</openerp>
+

=== added directory 'account_reconcile_constraint'
=== added file 'account_reconcile_constraint/__init__.py'
--- account_reconcile_constraint/__init__.py	1970-01-01 00:00:00 +0000
+++ account_reconcile_constraint/__init__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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/>.
+#
+##############################################################################
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
+import account_move_line

=== added file 'account_reconcile_constraint/__openerp__.py'
--- account_reconcile_constraint/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_reconcile_constraint/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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" : "Reconcile reconcile accounts",
+    "version" : "1.1",
+    "author" : "Camptocamp SA",
+    "category": 'Accounting & Finance',
+    'complexity': "normal",
+    "description": """
+Allow reconciliation only for accounts marked to be reconciled
+
+    """,
+    'website': 'http://www.camptocamp.com',
+    "depends" : ["account"],
+    'init_xml': [],
+    'update_xml': [],
+    'demo_xml': [],
+    'installable': True,
+    'auto_install': False,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'account_reconcile_constraint/account_move_line.py'
--- account_reconcile_constraint/account_move_line.py	1970-01-01 00:00:00 +0000
+++ account_reconcile_constraint/account_move_line.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2012-2012 Camptocamp Austria (<http://www.camptocamp.at>)
+#
+#    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/>.
+#
+##############################################################################
+
+# FIXME remove logger lines or change to debug
+ 
+from osv import fields, osv
+from tools.translate import _
+import logging
+
+class account_move_line(osv.osv):
+    _inherit = 'account.move.line'
+    _logger = logging.getLogger(__name__)
+    
+    def _reconcile(self, cr, uid, ids, context=None):
+        for l in self.browse(cr, uid, ids, context):
+            r = True
+            if l.reconcile_id and not l.account_id.reconcile:
+		r = False
+        return r
+    
+    def _new_constraints(self, cr, uid, ids, context=None):
+        self._logger.debug('constraints start')
+        model_obj = self.pool.get('ir.model')
+        model_ids = model_obj.search(cr, uid, [('name','=','account.move.line')])
+        constraints = []
+        for m in model_obj.browse(cr, uid, model_ids):
+            if m._constraints:
+                constraints = m._constraints   
+                self._logger.debug('constraints %s', constraints)
+        s = "(_reconcile,_('You must not reconcile moves on account '),['reconcile_id'])"
+        self._logger.debug('constraints string %s', s)
+        constraints.append(s)
+        self._logger.info('new constraints %s', constraints)
+        return constraints
+ 
+# FIXME       
+#    _constraints = _new_constraints
+    _constraints = [(_reconcile,_('You must not reconcile moves on account'),['reconcile_id'])]
+
+    
+account_move_line()

=== added directory 'all_apps'
=== added file 'all_apps/__init__.py'
--- all_apps/__init__.py	1970-01-01 00:00:00 +0000
+++ all_apps/__init__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
+#
+#    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/>.     
+#
+##############################################################################
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'all_apps/__openerp__.py'
--- all_apps/__openerp__.py	1970-01-01 00:00:00 +0000
+++ all_apps/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
+#
+#    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': 'All apps',
+    'version': '1.0',
+    'category': 'Others',
+    'description': """
+installs all apps
+""",
+    'author': 'Camptocamp Austria',
+    'depends': [
+"account_accountant"
+,"account_voucher"
+,"base_calendar"
+,"contacts"
+,"crm"
+,"event"
+,"hr"
+,"hr_evaluation"
+,"hr_expense"
+,"hr_holidays"
+,"hr_recruitment"
+,"hr_timesheet_sheet"
+,"mail"
+,"mrp"
+,"note"
+,"point_of_sale"
+,"project"
+,"project_gtd"
+,"project_issue"
+,"purchase"
+,"sale"
+,"stock"
+     ],
+    'update_xml': [],
+    'demo_xml': [],
+    'installable': True,
+    'active': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'analytic_user_function_project/__openerp__.py'
--- analytic_user_function_project/__openerp__.py	2012-12-20 15:30:00 +0000
+++ analytic_user_function_project/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -28,9 +28,10 @@
 """
 , 'author'      : 'Camptocamp'
 , 'depends'     : [ 'analytic_user_function','project_timesheet' ]
-, 'update_xml'  : ['analytic_user_function_view.xml']
+, 'update_xml'  : ['analytic_user_function_view.xml','security/ir.model.access.csv']
 , 'demo_xml'    : []
 , 'installable' : True
+, 'application'  : False 
 , 'active'      : False
 }
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'analytic_user_function_project/analytic_user_function_view.xml'
--- analytic_user_function_project/analytic_user_function_view.xml	2011-12-30 06:08:13 +0000
+++ analytic_user_function_project/analytic_user_function_view.xml	2013-07-10 21:51:25 +0000
@@ -9,7 +9,7 @@
             <field name="type">form</field>
             <field name="inherit_id" ref="project.edit_project"/>
             <field name="arch" type="xml">
-                <xpath expr="/form/notebook/page" position="after">
+                <xpath expr="/form/sheet/notebook/page" position="after">
                     <page string="Users/Products Rel.">
                         <field name="user_product_ids" colspan="4" nolabel="1"/>
                     </page>

=== modified file 'analytic_user_function_project/hr_timesheet.py'
--- analytic_user_function_project/hr_timesheet.py	2011-12-30 08:06:54 +0000
+++ analytic_user_function_project/hr_timesheet.py	2013-07-10 21:51:25 +0000
@@ -50,13 +50,13 @@
           cr.execute("""
 update account_analytic_line a set product_id = (select product_id from analytic_user_funct_grid where user_id = a.user_id and account_id = a.account_id)
  where invoice_id is null and to_invoice is not null and product_id is not null
-   and id in (select id from account_analytic_line where invoice_id is null and to_invoice is not null and product_id is not null )
+   --and id in (select id from account_analytic_line where invoice_id is null and to_invoice is not null and product_id is not null )
    and account_id in (select account_id from analytic_user_funct_grid);
 """)
           cr.execute("""
 update account_analytic_line a set amount = (select -a.unit_amount * standard_price from product_product p, product_template t where p.id =  a.product_id and t.id = p.product_tmpl_id)
  where invoice_id is null and to_invoice is not null and product_id is not null and unit_amount is not null
-   and id in (select id from account_analytic_line where invoice_id is null and to_invoice is not null and product_id is not null )
+   --and id in (select id from account_analytic_line where invoice_id is null and to_invoice is not null and product_id is not null )
    and account_id in (select account_id from analytic_user_funct_grid);
 """)
 

=== added directory 'analytic_user_function_project/security'
=== added file 'analytic_user_function_project/security/ir.model.access.csv'
--- analytic_user_function_project/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ analytic_user_function_project/security/ir.model.access.csv	2013-07-10 21:51:25 +0000
@@ -0,0 +1,11 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_analytic_user_funct_grid_all,analytic user funct grid,analytic_user_function.model_analytic_user_funct_grid,project.group_project_user,1,0,0,0
+hr_employee_all,hr_employee_all,hr.model_hr_employee,project.group_project_user,1,0,0,0
+product_all,product_all,product.model_product_product,project.group_project_user,1,0,0,0
+product_templ_all,product_templ_all,product.model_product_template,project.group_project_user,1,0,0,0
+product_suppl_all,product_suppl_all,product.model_product_supplierinfo,project.group_project_user,1,0,0,0
+product_price_type_all,product_price_type_all,product.model_product_price_type,project.group_project_user,1,0,0,0
+product_product_uom_all,product_uom_all,product.model_product_uom,project.group_project_user,1,0,0,0
+account_analytic_line_all,account_analytic_line_all,analytic.model_account_analytic_line,project.group_project_user,1,1,1,1
+hr_anlytic_timesheet_all,hr_anlytic_timesheet_all,hr_timesheet.model_hr_analytic_timesheet,project.group_project_user,1,1,1,1
+

=== modified file 'base_ordered/ordered.py'
--- base_ordered/ordered.py	2012-12-20 15:30:00 +0000
+++ base_ordered/ordered.py	2013-07-10 21:51:25 +0000
@@ -54,3 +54,9 @@
 
 account_invoice()
 
+class account_fiscalyear(osv.osv):
+    _inherit = "account.fiscalyear"
+    _order = 'date_start desc, id desc'
+
+account_fiscalyear()
+

=== modified file 'base_partner_contact/__openerp__.py'
--- base_partner_contact/__openerp__.py	2012-12-20 15:30:00 +0000
+++ base_partner_contact/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -30,7 +30,7 @@
     """,
     "depends" : ["base"],
     "init_xml" : [ ],
-    "demo_xml" : [ ],
+    "demo"     : [ ],
     "update_xml" : [ "partner_view.xml", "security/ir.model.access.csv", ],
     "installable": True
 }

=== modified file 'base_partner_contact/partner.py'
--- base_partner_contact/partner.py	2012-10-14 17:12:13 +0000
+++ base_partner_contact/partner.py	2013-07-10 21:51:25 +0000
@@ -47,28 +47,35 @@
         # this is for partner - alphabetical address book - sort
         res = {}
         for partner in self.browse(cr, uid, ids, context):
+            if partner.name and not partner.last_name:
+                l_name = partner.name
             if partner.is_company:
-                name = partner.last_name
+                name = partner.last_name or l_name
             else:    
                 first_name = partner.first_name or '' + ' '
                 middle_name = partner.middle_name and ' ' + partner.middle_name  + ' ' or ''
-                last_name = partner.last_name+', '
+                last_name = partner.last_name or l_name +', '
                 title_prefix = ' '+ self._get_title_name(cr,uid, partner.title_prefix_id) + ' '
                 title_postfix = ' ' + self._get_title_name(cr,uid, partner.title_postfix_id)
 
                 name = last_name + first_name + middle_name + title_prefix + title_postfix
                 if name == last_name:
                     name = replace(name, ', ', '')
-            
-            res[partner.id] = name.replace('  ',' ').rstrip(' ').lstrip(' ') # to avoid double spaces
+            if name:            
+                res[partner.id] = name.replace('  ',' ').rstrip(' ').lstrip(' ') # to avoid double spaces
+            else:
+                res[partner.id] = ''
+
         return res
 
     def _compose_full_name(self, cr, uid, ids, name, arg, context=None):
         # this is for Address
         res = {}
         for partner in self.browse(cr, uid, ids, context):
+            if partner.name and not partner.last_name:
+                l_name = partner.name
             if partner.is_company:
-                name = partner.last_name
+                name = partner.last_name or l_name
             else:    
                 salutation = partner.salutation_id and partner.salutation_id.name_address or ''
                 first_name = partner.first_name or ''
@@ -127,6 +134,13 @@
                          set last_name = name
                        where last_name is null;""")
 
+    def create(self, cr, uid, vals, context=None):
+        if vals.get('name') and not vals.get('last_name') or ( vals.get('last_name') and not vals['last_name']):
+            vals['last_name'] = vals['name']
+        res = super(res_partner, self).create(cr, uid, vals, context)
+        return res
+
+
 #    def onchange_name(self, cr, uid, id, is_company = False, name='', first_name='', last_name='', middle_name='', title_prefix_id='', title_postfix_id='', context={}):
 #        vals = {}
 #        vals['is_company'] = is_company

=== modified file 'base_partner_contact/partner_view.xml'
--- base_partner_contact/partner_view.xml	2012-10-14 20:09:42 +0000
+++ base_partner_contact/partner_view.xml	2013-07-10 21:51:25 +0000
@@ -10,7 +10,6 @@
       <field name="arch" type="xml">
       <field name="name" position="replace">
           
-          <field name="is_company"/>
           <field name="salutation_id" attrs="{'invisible':[('is_company','=','1')]}" options='{"quick_create": false}'/>
           <field name="salutation_partner_id" attrs="{'invisible':[('is_company','=','1')]}" options='{"quick_create": false}'/>
           <field name="title_prefix_id" attrs="{'invisible':[('is_company','=','1')]}" domain="[('domain', '=', 'contact')]" options='{"quick_create": false}'/>

=== added directory 'base_vat_check'
=== added file 'base_vat_check/__init__.py'
--- base_vat_check/__init__.py	1970-01-01 00:00:00 +0000
+++ base_vat_check/__init__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
+#
+#    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 base_vat
+import installer
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_vat_check/__openerp__.py'
--- base_vat_check/__openerp__.py	1970-01-01 00:00:00 +0000
+++ base_vat_check/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
+#
+#    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'        : 'VAT check enhanced'
+, 'version'     : '1.0'
+, 'category'    : 'Base'
+, 'description' : """
+This module enhances the VAT check to comply to accounting standards
+
+* save date and the method (vies/checksum) used for checking
+* automatically save the company name associated with the VAT-ID
+** at least some German VAT numbers return '---' as company name !!!
+
+"""
+, 'author'      : 'Camptocamp Austria'
+, 'depends'     : [ 'base_vat' ]
+, 'update_xml'  : ['base_vat_view.xml', 'installer_view.xml']
+, 'demo_xml'    : []
+, 'installable' : True
+, 'active'      : False
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_vat_check/base_vat.py'
--- base_vat_check/base_vat.py	1970-01-01 00:00:00 +0000
+++ base_vat_check/base_vat.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,108 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2012 OpenERP SA (<http://openerp.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU 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 General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from osv import osv, fields
+from tools.translate import _
+import time
+from urllib import getproxies
+
+class res_partner(osv.osv):
+    _inherit = 'res.partner'
+    _sel = [('vies','VIES'),('simple','Simple'),('none','Not Checked')]
+    _columns = \
+        { 'vat_subjected'     : fields.boolean('VAT Legal Statement', help="Check this box if the partner is subjected to the VAT. It will be used for the VAT legal statement.")
+        , 'vat_method'        : fields.selection(_sel, 'VAT Method', readonly=True, help="""'VIES' checks using http://ec.europa.eu/taxation_customs/vies, 'Simple' calculates checksum for specific countries""")
+        , 'vat_check_date'    : fields.datetime('VAT Check Date', readonly=True)
+        , 'vat_check_name'    : fields.char('VAT Check Name', size=256, readonly=True)
+        , 'vat_check_address' : fields.text('VAT Check Address', readonly=True)
+        }
+
+    def check_vat(self, cr, uid, ids, context=None):
+        #res = super(res_partner, self).check_vat(cr, uid, ids, context=None)
+        res = True
+        self.check_vat_ext(cr, uid, ids, context=None)
+        return res
+
+    def check_vat_ext(self, cr, uid, ids, context):
+        if not context:
+            context = {}
+        vat = ''
+        if context.get('vat'):
+            if context['vat'] != 'none':
+                vat = context['vat'].replace(" ","")
+        else:
+            for partner in self.browse(cr, uid, ids, context):
+                if partner.vat:
+                    vat = partner.vat.replace(" ","")
+        method = 'none'
+        date_now = time.strftime('%Y-%m-%d %H:%M:%S')
+        name = ""
+        address = ""
+        if vat:
+            vat = vat.replace(' ','')
+            vat_mod = False
+            user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
+            if user_company.vat_check_vies:
+                try:
+                    from suds.client import Client
+                    vat_mod = True
+                except:
+                    raise osv.except_osv(_('Error'), _('import module "suds" failed - check VIES needs this module'))
+
+            check = False
+            if vat_mod:
+                try:
+                    client = Client("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl";, proxy=getproxies())
+                    res = client.service.checkVat(countryCode=vat[:2], vatNumber=vat[2:])
+
+                    check = bool(res["valid"])
+                    if check :
+                        #date_now = res["requestDate"]
+                        name = res["name"]
+                        address = res["address"]
+                        method = 'vies'
+                    else:
+                        raise osv.except_osv(_('VIES Error'), _('VIES check failed "%s"') % vat)
+                except:
+                    raise osv.except_osv(_('VIES Error'), _('General Error: connection timeout for "%s"') % vat)
+
+            else:
+                vat_country, vat_number = self._split_vat(vat)
+                if self.simple_vat_check(cr, uid, vat_country, vat_number, context=context):
+                    method = 'simple'
+                else:
+                    raise osv.except_osv(_('Error'), _('simple VAT check digit failed'))
+        vals = {'vat_method': method, 'vat_check_date': date_now, 'vat_check_name' : name, 'vat_check_address' : address, 'vat' : vat}
+        self.write(cr, uid, ids, vals)
+        return vals
+
+    def vat_change(self, cr, uid, ids, value, context=None):
+        res = super(res_partner, self).vat_change(cr, uid, ids, value, context=None)   
+
+        if not context:
+            context = {}
+        context['vat'] = value or 'none'
+        vals = self.check_vat_ext(cr, uid, ids, context)  
+        res['value'].update(vals)
+        return res
+
+res_partner()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'base_vat_check/base_vat_view.xml'
--- base_vat_check/base_vat_view.xml	1970-01-01 00:00:00 +0000
+++ base_vat_check/base_vat_view.xml	2013-07-10 21:51:25 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+  <data>
+    <record id="view_partner_vat_check_form" model="ir.ui.view">
+      <field name="name">res.partner.vat.check.inherit</field>
+      <field name="model">res.partner</field>
+      <field name="inherit_id" ref="base_vat.view_partner_form"/>
+      <field name="arch" type="xml">
+        <field name="vat_subjected" position="after">
+          <field name="vat_method"/>
+          <field name="vat_check_date"/>
+          <newline/>
+          <field name="vat_check_name" colspan="4"/>
+          <newline/>
+          <field name="vat_check_address" colspan="4"/>
+        </field>
+      </field>
+    </record>
+  </data>
+</openerp>
+

=== added directory 'base_vat_check/i18n'
=== added file 'base_vat_check/i18n/base_vat_check.pot'
--- base_vat_check/i18n/base_vat_check.pot	1970-01-01 00:00:00 +0000
+++ base_vat_check/i18n/base_vat_check.pot	2013-07-10 21:51:25 +0000
@@ -0,0 +1,48 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* base_vat_check
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-11-16 21:45+0000\n"
+"PO-Revision-Date: 2012-11-16 21:45+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: base_vat_check
+#: selection:res.partner,vat_method:0
+msgid "Simple"
+msgstr ""
+
+#. module: base_vat_check
+#: field:res.partner,vat_method:0
+msgid "VAT Method"
+msgstr ""
+
+#. module: base_vat_check
+#: field:res.partner,vat_check_date:0
+msgid "VAT Check Date"
+msgstr ""
+
+#. module: base_vat_check
+#: help:res.partner,vat_method:0
+msgid ""
+"'VIES' checks using http://ec.europa.eu/taxation_customs/vies, 'Simple' "
+"calculates checksum for specific countries"
+msgstr ""
+
+#. module: base_vat_check
+#: model:ir.model,name:base_vat_check.model_res_partner
+msgid "Partner"
+msgstr ""
+
+#. module: base_vat_check
+#: selection:res.partner,vat_method:0
+msgid "VIES"
+msgstr ""

=== added file 'base_vat_check/i18n/de.po'
--- base_vat_check/i18n/de.po	1970-01-01 00:00:00 +0000
+++ base_vat_check/i18n/de.po	2013-07-10 21:51:25 +0000
@@ -0,0 +1,47 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* base_vat_check
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-11-16 21:45+0000\n"
+"PO-Revision-Date: 2012-11-16 21:45+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: base_vat_check
+#: selection:res.partner,vat_method:0
+msgid "Simple"
+msgstr "Simple"
+
+#. module: base_vat_check
+#: field:res.partner,vat_method:0
+msgid "VAT Method"
+msgstr "UID Methode"
+
+#. module: base_vat_check
+#: field:res.partner,vat_check_date:0
+msgid "VAT Check Date"
+msgstr "UID Prüfdatum"
+
+#. module: base_vat_check
+#: help:res.partner,vat_method:0
+msgid "'VIES' checks using http://ec.europa.eu/taxation_customs/vies, 'Simple' calculates checksum for specific countries"
+msgstr "'VIES' prüft mit http://ec.europa.eu/taxation_customs/vies, 'Simple' berechnet die Prüfziffer für einige Länder"
+
+#. module: base_vat_check
+#: model:ir.model,name:base_vat_check.model_res_partner
+msgid "Partner"
+msgstr "Partner"
+
+#. module: base_vat_check
+#: selection:res.partner,vat_method:0
+msgid "VIES"
+msgstr "VIES"
+

=== added file 'base_vat_check/installer.py'
--- base_vat_check/installer.py	1970-01-01 00:00:00 +0000
+++ base_vat_check/installer.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+##############################################
+#
+# Swing Entwicklung betrieblicher Informationssysteme GmbH
+# (<http://www.swing-system.com>)
+# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
+# all rights reserved
+#    22-JUN-2013 (GK) created
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs.
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly advised to contract a Free Software
+# Service Company.
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/> or
+# write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA  02111-1.17, USA.
+#
+###############################################
+from osv import fields, osv
+    
+class base_vat_installer(osv.osv_memory):
+    _name    = 'res.partner.base_vat.installer'
+    _inherit = 'res.config.installer'
+
+    def execute(self, cr, uid, ids, context=None):
+        self.execute_simple(cr, uid, ids, context)
+        super(base_vat_installer, self).execute(cr, uid, ids, context=context)
+    # end def execute
+
+    def execute_simple(self, cr, uid, ids, context=None) :
+        partner_obj = self.pool.get('res.partner')
+        for partner in partner_obj.browse(cr, uid, partner_obj.search(cr, uid, [("vat", "!=", None)])) :
+            partner_obj.check_vat_ext(cr, uid, [partner.id], context)
+    # end def execute_simple
+base_vat_installer()
+

=== added file 'base_vat_check/installer_view.xml'
--- base_vat_check/installer_view.xml	1970-01-01 00:00:00 +0000
+++ base_vat_check/installer_view.xml	2013-07-10 21:51:25 +0000
@@ -0,0 +1,34 @@
+<openerp>
+  <data>
+    <record id="base_vat_installer_form" model="ir.ui.view">
+      <field name="name">res.partner.base_vat.installer.form</field>
+      <field name="model">res.partner.base_vat.installer</field>
+      <field name="type">form</field>
+      <field name="inherit_id" ref="base.res_config_installer"/>
+      <field name="arch" type="xml">
+        <data>
+          <form position="attributes">
+            <attribute name="string">Checking all VATs with VIES</attribute>
+          </form>
+          <separator string="title" position="attributes">
+            <attribute name="string">Checking all VATs with VIES (please be patient)</attribute>
+          </separator>
+        </data>
+      </field>
+    </record>
+    <record id="action_base_vat_installer" model="ir.actions.act_window">
+      <field name="name">Checking all VATs with VIES</field>
+      <field name="type">ir.actions.act_window</field>
+      <field name="res_model">res.partner.base_vat.installer</field>
+      <field name="view_id" ref="base_vat_installer_form"/>
+      <field name="view_type">form</field>
+      <field name="view_mode">form</field>
+      <field name="target">new</field>
+    </record>
+    <record id="base_vat_installer_todo" model="ir.actions.todo">
+      <field name="action_id" ref="action_base_vat_installer"/>
+      <field name="type">automatic</field>
+    </record>
+  </data>
+</openerp>
+

=== modified file 'c2c_account_closing_remarks/account_view.xml'
--- c2c_account_closing_remarks/account_view.xml	2011-11-20 16:33:45 +0000
+++ c2c_account_closing_remarks/account_view.xml	2013-07-10 21:51:25 +0000
@@ -7,7 +7,7 @@
       <field name="model">account.closing.text</field>
       <field name="type">tree</field>
       <field name="arch" type="xml">
-        <tree>
+        <tree string="Closing Text">
           <field name="company_id"/>
           <field name="account_id"/>
           <field name="fiscalyear_id"/>
@@ -20,7 +20,7 @@
       <field name="model">account.closing.text</field>
       <field name="type">form</field>
       <field name="arch" type="xml">
-        <form>
+        <form string="Closing Text">
           <field name="account_id" colspan="4"/>
           <field name="fiscalyear_id"/>
           <field name="company_id"/>
@@ -82,8 +82,8 @@
       <field name="priority" eval="10"/>
       <field name="type">form</field>
       <field name="arch" type="xml">
-        <notebook>
-          <page string="Closing text">
+        <field name="note" position="after">
+          <group string="Closing text">
             <field colspan="4" name="account_closing_remark_ids" nolabel="1">
               <form>
                 <field name="company_id"/>
@@ -97,8 +97,8 @@
                 <field name="closing_text"/>
               </tree>
             </field>
-          </page>
-        </notebook>
+          </group>
+       </field>
       </field>
     </record>
   </data>

=== modified file 'c2c_account_interest/interest_view.xml'
--- c2c_account_interest/interest_view.xml	2012-02-07 20:03:13 +0000
+++ c2c_account_interest/interest_view.xml	2013-07-10 21:51:25 +0000
@@ -8,7 +8,7 @@
       <field name="type">tree</field>
       <field name="arch" type="xml">
         <tree string="Intrest Rates" editable="bottom">
-          <field name="name" select="1"/>
+          <field name="name" />
           <field name="company_id"/>
         </tree>
       </field>
@@ -20,20 +20,20 @@
       <field name="type">form</field>
       <field name="arch" type="xml">
         <form string="Interst Rates">
-          <field name="name" select="1"/>
+          <field name="name" />
           <field name="company_id"/>
-          <field name="interest_rate_ids" nolabel="1" select="1" colspan="4">
+          <field name="interest_rate_ids" nolabel="1"  colspan="4">
             <tree string="Interest Rates" editable="bottom">
-              <field name="date_from" select="1"/>
-              <field name="date_to" select="1"/>
-              <field name="interest_rate_debit" select="1"/>
-              <field name="interest_rate_credit" select="1"/>
+              <field name="date_from" />
+              <field name="date_to" />
+              <field name="interest_rate_debit" />
+              <field name="interest_rate_credit" />
             </tree>
             <form string="Interest Rates">
-              <field name="date_from" select="1"/>
-              <field name="date_to" select="1"/>
-              <field name="interest_rate_debit" select="1"/>
-              <field name="interest_rate_credit" select="1"/>
+              <field name="date_from" />
+              <field name="date_to" />
+              <field name="interest_rate_debit" />
+              <field name="interest_rate_credit" />
             </form>
           </field>
         </form>
@@ -58,8 +58,9 @@
       <field name="priority" eval="20"/>
       <field name="type">form</field>
       <field name="arch" type="xml">
-        <notebook>
-          <page string="Interest Rates">
+         <field name="note" position="after">
+       
+          <group string="Interest Rates">
             <separator colspan="4" string="General interest rates"/>
             <field colspan="4" name="account_interest_ids" nolabel="1"/>
             <separator colspan="4" string="Account specific interest rates"/>
@@ -80,8 +81,8 @@
                 <field name="company_id"/>
               </tree>
             </field>
-          </page>
-        </notebook>
+          </group>
+        </field>
       </field>
     </record>
   </data>

=== modified file 'c2c_account_payment_extension/__init__.py'
--- c2c_account_payment_extension/__init__.py	2012-06-09 14:31:08 +0000
+++ c2c_account_payment_extension/__init__.py	2013-07-10 21:51:25 +0000
@@ -30,7 +30,9 @@
 # 59 Temple Place - Suite 330, Boston, MA  02111-1.17, USA.
 #
 ###############################################
+import payment_type
 import payment_mode
+import payment_order
 import res_partner
 import account_invoice
 import account_move_line

=== modified file 'c2c_account_payment_extension/__openerp__.py'
--- c2c_account_payment_extension/__openerp__.py	2012-06-09 14:42:52 +0000
+++ c2c_account_payment_extension/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -1,11 +1,13 @@
 # -*- coding: utf-8 -*-
 ##############################################
-#
+# based on work of
+# Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
+# Jordi Esteve <jesteve@xxxxxxxxxxxxxxx>
 # Swing Entwicklung betrieblicher Informationssysteme GmbH
 # (<http://www.swing-system.com>)
 # Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
 # all rights reserved
-#    08-JUN-2012 (GK) created
+#    05-May-2013  created
 #
 # WARNING: This program as such is intended to be used by professional
 # programmers who take the whole responsibility of assessing all potential
@@ -39,14 +41,18 @@
 , "category"     : "Accounting & Finance"
 , "depends"      : ["account_payment"]
 , "init_xml"     : []
-, "demo_xml"     : []
+, "demo"         : []
 , "update_xml"   : 
-    [ "payment_mode_view.xml"
+    [ "payment_type_view.xml"
+    , "payment_mode_view.xml"
+    , "payment_order_view.xml"
     , "res_partner_view.xml"
     , "account_invoice_view.xml"
     , "wizard/account_payment_order_view.xml"
+    , "security/ir.model.access.csv"
     ]
 , "test"         : []
 , "auto_install" : False
 , "installable"  : True
+, 'application'  : False
 }

=== modified file 'c2c_account_payment_extension/payment_mode.py'
--- c2c_account_payment_extension/payment_mode.py	2012-06-09 14:31:42 +0000
+++ c2c_account_payment_extension/payment_mode.py	2013-07-10 21:51:25 +0000
@@ -34,7 +34,7 @@
 
 class payment_mode(osv.osv):
     _inherit     = 'payment.mode'
-    _description = 'Payment types'
+    _description = 'Payment Modes'
     _columns     = \
         { 'amount_partner_min'  : fields.float
             ('Minimum Payment', digits=(16, 2), help="Minimum payment per partner")
@@ -42,7 +42,7 @@
             ( 'Require Bank Account'
             , help='Ensure all lines in the payment order have a bank account when proposing lines to be added in the payment order.'
             )
-
+        ,'type': fields.many2one('payment.type', 'Payment type', required=True, help='Select the Payment Type for the Payment Mode.'),
         }
     _defaults = \
         { 'amount_partner_min'   : lambda *a : 100.0

=== added file 'c2c_account_payment_extension/payment_order.py'
--- c2c_account_payment_extension/payment_order.py	1970-01-01 00:00:00 +0000
+++ c2c_account_payment_extension/payment_order.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,317 @@
+# -*- coding: utf-8 -*-
+##############################################
+#
+# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
+# all rights reserved
+#    this work is based on
+#    Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
+#                       Jordi Esteve <jesteve@xxxxxxxxxxxxxxx>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs.
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly advised to contract a Free Software
+# Service Company.
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/> or
+# write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA  02111-1.17, USA.
+#
+###############################################
+from osv import osv, fields
+from tools.translate import _
+import one2many_sorted
+
+class payment_order(osv.osv):
+    _name = 'payment.order'
+    _inherit = 'payment.order'
+  
+#    def _get_type(self, cr, uid, context=None):
+#        if context is None:
+#            context = {}
+#        return context.get('type', 'payable')
+
+    def _get_reference(self, cr, uid, context=None):
+        if context is None:
+            context = {}
+        #type = context.get('type', 'payable')
+        type = 'payable'
+        #model = type == 'payable' and 'payment.order' or 'rec.payment.order'
+        model = 'payment.order' 
+        return self.pool.get('ir.sequence').get(cr, uid, model)
+
+    def _get_period(self, cr, uid, context=None):
+        try:
+            # find() function will throw an exception if no period can be found for
+            # current date. That should not be a problem because user would be notified
+            # but as this model inherits an existing one, once installed it will create 
+            # the new field and try to update existing records (even if there are no records yet)
+            # So we must ensure no exception is thrown, otherwise the module can only be installed
+            # once periods are created.
+            periods = self.pool.get('account.period').find(cr, uid)
+            return periods[0]
+        except Exception, e:
+            return False
+
+#    def _payment_type_name_get(self, cr, uid, ids, field_name, arg, context=None):
+#        result = {}
+#        for rec in self.browse(cr, uid, ids, context):
+#            result[rec.id] = rec.mode and rec.mode.type.name or ""
+#        return result
+
+    def _name_get(self, cr, uid, ids, field_name, arg, context=None):
+        result = {}
+        for rec in self.browse(cr, uid, ids, context):
+            result[rec.id] = rec.reference
+        return result
+    
+    _columns = {
+        'type': fields.selection([
+            ('payable','Payable'),
+            ('receivable','Receivable'),
+            ],'Type', readonly=True, select=True),
+        # invisible field to filter payment order lines by payment type
+        #'payment_type_name': fields.function(_payment_type_name_get, method=True, type="char", size=64, string="Payment type name"),
+        # The field name is necessary to add attachement documents to payment orders
+#        'name': fields.function(_name_get, method=True, type="char", size=64, string="Name"),
+        'create_account_moves': fields.selection([('bank-statement','Bank Statement'),('direct-payment','Direct Payment')],
+                                                 'Create Account Moves',
+                                                 required=True,
+                                                 states={'done':[('readonly',True)]},
+                                                 help='Indicates when account moves should be created for order payment lines. "Bank Statement" '\
+                                                      'will wait until user introduces those payments in bank a bank statement. "Direct Payment" '\
+                                                      'will mark all payment lines as payied once the order is done.'),
+        'period_id': fields.many2one('account.period', 'Period', states={'done':[('readonly',True)]}),
+        'line_ids': one2many_sorted.one2many_sorted('payment.line', 'order_id', 'Payment lines', states={'done': [('readonly', True)]}, \
+                 order = ' partner_id.name, ml_inv_ref.number'),
+    }
+    _defaults = {
+#        'type': _get_type,
+        'reference': _get_reference,
+        'create_account_moves': lambda *a: 'bank-statement',
+        'period_id': _get_period,
+    }
+
+    def cancel_from_done(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+
+        #Search for account_moves
+        remove = []
+        for move in self.browse(cr,uid,ids,context):
+            #Search for any line
+            for line in move.line_ids:
+                if line.payment_move_id:
+                    remove += [ line.payment_move_id.id ]
+        
+        self.pool.get('account.move').button_cancel( cr, uid, remove, context=context)
+        self.pool.get('account.move').unlink(cr, uid, remove, context)
+        self.write( cr, uid, ids, {
+            'state':'cancel'
+        },context=context)
+        return True
+
+    def unlink(self, cr, uid, ids, context=None):
+        pay_orders = self.read(cr, uid, ids, ['state'], context=context)
+        unlink_ids = []
+        for t in pay_orders:
+            if t['state'] in ('draft', 'cancel'):
+                unlink_ids.append(t['id'])
+            else:
+                raise osv.except_osv(_('Invalid action!'), _('You cannot delete payment order(s) which are already confirmed or done!'))
+        result = super(payment_order, self).unlink(cr, uid, unlink_ids, context=context)
+        return result
+    
+    
+    def set_done(self, cr, uid, ids, context=None):
+        result = super(payment_order, self).set_done(cr, uid, ids, context)
+
+        company_currency_id = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.currency_id.id
+
+        for order in self.browse(cr, uid, ids, context):
+            if order.create_account_moves != 'direct-payment':
+                continue
+
+            # This process creates a simple account move with bank and line accounts and line's amount. At the end
+            # it will reconcile or partial reconcile both entries if that is possible.
+
+            move_id = self.pool.get('account.move').create(cr, uid, {
+                'name': '/',
+                'journal_id': order.mode.journal.id,
+                'period_id': order.period_id.id,
+            }, context)
+
+            for line in order.line_ids:
+                if not line.amount:
+                    continue
+
+                if not line.account_id:
+                    raise osv.except_osv(_('Error!'), _('Payment order should create account moves but line with amount %.2f for partner "%s" has no account assigned.') % (line.amount, line.partner_id.name ) )
+
+                currency_id = order.mode.journal.currency and order.mode.journal.currency.id or company_currency_id
+
+#                if line.type == 'payable':
+                line_amount = line.amount_currency or line.amount
+#                else:
+#                   line_amount = -line.amount_currency or -line.amount
+                    
+                if line_amount >= 0:
+                    account_id = order.mode.journal.default_credit_account_id.id
+                else:
+                    account_id = order.mode.journal.default_debit_account_id.id
+                acc_cur = ((line_amount<=0) and order.mode.journal.default_debit_account_id) or line.account_id
+
+                ctx = context.copy()
+                ctx['res.currency.compute.account'] = acc_cur
+                amount = self.pool.get('res.currency').compute(cr, uid, currency_id, company_currency_id, line_amount, context=ctx)
+
+                val = {
+                    'name': line.move_line_id and line.move_line_id.name or '/',
+                    'move_id': move_id,
+                    'date': order.date_done,
+                    'ref': line.move_line_id and line.move_line_id.ref or False,
+                    'partner_id': line.partner_id and line.partner_id.id or False,
+                    'account_id': line.account_id.id,
+                    'debit': ((amount>0) and amount) or 0.0,
+                    'credit': ((amount<0) and -amount) or 0.0,
+                    'journal_id': order.mode.journal.id,
+                    'period_id': order.period_id.id,
+                    'currency_id': currency_id,
+                }
+                
+                amount = self.pool.get('res.currency').compute(cr, uid, currency_id, company_currency_id, line_amount, context=ctx)
+                if currency_id != company_currency_id:
+                    amount_cur = self.pool.get('res.currency').compute(cr, uid, company_currency_id, currency_id, amount, context=ctx)
+                    val['amount_currency'] = -amount_cur
+
+                if line.account_id and line.account_id.currency_id and line.account_id.currency_id.id != company_currency_id:
+                    val['currency_id'] = line.account_id.currency_id.id
+                    if company_currency_id == line.account_id.currency_id.id:
+                        amount_cur = line_amount
+                    else:
+                        amount_cur = self.pool.get('res.currency').compute(cr, uid, company_currency_id, line.account_id.currency_id.id, amount, context=ctx)
+                    val['amount_currency'] = amount_cur
+
+                partner_line_id = self.pool.get('account.move.line').create(cr, uid, val, context, check=False)
+
+                # Fill the secondary amount/currency
+                # if currency is not the same than the company
+                if currency_id != company_currency_id:
+                    amount_currency = line_amount
+                    move_currency_id = currency_id
+                else:
+                    amount_currency = False
+                    move_currency_id = False
+
+                self.pool.get('account.move.line').create(cr, uid, {
+                    'name': line.move_line_id and line.move_line_id.name or '/',
+                    'move_id': move_id,
+                    'date': order.date_done,
+                    'ref': line.move_line_id and line.move_line_id.ref or False,
+                    'partner_id': line.partner_id and line.partner_id.id or False,
+                    'account_id': account_id,
+                    'debit': ((amount < 0) and -amount) or 0.0,
+                    'credit': ((amount > 0) and amount) or 0.0,
+                    'journal_id': order.mode.journal.id,
+                    'period_id': order.period_id.id,
+                    'amount_currency': amount_currency,
+                    'currency_id': move_currency_id,
+                }, context)
+
+                aml_ids = [x.id for x in self.pool.get('account.move').browse(cr, uid, move_id, context).line_id]
+                for x in self.pool.get('account.move.line').browse(cr, uid, aml_ids, context):
+                    if x.state != 'valid':
+                        raise osv.except_osv(_('Error !'), _('Account move line "%s" is not valid') % x.name)
+
+                if line.move_line_id and not line.move_line_id.reconcile_id:
+                    # If payment line has a related move line, we try to reconcile it with the move we just created.
+                    lines_to_reconcile = [
+                        partner_line_id,
+                    ]
+
+                    # Check if payment line move is already partially reconciled and use those moves in that case.
+                    if line.move_line_id.reconcile_partial_id:
+                        for rline in line.move_line_id.reconcile_partial_id.line_partial_ids:
+                            lines_to_reconcile.append( rline.id )
+                    else:
+                        lines_to_reconcile.append( line.move_line_id.id )
+
+                    amount = 0.0
+                    for rline in self.pool.get('account.move.line').browse(cr, uid, lines_to_reconcile, context):
+                        amount += rline.debit - rline.credit
+
+                    currency = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.currency_id
+
+                    if self.pool.get('res.currency').is_zero(cr, uid, currency, amount):
+                        self.pool.get('account.move.line').reconcile(cr, uid, lines_to_reconcile, 'payment', context=context)
+                    else:
+                        self.pool.get('account.move.line').reconcile_partial(cr, uid, lines_to_reconcile, 'payment', context)
+
+                if order.mode.journal.entry_posted:
+                    self.pool.get('account.move').write(cr, uid, [move_id], {
+                        'state':'posted',
+                    }, context)
+
+                self.pool.get('payment.line').write(cr, uid, [line.id], {
+                    'payment_move_id': move_id,
+                }, context)
+
+        return result
+
+payment_order()
+
+   
+class payment_line(osv.osv):
+    _name = 'payment.line'
+    _inherit = 'payment.line'
+
+    def _auto_init(self, cr, context=None):
+        cr.execute("SELECT column_name FROM information_schema.columns WHERE table_name = 'payment_line' and column_name='type'")
+        if cr.fetchone():
+            update_sign = False
+        else:
+            update_sign = True
+        result = super(payment_line, self)._auto_init(cr, context=context)
+
+        if update_sign:
+            # Ensure related store value of field 'type' is updated in the database.
+            # Note that by forcing the update here we also ensure everything is done in the same transaction.
+            # Because addons/__init__.py will execute a commit just after creating table fields.
+            result.sort()
+            for item in result:
+                item[1](cr, *item[2])
+            # Change sign of 'receivable' payment lines
+            cr.execute("UPDATE payment_line SET amount_currency = -amount_currency WHERE type='receivable'")
+        return result
+
+    _columns = {
+        'move_line_id': fields.many2one('account.move.line', 'Entry line', domain="[('reconcile_id','=', False), ('amount_to_pay','!=',0), ('account_id.type','=',parent.type),('payment_type','ilike',parent.payment_type_name or '%')]", help='This Entry Line will be referred for the information of the ordering customer.'),
+        'payment_move_id': fields.many2one('account.move', 'Payment Move', readonly=True, help='Account move that pays this debt.'),
+        'account_id': fields.many2one('account.account', 'Account'),
+        'type': fields.related('order_id','type', type='selection', selection=[('payable','Payable'),('receivable','Receivable')], readonly=True, store=True, string='Type'),
+    }
+
+    def onchange_move_line(self, cr, uid, ids, move_line_id, payment_type, date_prefered, date_scheduled, currency=False, company_currency=False, context=None):
+        # Adds account.move.line name to the payment line communication
+        res = super(payment_line, self).onchange_move_line(cr, uid, ids, move_line_id, payment_type, date_prefered, date_scheduled, currency, company_currency, context)
+        if move_line_id:
+            line = self.pool.get('account.move.line').browse(cr, uid, move_line_id)
+            if line.name != '/':
+                res['value']['communication'] = res['value']['communication'] + '. ' + line.name
+            res['value']['account_id'] = line.account_id.id
+        return res
+
+payment_line()
+ 

=== added file 'c2c_account_payment_extension/payment_order_view.xml'
--- c2c_account_payment_extension/payment_order_view.xml	1970-01-01 00:00:00 +0000
+++ c2c_account_payment_extension/payment_order_view.xml	2013-07-10 21:51:25 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+    <record id="view_payment_order_form_ext1" model="ir.ui.view">
+        <field name="name">payment.order.form.ext1</field>
+        <field name="model">payment.order</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account_payment.view_payment_order_form"/>
+        <field name="arch" type="xml">
+            <field name="mode" position="after">
+                <field name="create_account_moves" />
+                <group colspan="2" col="1" attrs="{'invisible': [('create_account_moves', '=', 'bank-statement')]}">
+                    <field name="period_id" attrs="{'required': [('create_account_moves', '!=', 'bank-statement')]}"/>
+                </group>
+            </field>
+        </field>
+    </record>
+</data>
+</openerp>

=== added file 'c2c_account_payment_extension/payment_type.py'
--- c2c_account_payment_extension/payment_type.py	1970-01-01 00:00:00 +0000
+++ c2c_account_payment_extension/payment_type.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+##############################################
+#
+# Swing Entwicklung betrieblicher Informationssysteme GmbH
+# (<http://www.swing-system.com>)
+# Copyright (C) ChriCar Beteiligungs- und Beratungs- GmbH
+# all rights reserved
+#    08-JUN-2012 (GK) created
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs.
+# End users who are looking for a ready-to-use solution with commercial
+# guarantees and support are strongly advised to contract a Free Software
+# Service Company.
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/> or
+# write to the Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA  02111-1.17, USA.
+#
+###############################################
+from osv import osv, fields
+
+
+class payment_type(osv.osv):
+    _name= 'payment.type'
+    _description= 'Payment type'
+    _columns= {
+        'name': fields.char('Name', size=64, required=True, help='Payment Type', translate=True),
+        'code': fields.char('Code', size=64, required=True, help='Specify the Code for Payment Type'),
+        'suitable_bank_types': fields.many2many('res.partner.bank.type',
+            'bank_type_payment_type_rel',
+            'pay_type_id','bank_type_id',
+            'Suitable bank types'),
+        'active': fields.boolean('Active', select=True),
+        'note': fields.text('Description', translate=True, help="Description of the payment type that will be shown in the invoices"),
+        'company_id': fields.many2one('res.company', 'Company', required=True),
+    }
+    _defaults = {
+        'active': lambda *a: 1,
+        'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id
+    }
+
+payment_type()
+

=== added file 'c2c_account_payment_extension/payment_type_view.xml'
--- c2c_account_payment_extension/payment_type_view.xml	1970-01-01 00:00:00 +0000
+++ c2c_account_payment_extension/payment_type_view.xml	2013-07-10 21:51:25 +0000
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+
+
+<!--************************** PARTNERS - payment type **************************-->
+<!--
+<record model="ir.ui.view" id="view_payment_type_res_partner_form1">
+<field name="name">res.partner.form.payment_type1</field>
+<field name="model">res.partner</field>
+<field name="type">form</field>
+<field name="inherit_id" ref="account.view_partner_property_form"/>
+<field name="priority" eval="20"/>
+<field name="arch" type="xml">
+    <field name="property_account_receivable" position="after">
+	<field name="payment_type_customer" widget="selection"/>
+    </field>
+</field>
+</record>
+
+<record model="ir.ui.view" id="view_payment_type_res_partner_form2">
+<field name="name">res.partner.form.payment_type2</field>
+<field name="model">res.partner</field>
+<field name="type">form</field>
+<field name="inherit_id" ref="account.view_partner_property_form"/>
+<field name="priority" eval="20"/>
+<field name="arch" type="xml">
+    <field name="property_account_payable" position="after">
+	<field name="payment_type_supplier" widget="selection"/>
+    </field>
+</field>
+</record>
+-->
+<!--****************************** PAYMENT TYPE ******************************-->
+<record model="ir.ui.view" id="view_payment_type_tree">
+<field name="name">payment.type.tree</field>
+<field name="model">payment.type</field>
+<field name="type">tree</field>
+<field name="arch" type="xml">
+    <tree string="Payment Type">
+	<field name="name"/>
+	<field name="code"/>
+	<field name="active"/>
+	<field name="company_id" groups="base.group_multi_company"/>
+    </tree>
+</field>
+</record>
+
+<record model="ir.ui.view" id="view_payment_type_form">
+<field name="name">payment.type.form</field>
+<field name="model">payment.type</field>
+<field name="type">form</field>
+<field name="arch" type="xml">
+    <form string="Payment Type">
+	<field name="name" select="1"/>
+	<field name="code" select="1"/>
+	<field name="active" select="1"/>
+	<field name="company_id" select="1" widget='selection' groups="base.group_multi_company"/>
+	<separator string="Description" colspan="4"/>
+	<field name="note" nolabel="1" colspan="4"/>
+	<separator string="Suitable Bank Types" colspan="4"/>
+	<field name="suitable_bank_types" nolabel="1" colspan="4"/>
+    </form>
+</field>
+</record>
+
+<record model="ir.actions.act_window" id="action_payment_type">
+<field name="name">Payment Type</field>
+<field name="res_model">payment.type</field>
+<field name="view_mode">tree,form</field>
+</record>
+
+<menuitem action="action_payment_type" id="menu_action_payment_type" parent="account.menu_configuration_misc"/>
+
+
+<!--****************************** PAYMENT MODE ******************************-->
+<record id="view_payment_mode_form_require_bank_account" model="ir.ui.view">
+<field name="name">payment.mode.form.require_bank_account</field>
+<field name="model">payment.mode</field>
+<field name="type">form</field>
+<field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
+<field name="arch" type="xml">
+    <field name="bank_id" position="before">
+	<field name="type"/>
+    </field>
+</field>
+</record>
+
+</data>
+</openerp>
+

=== added file 'c2c_account_payment_extension/payment_view.xml'
--- c2c_account_payment_extension/payment_view.xml	1970-01-01 00:00:00 +0000
+++ c2c_account_payment_extension/payment_view.xml	2013-07-10 21:51:25 +0000
@@ -0,0 +1,391 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+    <!--************************** PARTNERS - default bank **************************-->
+<!-- defekt FIXME
+    <record model="ir.ui.view" id="view_partner_form1">
+        <field name="name">view.partner.form1</field>
+        <field name="model">res.partner</field>
+        <field name="inherit_id" ref="account.view_partner_property_form"/>
+        <field name="arch" type="xml">
+            <field name="name" position="after">
+                  <field name="default_bank"/>
+            </field>
+        </field>
+    </record>
+
+    <record model="ir.ui.view" id="view_partner_form2">
+        <field name="name">view.partner.form2</field>
+        <field name="model">res.partner</field>
+        <field name="inherit_id" ref="account.view_partner_property_form"/>
+        <field name="arch" type="xml">
+            <tree string="Bank Details" position="inside">
+                <field name="default_bank"/>
+            </tree>
+        </field>
+    </record>
+-->
+    <record model="ir.ui.view" id="view_partner_form3">
+        <field name="name">view.partner.form3 </field>
+        <field name="model">res.partner.bank</field>
+        <field name="inherit_id" ref="base.view_partner_bank_form"/>
+        <field name="arch" type="xml">
+            <field name="bank" position="after">
+                <field name="default_bank"/>
+            </field>
+        </field>
+    </record>
+
+    <record model="ir.ui.view" id="view_partner_bank_tree">
+        <field name="name">view.partner.bank.tree </field>
+        <field name="model">res.partner.bank</field>
+        <field name="inherit_id" ref="base.view_partner_bank_tree"/>
+        <field name="arch" type="xml">
+            <field name="sequence" position="after">
+                <field name="default_bank"/>
+            </field>
+        </field>
+    </record>
+
+
+    <!--************************** PARTNERS - payment type **************************-->
+<!--
+    <record model="ir.ui.view" id="view_payment_type_res_partner_form1">
+        <field name="name">res.partner.form.payment_type1</field>
+        <field name="model">res.partner</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account.view_partner_property_form"/>
+        <field name="priority" eval="20"/>
+        <field name="arch" type="xml">
+            <field name="property_account_receivable" position="after">
+                <field name="payment_type_customer" widget="selection"/>
+            </field>
+        </field>
+    </record>
+
+    <record model="ir.ui.view" id="view_payment_type_res_partner_form2">
+        <field name="name">res.partner.form.payment_type2</field>
+        <field name="model">res.partner</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account.view_partner_property_form"/>
+        <field name="priority" eval="20"/>
+        <field name="arch" type="xml">
+            <field name="property_account_payable" position="after">
+                <field name="payment_type_supplier" widget="selection"/>
+            </field>
+        </field>
+    </record>
+-->
+
+    <!--****************************** PAYMENT TYPE ******************************-->
+        <record model="ir.ui.view" id="view_payment_type_tree">
+        <field name="name">payment.type.tree</field>
+        <field name="model">payment.type</field>
+        <field name="type">tree</field>
+        <field name="arch" type="xml">
+            <tree string="Payment Type">
+                <field name="name"/>
+                <field name="code"/>
+                <field name="active"/>
+                <field name="company_id" groups="base.group_multi_company"/>
+            </tree>
+        </field>
+    </record>
+
+    <record model="ir.ui.view" id="view_payment_type_form">
+        <field name="name">payment.type.form</field>
+        <field name="model">payment.type</field>
+        <field name="type">form</field>
+        <field name="arch" type="xml">
+            <form string="Payment Type">
+                <field name="name" select="1"/>
+                <field name="code" select="1"/>
+                <field name="active" select="1"/>
+                <field name="company_id" select="1" widget='selection' groups="base.group_multi_company"/>
+                <separator string="Description" colspan="4"/>
+                <field name="note" nolabel="1" colspan="4"/>
+                <separator string="Suitable Bank Types" colspan="4"/>
+                <field name="suitable_bank_types" nolabel="1" colspan="4"/>
+            </form>
+        </field>
+    </record>
+<!--
+    <record model="ir.actions.act_window" id="action_payment_type">
+        <field name="name">Payment Type</field>
+        <field name="res_model">payment.type</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,form</field>
+    </record>
+
+    <menuitem action="action_payment_type" id="menu_action_payment_type" parent="account.menu_configuration_misc"/>
+    -->
+
+    <!--****************************** PAYMENT MODE ******************************-->
+    <record id="view_payment_mode_form_require_bank_account" model="ir.ui.view">
+        <field name="name">payment.mode.form.require_bank_account</field>
+        <field name="model">payment.mode</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account_payment.view_payment_mode_form"/>
+        <field name="arch" type="xml">
+            <field name="bank_id" position="before">
+                <field name="require_bank_account"/>
+                <field name="type"/>
+            </field>
+        </field>
+    </record>
+
+
+    <!--****************************** INVOICES ******************************-->
+    <!--Field partner_bank_id in client invoices has a strange domain: domain="[('partner_id.ref_companies', 'in', [company_id])]"-->
+    <record model="ir.ui.view" id="invoice_form3">
+        <field name="name">account.invoice.form3.payment_type</field>
+        <field name="model">account.invoice</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account.invoice_form"/>
+        <field name="arch" type="xml">
+            <field name="partner_bank_id" position="replace">
+                <field domain="[('partner_id', '=', partner_id)]" name="partner_bank_id" on_change="onchange_partner_bank(partner_bank_id)"/>
+            </field>
+        </field>
+    </record>
+
+    <record model="ir.ui.view" id="invoice_form4">
+        <field name="name">account.invoice.form4.payment_type</field>
+        <field name="model">account.invoice</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account.invoice_form"/>
+        <field name="arch" type="xml">
+            <field name="payment_term" position="after">
+                <field domain="[('company_id', '=', company_id)]" name="payment_type" on_change="onchange_payment_type(payment_type, partner_id)" />
+            </field>
+        </field>
+    </record>
+
+    <record model="ir.ui.view" id="invoice_supplier_form2">
+        <field name="name">account.invoice.supplier.form2</field>
+        <field name="model">account.invoice</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account.invoice_supplier_form"/>
+        <field name="arch" type="xml">
+            <field name="payment_term" position="after">
+                <field domain="[('company_id', '=', company_id)]" name="payment_type" on_change="onchange_payment_type(payment_type, partner_id)" />
+            </field>
+        </field>
+    </record>
+
+
+    <!--************ account.move.line extension to show additional fields **********-->
+    <record model="ir.ui.view" id="payments_move_line_tree">
+        <field name="name">account.payments.move.line.tree</field>
+        <field name="model">account.move.line</field>
+        <field name="type">tree</field>
+        <field name="inherit_id" ref="account_payment.view_move_line_tree_wiz"/>
+        <field name="arch" type="xml">
+            <field name="currency_id" position="replace">
+                <field name="currency_id" groups="base.group_extended"/>
+                <field name="reconcile_id"/>
+                <field name="reconcile_partial_id" groups="base.group_extended"/>
+                <field name="state"/>
+                <field name="payment_type"/>
+            </field>
+        </field>
+    </record>
+
+    <record model="ir.ui.view" id="payments_move_line_form">
+        <field name="name">account.payments.move.line.form</field>
+        <field name="model">account.move.line</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account.view_move_line_form"/>
+        <field name="arch" type="xml">
+            <separator string="Reconciliation" position="before">
+                <group col="2" colspan="2">
+                    <separator colspan="2" string="Payment"/>
+                    <field name="payment_type" select="1" widget="selection"/>
+                    <field name="partner_bank_id" domain="[('partner_id','=',partner_id)]"/>
+                    <field name="received_check"/>
+                </group>
+            </separator>
+        </field>
+    </record>
+
+
+    <!--***************************** BANK STATEMENT *********************************-->
+<!--
+    <record id="view_bank_statement_form_ext" model="ir.ui.view">
+        <field name="name">account.bank.statement.form.ext</field>
+        <field name="model">account.bank.statement</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account_payment.view_bank_statement_form"/>
+        <field name="arch" type="xml">
+            <button name="%(account_payment.action_account_populate_statement_confirm)d" position="replace">
+                <button name="%(wizard_populate_statement_ext)d" string="Import payment lines" type="action" attrs="{'invisible':[('state','=','confirm')]}" icon="gtk-execute"/>
+            </button>
+        </field>
+    </record>
+-->
+
+    <!--***************************** PAYMENT ORDER *********************************-->
+    <!-- Filter invoices by payment type. Allow negative payment amounts -->
+    <record id="view_payment_order_form_ext1" model="ir.ui.view">
+        <field name="name">payment.order.form.ext1</field>
+        <field name="model">payment.order</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account_payment.view_payment_order_form"/>
+        <field name="arch" type="xml">
+            <button name="%(account_payment.action_create_payment_order)d" position="replace">
+                <field name="payment_type_name" invisible="1"/>
+                <field name="type"/>
+                <field name="create_account_moves"/>
+                <group colspan="2" col="1" attrs="{'invisible': [('create_account_moves', '=', 'bank-statement')]}">
+                    <field name="period_id" attrs="{'required': [('create_account_moves', '!=', 'bank-statement')]}"/>
+                </group>
+                <button colspan="2" name="%(wizard_populate_payment_ext)d" string="Select invoices to pay/receive payment" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
+            </button>
+        </field>
+    </record>
+
+    <record id="view_payment_order_form_ext2" model="ir.ui.view">
+        <field name="name">payment.order.form.ext2</field>
+        <field name="model">payment.order</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account_payment.view_payment_order_form"/>
+        <field name="arch" type="xml">
+            <field name="move_line_id" position="replace">
+            <group col="6" colspan="4">
+                <field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_scheduled,currency,company_currency,context)" select="1"/>
+                <field name="account_id"/>
+                <field name="payment_move_id"/>
+            </group>
+            </field>
+        </field>
+    </record>
+
+    <record id="view_payment_order_form_cancel" model="ir.ui.view">
+        <field name="name">payment.order.form.cancel</field>
+        <field name="model">payment.order</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account_payment.view_payment_order_form"/>
+        <field name="arch" type="xml">
+            <button name="cancel" position="after">
+                <button name="cancel_from_done" states="done" type="object" string="Cancel" icon="gtk-cancel"/>
+            </button>
+        </field>
+    </record>
+
+    <record id="view_payment_line_form_ext1" model="ir.ui.view">
+        <field name="name">payment.line.ext1</field>
+        <field name="model">payment.line</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="account_payment.view_payment_line_form"/>
+        <field name="arch" type="xml">
+            <field name="move_line_id" position="replace">
+                <!--<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_scheduled,currency,company_currency,context)" select="1"/>-->
+            <group col="6" colspan="4">
+                <field name="move_line_id" on_change="onchange_move_line(move_line_id, False, currency, company_currency)" select="1"/>
+                <field name="account_id"/>
+                <field name="payment_move_id"/>
+            </group>
+            </field>
+        </field>
+    </record>
+
+
+    <!--**************************** PAYABLE PAYMENT ORDER ********************************-->
+    <record id="account_payment.action_payment_order_tree" model="ir.actions.act_window">
+        <field name="name">Pay. payment order</field>
+        <field name="res_model">payment.order</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,form</field>
+        <field name="domain">[('type','=','payable')]</field>
+        <field name="context">{'type':'payable'}</field>
+    </record>
+
+    <!--**************************** RECEIVABLE PAYMENT ORDER ********************************-->
+    <record id="action_rec_payment_order_tree" model="ir.actions.act_window">
+        <field name="name">Rec. payment order</field>
+        <field name="res_model">payment.order</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,form</field>
+        <field name="domain">[('type','=','receivable')]</field>
+        <field name="context">{'type':'receivable'}</field>
+    </record>
+    <menuitem action="action_rec_payment_order_tree" id="menu_action_rec_payment_order_form" parent="account_payment.menu_main_payment" sequence="2"/>
+
+    <!--****************************** PAYMENTS ***********************************-->
+    <record id="view_payments_tree" model="ir.ui.view">
+        <field name="name">Payments</field>
+        <field name="model">account.move.line</field>
+        <field name="field_parent">partner_id</field>
+        <field name="type">tree</field>
+        <field name="priority" eval="20"/>
+        <field name="arch" type="xml">
+            <tree string="Payments" editable="top"
+                        colors="grey:reconcile_id!=0;blue:amount_to_pay==0;red:date_maturity&lt;time.strftime('%%Y-%%m-%%d')">
+                <field name="invoice" readonly="1"/>
+                <field name="partner_id" readonly="1"/>
+                <field name="account_id" readonly="1"/>
+                <field name="debit" readonly="1" sum="Total Debit"/>
+                <field name="credit" readonly="1" sum="Total Credit"/>
+                <field name="amount_to_pay" readonly="1" sum="Total Amount to Pay"/>
+                <field name="payment_type" readonly="1"/>
+                <field name="partner_bank_id" domain="[('partner_id','=',partner_id)]"/>
+                <field name="received_check"/>
+                <field name="date_maturity"/>
+                <field name="move_id" readonly="1"/>
+                <field name="reconcile_id" readonly="1"/>
+                <field name="reconcile_partial_id" readonly="1"/>
+            </tree>
+        </field>
+    </record>
+
+    <record id="view_payments_filter" model="ir.ui.view">
+        <field name="name">Invoice Payments Select</field>
+        <field name="model">account.move.line</field>
+        <field name="type">search</field>
+        <field name="priority" eval="20"/>
+        <field name="arch" type="xml">
+            <search string="Search Invoice Payments">
+               <group col='10' colspan='4'>
+                    <filter icon="terp-sale" string="Receive" domain="[('account_id.type','=','receivable')]" help="Receivable payments"/>
+                    <filter icon="terp-purchase" string="Pay" domain="[('account_id.type','=','payable')]" help="Payable payments"/>
+                    <separator orientation="vertical"/>
+                    <filter icon="terp-dolar_ok!" string="Unreconciled" domain="[('reconcile_id','=',False)]" help="Unreconciled payments"/>
+                    <field name="account_id"/>
+                    <field name="partner_id"/>
+                    <field name="invoice"/>
+                    <field name="date_maturity"/>
+                    <newline/>
+                    <field name="amount_to_pay"/>
+                    <field name="payment_type" widget="selection"/>
+                    <field name="partner_bank_id"/>
+                    <field name="received_check"/>
+               </group>
+           </search>
+        </field>
+    </record>
+
+    <!-- Invoice Payments -->
+    <record model="ir.actions.act_window" id="action_invoice_payments">
+        <field name="name">Invoice payments</field>
+        <field name="res_model">account.move.line</field>
+        <field name="view_type">form</field>
+        <field name="view_id" ref="view_payments_tree"/>
+        <field name="search_view_id" ref="view_payments_filter"/>
+        <field name="domain">[('account_id.type','in',['receivable','payable']),('invoice','&lt;&gt;',False)]</field>
+    </record>
+    <menuitem name="Invoice payments" parent="account_payment.menu_main_payment" action="action_invoice_payments" id="menu_action_invoice_payments" sequence="4"/>
+
+    <!-- Done Payments -->
+    <record model="ir.actions.act_window" id="action_done_payments">
+        <field name="name">Done payments</field>
+        <field name="res_model">account.move.line</field>
+        <field name="view_type">form</field>
+        <field name="view_id" ref="view_payments_tree"/>
+        <field name="search_view_id" ref="view_payments_filter"/>
+        <field name="domain">[('account_id.type','in',['receivable','payable']),('invoice','=',False)]</field>
+    </record>
+    <menuitem name="Done payments" parent="account_payment.menu_main_payment" action="action_done_payments" id="menu_action_done_payments" sequence="5"/>
+
+</data>
+</openerp>

=== added directory 'c2c_account_payment_extension/security'
=== added file 'c2c_account_payment_extension/security/ir.model.access.csv'
--- c2c_account_payment_extension/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ c2c_account_payment_extension/security/ir.model.access.csv	2013-07-10 21:51:25 +0000
@@ -0,0 +1,4 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_payment_type","payment.type","model_payment_type","account_payment.group_account_payment",1,1,1,1
+"access_payment_type_user","payment.type.user","model_payment_type","base.group_user",1,0,0,0
+

=== added file 'c2c_account_payment_extension/wizard/.directory'
--- c2c_account_payment_extension/wizard/.directory	1970-01-01 00:00:00 +0000
+++ c2c_account_payment_extension/wizard/.directory	2013-07-10 21:51:25 +0000
@@ -0,0 +1,5 @@
+[Dolphin]
+SortRole=date
+Timestamp=2013,3,17,18,17,17
+Version=3
+ViewMode=1

=== modified file 'c2c_account_payment_extension/wizard/account_payment_order.py'
--- c2c_account_payment_extension/wizard/account_payment_order.py	2012-10-13 00:35:19 +0000
+++ c2c_account_payment_extension/wizard/account_payment_order.py	2013-07-10 21:51:25 +0000
@@ -51,11 +51,16 @@
 
     def _get_min_balance_default(self, cr, uid, context=None):
         _logger = logging.getLogger(__name__)
-        _logger.info('FGF pay min_balance context %s' % (context))
+        _logger.debug('FGF pay min_balance context %s' % (context))
         min_balance = 0
         order_obj = self.pool.get('payment.order')
-        for order in order_obj.browse(cr, uid, [ context['active_id'] ]):
-            min_balance = order.mode.amount_partner_min
+        order_id = ''
+        min_balance = 0.0
+        if context.get('active_id'):
+           order_id = context['active_id']
+           for order in order_obj.browse(cr, uid, order_id ):
+            if order.mode:
+                min_balance = order.mode.amount_partner_min
         return min_balance
 
 
@@ -70,6 +75,7 @@
         order_obj = self.pool.get('payment.order')
         line_obj  = self.pool.get('account.move.line')
         invoice_obj  = self.pool.get('account.invoice')
+        payment_obj = self.pool.get('payment.line')
         mod_obj   = self.pool.get('ir.model.data')
         obj       = self.browse(cr, uid, ids, context=context)[0]
         payment   = order_obj.browse(cr, uid, context['active_id'], context=context)
@@ -87,8 +93,8 @@
             , ('date_maturity', '<=', obj.duedate)
             , ('date_maturity', '=', False)
             ]
-        _logger.info('FGF pay line domain %s' % (domain))
-        _logger.info('FGF pay line context %s' % (context))
+        _logger.debug('FGF pay line domain %s' % (domain))
+        _logger.debug('FGF pay line context %s' % (context))
         ids = line_obj.search(cr, uid, domain, context=context)
         ids2 = ','.join(map(str,ids))
         sql = """select partner_id, round(sum(debit-credit),2) as balance
@@ -98,15 +104,15 @@
         cr.execute(sql)
         partner_balances = dict(cr.fetchall())
         precision = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')
-        _logger.info('FGF partner_balance %s' % (partner_balances))
+        _logger.debug('FGF partner_balance %s' % (partner_balances))
 
-        _logger.info('FGF pay line ids %s' % (ids))
+        _logger.debug('FGF pay line ids %s' % (ids))
         line_ids = []
         for line in line_obj.browse(cr, uid, ids) :
-            _logger.info('FGF line %s %s ' % (line.id, line.partner_id.name))
-            _logger.info('FGF pay block %s' % (line.invoice.payment_block))
+            _logger.debug('FGF line %s %s ' % (line.id, line.partner_id.name))
+            _logger.debug('FGF pay block %s' % (line.invoice.payment_block))
             if line.invoice.payment_block : continue
-            _logger.info('FGF pay partner block %s' % (line.partner_id.payment_block))
+            _logger.debug('FGF pay partner block %s' % (line.partner_id.payment_block))
             if line.partner_id.payment_block : continue
             # FGF its crazy : 
             #  partner_id.credit always returns 0
@@ -126,14 +132,14 @@
             #balance_to_pay = res and -res[0] or 0
             balance_to_pay = -round(partner_balances[line.partner_id.id],precision)
 
-            _logger.info('FGF pay partner balance %s amount to pay %s balance_to_pay %s Obey %s' % (partner_balance, line.amount_to_pay, balance_to_pay, line.partner_id.payment_obey_balance ))
+            _logger.debug('FGF pay partner balance %s amount to pay %s balance_to_pay %s Obey %s' % (partner_balance, line.amount_to_pay, balance_to_pay, line.partner_id.payment_obey_balance ))
             if (line.partner_id.payment_obey_balance 
                 and obj.balance_filter 
                 and (-partner_balance < obj.min_balance 
                 or balance_to_pay < obj.min_balance) ) : continue 
             elif not line.amount_to_pay > 0: continue
                 
-            _logger.info('FGF pay bank invoice %s, partner %s' % (line.invoice.partner_bank_id, line.invoice and line.invoice.partner_id.bank_ids ))
+            _logger.debug('FGF pay bank invoice %s, partner %s' % (line.invoice.partner_bank_id, line.invoice and line.invoice.partner_id.bank_ids ))
             if (line.invoice and not line.invoice.partner_bank_id):
                 if not line.invoice.partner_id.bank_ids and payment.mode.require_bank_account : 
                     continue
@@ -146,24 +152,49 @@
                             ( _('Data model error ! !')
                             , _('Partner %s has no bank account information') % line.invoice.partner_id.name
                             )
-            _logger.info('FGF ACCEPTED %s' % (line.id))
+            _logger.debug('FGF ACCEPTED %s' % (line.id))
             line_ids.append(line.id)
-        _logger.info('FGF line_ids %s' % (line_ids))
+        _logger.debug('FGF line_ids %s' % (line_ids))
 # End search modification
+        t = None
+        line2bank = line_obj.line2bank(cr, uid, line_ids, t, context)
+## Finally populate the current payment with new lines:
+        for line in line_obj.browse(cr, uid, line_ids, context=context):
+            if payment.date_prefered == "now":
+                #no payment date => immediate payment
+                date_to_pay = False
+            elif payment.date_prefered == 'due':
+                date_to_pay = line.date_maturity
+            elif payment.date_prefered == 'fixed':
+                date_to_pay = payment.date_scheduled
+            
+            payment_obj.create(cr, uid,{
+                    'move_line_id': line.id,
+                    'amount_currency': line.amount_to_pay,
+                    'bank_id': line2bank.get(line.id),
+                    'order_id': payment.id,
+                    'partner_id': line.partner_id and line.partner_id.id or False,
+                    'communication': line.ref or '/',
+                    'date': date_to_pay,
+                    'currency': line.invoice and line.invoice.currency_id.id or False,
+                    'account_id': line.account_id.id,
+
+                }, context=context)
 
 # 
 
         context.update({'line_ids': line_ids})
         model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'view_create_payment_order_lines')], context=context)
         resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
-        return {'name': ('Entry Lines'),
-                'context': context,
-                'view_type': 'form',
-                'view_mode': 'form',
-                'res_model': 'payment.order.create',
-                'views': [(resource_id,'form')],
-                'type': 'ir.actions.act_window',
-                'target': 'new',
-        }
+#        return {'name': ('Entry Lines'),
+#                'context': context,
+#                'view_type': 'form',
+#                'view_mode': 'form',
+#                'res_model': 'payment.order.create',
+#                'views': [(resource_id,'form')],
+#                'type': 'ir.actions.act_window',
+#                'target': 'new',
+#        }
+        return {}
 
 payment_order_create()

=== modified file 'c2c_account_tax_rounding/__openerp__.py'
--- c2c_account_tax_rounding/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_account_tax_rounding/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -42,7 +42,7 @@
        ],
     #'update_xml': ['product_view.xml'],
     'demo_xml': [],
-    'installable': True,
+    'installable': False,
     'active': False,
 }
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'c2c_austria_base/__openerp__.py'
--- c2c_austria_base/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_austria_base/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -35,7 +35,7 @@
  ,"account_chart"
  #,"account_coda"
  ,"account_followup"
- ,"account_invoice_layout"
+ #,"account_invoice_layout"
  ,"account_payment"
  ,"account_voucher"
  ,"analytic"
@@ -44,16 +44,16 @@
  ,"base_calendar"
  ,"base_iban"
 # ,"base_report_creator"
- ,"base_report_designer"
+# ,"base_report_designer"
  ,"base_setup"
- ,"base_tools"
+# ,"base_tools"
  ,"base_vat"
  ,"board"
- ,"caldav"
+# ,"caldav"
  ,"crm"
- ,"crm_caldav"
+# ,"crm_caldav"
  ,"crm_claim"
- ,"crm_fundraising"
+# ,"crm_fundraising"
  ,"crm_helpdesk"
  ,"decimal_precision"
  ,"delivery"
@@ -90,22 +90,22 @@
  ,"project_mrp"
  ,"purchase"
  ,"purchase_requisition"
- ,"report_designer"
+# ,"report_designer"
  ,"report_intrastat"
  ,"resource"
  ,"sale"
  ,"sale_crm"
  ,"sale_journal"
- ,"sale_layout"
+# ,"sale_layout"
  ,"sale_order_dates"
 # ,"thunderbird"
  ,"stock"
  ,"survey"
  ,"warning"
- ,"wiki"
- ,"wiki_faq"
+# ,"wiki"
+# ,"wiki_faq"
  #,"wiki_quality_manual"
- ,"wiki_sale_faq"
+# ,"wiki_sale_faq"
       ],
     'update_xml': [       ],
     #'update_xml': ['product_view.xml'],

=== modified file 'c2c_austria_extension/__openerp__.py'
--- c2c_austria_extension/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_austria_extension/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -35,37 +35,37 @@
 ,"c2c_sequence_fy"
 ,"c2c_process"
 ,"c2c_iban_formatter"
-,"c2c_account_line_change"
+#,"c2c_account_line_change"
 ,"c2c_account_interest"
-,"c2c_account_tax_rounding"
-,"c2c_budget"
+#,"c2c_account_tax_rounding"
+#,"c2c_budget"
 ,"c2c_managment_board"
 ,"c2c_period_yyyymm"
-,"c2c_product_price_unit"
+#,"c2c_product_price_unit"
 ,"c2c_reporting_tools"
-,"c2c_stock_accounting"
-,"c2c_stock_negative"
-,"c2c_stock_track_internal"
+#,"c2c_stock_accounting"
+#,"c2c_stock_negative"
+#,"c2c_stock_track_internal"
 ,"account_analytic_analysis"
 ,"account_analytic_default"
 #,"account_asset"
 #,"account_reporting"
 #,"account_simulation"
-,"analytic_journal_billing_rate"
+#,"analytic_journal_billing_rate"
 ,"analytic_user_function"
 ,"account_financial_report"
 #,"account_payment_extension"
 #,"account_report"
 ,"audittrail"
-,"base_contact"
-,"document_ics"
+#,"base_contact"
+#,"document_ics"
 ,"pad"
-,"project_caldav"
+#,"project_caldav"
 ,"project_issue"
 ,"project_issue_sheet"
-,"project_mailgate"
-,"project_messages"
-,"project_planning"
+#,"project_mailgate"
+#,"project_messages"
+#,"project_planning"
 ,"project_timesheet"
 #,"project_contact"
 ,"chricar_account_analytic"
@@ -73,12 +73,12 @@
 ,"chricar_crm_helpdesk"
 ,"chricar_partner_id_number"
 ,"chricar_partner_parent_companies"
-,"chricar_product_gtin"
-,"chricar_product_image"
-,"chricar_stock_location_product_limited"
-,"chricar_stock_partner_stat"
-,"stock_location"
-,"chricar_partner_layout"
+#,"chricar_product_gtin"
+#,"chricar_product_image"
+#,"chricar_stock_location_product_limited"
+#,"chricar_stock_partner_stat"
+#,"stock_location"
+#,"chricar_partner_layout"
 ],
     'update_xml': [],
     #'update_xml': ['product_view.xml'],

=== modified file 'c2c_austria_payment/__openerp__.py'
--- c2c_austria_payment/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_austria_payment/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -32,7 +32,7 @@
     'depends': [
 "c2c_austria_extension"
 ,"account_payment_edifact"
-,"purchase_payment"
+#,"purchase_payment"
 #,"sale_payment"
 ],
     'update_xml': [],

=== modified file 'c2c_autosearch_check/__openerp__.py'
--- c2c_autosearch_check/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_autosearch_check/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -43,9 +43,10 @@
 , "category"     : "Generic Modules/Base"
 , "depends"      : ["base"]
 , "init_xml"     : ["autosearch_data.xml"]
-, "demo_xml"     : []
+, "demo"         : []
 , "update_xml"   : ["autosearch_view.xml"]
 , "auto_install" : False
 , "installable"  : True
+, 'application'  : False
 }
 

=== modified file 'c2c_budget/__openerp__.py'
--- c2c_budget/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_budget/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -43,7 +43,7 @@
     [ "account"
     , "c2c_reporting_tools"
     , "chricar_account_period_sum"
-    , "report_webkit_chapter_server"
+#    , "report_webkit_chapter_server"
     ]
 , "init_xml" : []
 , "update_xml" : 
@@ -51,8 +51,9 @@
     , "c2c_budget_wizard.xml"
     , "security/ir.model.access.csv"
     , "report_chart.xml"
-    , "wizard/chart.xml"
+#    , "wizard/chart.xml"
     ]
 , "auto_install": False
 , "installable": True
+, 'application'  : False
 }

=== modified file 'c2c_budget/c2c_budget_view.xml'
--- c2c_budget/c2c_budget_view.xml	2012-12-20 15:30:00 +0000
+++ c2c_budget/c2c_budget_view.xml	2013-07-10 21:51:25 +0000
@@ -48,14 +48,14 @@
                         
                                 <form string="Budget">
                                         <group colspan="8" col="8" string="Budget">
-                                                <field name="name" select="1" />
-                                                <field name="code" select="1"/>
+                                                <field name="name"  />
+                                                <field name="code" />
                                                 <newline/>
                                                 <field name="budget_item_id" domain="[('parent_id','=', False)]" />
-                                                <field name="active" select="2"/>
+                                                <field name="active" />
                                                 <newline/>
-                                                <field name="start_date" select="2"/>
-                                                <field name="end_date" select="2"/>
+                                                <field name="start_date" />
+                                                <field name="end_date" />
                                                 <newline/>
                                                 <field name="create_date" />
                                                 <newline/>
@@ -82,14 +82,14 @@
                         
                                 <form string="Budget Versions">
                                         <group colspan="8" col="8" string="Budgets Versions">
-                                                <field name="name" select="1"/>
-                                                <field name="code" select="1"/>
+                                                <field name="name" />
+                                                <field name="code" />
                                                 <newline/>
-                                                <field name="budget_id" select="1" />
+                                                <field name="budget_id"  />
                                                 <field name="currency_id" />
                                                 <newline/>
-                                                <field name="company_id" select="2" groups="base.group_multi_company"/>
-                                                <field name="user_id" select="2"/>
+                                                <field name="company_id"  groups="base.group_multi_company"/>
+                                                <field name="user_id" />
                                             <newline/>
                                                 <field name="ref_date" />
                                                 <field name="create_date" />
@@ -98,7 +98,7 @@
                                         </group>
                                         <notebook>
                                                 <page string="Budget Lines">
-                                                        <field name="budget_line_ids" nolabel="1" mode="tree" select="1" context="{'currency_id':currency_id, 'budget_id':budget_id, 'version_id':active_id}" >
+                                                        <field name="budget_line_ids" nolabel="1" mode="tree"  context="{'currency_id':currency_id, 'budget_id':budget_id, 'version_id':active_id}" >
                                                                 <tree string="Budget Lines" editable="top">        
                                                                         <field name="period_id" context="{'budget_id':parent.budget_id, 'version_id':parent.id}" />
                                                                         <field name="budget_item_id" context="{'budget_id':parent.budget_id, 'version_id':parent.id}" />
@@ -138,13 +138,13 @@
                         
                                 <form string="Budget Items">
                                         <group colspan="8" col="8" string="Budget Items">
-                                                <field name="name" select="1"/>
-                                                <field name="code" select="1"/>
-                                                <newline/>
-                                                <field name="type" select="1" />
-                                                <field name="parent_id" select="2" />
-                                                <newline/>
-                                                <field name="active" select="2"/>
+                                                <field name="name" />
+                                                <field name="code" />
+                                                <newline/>
+                                                <field name="type"  />
+                                                <field name="parent_id"  />
+                                                <newline/>
+                                                <field name="active" />
                                         </group>
                                         <group colspan="8" col="8" string="Reports">
                                                 <field name="sequence" />
@@ -321,11 +321,11 @@
                     <field name="priority" eval="3"/>
                         <field name="arch" type="xml">
                                 <form string="Budget Lines">
-                                        <field name="budget_version_id" select="1"/>
-                                        <field name="period_id" select="1"/>
-                                        <field name="budget_item_id"  domain="[('type', '=', 'normal')]" select="1"/>
-                                        <field name="name" select="1" />
-                                        <field name="analytic_account_id" select="1"/>
+                                        <field name="budget_version_id" />
+                                        <field name="period_id" />
+                                        <field name="budget_item_id"  domain="[('type', '=', 'normal')]" />
+                                        <field name="name"  />
+                                        <field name="analytic_account_id" />
                                         <field name="amount" />
                                         <field name="currency_id" />
                                 </form>
@@ -335,6 +335,7 @@
 
 
             <!-- VIEW: budget analytic line list -->
+<!--
                 <record model="ir.ui.view" id="view_budget_analytic_line_list">
                     <field name="name">c2c_budget.analytic_line.list</field>
                     <field name="model">c2c_budget.analytic_line</field>
@@ -354,7 +355,7 @@
                         </field>
                 </record>        
                 
-
+-->
                 
                 
                 

=== modified file 'c2c_budget/c2c_budget_wizard.xml'
--- c2c_budget/c2c_budget_wizard.xml	2012-12-20 15:30:00 +0000
+++ c2c_budget/c2c_budget_wizard.xml	2013-07-10 21:51:25 +0000
@@ -71,12 +71,13 @@
                 name="budget.advanced_search" 
                             menu="False"                
                 id="wizard_search_budget_lines" />
+<!--
         <menuitem
                         parent = "c2c_budget.menu_budget_c2c"
                         id="menu_wizard_search_budget_lines"
                         action="wizard_search_budget_lines"
                         type="wizard" />
-   
+  --> 
    
            <!-- add a print item in budgets objects to compare versions -->
         <wizard string="Versions Comparing" 

=== modified file 'c2c_budget/wizard/__init__.py'
--- c2c_budget/wizard/__init__.py	2012-12-20 15:30:00 +0000
+++ c2c_budget/wizard/__init__.py	2013-07-10 21:51:25 +0000
@@ -28,11 +28,11 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 ##############################################################################
-import validate_budget_structure
-import budget_by_period
-import budgetlines_from_aa
-import advanced_search
-import compare_versions
-import budget_consolidation
-import budget_vs_reality
-import chart
+#import validate_budget_structure
+#import budget_by_period
+#import budgetlines_from_aa
+#import advanced_search
+#import compare_versions
+#import budget_consolidation
+#import budget_vs_reality
+#import chart

=== modified file 'c2c_budget/wizard/advanced_search.py'
--- c2c_budget/wizard/advanced_search.py	2012-12-20 15:30:00 +0000
+++ c2c_budget/wizard/advanced_search.py	2013-07-10 21:51:25 +0000
@@ -28,7 +28,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 ##############################################################################
-import wizard
+#import wizard
 import pooler
 from tools.misc import UpdateableStr
 
@@ -158,4 +158,4 @@
     }
     
     
-wiz_advanced_search('budget.advanced_search')
\ No newline at end of file
+wiz_advanced_search('budget.advanced_search')

=== modified file 'c2c_budget/wizard/budget_by_period.py'
--- c2c_budget/wizard/budget_by_period.py	2012-12-20 15:30:00 +0000
+++ c2c_budget/wizard/budget_by_period.py	2013-07-10 21:51:25 +0000
@@ -28,7 +28,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 ##############################################################################
-import wizard
+#import wizard
 import pooler
 from tools.misc import UpdateableStr
 

=== modified file 'c2c_budget/wizard/budgetlines_from_aa.py'
--- c2c_budget/wizard/budgetlines_from_aa.py	2012-12-20 15:30:00 +0000
+++ c2c_budget/wizard/budgetlines_from_aa.py	2013-07-10 21:51:25 +0000
@@ -28,7 +28,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 ##############################################################################
-import wizard
+#import wizard
 import pooler
 from osv import osv
 
@@ -179,4 +179,4 @@
 
     }
     
-wiz_budgetlines_from_aa('budgetlines.from.aa')
\ No newline at end of file
+wiz_budgetlines_from_aa('budgetlines.from.aa')

=== modified file 'c2c_budget/wizard/chart.xml'
--- c2c_budget/wizard/chart.xml	2012-01-30 16:59:10 +0000
+++ c2c_budget/wizard/chart.xml	2013-07-10 21:51:25 +0000
@@ -4,7 +4,6 @@
     <record id="view_budget_item_chart" model="ir.ui.view">
       <field name="name">account.analytic.chart.sum.form</field>
       <field name="model">account.analytic.chart.sum</field>
-      <field name="type">form</field>
       <field name="arch" type="xml">
         <form string="Budget Item Charts">
           <group colspan="4">

=== modified file 'c2c_budget/wizard/validate_budget_structure.py'
--- c2c_budget/wizard/validate_budget_structure.py	2012-12-20 15:30:00 +0000
+++ c2c_budget/wizard/validate_budget_structure.py	2013-07-10 21:51:25 +0000
@@ -28,7 +28,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 ##############################################################################
-import wizard
+#import wizard
 from copy import copy
 import pooler
 

=== modified file 'c2c_budget_report/__openerp__.py'
--- c2c_budget_report/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_budget_report/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -47,4 +47,5 @@
     ]
 , "auto_install": False
 , "installable": True
+, 'application'  : False
 }

=== modified file 'c2c_cashbox/__openerp__.py'
--- c2c_cashbox/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_cashbox/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -9,9 +9,10 @@
  , "category"     : "Accounting & Finance"
  , "depends"      : ["account"]
  , "init_xml"     : []
- , "demo_xml"     : []
+ , "demo"         : []
  , "update_xml"   : ["cashbox_view.xml"]
  , "auto_install" : False
  , "installable"  : False
+, 'application'  : False
 }
 

=== modified file 'c2c_iban_formatter/__openerp__.py'
--- c2c_iban_formatter/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_iban_formatter/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -44,8 +44,9 @@
 , "category"    : "Client Modules/Camptocamp"
 , "depends"     : ["base_iban"]
 , "init_xml"    : []
-, "demo_xml"    : []
+, "demo"        : []
 , "update_xml"  : ["iban_view.xml"]
 , "auto_install": False
 , "installable" : True
+, 'application'  : False
 }

=== modified file 'c2c_managment_board/management_board.xml'
--- c2c_managment_board/management_board.xml	2011-11-24 11:16:50 +0000
+++ c2c_managment_board/management_board.xml	2013-07-10 21:51:25 +0000
@@ -38,7 +38,7 @@
     <menuitem
       action="action_report_sale_order_board_tree"
       id="menu_action_report_sale_order_board_tree"
-      parent="board.menu_dasboard"/>
+      parent="base.menu_reporting_dashboard"/>
     <!-- Purchase Order -->
     <record model="ir.ui.view" id="report_purchase_order_board_graph">
       <field name="name">report.purchase.order.board.graph</field>
@@ -76,7 +76,7 @@
     <menuitem
       action="action_report_purchase_order_board_tree"
       id="menu_action_report_purchase_order_board_tree"
-      parent="purchase.menu_purchase_deshboard"/>
+      parent="base.next_id_73"/>
     <!-- Invoices -->
     <record model="ir.ui.view" id="report_invoice_board_graph">
       <field name="name">report.invoice.board.graph</field>
@@ -116,7 +116,7 @@
     <menuitem
       action="action_report_invoice_board_tree"
       id="menu_action_report_invoice_board_tree"
-      parent="account.menu_dashboard_acc"/>
+      parent="account.menu_finance_reporting"/>
     <!-- Finance -->
     <record model="ir.ui.view" id="report_finance_board_graph">
       <field name="name">report.finance.board.graph</field>
@@ -156,6 +156,6 @@
     <menuitem
       action="action_report_finance_board_tree"
       id="menu_action_report_finance_board_tree"
-      parent="account.menu_dashboard_acc"/>
+      parent="account.menu_finance_reporting"/>
   </data>
 </openerp>

=== modified file 'c2c_managment_board/management_board_graph.xml'
--- c2c_managment_board/management_board_graph.xml	2012-01-25 09:01:13 +0000
+++ c2c_managment_board/management_board_graph.xml	2013-07-10 21:51:25 +0000
@@ -31,7 +31,7 @@
       action="open_board_manager"
       icon="terp-graph"
       id="menu_board_manager"
-      parent="account.menu_dashboard_acc"
+      parent="account.menu_finance_accounting"
       sequence="1"/>
   </data>
 </openerp>

=== modified file 'c2c_partner_address_label/__init__.py'
--- c2c_partner_address_label/__init__.py	2012-12-20 15:30:00 +0000
+++ c2c_partner_address_label/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #    Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
@@ -16,7 +16,7 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 

=== modified file 'c2c_partner_address_label/partner.py'
--- c2c_partner_address_label/partner.py	2012-12-20 15:30:00 +0000
+++ c2c_partner_address_label/partner.py	2013-07-10 21:51:25 +0000
@@ -42,7 +42,7 @@
 #    }
 #
 #    def init(self, cr):
-#        # set reasonable values 
+#        # set reasonable values
 #        cr.execute("""update res_country
 #                         set zip_position = 'after'
 #                       where code in ('US')
@@ -60,11 +60,20 @@
 class res_company(osv.osv):
     _inherit = 'res.company'
     _columns = {
-        'company_address_id':fields.many2one('res.partner.address', 'Address for Report Header', domain="[('partner_id', '=', partner_id)]"),
+        'company_address_id':fields.many2one('res.partner', 'Address for Report Header'),
         'address_label_position' : fields.selection([('left','Left'),('right','Right')], string="Address Window Position", help="Position of address window on standard company enevlops. Many reports do not use this yet"),
+        'print_code': fields.boolean('Print Product Code',help="Print product code on invoice, picking, sale order"),
+        'print_address_info': fields.boolean('Print Address Info',help="Print additional address information next ot address field"),
+        'print_cell_borders': fields.boolean('Print Cell Borders',help="Print fine cell borders"),
+        'document_label_position': fields.selection([('left','Left'),('right','Right')], string="Document Label Position", help="Position of address number and date left or right"),
     }
     _defaults = {
         'address_label_position': lambda *a: 'right',
+        'document_label_position': lambda *a: 'right',
+        'print_code': lambda *a: True,
+        'print_address_info': lambda *a: True,
+        'print_cell_borders': lambda *a: True,
+        
     }
 
 res_company()
@@ -72,8 +81,8 @@
 #----------------------------------------------------------
 #  Address
 #----------------------------------------------------------
-class res_partner_address(osv.osv):
-    _inherit = 'res.partner.address'
+class res_partner(osv.osv):
+    _inherit = 'res.partner'
 
     def _address_label(self, cr, uid, ids, name, arg, context=None):
         _logger = logging.getLogger(__name__)
@@ -83,27 +92,32 @@
             _logger.debug('FGF address_label street %s' % (a.street))
             lf ='\n'
 
-            bc = self.pool.get('ir.module.module').search(cr, uid,  [('name', '=', 'base_partner_contact'),('state', '=', 'installed')], context=context)
-            if bc:
-                l = a.partner_id.full_name
+#            bc = self.pool.get('ir.module.module').search(cr, uid,  [('name', '=', 'base_partner_contact'),('state', '=', 'installed')], context=context)
+#            if bc:
+#                l = a.full_name
+#            else:
+#                l = a.name or ''
+#                if a.title:
+#                    l = l + ' ' + a.title.name
+#
+#            bc = self.pool.get('ir.module.module').search(cr, uid,  [('name', '=', 'base_contact'),('state', '=', 'installed')], context=context)
+#
+#            if not bc:
+#                t = ''
+#                if a.title:
+#                    t = a.title.name + ' ' or ''
+#                if a.name:
+#                    t = t + a.name
+#                if t:
+#                    l = l + lf + t
+
+
+
+            if a.parent_id:
+                l = a.parent_id.name + lf + a.name
             else:
-                l = a.partner_id.name or ''
-                if a.partner_id.title:
-                    l = l + ' ' + a.partner_id.title.name
-
-            bc = self.pool.get('ir.module.module').search(cr, uid,  [('name', '=', 'base_contact'),('state', '=', 'installed')], context=context)
-
-            if not bc:
-                t = ''
-                if a.title:
-                    t = a.title.name + ' ' or ''
-                if a.name:
-                    t = t + a.name
-                if t:
-                    l = l + lf + t
-
-            
-            address = self._display_address(cr,uid,a)
+                l = a.name
+            address = self._display_address(cr,uid,a,without_company=True)
             address_compact =''
             for line in address.split('\n'):
                 if line.strip():
@@ -112,52 +126,8 @@
             _logger.debug('FGF address_label %s' % (res[a.id]))
         return res
 
-# new in 6.1 labe_format        
-    def _address_label_old(self, cr, uid, ids, name, arg, context=None):
-        res = {}
-        lf ='\x0A'
-        for a in self.browse(cr, uid, ids, context=context):
-             l = a.partner_id.name or ''
-             if a.partner_id.title:
-                  l = l + ' ' + a.partner_id.title.name
-             t = ''
-             if a.title:
-                  t = a.title.name + ' ' or ''
-             if a.name:
-                  t = t + a.name
-             if t:
-                  l = l + lf + t
-             if a.street:
-                  l = l + lf + a.street
-             if a.street2:
-                  l = l + lf + a.street2
-             z = ''
-             if a.city:
-                  z = a.city
-             if a.zip:
-                  zip_position='before'
-                  if a.country_id.zip_position:
-                      zip_position = a.country_id.zip_position
-                  if zip_position == 'before':
-                      z = a.zip + ' ' + z
-                  if zip_position == 'after':
-                      if a.state_id.code:
-                          z = z + ', ' + a.state_id.code +', '+ a.zip
-                      else:
-                          z = z + ', ' + a.zip
-                  if zip_position == 'below':
-                      z = z + lf + a.zip
-             if z:
-                  l = l +lf + z
-             if a.state_id:
-                  l = l + lf + a.state_id.name
-             if a.country_id:
-                  l = l + lf + a.country_id.name
-             res[a.id] = l
-        return res
-
     _columns = {
         'address_label': fields.function(_address_label, type='text', method = True, string="Address Label"),
     }
-    
-res_partner_address()
+
+res_partner()

=== modified file 'c2c_partner_address_label/partner_view.xml'
--- c2c_partner_address_label/partner_view.xml	2012-03-10 13:50:47 +0000
+++ c2c_partner_address_label/partner_view.xml	2013-07-10 21:51:25 +0000
@@ -3,16 +3,18 @@
   <data>
     <record model="ir.ui.view" id="c2c_res_partner_address_label_form">
       <field name="name">c2c.res.partner.address.label.form</field>
-      <field name="model">res.partner.address</field>
-      <field name="inherit_id" ref="base.view_partner_address_form1"/>
+      <field name="model">res.partner</field>
       <field name="type">form</field>
+      <field name="inherit_id" ref="base.view_partner_form"/>
       <field name="arch" type="xml">
-        <field name="state_id" position="after">
-          <field name="address_label" height="150"/>
-        </field>
+        <page string="Contacts" position="after">
+          <page string="Address Label">
+            <field name="address_label" height="150"/>
+          </page>
+        </page>
       </field>
     </record>
-
+    
  <!-- Country  now uses address_format
     <record model="ir.ui.view" id="c2c_res_country_label_form">
       <field name="name">c2c.res.country.label.form</field>
@@ -44,13 +46,21 @@
       <field name="inherit_id" ref="base.view_company_form"/>
       <field name="type">form</field>
       <field name="arch" type="xml">
-        <page string="Configuration" position="inside">
-          <group colspan="2" col="4">
+        <xpath expr="//page[@string='Configuration']" position="inside">
+
             <separator string="Address Window Position" colspan="4"/>
+<group>
             <field name="company_address_id"  colspan="4"/>
             <field name="address_label_position"/>
-          </group>
-        </page>
+</group>
+            <separator string="Layout Config of partner related documents" colspan="4"/>
+<group>
+            <field name="print_code"/>
+            <field name="print_address_info"/>
+            <field name="print_cell_borders"/>
+            <field name="document_label_position"/>
+</group>
+        </xpath>
       </field>
     </record>
   </data>

=== modified file 'c2c_partner_address_label/report/__init__.py'
--- c2c_partner_address_label/report/__init__.py	2011-08-06 07:32:09 +0000
+++ c2c_partner_address_label/report/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,1 +1,1 @@
-import report_webkit_html
\ No newline at end of file
+import report_webkit_html

=== modified file 'c2c_partner_address_label/report/report_webkit_html.py'
--- c2c_partner_address_label/report/report_webkit_html.py	2011-08-06 07:32:09 +0000
+++ c2c_partner_address_label/report/report_webkit_html.py	2013-07-10 21:51:25 +0000
@@ -12,9 +12,8 @@
             'uid': uid,
             'locale': locale,
         })
-        
+
 report_sxw.report_sxw('report.res.partner.label.test',
                        'res.partner.address',
                        'addons/c2c_partner_address_label/report/report_label_test.mako',
                        parser=report_webkit_html)
-

=== modified file 'c2c_period_yyyymm/__init__.py'
--- c2c_period_yyyymm/__init__.py	2011-06-13 19:28:56 +0000
+++ c2c_period_yyyymm/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
 #
-#    OpenERP, Open Source Management Solution   
+#    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 #    $Id$
 #

=== modified file 'c2c_period_yyyymm/__openerp__.py'
--- c2c_period_yyyymm/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_period_yyyymm/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
 #
-#    OpenERP, Open Source Management Solution   
+#    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 #    $Id$
 #

=== modified file 'c2c_period_yyyymm/period_yyyymm.py'
--- c2c_period_yyyymm/period_yyyymm.py	2012-10-10 19:55:41 +0000
+++ c2c_period_yyyymm/period_yyyymm.py	2013-07-10 21:51:25 +0000
@@ -54,17 +54,19 @@
         cr.execute("""update account_period
                          set name = to_char(date_stop,'YYYYMM'),
                              code = to_char(date_stop,'YYYYMM')
-                            where name = to_char(date_stop,'MM/YYYY')
-                  """)          
+                            where name != to_char(date_stop,'YYYYMM')
+                              and special = False
+                  """)
 
         cr.execute("""update account_period
                          set name = to_char(date_stop,'YYYY') || '00 Opening Period',
                              code = to_char(date_stop,'YYYY') || '00'
-                            where name like 'Opening%'
-                  """)          
-        
+                            where special=True
+
+                  """)
+
         cr.execute("""update ir_sequence
                          set prefix = replace(prefix,'/','-')
-                  """)          
+                  """)
 
 account_fiscalyear()

=== modified file 'c2c_process/__openerp__.py'
--- c2c_process/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_process/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -44,8 +44,9 @@
 , "category"    : "Client Modules/Camptocamp"
 , "depends"     : ["base"]
 , "init_xml"    : []
-, "demo_xml"    : []
+, "demo"        : []
 , "update_xml"  : ["base_view.xml"]
 , "auto_install": False
 , "installable" : True
+, 'application'  : False
 }

=== modified file 'c2c_product_price_unit/__init__.py'
--- c2c_product_price_unit/__init__.py	2012-12-20 15:30:00 +0000
+++ c2c_product_price_unit/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #    Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
@@ -16,7 +16,7 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 

=== modified file 'c2c_product_price_unit/__openerp__.py'
--- c2c_product_price_unit/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_product_price_unit/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -34,7 +34,7 @@
     * price per 1000
     * price in cents ...
 Example: gasoline is quoted 1 liter i= 115,5 cents or 1,115 €
-         diodes 4.99€/1000 Units 
+         diodes 4.99€/1000 Units
 
 The module hides the original price fields and fills these with converted values.
 Advantage - no change of the underlying logic of the base model for computation.
@@ -48,12 +48,12 @@
 * all onchange on product_id must return default price_unit_id (done for SO/PO,INV)
 * all wizards must transfer price_unit_id and unit_price_pu (many do not work now)
 * all "create" must transfer price_unit_id and unit_price_pu
-* defaults for 
-** price_unit_id 
-** price_unit_pu (from price_unit) 
+* defaults for
+** price_unit_id
+** price_unit_pu (from price_unit)
 * functions using price_unit must probably use price_unit_pu
-* c2c_product.price_unit.xml must be loaded in product.py 
-  before running the update statements 
+* c2c_product.price_unit.xml must be loaded in product.py
+  before running the update statements
   currenty the module must be updated immediately to fill price_unit_id
 * Product
 ** Button Udate standard price (average costing)
@@ -72,8 +72,13 @@
 ** Reports
 * Price Lists
     """,
+<<<<<<< TREE
     'author': 'Camptocamp',
     'depends': ['product', 'purchase', 'sale_layout','hr_expense','account_anglo_saxon', 'c2c_stock_accounting' ],
+=======
+    'author': 'Camptocamp Austria',
+    'depends': ['product', 'purchase', 'hr_expense','account_anglo_saxon', 'c2c_stock_accounting' ],
+>>>>>>> MERGE-SOURCE
     'update_xml': ['c2c_product.price_unit.xml',
                    'security/product_security.xml',
                    'security/ir.model.access.csv',

=== modified file 'c2c_product_price_unit/account_invoice.py'
--- c2c_product_price_unit/account_invoice.py	2012-12-20 15:30:00 +0000
+++ c2c_product_price_unit/account_invoice.py	2013-07-10 21:51:25 +0000
@@ -32,13 +32,13 @@
     _logger = logging.getLogger(__name__)
 
     def _get_default_id(self, cr, uid, price_unit_id, context=None):
-       self._logger.debug('invoice pi_id `%s`', price_unit_id)
-       pu = self.pool.get('c2c_product.price.unit')
-       if not pu: return
-       res =  pu.get_default_id(cr, uid, price_unit_id, context) 
-       self._logger.debug('invoice default price_unit_id `%s`', res)
-       return res
-        
+        self._logger.debug('invoice pi_id `%s`', price_unit_id)
+        pu = self.pool.get('c2c_product.price.unit')
+        if not pu: return
+        res =  pu.get_default_id(cr, uid, price_unit_id, context)
+        self._logger.debug('invoice default price_unit_id `%s`', res)
+        return res
+
     _columns = {
         'price_unit_id'    : fields.many2one('c2c_product.price_unit','Price Unit' ),
         'price_unit_pu'    : fields.float(string='Unit Price',digits_compute=dp.get_precision('Sale Price'),  \
@@ -51,47 +51,53 @@
     }
 
     def init(self, cr):
-      cr.execute("""
-          update account_invoice_line set price_unit_pu = price_unit  where price_unit_pu is null;
-      """)
-      cr.execute("""
-          update account_invoice_line set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
-      """)
-      
+        cr.execute("""
+            update account_invoice_line set price_unit_pu = price_unit  where price_unit_pu is null;
+        """)
+        cr.execute("""
+            update account_invoice_line set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
+        """)
+
     def product_id_change_c2c_pu(self, cr, uid, ids, product, uom, qty=0, name='',
-           type=False, partner_id=False, fposition_id=False, price_unit_pu=False, 
+           type=False, partner_id=False, fposition_id=False, price_unit_pu=False,
            address_invoice_id=False, currency_id=False, company_id=None,price_unit_id=None):
-       res = {}
-       self._logger.debug('invoice `%s` `%s`', price_unit_id, price_unit_pu)
-
-       if product :
-           context ={}
-           res['value'] = super(account_invoice_line, self).product_id_change( cr, uid, ids, product, uom, qty, name,
-               type, partner_id, fposition_id, price_unit_pu, address_invoice_id, currency_id, context)['value']
-           prod = self.pool.get('product.product').browse(cr, uid, product)
-           if type in ['out_invoice','out_refund']:
-               price_unit_id = prod.list_price_unit_id.id
-           if not price_unit_id:
-               price_unit_id = prod.price_unit_id.id
-        
-           coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, price_unit_id)
-           price_unit_pu = res['value']['price_unit'] *coeff
-           self._logger.debug('invoice res `%s`', res['value'])
-
-           res['value']['price_unit_id'] = price_unit_id
-           res['value']['price_unit_pu'] = price_unit_pu
-
-       return res
+        res = {}
+        self._logger.debug('invoice `%s` `%s`', price_unit_id, price_unit_pu)
+
+        if product :
+            context ={}
+            res['value'] = super(account_invoice_line, self).product_id_change( cr, uid, ids, product, uom, qty, name,
+                type, partner_id, fposition_id, price_unit_pu, address_invoice_id, currency_id, context)['value']
+            prod = self.pool.get('product.product').browse(cr, uid, product)
+            if type in ['out_invoice','out_refund']:
+                price_unit_id = prod.list_price_unit_id.id
+            if not price_unit_id:
+                price_unit_id = prod.price_unit_id.id
+
+            coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, price_unit_id)
+            price_unit_pu = res['value']['price_unit'] *coeff
+            self._logger.debug('invoice res `%s`', res['value'])
+
+            res['value']['price_unit_id'] = price_unit_id
+            res['value']['price_unit_pu'] = price_unit_pu
+
+        return res
 
     def onchange_price_unit(self, cr, uid, ids, field_name, qty, price_pu, price_unit_id):
         res = {}
         if  price_pu and  price_unit_id and qty:
-           coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, price_unit_id)
-           price = price_pu / float(coeff) 
-           self._logger.debug('invoice res q `%s` `%s` `%s` `%s` `%s`', field_name,qty,price_pu,price_unit_id,price)
-           return {'value': {field_name : price}}
+            coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, price_unit_id)
+            price = price_pu / float(coeff)
+            self._logger.debug('invoice res q `%s` `%s` `%s` `%s` `%s`', field_name,qty,price_pu,price_unit_id,price)
+            return {'value': {field_name : price}}
         return res
 
+    def create(self, cr, uid, vals, context=None, check=True):
+        if not vals.get('price_unit_pu') and vals.get('price_unit'):
+            vals['price_unit_pu'] = vals['price_unit']
+        return super(account_invoice_line, self).create(cr, uid, vals, context=context)
+
+
 account_invoice_line()
 
 
@@ -100,13 +106,13 @@
 
     def _refund_cleanup_lines(self, cr, uid, lines):
         for line in lines:
-          if line.get('price_unit_id'):
+            if line.get('price_unit_id'):
                 line['price_unit_id'] = line['price_unit_id'][0]
         res = super(account_invoice, self)._refund_cleanup_lines(cr, uid, lines)
         if res:
-          resd = res[0][2]
-          resd['price_unit_id'] =  line['price_unit_id']
-          res = [(res[0][0], res[0][1], resd)]
+            resd = res[0][2]
+            resd['price_unit_id'] =  line['price_unit_id']
+            res = [(res[0][0], res[0][1], resd)]
         return res
 
 

=== modified file 'c2c_product_price_unit/hr_expense.py'
--- c2c_product_price_unit/hr_expense.py	2012-12-20 15:30:00 +0000
+++ c2c_product_price_unit/hr_expense.py	2013-07-10 21:51:25 +0000
@@ -40,9 +40,9 @@
 
     def _get_price_unit_id(self, cr, uid, context):
         self._logger.debug('%s', context)
-        return 
+        return
 
-    _columns = { 
+    _columns = {
         'price_unit_id'    : fields.many2one('c2c_product.price_unit','Price Unit'),
         'price_unit_pu'    : fields.float(string='Unit Price',digits_compute=dp.get_precision('Cost Price'),  \
                             help='Price using "Price Units"') ,
@@ -55,18 +55,18 @@
     }
 
     def init(self, cr):
-      cr.execute("""
-          update hr_expense_line set price_unit_pu = unit_amount  where price_unit_pu is null;
-      """)
-      cr.execute("""
-          update hr_expense_line set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
-      """)
+        cr.execute("""
+            update hr_expense_line set price_unit_pu = unit_amount  where price_unit_pu is null;
+        """)
+        cr.execute("""
+            update hr_expense_line set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
+        """)
 
     def onchange_price_unit(self, cr, uid, ids, field_name,price_pu, price_unit_id):
         if  price_pu and  price_unit_id:
-           pu = self.pool.get('c2c_product.price_unit').browse(cr, uid, price_unit_id)
-           price = price_pu / pu.coefficient
-           return {'value': {field_name : price}}
+            pu = self.pool.get('c2c_product.price_unit').browse(cr, uid, price_unit_id)
+            price = price_pu / pu.coefficient
+            return {'value': {field_name : price}}
         return {}
 
 hr_expense_line()

=== modified file 'c2c_product_price_unit/product.py'
--- c2c_product_price_unit/product.py	2012-12-20 15:30:00 +0000
+++ c2c_product_price_unit/product.py	2013-07-10 21:51:25 +0000
@@ -40,24 +40,24 @@
     #def get_coeff(self, cr, uid, price_unit_id):
         if not context:
             context = {}
-        
+
         coeff = 1.0
         if price_unit_id:
-           cr.execute('select coefficient from c2c_product_price_unit where id=%s' , (price_unit_id,))
+            cr.execute('select coefficient from c2c_product_price_unit where id=%s' , (price_unit_id,))
         #res = cr.fetchone()[0] or 1.0
-           coeff = cr.fetchone()[0]
+            coeff = cr.fetchone()[0]
         return coeff
-    
+
     def get_default_id(self, cr, uid, price_unit_id, context=None):
         if context is None:
             context = {}
-        
+
         if not price_unit_id:
-           cr.execute('select min(id) from c2c_product_price_unit where coefficient=1' )
+            cr.execute('select min(id) from c2c_product_price_unit where coefficient=1' )
         #res = cr.fetchone()[0] or 1.0
-           price_unit_id = cr.fetchone()[0] or ''
+            price_unit_id = cr.fetchone()[0] or ''
         return price_unit_id
-     
+
 
 c2c_product_price_unit()
 
@@ -70,9 +70,9 @@
 
 
     def _get_default_id(self, cr, uid, price_unit_id, context=None):
-       pu = self.pool.get('c2c_product.price.unit')
-       if not pu: return
-       return pu.get_default_id(cr, uid, price_unit_id, context)
+        pu = self.pool.get('c2c_product.price.unit')
+        if not pu: return
+        return pu.get_default_id(cr, uid, price_unit_id, context)
 
     _columns = {
         'price_unit_id'    :fields.many2one('c2c_product.price_unit','Price Unit'),
@@ -86,18 +86,18 @@
 
     }
     def init(self, cr):
-      cr.execute("""
-update product_template set standard_price_pu=standard_price  where standard_price_pu is null;
-      """)
-      cr.execute("""
-update product_template set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
-      """)
-      cr.execute("""
-update product_template set list_price_pu=list_price  where list_price_pu is null;
-      """)
-      cr.execute("""
-update product_template set list_price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where list_price_unit_id is null;
-      """)
+        cr.execute("""
+  update product_template set standard_price_pu=standard_price  where standard_price_pu is null;
+        """)
+        cr.execute("""
+  update product_template set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
+        """)
+        cr.execute("""
+  update product_template set list_price_pu=list_price  where list_price_pu is null;
+        """)
+        cr.execute("""
+  update product_template set list_price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where list_price_unit_id is null;
+        """)
 
     _columns = {
         'price_unit_id'    :fields.many2one('c2c_product.price_unit','Price Unit', required=True),
@@ -116,22 +116,22 @@
         'list_price_unit_id'   : _get_default_id,
         'list_price_pu': 0.0,
         'standard_price': 0.0,
- 
-
-    } 
+
+
+    }
     def init(self, cr):
-      cr.execute("""
-update product_template set standard_price_pu=standard_price  where standard_price_pu is null;
-      """)
+        cr.execute("""
+  update product_template set standard_price_pu=standard_price  where standard_price_pu is null;
+        """)
 product_template()
 
 class product_product(osv.osv):
     _inherit = "product.product"
     def onchange_price_unit(self, cr, uid, ids, field_name,price_pu, price_unit_id):
         if  price_pu and  price_unit_id:
-           pu = self.pool.get('c2c_product.price_unit').browse(cr, uid, price_unit_id)
-           price = price_pu / float(pu.coefficient)
-           return {'value': {field_name : price}}
+            pu = self.pool.get('c2c_product.price_unit').browse(cr, uid, price_unit_id)
+            price = price_pu / float(pu.coefficient)
+            return {'value': {field_name : price}}
         return False
 
 product_product()

=== modified file 'c2c_product_price_unit/product_view.xml'
--- c2c_product_price_unit/product_view.xml	2012-08-13 21:14:02 +0000
+++ c2c_product_price_unit/product_view.xml	2013-07-10 21:51:25 +0000
@@ -11,9 +11,9 @@
       <field name="type">form</field>
       <field name="arch" type="xml">
         <form string="Price Units">
-          <field name="name" select="1"/>
-          <field name="coefficient" select="1"/>
-          <field name="code" select="1"/>
+          <field name="name" />
+          <field name="coefficient" />
+          <field name="code" />
           <notebook colspan="4">
             <page string="invisible" invisible="1"/>
           </notebook>
@@ -27,9 +27,9 @@
       <field name="type">tree</field>
       <field name="arch" type="xml">
         <tree string="Price Units" editable="bottom">
-          <field name="coefficient" select="1"/>
-          <field name="name" select="1"/>
-          <field name="code" select="1"/>
+          <field name="coefficient" />
+          <field name="name" />
+          <field name="code" />
         </tree>
       </field>
     </record>
@@ -77,7 +77,6 @@
       <field name="type">form</field>
       <field name="arch" type="xml">
         <field name="standard_price" position="replace">
-          <group col="4" colspan="2">
             <field
               attrs="{'readonly':[('cost_method','=','average')]}"
               name="standard_price_pu"
@@ -87,7 +86,6 @@
               name="price_unit_id"
               on_change="onchange_price_unit('standard_price',standard_price_pu,price_unit_id)"
               widget="selection"/>
-          </group>
           <!-- the following field should have this attr, but it is only visible to experts , so I do not handle this
      it must be writeable for now to allow onchange_price_unit to wirte AND save
             'readonly':[('cost_method','=','average')]}"
@@ -107,8 +105,6 @@
       <field name="arch" type="xml">
         <field name="list_price" position="replace">
           <label string="List Price:" align="1.0"/>
-          <group col="2" colspan="1">
-            <group col="4" colspan="2">
               <field
                 name="list_price_pu"
                 nolabel="1"
@@ -117,9 +113,7 @@
                 name="list_price_unit_id"
                 on_change="onchange_price_unit('list_price',list_price_pu,list_price_unit_id)"
                 widget="selection"/>
-            </group>
             <field nolabel="1" name="list_price" groups="c2c_product_price_unit.group_c2c_product_price_unit_manager"/>
-          </group>
         </field>
       </field>
     </record>

=== modified file 'c2c_product_price_unit/purchase.py'
--- c2c_product_price_unit/purchase.py	2012-12-20 15:30:00 +0000
+++ c2c_product_price_unit/purchase.py	2013-07-10 21:51:25 +0000
@@ -32,18 +32,18 @@
     _logger = logging.getLogger(__name__)
 
     def _get_default_id(self, cr, uid, price_unit_id, context=None):
-       pu = self.pool.get('c2c_product.price.unit')
-       if not pu: return 1.0
-       return pu.get_default_id(cr, uid, price_unit_id, context)
+        pu = self.pool.get('c2c_product.price.unit')
+        if not pu: return 1.0
+        return pu.get_default_id(cr, uid, price_unit_id, context)
 
     def _get_default_price_unit_pu(self, cr, uid, price_unit_id, context=None):
-       pu = self.browse(cr, uid, price_unit_id)
-       res  = 0.0
-       if not pu:
-           return res
-       for p in pu:
-           res = p.price_unit
-       return res
+        pu = self.browse(cr, uid, price_unit_id)
+        res  = 0.0
+        if not pu:
+            return res
+        for p in pu:
+            res = p.price_unit
+        return res
 
     _columns = \
         { 'price_unit_id' : fields.many2one('c2c_product.price_unit','Price Unit', required=True)
@@ -64,52 +64,52 @@
         'price_unit_pu'   : _get_default_price_unit_pu,
         'price_unit'      : 0.0
         }
-        
+
     def init(self, cr):
-      cr.execute("""
-          update purchase_order_line set price_unit_pu = price_unit  where price_unit_pu is null;
-      """)
-      cr.execute("""
-          update purchase_order_line set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
-      """)
+        cr.execute("""
+            update purchase_order_line set price_unit_pu = price_unit  where price_unit_pu is null;
+        """)
+        cr.execute("""
+            update purchase_order_line set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
+        """)
 
     def product_id_change_2c2_pu(self, cr, uid, ids, pricelist, product, qty, uom,
             partner_id, date_order=False, fiscal_position=False, date_planned=False,
             name=False, price_unit_pu=False, notes=False, price_unit_id=False ):
-       res = {}
-       self._logger.debug('purch `%s` `%s`', price_unit_id, price_unit_pu)
-
-       if product:
-           prod = self.pool.get('product.product').browse(cr, uid, product)
-           res['value'] = super(purchase_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty, uom,
-               partner_id, date_order, fiscal_position, date_planned,
-               name, price_unit_pu, notes)['value']
-           if not price_unit_id:
-               price_unit_id = prod.price_unit_id.id
-           coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, price_unit_id)
-           #if not price_unit_pu:
-           #     price_unit_pu = prod.price_unit_pu
-       
-           self._logger.debug('purch -68a-  `%s` `%s`', price_unit_id, price_unit_pu)
-           self._logger.debug('purch -68b-  `%s`', res['value'])
-           
-           res['value']['price_unit_id'] = price_unit_id
-           res['value']['price_unit_pu'] =  res['value']['price_unit'] * coeff
-           #res['value']['price_unit']    = price_unit_pu / float(coeff)
-           self._logger.debug('purch -68c-  `%s`', res['value'])
-       return res
+        res = {}
+        self._logger.debug('purch `%s` `%s`', price_unit_id, price_unit_pu)
+
+        if product:
+            prod = self.pool.get('product.product').browse(cr, uid, product)
+            res['value'] = super(purchase_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty, uom,
+                partner_id, date_order, fiscal_position, date_planned,
+                name, price_unit_pu, notes)['value']
+            if not price_unit_id:
+                price_unit_id = prod.price_unit_id.id
+            coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, price_unit_id)
+            #if not price_unit_pu:
+            #     price_unit_pu = prod.price_unit_pu
+
+            self._logger.debug('purch -68a-  `%s` `%s`', price_unit_id, price_unit_pu)
+            self._logger.debug('purch -68b-  `%s`', res['value'])
+
+            res['value']['price_unit_id'] = price_unit_id
+            res['value']['price_unit_pu'] =  res['value']['price_unit'] * coeff
+            #res['value']['price_unit']    = price_unit_pu / float(coeff)
+            self._logger.debug('purch -68c-  `%s`', res['value'])
+        return res
 
 
     def onchange_price_unit(self, cr, uid, ids, field_name,qty,price_pu, price_unit_id):
         self._logger.debug('purch -68c-a  `%s` `%s` `%s`', field_name, price_pu, price_unit_id)
         res = {}
         if  price_pu and  price_unit_id and qty:
-           self._logger.debug('purch -68c-b  `%s`', field_name)
-           coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, price_unit_id)
-           self._logger.debug('purch -68c-c  `%s` `%s`', field_name,coeff)
-           price = price_pu / float(coeff) 
-           self._logger.debug('purch -68c-d  `%s``%s``%s`', field_name, price, coeff)
-           return {'value': {field_name : price}}
+            self._logger.debug('purch -68c-b  `%s`', field_name)
+            coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, price_unit_id)
+            self._logger.debug('purch -68c-c  `%s` `%s`', field_name,coeff)
+            price = price_pu / float(coeff)
+            self._logger.debug('purch -68c-d  `%s``%s``%s`', field_name, price, coeff)
+            return {'value': {field_name : price}}
         return res
 
 purchase_order_line()
@@ -153,6 +153,3 @@
         return res
 
 purchase_order()
-
-
-

=== modified file 'c2c_product_price_unit/sale.py'
--- c2c_product_price_unit/sale.py	2012-12-20 15:30:00 +0000
+++ c2c_product_price_unit/sale.py	2013-07-10 21:51:25 +0000
@@ -32,18 +32,18 @@
     _logger = logging.getLogger(__name__)
 
     def _get_default_id(self, cr, uid, price_unit_id, context=None):
-       pu = self.pool.get('c2c_product.price.unit')
-       if not pu: return 1.0
-       return pu.get_default_id(cr, uid, price_unit_id, context)
+        pu = self.pool.get('c2c_product.price.unit')
+        if not pu: return 1.0
+        return pu.get_default_id(cr, uid, price_unit_id, context)
 
     def _get_default_price_unit_pu(self, cr, uid, price_unit_id, context=None):
-       pu = self.browse(cr, uid, price_unit_id)
-       res  = 0.0
-       if not pu:
-           return res
-       for p in pu:
-           res = p.price_unit
-       return res
+        pu = self.browse(cr, uid, price_unit_id)
+        res  = 0.0
+        if not pu:
+            return res
+        for p in pu:
+            res = p.price_unit
+        return res
 
     _columns = {
         'price_unit_id'    : fields.many2one('c2c_product.price_unit','Price Unit', required=True),
@@ -60,36 +60,36 @@
 
 
     def init(self, cr):
-      cr.execute("""
-          update sale_order_line set price_unit_pu = price_unit  where price_unit_pu is null;
-      """)
-      cr.execute("""
-          update sale_order_line set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
-      """)
+        cr.execute("""
+            update sale_order_line set price_unit_pu = price_unit  where price_unit_pu is null;
+        """)
+        cr.execute("""
+            update sale_order_line set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
+        """)
 
     #def product_id_change_c2c_pu(self, cr, uid, ids, pricelist, product, qty=0,
     def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
             uom=False, qty_uos=0, uos=False, name='', partner_id=False,
             lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False,context={}):
-       res = {}
-       self._logger.debug('sale a0 `%s` `%s` `%s` `%s`', qty, qty_uos, uos, uom)
-       res = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty=qty, 
-                uom=uom, qty_uos=qty_uos, uos=uos, name=name,
-                partner_id=partner_id, lang=lang, update_tax=update_tax,
-                date_order=date_order)
-       self._logger.debug('sale a1 `%s`', res['value'] )
-       if product:
-           prod = self.pool.get('product.product').browse(cr, uid, product)
-           price_unit_id = prod.list_price_unit_id.id
-           self._logger.debug('sale pu `%s` `%s` `%s`', price_unit_id, product, 'prod.name')
-           res['value']['price_unit_id'] = price_unit_id
-           self._logger.debug('sale pu2 `%s`', res['value'])
-     
-           if res['value']['price_unit'] and qty:
-               coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, price_unit_id)
-               res['value']['price_unit_pu'] = res['value']['price_unit'] * coeff 
-               self._logger.debug('sale 2 `%s` `%s` `%s`', coeff, res['value']['price_unit'], res['value'])
-       return res
+        res = {}
+        self._logger.debug('sale a0 `%s` `%s` `%s` `%s`', qty, qty_uos, uos, uom)
+        res = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty=qty,
+                 uom=uom, qty_uos=qty_uos, uos=uos, name=name,
+                 partner_id=partner_id, lang=lang, update_tax=update_tax,
+                 date_order=date_order)
+        self._logger.debug('sale a1 `%s`', res['value'] )
+        if product:
+            prod = self.pool.get('product.product').browse(cr, uid, product)
+            price_unit_id = prod.list_price_unit_id.id
+            self._logger.debug('sale pu `%s` `%s` `%s`', price_unit_id, product, 'prod.name')
+            res['value']['price_unit_id'] = price_unit_id
+            self._logger.debug('sale pu2 `%s`', res['value'])
+
+            if res['value']['price_unit'] and qty:
+                coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, price_unit_id)
+                res['value']['price_unit_pu'] = res['value']['price_unit'] * coeff
+                self._logger.debug('sale 2 `%s` `%s` `%s`', coeff, res['value']['price_unit'], res['value'])
+        return res
 
     def onchange_price_unit(self, cr, uid, ids, field_name,qty, price_pu, price_unit_id):
         if  price_pu and  price_unit_id and qty:
@@ -131,7 +131,3 @@
         return res
 
 sale_order()
-
-
-
-

=== modified file 'c2c_product_price_unit/sale_layout_view.xml'
--- c2c_product_price_unit/sale_layout_view.xml	2011-11-22 23:12:29 +0000
+++ c2c_product_price_unit/sale_layout_view.xml	2013-07-10 21:51:25 +0000
@@ -23,13 +23,13 @@
                     context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty,'pricelist':parent.pricelist_id,'shop':parent.shop_id,'uom':product_uom}"
                     name="product_id"
                     on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom,product_uos_qty, product_uos,name, parent.partner_id,False , True, parent.date_order, product_packaging, parent.fiscal_position,True, context)"
-                    select="1"/>
+                    />
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')]}"
                     context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty,'pricelist':parent.pricelist_id,'shop':parent.shop_id,'uom':product_uom}"
                     name="product_uom_qty"
                     on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, product_packaging, parent.fiscal_position, True, context"
-                    select="1"/>
+                    />
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')],  'required':[('layout_type','not in',['title','text','subtotal','line','break'])]}"
                     name="product_uom"
@@ -51,11 +51,11 @@
                     attrs="{'readonly':[('layout_type','in',('line','break'))] }"
                     colspan="4"
                     name="name"
-                    select="2"/>
+                    />
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')],'required':[('layout_type','not in',['title','text','subtotal','line','break'])]}"
                     name="price_unit"
-                    select="2"/>
+                    />
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')]}"
                     name="discount"/>
@@ -65,16 +65,16 @@
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')]}"
                     name="delay"
-                    select="2"/>
+                    />
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')]}"
                     colspan="4"
                     domain="[('parent_id','=',False)]"
                     name="tax_id"/>
                   <separator colspan="4" string="States"/>
-                  <field name="state" select="2"/>
+                  <field name="state" />
                   <group col="3" colspan="2">
-                    <field name="invoiced" select="2"/>
+                    <field name="invoiced" />
                     <button
                       colspan="1"
                       name="%(sale.action_view_sale_order_line_make_invoice)d"
@@ -89,7 +89,7 @@
                     name="product_uos_qty"
                     on_change="uos_change(product_uos, product_uos_qty, product_id)"/>
                   <field groups="product.group_uos" name="product_uos"/>
-                  <field name="address_allotment_id" select="2"/>
+                  <field name="address_allotment_id" />
                   <separator colspan="4" string="Properties"/>
                   <field colspan="4" name="property_ids" nolabel="1"/>
                 </page>

=== modified file 'c2c_product_price_unit/sale_layout_view_formatted.xml'
--- c2c_product_price_unit/sale_layout_view_formatted.xml	2011-11-22 23:12:29 +0000
+++ c2c_product_price_unit/sale_layout_view_formatted.xml	2013-07-10 21:51:25 +0000
@@ -23,13 +23,13 @@
                     context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'shop':parent.shop_id, 'uom':product_uom}"
                     name="product_id"
                     on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, True, parent.date_order, product_packaging, parent.fiscal_position)"
-                    select="1"/>
+                    />
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')]}"
                     context="{'partner_id':parent.partner_id,'quantity':product_uom_qty,'pricelist':parent.pricelist_id,'shop':parent.shop_id,'uom':product_uom}"
                     name="product_uom_qty"
                     on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, product_packaging, parent.fiscal_position)"
-                    select="1"/>
+                    />
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')],  'required':[('layout_type','not in',['title','text','subtotal','line','break'])]}"
                     name="product_uom"
@@ -51,11 +51,11 @@
                     attrs="{'readonly':[('layout_type','in',('line','break'))] }"
                     colspan="4"
                     name="name"
-                    select="2"/>
+                    />
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')],'required':[('layout_type','not in',['title','text','subtotal','line','break'])]}"
                     name="price_unit"
-                    select="2"/>
+                    />
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')]}"
                     name="discount"/>
@@ -65,16 +65,16 @@
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')]}"
                     name="delay"
-                    select="2"/>
+                    />
                   <field
                     attrs="{'readonly':[('layout_type','!=','article')]}"
                     colspan="4"
                     domain="[('parent_id','=',False)]"
                     name="tax_id"/>
                   <separator colspan="4" string="States"/>
-                  <field name="state" select="2"/>
+                  <field name="state" />
                   <group col="3" colspan="2">
-                    <field name="invoiced" select="2"/>
+                    <field name="invoiced" />
                     <button
                       colspan="1"
                       name="%(sale.action_view_sale_order_line_make_invoice)d"
@@ -89,7 +89,7 @@
                     name="product_uos_qty"
                     on_change="uos_change(product_uos, product_uos_qty, product_id)"/>
                   <field groups="product.group_uos" name="product_uos"/>
-                  <field name="address_allotment_id" select="2"/>
+                  <field name="address_allotment_id" />
                   <separator colspan="4" string="Properties"/>
                   <field colspan="4" name="property_ids" nolabel="1"/>
                 </page>

=== modified file 'c2c_product_price_unit/sale_view.xml'
--- c2c_product_price_unit/sale_view.xml	2011-12-03 11:18:58 +0000
+++ c2c_product_price_unit/sale_view.xml	2013-07-10 21:51:25 +0000
@@ -5,7 +5,7 @@
     <record model="ir.ui.view" id="c2c_product_sale_oder_view">
       <field name="name">c2c_product.sale_order.view</field>
       <field name="model">sale.order</field>
-      <field name="inherit_id" ref="sale_layout.view_order_form_inherit_1"/>
+      <field name="inherit_id" ref="sale.view_order_form"/>
       <field name="type">form</field>
       <field name="arch" type="xml">
         <field name="price_unit" position="replace">
@@ -42,10 +42,10 @@
     <record model="ir.ui.view" id="c2c_sale_oder_line_tree_view">
       <field name="name">c2c_product.sale_order_line_tree.view</field>
       <field name="model">sale.order</field>
-      <field name="inherit_id" ref="sale_layout.view_order_form_inherit_1"/>
+      <field name="inherit_id" ref="sale.view_order_form"/>
       <field name="type">form</field>
       <field name="arch" type="xml">
-        <xpath expr="/form/notebook/page/field[@name='abstract_line_ids']/tree/field[@name='price_unit']" position="replace">
+        <xpath expr="/form/sheet/notebook/page[@string='Order Lines']/field/tree/field[@name='price_unit']" position="replace">
           <field name="price_unit_pu"/>
           <field name="price_unit_id"/>
           <field name="price_unit" groups="c2c_product_price_unit.group_c2c_product_price_unit_manager"/>

=== modified file 'c2c_product_price_unit/stock.py'
--- c2c_product_price_unit/stock.py	2012-12-20 15:30:00 +0000
+++ c2c_product_price_unit/stock.py	2013-07-10 21:51:25 +0000
@@ -34,12 +34,12 @@
         if context is None:
             context = {}
         if not context.get('product_id', False):
-            return False 
+            return False
         pu_id = self.pool.get('product.product').browse(cr, uid, context['product_id']).price_unit_id.id
         return pu_id or False
 
 
-    _columns = { 
+    _columns = {
         'price_unit_id'    : fields.many2one('c2c_product.price_unit','Price Unit'),
         'price_unit_pu'    : fields.float(string='Unit Price',digits_compute=dp.get_precision('Sale Price'),  \
                             help='Price using "Price Units"') ,
@@ -60,20 +60,20 @@
     }
 
     def init(self, cr):
-      cr.execute("""
-          update stock_move set price_unit_pu = price_unit  where price_unit_pu is null;
-      """)
-      cr.execute("""
-          update stock_move set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
-      """)
+        cr.execute("""
+            update stock_move set price_unit_pu = price_unit  where price_unit_pu is null;
+        """)
+        cr.execute("""
+            update stock_move set price_unit_id = (select min(id) from c2c_product_price_unit where coefficient=1) where price_unit_id is null;
+        """)
 
     def onchange_price_unit(self, cr, uid, ids, field_name,price_pu, price_unit_id):
         if  price_pu and  price_unit_id:
-           pu = self.pool.get('c2c_product.price_unit').browse(cr, uid, price_unit_id)
-           price = price_pu / float(pu.coefficient)
-           return {'value': {field_name : price}}
+            pu = self.pool.get('c2c_product.price_unit').browse(cr, uid, price_unit_id)
+            price = price_pu / float(pu.coefficient)
+            return {'value': {field_name : price}}
         return {}
-        
+
     def onchange_product_id(self, cr, uid, ids, prod_id=False, loc_id=False,
                             loc_dest_id=False, address_id=False):
         context = {}
@@ -85,7 +85,7 @@
             standard_price_pu = prod_obj.standard_price_pu
             res['value'].update({'price_unit_id':pu_id, 'price_unit_pu':standard_price_pu})
         return res
-      
+
 
 stock_move()
 
@@ -120,7 +120,7 @@
                 price_unit = move_line.price_unit_sale or ''
                 price_unit_pu = move_line.price_unit_sale * coeff or ''
                 price_unit_id = move_line.price_unit_sale_id.id or ''
-          
+
         inv_line_obj = self.pool.get('account.invoice.line')
         inv_line_obj.write(cr, uid, invoice_line_id, {'price_unit_id': price_unit_id, 'price_unit_pu': price_unit_pu})
 

=== modified file 'c2c_product_price_unit/stock_view.xml'
--- c2c_product_price_unit/stock_view.xml	2012-01-28 14:05:08 +0000
+++ c2c_product_price_unit/stock_view.xml	2013-07-10 21:51:25 +0000
@@ -2,33 +2,36 @@
 <openerp>
   <data>
     <!-- Price Units in internal moves -->
+<!--
         <record id="view_picking_price_unit_form" model="ir.ui.view">
             <field name="name">stock.picking.price.unit.form</field>
             <field name="model">stock.picking</field>
             <field name="type">form</field>
             <field name="inherit_id" ref="stock.view_picking_form"/>
             <field name="arch" type="xml">
-               <xpath expr="/form/notebook/page/field/form/group/field[@name='product_uom']" position="after">
+               <xpath expr="/form/sheet/notebook/page/field/form/group/field[@name='product_uom']" position="after">
                   <field name="price_unit_pu" on_change="onchange_price_unit('price_unit',price_unit_pu,price_unit_id)" groups="c2c_product_price_unit.group_c2c_product_price_unit_manager"/>
                   <field name="price_unit_id" on_change="onchange_price_unit('price_unit',price_unit_pu,price_unit_id)" groups="c2c_product_price_unit.group_c2c_product_price_unit_manager"/>
                   <field name="price_unit" groups="c2c_product_price_unit.group_c2c_product_price_unit_manager"/>
                </xpath>
       </field>
     </record>
+-->
     <!-- Price Units in incoming moves -->
+<!--
         <record id="view_picking_price_unit_in_form" model="ir.ui.view">
             <field name="name">stock.picking.price_unit.in.form</field>
             <field name="model">stock.picking</field>
             <field name="type">form</field>
             <field name="inherit_id" ref="stock.view_picking_in_form"/>
             <field name="arch" type="xml">
-               <xpath expr="/form/notebook/page/field/form/group/field[@name='product_uom']" position="after">
+               <xpath expr="/form/sheet/notebook/page/field/form/group/field[@name='product_uom']" position="after">
                   <field name="price_unit_pu" on_change="onchange_price_unit('price_unit',price_unit_pu,price_unit_id)" groups="c2c_product_price_unit.group_c2c_product_price_unit_manager"/>
                   <field name="price_unit_id" on_change="onchange_price_unit('price_unit',price_unit_pu,price_unit_id)" groups="c2c_product_price_unit.group_c2c_product_price_unit_manager"/>
                   <field name="price_unit" groups="c2c_product_price_unit.group_c2c_product_price_unit_manager"/>
                </xpath>
       </field>
     </record>
-
+-->
   </data>
 </openerp>

=== modified file 'c2c_product_price_unit/wizard/__init__.py'
--- c2c_product_price_unit/wizard/__init__.py	2011-12-13 23:25:42 +0000
+++ c2c_product_price_unit/wizard/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #
@@ -15,11 +15,10 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 
 import purchase_line_invoice
 import stock_partial_picking
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-

=== modified file 'c2c_product_price_unit/wizard/purchase_line_invoice.py'
--- c2c_product_price_unit/wizard/purchase_line_invoice.py	2012-05-31 13:45:08 +0000
+++ c2c_product_price_unit/wizard/purchase_line_invoice.py	2013-07-10 21:51:25 +0000
@@ -28,11 +28,11 @@
 class purchase_line_invoice(osv.osv_memory):
     _inherit = 'purchase.order.line_invoice'
     _logger = logging.getLogger(__name__)
-    
+
     def makeInvoices(self, cr, uid, ids, context=None):
         res = super(purchase.order.line_invoice,self).makeInvoices(cr, uid, ids, context=None)
         self._logger.debug('makeInvoices FGF: %s  `%s`', res)
-#FIXME 
+#FIXME
         return res
 
 purchase_line_invoice()
@@ -44,7 +44,7 @@
     _inherit = 'purchase.order.line_invoice'
     _description = 'Purchase Order Line Make Invoice c2c'
     _logger = logging.getLogger(__name__)
-    
+
     def makeInvoices(self, cr, uid, ids, context=None):
         self._logger.debug('invoice modified')
         """
@@ -182,4 +182,3 @@
 purchase_line_invoic_copy()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-

=== modified file 'c2c_product_price_unit/wizard/stock_partial_picking.py'
--- c2c_product_price_unit/wizard/stock_partial_picking.py	2012-05-09 20:48:39 +0000
+++ c2c_product_price_unit/wizard/stock_partial_picking.py	2013-07-10 21:51:25 +0000
@@ -25,7 +25,7 @@
 
 class stock_partial_picking_line(osv.TransientModel):
     _inherit = "stock.partial.picking.line"
-   
+
     _columns = {
       'cost_pu' : fields.float("Cost PU", help="PU Unit Cost for this product line"),
       'sale' : fields.float("Sale", help="Sale for this product line"),
@@ -36,11 +36,11 @@
     }
 
     def onchange_cost_pu(self, cr, uid, ids,field,cost_pu,cost_unit_pu):
-       if cost_pu and cost_unit_pu:
-           coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, cost_unit_pu)
-           cost = cost_pu / coeff
-           return {'value' : {field: cost }}
-       return
+        if cost_pu and cost_unit_pu:
+            coeff = self.pool.get('c2c_product.price_unit').get_coeff(cr, uid, cost_unit_pu)
+            cost = cost_pu / coeff
+            return {'value' : {field: cost }}
+        return
 
 
 class stock_partial_picking(osv.osv_memory):
@@ -48,23 +48,23 @@
     _logger = logging.getLogger(__name__)
 
     def _product_cost_for_average_update(self, cr, uid, move):
-       res = super(stock_partial_picking,self)._product_cost_for_average_update(cr, uid, move )
-       self._logger.debug('_product_cost_for_average_update `%s`', res)
-       res.update({'cost_pu' : move.price_unit_pu or move.purchase_line_id.price_unit_pu or  move.product_id.standard_price, \
-               'cost_unit_pu': move.price_unit_id.id or move.purchase_line_id.price_unit_id.id or move.product_id.price_unit_id.id})
-       # FIXME - remove if 
-       #res.update({'cost' : move.purchase_line_id.price_unit or  move.product_id.standard_price })
-       self._logger.debug('_product_cost_for_average_update `%s`', res)
-       return res
- 
+        res = super(stock_partial_picking,self)._product_cost_for_average_update(cr, uid, move )
+        self._logger.debug('_product_cost_for_average_update `%s`', res)
+        res.update({'cost_pu' : move.price_unit_pu or move.purchase_line_id.price_unit_pu or  move.product_id.standard_price, \
+                'cost_unit_pu': move.price_unit_id.id or move.purchase_line_id.price_unit_id.id or move.product_id.price_unit_id.id})
+        # FIXME - remove if
+        #res.update({'cost' : move.purchase_line_id.price_unit or  move.product_id.standard_price })
+        self._logger.debug('_product_cost_for_average_update `%s`', res)
+        return res
+
     def _partial_move_for(self, cr, uid, move):
-       res = super(stock_partial_picking,self)._partial_move_for(cr, uid, move)
-       self._logger.debug('_partial_move_for (b) `%s`', res)
-       self._logger.debug('move `%s`', move)
-       res.update({'move_type': move.picking_id.type})
-       if move.picking_id.type == 'out' : #and move.product_id.cost_method == 'average':
-           res.update({'cost_sale_pu' : move.sale_line_id.price_unit_pu or  move.product_id.list_price, \
-               'cost_unit_sale_pu': move.sale_line_id and move.sale_line_id.price_unit_id.id or move.product_id.price_unit_id.id,
-               'sale' : move.sale_line_id.price_unit or  move.product_id.list_price})
-       self._logger.debug('_partial_move_for (c `%s`', res)
-       return res 
+        res = super(stock_partial_picking,self)._partial_move_for(cr, uid, move)
+        self._logger.debug('_partial_move_for (b) `%s`', res)
+        self._logger.debug('move `%s`', move)
+        res.update({'move_type': move.picking_id.type})
+        if move.picking_id.type == 'out' : #and move.product_id.cost_method == 'average':
+            res.update({'cost_sale_pu' : move.sale_line_id.price_unit_pu or  move.product_id.list_price, \
+                'cost_unit_sale_pu': move.sale_line_id and move.sale_line_id.price_unit_id.id or move.product_id.price_unit_id.id,
+                'sale' : move.sale_line_id.price_unit or  move.product_id.list_price})
+        self._logger.debug('_partial_move_for (c `%s`', res)
+        return res

=== added directory 'c2c_product_price_unit_anglosaxon'
=== added file 'c2c_product_price_unit_anglosaxon/__init__.py'
--- c2c_product_price_unit_anglosaxon/__init__.py	1970-01-01 00:00:00 +0000
+++ c2c_product_price_unit_anglosaxon/__init__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
+#
+#    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
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'c2c_product_price_unit_anglosaxon/__openerp__.py'
--- c2c_product_price_unit_anglosaxon/__openerp__.py	1970-01-01 00:00:00 +0000
+++ c2c_product_price_unit_anglosaxon/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
+#
+#    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': 'Product Price Unit Anglos Saxon',
+    'version': '0.7',
+    'category': 'Warehouse Management',
+    'description': """
+adapts the price difference (write down to use price units)
+    """,
+    'author': 'Camptocamp Austria',
+    'depends': ['account_anglo_saxon','c2c_product_price_unit','c2c_stock_accounting','picking_invoice_rel' ],
+    'update_xml': [],
+    #'update_xml': ['product_view.xml'],
+    'demo_xml': [],
+    'installable': True,
+    'active': False,
+    'auto_install': True
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'c2c_product_price_unit_anglosaxon/invoice.py'
--- c2c_product_price_unit_anglosaxon/invoice.py	1970-01-01 00:00:00 +0000
+++ c2c_product_price_unit_anglosaxon/invoice.py	2013-07-10 21:51:25 +0000
@@ -0,0 +1,187 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#    Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
+#
+#    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/>.
+#
+##############################################################################
+
+from osv import osv, fields
+import decimal_precision as dp
+from tools.translate import _
+import logging 
+
+class account_invoice_line(osv.osv):
+    _inherit = "account.invoice.line"
+    
+    def move_line_get(self, cr, uid, invoice_id, context=None):
+        _logger  = logging.getLogger(__name__)
+        inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context) 
+        stock_moves = {}
+        for pick in inv.picking_ids:
+            for ml in pick.move_lines:
+                if stock_moves.get(ml.product_id.id):
+                    qty = stock_moves[ml.product_id.id][0]
+                    cost = stock_moves[ml.product_id.id][1]
+                    stock_moves[ml.product_id.id] = (ml.product_qty+qty, ml.move_value_cost+cost)
+                else:
+                    stock_moves[ml.product_id.id] = (ml.product_qty, ml.move_value_cost)
+        self._logger.debug('FGF anglo stock moves %s', stock_moves)
+        
+        res_orig = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context=context)
+        self._logger.debug('FGF anglosaxon res_orig %s', res_orig)
+        tax = {}
+        for res_line in res_orig:
+            self._logger.debug('FGF anglo stock res line orig %s', res_line)
+            if res_line.get('product_id'):
+                tax_amount = ''
+                tax_code_id = ''
+                if res_line.get('tax_amount'):
+                    tax_amount = res_line['tax_amount']
+                if res_line.get('tax_code_id'):
+                    tax_code_id = res_line['tax_code_id']
+                if tax_amount:
+                    tax[res_line['product_id']] = (tax_amount, tax_code_id)
+                
+        self._logger.debug('FGF anglo stock tax orig %s', tax)
+          
+        res= []
+             
+        for i_line in inv.invoice_line:
+            self._logger.debug('FGF anglosaxon line data %s %s', i_line.quantity, i_line.price_subtotal)
+            if not i_line.product_id or not stock_moves.get(i_line.product_id.id) :
+                self._logger.debug('FGF anglosaxon pass 1')
+                res = res_orig
+               
+            elif i_line.product_id.type != 'product':
+                self._logger.debug('FGF anglosaxon pass 2')
+                res = res_orig
+                
+
+            else:
+                # FIXME qty_diff not yet hadled
+                qty_diff = i_line.quantity - stock_moves[i_line.product_id.id][0]
+                
+                stock_line_amount = stock_moves[i_line.product_id.id][1]
+                amount_diff = i_line.price_subtotal - stock_line_amount
+                
+                
+                self._logger.debug('FGF anglosaxon diff %s %s', qty_diff, amount_diff)
+                
+                if inv.type in ('out_invoice','out_refund') :
+                    res = res_orig
+                    qty_diff = i_line.quantity - stock_moves[i_line.product_id.id][0]
+                    amount_diff = i_line.price_subtotal - stock_line_amount
+                    self._logger.debug('FGF anglosaxon must compute diff out %s %s', i_line.quantity, i_line.price_subtotal)
+
+                    if inv.type == 'out_invoice':
+                        # debit account dacc will be the output account
+                        # first check the product, if empty check the category
+                        dacc = i_line.product_id.property_stock_account_output and i_line.product_id.property_stock_account_output.id
+                        if not dacc:
+                            dacc = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id
+                    else:
+                        # = out_refund
+                        # debit account dacc will be the input account
+                        # first check the product, if empty check the category
+                        dacc = i_line.product_id.property_stock_account_input and i_line.product_id.property_stock_account_input.id
+                        if not dacc:
+                            dacc = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id
+                    # in both cases the credit account cacc will be the expense account
+                    # first check the product, if empty check the category
+                    cacc = i_line.product_id.property_account_expense and i_line.product_id.property_account_expense.id
+                    if not cacc:
+                        cacc = i_line.product_id.categ_id.property_account_expense_categ and i_line.product_id.categ_id.property_account_expense_categ.id
+                    
+                    # this will only happen if the cost_price is changed between delivery and invoice
+                    for res_line in res_orig:
+                        if res_line['product_id'] == i_line.product_id.id :
+                           if res_line['account_id'] == dacc and res_line['price_unit'] != stock_line_amount:
+                               res_line['price_unit'] = stock_line_amount / stock_moves[i_line.product_id.id][0]
+                               res_line['price'] = res_line['price_unit'] * i_line.quantity
+                           elif  res_line['account_id'] == cacc  and res_line['price_unit'] != -stock_line_amount:
+                               res_line['price_unit'] = -stock_line_amount / stock_moves[i_line.product_id.id][0]
+                               res_line['price'] = res_line['price_unit'] * i_line.quantity
+
+
+                if inv.type in ('in_invoice','in_refund'):
+                    
+                    self._logger.debug('FGF anglosaxon must compute diff in %s %s', i_line.quantity, i_line.price_subtotal )
+                    # get the price difference account at the product
+                    acc = i_line.product_id.property_account_creditor_price_difference and i_line.product_id.property_account_creditor_price_difference.id
+                    if not acc:
+                        # if not found on the product get the price difference account at the category
+                        acc = i_line.product_id.categ_id.property_account_creditor_price_difference_categ and i_line.product_id.categ_id.property_account_creditor_price_difference_categ.id
+                    a = None
+                    if inv.type == 'in_invoice':
+                        # oa will be the stock input account
+                        # first check the product, if empty check the category
+                        oa = i_line.product_id.property_stock_account_input and i_line.product_id.property_stock_account_input.id
+                        if not oa:
+                            oa = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id
+                    else:
+                        # = in_refund
+                        # oa will be the stock output account
+                        # first check the product, if empty check the category
+                        oa = i_line.product_id.property_stock_account_output and i_line.product_id.property_stock_account_output.id
+                        if not oa:
+                            oa = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id
+                    if oa:
+                        # get the fiscal position
+                        fpos = i_line.invoice_id.fiscal_position or False
+                        a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa)
+
+                    if acc and a :
+                        # stock input account
+                        
+                        res.append({
+                            'type':'src',
+                            'name': i_line.name[:64],
+                            'price_unit': stock_line_amount / i_line.quantity, # i_line.product_id.standard_price,
+                            'quantity':i_line.quantity,
+                            'price': stock_line_amount,
+                            'account_id': a,
+                            'product_id':i_line.product_id.id,
+                            'uos_id':i_line.uos_id.id,
+                            'account_analytic_id': False,
+                            'taxes':i_line.invoice_line_tax_id,
+                            'tax_amount': tax[i_line.product_id.id][0],
+                            'tax_code_id': tax[i_line.product_id.id][1],
+                            })
+                        # price diff
+                        if amount_diff != 0:
+                            res.append({
+                                'type':'src',
+                                'name': i_line.name[:64],
+                                'price_unit': amount_diff / i_line.quantity, #i_line.product_id.standard_price,
+                                'quantity': i_line.quantity,
+                                'price': amount_diff, #-1 * get_price(cr, uid, inv, company_currency, i_line),
+                                'account_id': acc,
+                                'product_id':i_line.product_id.id,
+                                'uos_id':i_line.uos_id.id,
+                                'account_analytic_id': False,
+                                'taxes':i_line.invoice_line_tax_id,
+                                })
+
+
+
+
+        self._logger.debug('FGF anglosaxon res %s', res)
+        #raise osv.except_osv(_('Error'), _('TEST FGF Angosaxon'))
+        return res
+    
+account_invoice_line()

=== modified file 'c2c_project_activities/c2c_project_activities_view.xml'
--- c2c_project_activities/c2c_project_activities_view.xml	2012-08-13 21:14:02 +0000
+++ c2c_project_activities/c2c_project_activities_view.xml	2013-07-10 21:51:25 +0000
@@ -10,9 +10,9 @@
             <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="Activity">
-                    <field name="name" select="1"/>
-                    <field name="code" select="1"/>
-                    <field name="parent_id" select="1"/>
+                    <field name="name" />
+                    <field name="code" />
+                    <field name="parent_id" />
                     <!-- <field name="type" /> -->
                     <field name="project_ids" colspan="4"/>
                 </form>
@@ -115,8 +115,8 @@
             <field name="inherit_id" ref="account.view_account_analytic_line_form" />
             <field name="type">form</field>
             <field name="arch" type="xml">
-                <field name="unit_amount" select="2" position="after">
-                    <field name="activity" select="2"/>
+                <field name="unit_amount"  position="after">
+                    <field name="activity" />
                 </field>
             </field>
         </record>
@@ -127,7 +127,7 @@
             <field name="type">tree</field>
             <field name="arch" type="xml">
                 <field name="unit_amount" sum="Total quantity" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" position="after">
-                    <field name="activity" select="2"/>
+                    <field name="activity" />
                 </field>
             </field>
         </record>

=== modified file 'c2c_project_timesheet/__openerp__.py'
--- c2c_project_timesheet/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_project_timesheet/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -9,11 +9,12 @@
  also grouped by projects
  """
  , "category"     : "Generic Modules/Human Resources"
- , "depends"      : ["base","project_timesheet"]
+ , "depends"      : ["base","project","project_timesheet"]
  , "init_xml"     : []
- , "demo_xml"     : []
+ , "demo"         : []
  , "update_xml"   : ["timesheet_task_view.xml"]
  , "auto_install" : False
  , "installable"  : True
+, 'application'  : False
 }
 

=== modified file 'c2c_project_timesheet/timesheet_task.py'
--- c2c_project_timesheet/timesheet_task.py	2012-04-18 07:35:42 +0000
+++ c2c_project_timesheet/timesheet_task.py	2013-07-10 21:51:25 +0000
@@ -32,9 +32,23 @@
 # 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 ###############################################
+# FIXME
+# to overcome bug 1155843 we have introdued a date_date field (without time)
+# this makes sense, because in accounting we use days - regardless in whch timezone users are
+# this way group by date will work for allmost all tz as we use 12AM as time which will be converted in almost ll tz to the correct period
+# this needs redesign from scratch
+###############################################
 from osv import fields,osv
+import time
+from datetime import date
+import datetime 
+from datetime import timedelta
+from dateutil import relativedelta
+from openerp import tools
 import logging
 
+datetime = __import__('datetime')
+
 class project_work(osv.osv):
     _inherit = "project.task.work"
     _logger = logging.getLogger(__name__)
@@ -46,9 +60,11 @@
         return task_work_ids
 
     _columns = {
-        'date': fields.datetime('Date', select="1"),
-        'task_id': fields.many2one('project.task', 'Task', ondelete='cascade', required=True, select="1"),
-        'user_id': fields.many2one('res.users', 'Done by', required=True, select="1"),
+        'date_date': fields.date('Date w/o time', select="1",help="Date without time"),
+        #'task_id': fields.many2one('project.task', 'Task', ondelete='cascade', required=True, select="1"),
+        #'user_id': fields.many2one('res.users', 'Done by', required=True, select="1"),
+        'product_id': fields.many2one('product.product','Product' ),
+        'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Type of Invoicing', help="It allows to set the discount while making invoice"),
         'project_id' : fields.related('task_id', 'project_id', type='many2one', relation="project.project", string='Project',
         store = True
         # FIXME activation of this function causes project_id not be stored on normal entry 
@@ -58,12 +74,143 @@
 ),
     }
 
+    _defaults = {
+        'date_date': lambda *a: time.strftime('%Y-%m-%d')
+        }
+
+    def init(self, cr):
+        
+        res_user_obj = self.pool.get('res.users')
+        if res_user_obj._columns.get('context_tz'):
+            # Version 6.1
+            cr.execute("""
+            update project_task_work w
+                set date_date = (select  date_trunc('day',w.date AT TIME ZONE 'UTC' at time zone context_tz)
+                                    from res_users
+                                    where id = w.user_id)
+                where date_date is null or date_date = current_date;
+            """)
+        else:
+            # Version 7
+            cr.execute("""
+                update project_task_work w
+                set date_date = (select date_trunc('day',w.date AT TIME ZONE 'UTC' at time zone tz)
+                                    from res_users u,
+                                        res_partner p
+                                where u.id = w.user_id
+                                    and p.id = u.partner_id)
+                where date_date is null or date_date = current_date;
+            """)
+
+        work_ids = self.search(cr, 1, [])
+        for work in self.browse(cr, 1, work_ids):
+            d = work.date_date+' 12:00:00'
+            if d != work.date:
+                self.write(cr, 1, [work.id], {'date': d})
+         
+
+
+    def get_product(self, cr, uid, task):
+        
+        product_id = ''
+        grid_obj = self.pool.get('analytic.user.funct.grid')
+        if grid_obj:
+            grid_ids = grid_obj.search(cr, uid, [('user_id','=', uid),('account_id','=',task.project_id.analytic_account_id.id)])
+            for grid_line in grid_obj.browse(cr, uid, grid_ids):
+                product_id = grid_line.product_id.id
+
+        if not product_id:
+            employee_id = self.pool.get('hr.employee').search(cr, uid, [('user_id','=',uid)])
+            for employee in self.pool.get('hr.employee').browse(cr, uid, employee_id):
+                if employee.product_id:
+                    product_id = employee.product_id.id
+        return product_id
+
+    def onchange_task_id(self, cr, uid, ids, task_id, context=None):
+        value = {}
+        res = {} 
+        if task_id:
+            task_obj = self.pool.get('project.task')
+            for task in task_obj.browse(cr, uid, [task_id]): 
+                if task.project_id and task.project_id.to_invoice:
+	                value['to_invoice'] = task.project_id.to_invoice.id
+                product_id = self.get_product(cr, uid, task)
+                if product_id:
+                    value['product_id']= product_id
+        res['value']=value
+        return res
+
+
+
+    def _get_product(self, cr, uid, work_id):
+        product_id = ''
+        for work in self.browse(cr, uid, [work_id] ):
+            if work.product_id:
+                product_id = work.product_id.id
+            if not product_id:
+                self.get_product(cr, uid, work.task_id)
+                
+
+        return product_id
+
 
     def write(self, cr, uid, ids, vals, context=None):
-        if 'user_id' not in vals:
-            for task in self.browse(cr, uid, ids, context=context):
-                vals['user_id'] = task.user_id.id
-        return super(project_work,self).write(cr, uid, ids, vals, context)
+        obj_timesheet = self.pool.get('hr.analytic.timesheet')
+        obj_analytic_line= self.pool.get('account.analytic.line')
+        task_obj = self.pool.get('project.task')
+        self._logger.debug('FGF vals `%s`',  vals)
+        res = []
+        for work in self.browse(cr, uid, ids, context=context):
+            if 'user_id' not in vals:
+                vals['user_id'] = work.user_id.id
+            if vals.get('date_date', None):
+                vals['date'] = vals['date_date']+' 12:00:00'
+            res.append( super(project_work,self).write(cr, uid, [work.id], vals, context))
+            if work.hr_analytic_timesheet_id and work.hr_analytic_timesheet_id.line_id:
+                name = work.task_id.name
+                if work.name:
+                    name  += ': ' + work.name
+                val = {
+                   'to_invoice': work.to_invoice.id,
+                   'name' : name,
+                   'account_id' : work.task_id.project_id.analytic_account_id.id,
+                   }
+                product_id = self._get_product(cr, uid, work.id)
+                if product_id:
+                    val['product_id'] = product_id
+                self._logger.debug('FGF update analytic `%s` `%s`', work.hr_analytic_timesheet_id.line_id.id, val)
+                obj_analytic_line.write(cr, uid, [work.hr_analytic_timesheet_id.line_id.id], val)
+                task_obj.write(cr, uid, [work.task_id.id], {'remaining_hours' : work.task_id.remaining_hours})
+                
+        return res
+
+    def create(self, cr, uid, vals, *args, **kwargs):
+        if vals.get('date_date', None):
+             vals['date'] = vals['date_date']+' 12:00:00'
+        res = super(project_work,self).create(cr, uid, vals, *args, **kwargs)
+        task_obj = self.pool.get('project.task')
+        timeline_id = vals.get('hr_analytic_timesheet_id') and vals['hr_analytic_timesheet_id'] or ''
+        if timeline_id:
+            obj_timesheet = self.pool.get('hr.analytic.timesheet')
+            for work in self.browse(cr, uid, [res] ):
+                vals = {}
+                if work.to_invoice:
+                    vals['to_invoice'] = work.to_invoice.id
+                product_id = self._get_product(cr, uid, work.id)
+                if product_id:
+                    vals['product_id'] = product_id
+                obj_timesheet.write(cr, uid, [timeline_id], vals)
+                task_obj.write(cr, uid, [work.task_id.id], {'remaining_hours' : work.task_id.remaining_hours})
+
+        return res
+
+    def unlink(self, cr, uid, ids, *args, **kwargs):
+        task_obj = self.pool.get('project.task')
+        for work in self.browse(cr, uid, ids ):
+            task_id = work.task_id.id
+        res = super(project_work, self).unlink(cr, uid, ids, *args, **kwargs)
+        task_obj.write(cr, uid, [task_id], {'remaining_hours' : work.task_id.remaining_hours})
+        return res
 
 project_work()
 

=== modified file 'c2c_project_timesheet/timesheet_task_view.xml'
--- c2c_project_timesheet/timesheet_task_view.xml	2012-08-13 21:14:02 +0000
+++ c2c_project_timesheet/timesheet_task_view.xml	2013-07-10 21:51:25 +0000
@@ -13,12 +13,15 @@
       <field name="arch" type="xml">
         <tree string="Task Work" editable="top">
           <field name="project_id" readonly="1"/>
-          <field name="task_id" domain="[('state','=','open')]"/>
+          <field name="task_id" domain="[('state','=','open')]" on_change="onchange_task_id(task_id)"/>
           <field name="name"/>
           <field name="hours" sum="Hours"  widget="float_time"/>
-          <field name="date"/>
+          <field name="date" invisible="1"/>
+          <field name="date_date" required="1"/>
           <field name="user_id"/>
-          <field name="company_id" groups="base.group_multi_company"/>
+          <field name="to_invoice"/>
+          <field name="product_id"/>
+          <field name="company_id" groups="base.group_multi_company" invisible="1"/>
           <field name="hr_analytic_timesheet_id" readonly="1" invisible="1"/>
         </tree>
       </field>
@@ -30,11 +33,13 @@
       <field name="arch" type="xml">
         <form string="Task Work">
           <field name="project_id" readonly="1"/>
-          <field name="task_id" domain="[('state','=','open')]"/>
+          <field name="task_id" domain="[('state','=','open')]" on_change="onchange_task_id(task_id)"/>
           <field name="name"/>
           <field name="hours"  widget="float_time"/>
-          <field name="date"/>
+          <field name="date" invisible="1"/>
+          <field name="date_date" required="1"/>
           <field name="user_id"/>
+          <field name="product_id"/>
           <field name="company_id" groups="base.group_multi_company"/>
           <field name="hr_analytic_timesheet_id" groups="base.group_extended" readonly="1"/>
         </form>
@@ -49,43 +54,43 @@
         <search string="Task Work Search">
           <group col="14" colspan="4">
             <filter
-              domain="[('date','&lt;=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date','&gt;=',time.strftime('%%Y-%%m-%%d 00:00:00'))]"
+              domain="[('date_date','&lt;=',time.strftime('%%Y-%%m-%%d')),('date_date','&gt;=',time.strftime('%%Y-%%m-%%d'))]"
               help="Todays work"
               icon="terp-go-today"
               name="today"
               string="Today"/>
             <filter
-              domain="[('date','&lt;=',(datetime.date.today() + relativedelta(days=-1)).strftime('%%Y-%%m-%%d 23:59:59')),('date','&gt;=',(datetime.date.today() + relativedelta(days=-1)).strftime('%%Y-%%m-%%d 00:00:00'))]"
+              domain="[('date_date','=',(context_today()-datetime.timedelta(days=1).strftime('%%Y-%%m-%%d')))]"
               help="Yesterdays Work"
               icon="terp-go-today"
               string="Yesterday"/>
             <filter
-              domain="[('date','&lt;',(datetime.date.today() + relativedelta(months=1)).strftime('%%Y-%%m-01 00:00:00')),('date','&gt;=',time.strftime('%%Y-%%m-01 00:00:00')) ]"
+              domain="[('date_date','&lt;',(datetime.date.today() + relativedelta(months=1)).strftime('%%Y-%%m-01')),('date_date','&gt;=',time.strftime('%%Y-%%m-01')) ]"
               help="This month work"
               icon="terp-go-month"
               string="This Mo"/>
             <filter
-              domain="[('date','&lt;',(datetime.date.today().strftime('%%Y-%%m-01 00:00:00'))) , ('date','&gt;=', ((datetime.date.today() + relativedelta(months=-1)).strftime('%%Y-%%m-01 00:00:00'))) ]"
+              domain="[('date_date','&lt;',(datetime.date.today().strftime('%%Y-%%m-01'))) , ('date_date','&gt;=', ((datetime.date.today() + relativedelta(months=-1)).strftime('%%Y-%%m-01'))) ]"
               help="Last month work"
               icon="terp-go-month"
               string="Last Mo"/>
             <filter
-              domain="[('date','&gt;=', (datetime.date.today().strftime('%%Y-'+ str((((datetime.date.today().month/4)+1)*3-2)).zfill(2) +'-01 00:00:00')))]"
+              domain="[('date_date','&gt;=', (datetime.date.today().strftime('%%Y-'+ str((((datetime.date.today().month/4)+1)*3-2)).zfill(2) +'-01')))]"
               help="This Quarter work"
               icon="terp-go-month"
               string="This Qu"/>
             <filter
-              domain="[('date','&lt;', (datetime.date.today().strftime('%%Y-'+ str((((datetime.date.today().month/4)+1)*3-2)).zfill(2) +'-01 00:00:00'))) ,  ('date','&gt;=', ((datetime.datetime.now() + relativedelta(months=-3)).strftime('%%Y-'+ str(((( (datetime.datetime.now() + relativedelta(months=-3)).month/4)+1)*3-2)).zfill(2) +'-01 00:00:00'))) ] "
+              domain="[('date_date','&lt;', (datetime.date.today().strftime('%%Y-'+ str((((datetime.date.today().month/4)+1)*3-2)).zfill(2) +'-01'))) ,  ('date_date','&gt;=', ((datetime.datetime.now() + relativedelta(months=-3)).strftime('%%Y-'+ str(((( (datetime.datetime.now() + relativedelta(months=-3)).month/4)+1)*3-2)).zfill(2) +'-01'))) ] "
               help="Last quarters work"
               icon="terp-go-month"
               string="Last Qu"/>
             <filter
-              domain="[('date','&gt;=',time.strftime('%%Y-01-01 00:00:00')) ]"
+              domain="[('date_date','&gt;=',time.strftime('%%Y-01-01')) ]"
               help="This year work"
               icon="terp-go-year"
               string="This Yr"/>
             <filter
-              domain="[('date','&lt;',time.strftime('%%Y-01-01 00:00:00')) ,('date','&gt;=',(datetime.date.today() + relativedelta(years=-1)).strftime('%%Y-01-01 00:00:00')) ]"
+              domain="[('date_date','&lt;',time.strftime('%%Y-01-01')) ,('date_date','&gt;=',(datetime.date.today() + relativedelta(years=-1)).strftime('%%Y-01-01')) ]"
               help="Last year work"
               icon="terp-go-year"
               string="Last Yr"/>
@@ -94,7 +99,8 @@
             <field name="project_id"/>
             <field name="task_id"/>
             <field name="name"/>
-            <field name="company_id"/>
+            <field name="company_id" groups="base.group_multi_company"/>
+            <field name="product_id"/>
             <separator orientation="vertical"/>
             <field name="user_id">
               <filter domain="[('user_id','=',uid)]" help="My Work" icon="terp-personal" name="mywork"/>
@@ -103,7 +109,7 @@
           <newline/>
           <group expand="0" string="Extended Filters..." colspan="4" col="8">
             <field name="hours"/>
-            <field name="date"/>
+            <field name="date_date"/>
           </group>
           <newline/>
           <group expand="0" string="Group By..." colspan="4" col="8">
@@ -126,7 +132,7 @@
               name="by_user"
               string="User"/>
             <filter
-              context="{'group_by':'date'}"
+              context="{'group_by':'date_date'}"
               domain="[]"
               icon="terp-accessories-archiver"
               name="by_date"
@@ -159,7 +165,7 @@
     <menuitem
       action="c2c_project_task_work"
       id="menu_c2c_project_task_work"
-      parent="base.menu_project_management_time_tracking"
+      parent="project.menu_project_management"
       sequence="150"/>
   </data>
 </openerp>

=== modified file 'c2c_refresh_so_lines/sale_view.xml'
--- c2c_refresh_so_lines/sale_view.xml	2012-02-20 08:28:58 +0000
+++ c2c_refresh_so_lines/sale_view.xml	2013-07-10 21:51:25 +0000
@@ -6,7 +6,7 @@
             <field name="inherit_id" ref="sale.view_order_form"/>
             <field name="type">form</field>
             <field name="arch" type="xml">
-            <field name="invoiced" select="2" position="after" >
+            <field name="invoiced"  position="after" >
                 <button name="button_refresh_prices" 
                     string="Refresh line unit prices" 
                     states="draft" 

=== modified file 'c2c_reporting_tools/__openerp__.py'
--- c2c_reporting_tools/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_reporting_tools/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -51,4 +51,5 @@
 , "update_xml" : []
 , "auto_install": False
 , "installable": True
+, 'application'  : False
 }

=== modified file 'c2c_sale_multi_partner/__openerp__.py'
--- c2c_sale_multi_partner/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_sale_multi_partner/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -38,7 +38,7 @@
                    'stock_report.xml',
        ],
     'demo_xml': [],
-    'installable': True,
+    'installable': False,
     'active': False,
 }
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'c2c_sequence_fy/__init__.py'
--- c2c_sequence_fy/__init__.py	2012-12-20 15:30:00 +0000
+++ c2c_sequence_fy/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #    Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
@@ -16,7 +16,7 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 import account_fiscalyear

=== modified file 'c2c_sequence_fy/__openerp__.py'
--- c2c_sequence_fy/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_sequence_fy/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -25,19 +25,19 @@
 , 'version'     : '0.8'
 , 'category'    : 'Accounting & Finance'
 , 'description' : """
-This module adds 
+This module adds
 * monthly sequences for journals
 * "fy", "stn", "stc" and "jn" as placeholder for prefix and suffix.
 
 * creation rules for missing sequences in ir_sequence_type and account journal
    if a not existing sequence is requested it will be created on the fly.
-   * if no prefix pattern is defined in sequence-codes, a name will be created using 
+   * if no prefix pattern is defined in sequence-codes, a name will be created using
      the first characters of each word of then name of the sequence-code
      Example "Account Invoice In" will be "AAI-"
 
 * "fy" (fiscal year)
   This allows contiguous numbering per fiscal year.
-  This sequence code will be used to format the start date of the fiscal year 
+  This sequence code will be used to format the start date of the fiscal year
   for the placeholder 'fy' defined for sequences as prefix and suffix.
   Example a fiscal year starting on March 1st with a sequence code %Ya will generate 2011a.
   This allows to handle multiple fiscal years per calendar year and fiscal years not matching calendar years easily.
@@ -50,10 +50,10 @@
 
 * "jn" (journal-name)
   This allows to use the (abbreviated) journal name as placeholder.
-  
-If no prefix/suffix is specified, the prefix/suffix of the sequence-code is used. 
-
-This module is a prerequisite to automatically generated new fiscal years, periods and associated sequences 
+
+If no prefix/suffix is specified, the prefix/suffix of the sequence-code is used.
+
+This module is a prerequisite to automatically generated new fiscal years, periods and associated sequences
 using '(fy)' instead of hard coding.
 
 * Configuration wizard:
@@ -61,15 +61,17 @@
 """
 , 'author'      : 'Camptocamp'
 , 'depends'     : ['account']
-, 'update_xml'  : 
+, 'update_xml'  :
     [ 'ir_sequence_view.xml'
     , 'account_fiscalyear_view.xml'
     , 'ir_sequence_type_view.xml'
     , 'ir_sequence_installer_view.xml'
     , 'account_view.xml'
+    , 'security/ir.model.access.csv'
     ]
 , 'demo_xml'    : []
 , 'installable' : True
+, 'application'  : False 
 , 'active'      : False
 }
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'c2c_sequence_fy/account.py'
--- c2c_sequence_fy/account.py	2012-12-20 15:30:00 +0000
+++ c2c_sequence_fy/account.py	2013-07-10 21:51:25 +0000
@@ -39,13 +39,13 @@
     }
 
     def create_sequence(self, cr, uid, vals, context=None):
-       res =  super(account_journal,self).create_sequence(cr, uid, vals, context)
-       seq_obj = self.pool.get('ir.sequence')
-       for seq in seq_obj.browse(cr, uid, [res],context) :
-           # FIXME - include the new parameters like fy,etc and uset the prefix_pattern
-           prefix = seq.prefix.replace('/%(year)s/','-%(fy)s-')
-           seq_obj.write(cr, uid, res,{'prefix' : prefix }) 
-       return res
+        res =  super(account_journal,self).create_sequence(cr, uid, vals, context)
+        seq_obj = self.pool.get('ir.sequence')
+        for seq in seq_obj.browse(cr, uid, [res],context) :
+            # FIXME - include the new parameters like fy,etc and uset the prefix_pattern
+            prefix = seq.prefix.replace('/%(year)s/','-%(fy)s-')
+            seq_obj.write(cr, uid, res,{'prefix' : prefix })
+        return res
 
 
 account_journal()

=== modified file 'c2c_sequence_fy/account_move.py'
--- c2c_sequence_fy/account_move.py	2012-12-20 15:30:00 +0000
+++ c2c_sequence_fy/account_move.py	2013-07-10 21:51:25 +0000
@@ -23,6 +23,62 @@
 from tools.translate import _
 import logging
 
+class account_bank_statement(osv.osv):
+    _inherit = "account.bank.statement"
+    _logger = logging.getLogger(__name__)
+
+
+    # we have to copy the method because wen need to pass period_id and journal_id to next_by_id
+    # rest is identical
+    def button_confirm_bank(self, cr, uid, ids, context=None):
+        obj_seq = self.pool.get('ir.sequence')
+        if context is None:
+            context = {}
+
+        for st in self.browse(cr, uid, ids, context=context):
+            j_type = st.journal_id.type
+            company_currency_id = st.journal_id.company_id.currency_id.id
+            if not self.check_status_condition(cr, uid, st.state, journal_type=j_type):
+                continue
+
+            self.balance_check(cr, uid, st.id, journal_type=j_type, context=context)
+            if (not st.journal_id.default_credit_account_id) \
+                    or (not st.journal_id.default_debit_account_id):
+                raise osv.except_osv(_('Configuration Error !'),
+                        _('Please verify that an account is defined in the journal.'))
+
+            if not st.name == '/':
+                st_number = st.name
+            else:
+                c = {'fiscalyear_id': st.period_id.fiscalyear_id.id, 'period_id': st.period_id.id, 'journal_id': st.journal_id.id}
+                #c = {'fiscalyear_id': move.period_id.fiscalyear_id.id, 'period_id': move.period_id.id, 'journal_id': move.journal_id.id}
+                if st.journal_id.sequence_id:
+                    st_number = obj_seq.next_by_id(cr, uid, st.journal_id.sequence_id.id, context=c)
+                else:
+                    st_number = obj_seq.next_by_code(cr, uid, 'account.bank.statement', context=c)
+
+            for line in st.move_line_ids:
+                if line.state <> 'valid':
+                    raise osv.except_osv(_('Error !'),
+                            _('The account entries lines are not in valid state.'))
+            for st_line in st.line_ids:
+                if st_line.analytic_account_id:
+                    if not st.journal_id.analytic_journal_id:
+                        raise osv.except_osv(_('No Analytic Journal !'),_("You have to assign an analytic journal on the '%s' journal!") % (st.journal_id.name,))
+                if not st_line.amount:
+                    continue
+                st_line_number = self.get_next_st_line_number(cr, uid, st_number, st_line, context)
+                self.create_move_from_st_line(cr, uid, st_line.id, company_currency_id, st_line_number, context)
+
+            self.write(cr, uid, [st.id], {
+                    'name': st_number,
+                    'balance_end_real': st.balance_end
+            }, context=context)
+            self.log(cr, uid, st.id, _('Statement %s is confirmed, journal items are created.') % (st_number,))
+        return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
+
+account_bank_statement()
+
 class account_move(osv.osv):
     _inherit = "account.move"
     _logger = logging.getLogger(__name__)
@@ -60,7 +116,9 @@
                    'WHERE id IN %s',
                    ('posted', tuple(valid_moves),))
         return True
-        
+
+
+
     # 20121010 Fgf NOT USED ANY MORE
     def post_incompatible(self, cr, uid, ids, context=None):
         self._logger.debug('post move context `%s`', context)
@@ -69,69 +127,69 @@
         journal_id = context.get('journal_id')
         period_id = []
         if 'period_id' in context:
-           period_id = [context.get('period_id')]
+            period_id = [context.get('period_id')]
         self._logger.debug('post move period_id `%s`', period_id)
         invoice_obj = context.get('invoice')
         if invoice_obj and not journal_id:
-           journal_id = invoice_obj.journal_id.id
+            journal_id = invoice_obj.journal_id.id
         self._logger.debug('post move journal `%s`', journal_id)
         jour_obj = self.pool.get('account.journal')
         seq_obj  = self.pool.get('ir.sequence')
         if journal_id:
-          for jour in jour_obj.browse(cr, uid, [journal_id] , context=context):
-            self._logger.debug('post jour `%s` `%s`', jour, jour.sequence_id)
-            if jour.sequence_id: 
-                main_seq_id = jour.sequence_id.id
-            elif jour.create_sequence in ['create','create_fy']:
-                prefix = jour.prefix_pattern or "".join(w[0] for w in _(jour.name).split(' '))
-                values = \
-                            { 'name'           : jour.name
-                            , 'prefix'         : prefix
-                            , 'padding'        : 3
-                            , 'implementation' : 'no_gap'
-                            }
-                main_seq_id = seq_obj.create(cr, uid, values)
-                jou_obj.write(cr, uid, [journal_id], {'sequence_id' : main_seq_id})
-            
-            if jour.create_sequence == 'create_fy' :  
-                fy_seq_obj = self.pool.get('account.sequence.fiscalyear')
-                period_obj = self.pool.get('account.period')
-                if not period_id:
-                   self._logger.debug('per_id A')
-                   period_id = invoice_obj.period_id.id 
-                   self._logger.debug('per_id B `%s`', period_id)
-                   if not period_id:
-                       self._logger.debug('per_id C `%s`', period_id)
-                       period_id = period_obj.find(cr, uid, invoice_obj.date_invoice, context)
-                   self._logger.debug('per_id D `%s`', period_id)
-                
-                if not isinstance(period_id, list) :
-                    period_id = [period_id] 
-                for period in period_obj.browse(cr, uid, period_id):
-                    self._logger.debug('fy_id `%s`', period)
-                    fy_id = period.fiscalyear_id.id
-                    fy_code =  period.fiscalyear_id.code
-                    self._logger.debug('fy_id a `%s`', fy_id)
-                fy_seq = fy_seq_obj.search(cr, uid, [('fiscalyear_id','=', fy_id),('sequence_main_id','=',main_seq_id)])
-                self._logger.debug('fy_seq_id `%s`', fy_seq)
-                if not fy_seq:
-                   prefix = jour.prefix_pattern or "".join(w[0] for w in _(jour.name).split(' ')) + '-%(fy)s-'
-                    
-                   values = \
-                            { 'name'           : jour.name + ' ' +  fy_code
-                            , 'prefix'         : prefix
-                            , 'padding'        : 3
-                            , 'implementation' : 'no_gap'
-                            }
-                   fy_seq_id = seq_obj.create(cr, uid, values)
-                   fy_rel = \
-                          { 'sequence_id'      : fy_seq_id
-                          , 'sequence_main_id' : main_seq_id
-                          , 'fiscalyear_id'    : fy_id
-                          }   
-                   self._logger.debug('fy_rel `%s``%s`', fy_rel, prefix)
-                   fy_seq_obj.create(cr, uid, fy_rel)
-          #return True
+            for jour in jour_obj.browse(cr, uid, [journal_id] , context=context):
+                self._logger.debug('post jour `%s` `%s`', jour, jour.sequence_id)
+                if jour.sequence_id:
+                    main_seq_id = jour.sequence_id.id
+                elif jour.create_sequence in ['create','create_fy']:
+                    prefix = jour.prefix_pattern or "".join(w[0] for w in _(jour.name).split(' '))
+                    values = \
+                                { 'name'           : jour.name
+                                , 'prefix'         : prefix
+                                , 'padding'        : 3
+                                , 'implementation' : 'no_gap'
+                                }
+                    main_seq_id = seq_obj.create(cr, uid, values)
+                    jou_obj.write(cr, uid, [journal_id], {'sequence_id' : main_seq_id})
+
+                if jour.create_sequence == 'create_fy' :
+                    fy_seq_obj = self.pool.get('account.sequence.fiscalyear')
+                    period_obj = self.pool.get('account.period')
+                    if not period_id:
+                        self._logger.debug('per_id A')
+                        period_id = invoice_obj.period_id.id
+                        self._logger.debug('per_id B `%s`', period_id)
+                        if not period_id:
+                            self._logger.debug('per_id C `%s`', period_id)
+                            period_id = period_obj.find(cr, uid, invoice_obj.date_invoice, context)
+                        self._logger.debug('per_id D `%s`', period_id)
+
+                    if not isinstance(period_id, list) :
+                        period_id = [period_id]
+                    for period in period_obj.browse(cr, uid, period_id):
+                        self._logger.debug('fy_id `%s`', period)
+                        fy_id = period.fiscalyear_id.id
+                        fy_code =  period.fiscalyear_id.code
+                        self._logger.debug('fy_id a `%s`', fy_id)
+                    fy_seq = fy_seq_obj.search(cr, uid, [('fiscalyear_id','=', fy_id),('sequence_main_id','=',main_seq_id)])
+                    self._logger.debug('fy_seq_id `%s`', fy_seq)
+                    if not fy_seq:
+                        prefix = jour.prefix_pattern or "".join(w[0] for w in _(jour.name).split(' ')) + '-%(fy)s-'
+
+                        values = \
+                                 { 'name'           : jour.name + ' ' +  fy_code
+                                 , 'prefix'         : prefix
+                                 , 'padding'        : 3
+                                 , 'implementation' : 'no_gap'
+                                 }
+                        fy_seq_id = seq_obj.create(cr, uid, values)
+                        fy_rel = \
+                               { 'sequence_id'      : fy_seq_id
+                               , 'sequence_main_id' : main_seq_id
+                               , 'fiscalyear_id'    : fy_id
+                               }
+                        self._logger.debug('fy_rel `%s``%s`', fy_rel, prefix)
+                        fy_seq_obj.create(cr, uid, fy_rel)
+            #return True
         return super(account_move, self).post(cr, uid, ids, context)
 
 account_move()

=== modified file 'c2c_sequence_fy/ir_sequence.py'
--- c2c_sequence_fy/ir_sequence.py	2012-12-20 15:30:00 +0000
+++ c2c_sequence_fy/ir_sequence.py	2013-07-10 21:51:25 +0000
@@ -49,31 +49,33 @@
     _columns = {
     'period_ids': fields.one2many('account.sequence.period',
             'sequence_main_id', 'Sequences')
-    }        
-    
+    }
+
     def _abbrev(self, name, separator):
         return "".join(w[0] for w in _(name).split(separator))
     # end def _abbrev
-    
+
     def next_by_id(self, cr, uid, sequence_id, context=None):
         if not context: context = {}
         """ Draw an interpolated string using the specified sequence."""
         self._logger.debug('next_by_id `%s` `%s`', sequence_id, context)
-        self.check_read(cr, uid)
-        company_ids = self.pool.get('res.company').search(cr, uid, [], order='company_id', context=context) + [False]
+        #self.check_read(cr, uid)
+        #company_ids = self.pool.get('res.company').search(cr, uid, [], order='company_id', context=context) + [False]
         seq_id = sequence_id
-        
-        create_sequence = ''    
+
+        create_sequence = ''
+        per_seq = False
         if context.get('journal_id') and context['journal_id']:
             journal_obj = self.pool.get('account.journal')
             for journal in journal_obj.browse(cr, uid, [context['journal_id']]):
                 create_sequence = journal.create_sequence
+                company_id = journal.company_id.id
                 if journal.create_sequence == 'create_period' and context.get('period_id') and context['period_id']:
                     per_seq_obj = self.pool.get('account.sequence.period')
                     per_seq_ids = per_seq_obj.search(cr, uid,  [('sequence_main_id','=', sequence_id),('period_id','=',context['period_id'])])
                     if per_seq_ids:
                         for per_seq in per_seq_obj.browse(cr, uid, per_seq_ids):
-                           seq_id = per_seq.sequence_id.id
+                            seq_id = per_seq.sequence_id.id
                     else:
                         period_obj = self.pool.get('account.period')
                         for period in period_obj.browse(cr, uid, [context['period_id']]):
@@ -86,6 +88,7 @@
                         , 'prefix'         : prefix
                         , 'padding'        : journal.sequence_id.padding
                         , 'implementation' : journal.sequence_id.implementation
+                        , 'company_id'     : company_id
                         }
                         seq_id = self.create(cr, uid, vals)
                         vals2 = {
@@ -94,67 +97,76 @@
                           ,'period_id'        : context['period_id']
                           }
                         per_seq_obj.create(cr, uid, vals2)
-                        
-        if context.get('fiscalyear_id') and context['fiscalyear_id'] :
-                    fy = context['fiscalyear_id'] 
-                    self._logger.debug('fy `%s`', fy)
-                    if fy:
-                      fy_seq_obj = self.pool.get('account.sequence.fiscalyear')
-                      fy_seq_ids = fy_seq_obj.search(cr, uid,  [('sequence_main_id','=', sequence_id),('fiscalyear_id','=',fy)])
-                      if fy_seq_ids:
-                          for fy_s in  fy_seq_obj.browse(cr, uid, fy_seq_ids):
-                              seq_id = fy_s.sequence_id.id
-                      else:
-                          fy_obj = self.pool.get('account.fiscalyear')
-                          for fy in fy_obj.browse(cr, uid, [fy]):
-                              fy_code = fy.code
-                              fy_name = fy.name
-                              prefix = journal.sequence_id.prefix + fy.code +'-'
-                          sequence_code = journal.sequence_id.code
-                          vals = \
-                          { 'code'           : sequence_code
-                          , 'name'           : journal.sequence_id.name +' '+ fy_name
-                          , 'prefix'         : prefix
-                          , 'padding'        : journal.sequence_id.padding
-                          , 'implementation' : journal.sequence_id.implementation
-                          }
-                          seq_id = self.create(cr, uid, vals)
-                          vals2 = {
-                           'sequence_id'      : seq_id
-                          ,'sequence_main_id' : sequence_id
-                          ,'fiscalyear_id'    : context['fiscalyear_id']
-                          }
-                          fy_seq_obj.create(cr, uid, vals2)
-        
-        
-                          
+                        per_seq = True
+
+        if context.get('fiscalyear_id') and context['fiscalyear_id'] and not per_seq:
+            fy = context['fiscalyear_id']
+            self._logger.debug('fy `%s`', fy)
+            if fy:
+                fy_seq_obj = self.pool.get('account.sequence.fiscalyear')
+                fy_seq_ids = fy_seq_obj.search(cr, uid,  [('sequence_main_id','=', sequence_id),('fiscalyear_id','=',fy)])
+                if fy_seq_ids:
+                    for fy_s in  fy_seq_obj.browse(cr, uid, fy_seq_ids):
+                        seq_id = fy_s.sequence_id.id
+                else:
+                    for seq in self.browse(cr, uid, [sequence_id], context):
+                        sequence_code = seq.code
+                        sequence_name = seq.name
+                        sequence_padding = seq.padding
+                        sequence_implementation = seq.implementation
+                        prefix = seq.prefix or '' + fy.code +'-'
+                        company_id = seq.company_id.id
+                         
+                    fy_obj = self.pool.get('account.fiscalyear')
+                    for fy in fy_obj.browse(cr, uid, [fy]):
+                        fy_code = fy.code
+                        fy_name = fy.name
+
+                    vals = \
+                    { 'code'           : sequence_code
+                    , 'name'           : sequence_name +' '+ fy_name
+                    , 'prefix'         : prefix
+                    , 'padding'        : sequence_padding
+                    , 'implementation' : sequence_implementation
+                    , 'company_id'     : company_id
+                    }
+                    seq_id = self.create(cr, uid, vals)
+                    vals2 = {
+                     'sequence_id'      : seq_id
+                    ,'sequence_main_id' : sequence_id
+                    ,'fiscalyear_id'    : context['fiscalyear_id']
+                    }
+                    fy_seq_obj.create(cr, uid, vals2)
+
+
+
         self._logger.debug('next_by_id seq_id `%s`', seq_id)
-             
+
         #ids = self.search(cr, uid, ['&',('id','=', sequence_id),('company_id','in',company_ids)])
         return self._next(cr, uid, seq_id , context)
     # end def next_by_id
 
-    
+
     def _fy_code(self, cr, uid, context) :
-        if context and ('fiscalyear_id' in context) and context.get('fiscalyear_id', False): 
-          fy_id = context.get('fiscalyear_id', False)
-          if fy_id :
-            fiscalyear_obj = self.pool.get('account.fiscalyear')
-            fy = fiscalyear_obj.browse(cr, uid, fy_id)
-            return fy.sequence_code or fy.date_start[0:4]
+        if context and ('fiscalyear_id' in context) and context.get('fiscalyear_id', False):
+            fy_id = context.get('fiscalyear_id', False)
+            if fy_id :
+                fiscalyear_obj = self.pool.get('account.fiscalyear')
+                fy = fiscalyear_obj.browse(cr, uid, fy_id)
+                return fy.sequence_code or fy.date_start[0:4]
         else :
             return time.strftime('%Y')
     # end def _fy_code
-    
+
     def _month_code(self, cr, uid, context) :
-        if context and ('period_id' in context) and context.get('period_id', False): 
-          period_id = context.get('period_id', False)
-          if period_id :
-            period_obj = self.pool.get('account.period')
-            period = period_obj.browse(cr, uid, period_id)
-            # we assume that period code is YYYYMM
-            # if FY starts with april then this should return YYMM 
-            return period.code[2] 
+        if context and ('period_id' in context) and context.get('period_id', False):
+            period_id = context.get('period_id', False)
+            if period_id :
+                period_obj = self.pool.get('account.period')
+                period = period_obj.browse(cr, uid, period_id)
+                # we assume that period code is YYYYMM
+                # if FY starts with april then this should return YYMM
+                return period.code[2]
         else :
             return ''
     # end def _fy_code
@@ -167,7 +179,7 @@
             name = record['name']
             if record['code']:
                 name = record['code'] + ' ' + name
-            
+
             fy_id = context.get('fiscalyear_id', False)
             if fy_id :
                 fy_seq_code = self._fy_code(cr, uid, context)
@@ -184,7 +196,7 @@
         else :
             return False
     # end def _journal
-    
+
     def _journal_name(self, cr, uid, seq) :
         jou = self._journal(cr, uid, seq)
         if jou :
@@ -192,31 +204,31 @@
         else :
             return ''
     # end def _journal_name
-    
+
     def _seq_type(self, cr, uid, seq):
         seq_type_obj = self.pool.get('ir.sequence.type')
         ids = seq_type_obj.search(cr, uid, [('code', '=', seq.code)])
         if ids :
-          return seq_type_obj.browse(cr, uid, ids[0])
+            return seq_type_obj.browse(cr, uid, ids[0])
         else :
             return False
     # end def _seq_type
-    
+
     def _seq_type_name(self, cr, uid, seq) :
         ty = self._seq_type(cr, uid, seq)
-        return self._abbrev(ty.name, ' ')       
+        return self._abbrev(ty.name, ' ')
     # end def _seq_type_name
-    
+
     def _seq_type_code(self, cr, uid, seq) :
         ty = self._seq_type(cr, uid, seq)
         return self._abbrev(ty.code, '.')
     # end def _seq_type_code
-    
+
     def _next_seq(self, cr, uid, id) :
         seq = self.browse(cr, uid, id)
-        if isinstance(seq,list): 
-           seq = self.browse(cr, uid, id)[0]
-        
+        if isinstance(seq,list):
+            seq = self.browse(cr, uid, id)[0]
+
         self._logger.debug('_next_seq `%s`', seq)
         if seq.implementation == 'standard' :
             cr.execute("SELECT nextval('%s_%03d')" % (self._table, seq.id))
@@ -227,7 +239,7 @@
             cr.execute("UPDATE %s SET number_next=number_next+number_increment WHERE id=%s" % (self._table, seq.id))
         return seq
     # end def _next_seq
-    
+
     def _format(self, cr, uid, seq, context) :
         d = self._interpolation_dict()
         d['fy']  = self._fy_code(cr, uid, context)
@@ -243,7 +255,7 @@
             _prefix = self._interpolate(ty.prefix_pattern or '', d)
         else :
             _prefix = ''
-        if seq.suffix : 
+        if seq.suffix :
             _suffix = self._interpolate(seq.suffix, d)
         elif ty and ty.suffix_pattern :
             _suffix = self._interpolate(ty.suffix_pattern or '', d)
@@ -276,7 +288,7 @@
             if seq_type.create_sequence == 'none' :
                 raise osv.except_osv \
                     ( _('Integrity Error !')
-                    , _('Automatic creation not allowed for sequence-code %s with %s') 
+                    , _('Automatic creation not allowed for sequence-code %s with %s')
                         % (sequence_code, seq_type.create_sequence)
                     )
             values = \
@@ -285,6 +297,7 @@
 #                , 'prefix'         :  # "%(stn)-"
                 , 'padding'        : 3
                 , 'implementation' : 'no_gap'
+                , 'company_id'     :  company_id
                 }
             # we have to set uid = 1, because creating a sequence is granted to the module not to a user group
             new_id = self.create(cr, 1, values)

=== modified file 'c2c_sequence_fy/ir_sequence_installer.py'
--- c2c_sequence_fy/ir_sequence_installer.py	2012-12-20 15:30:00 +0000
+++ c2c_sequence_fy/ir_sequence_installer.py	2013-07-10 21:51:25 +0000
@@ -30,9 +30,9 @@
         cr.execute \
             ("""UPDATE ir_sequence
                  SET prefix = replace(prefix, '(year)', '(fy)'),
-                     suffix = replace(suffix, '(year)', '(fy)') 
-               WHERE (prefix LIKE '%(year)%' OR  suffix LIKE '%(year)%') 
-                 AND id IN (SELECT sequence_main_id FROM account_sequence_fiscalyear);""" 
+                     suffix = replace(suffix, '(year)', '(fy)')
+               WHERE (prefix LIKE '%(year)%' OR  suffix LIKE '%(year)%')
+                 AND id IN (SELECT sequence_main_id FROM account_sequence_fiscalyear);"""
             )
-  
+
 ir_sequence_installer()

=== modified file 'c2c_sequence_fy/ir_sequence_installer_view.xml'
--- c2c_sequence_fy/ir_sequence_installer_view.xml	2011-12-22 11:40:30 +0000
+++ c2c_sequence_fy/ir_sequence_installer_view.xml	2013-07-10 21:51:25 +0000
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <openerp>
   <data>
+<!--
     <record id="view_sequence_configuration_installer" model="ir.ui.view">
       <field name="name">ir.sequence.installer.form</field>
       <field name="model">ir.sequence.installer</field>
@@ -37,5 +38,6 @@
       <field name="category_id" ref="account.category_accounting_configuration"/>
       <field name="type">automatic</field>
     </record>
+-->
   </data>
 </openerp>

=== modified file 'c2c_sequence_fy/ir_sequence_view.xml'
--- c2c_sequence_fy/ir_sequence_view.xml	2012-10-10 19:26:48 +0000
+++ c2c_sequence_fy/ir_sequence_view.xml	2013-07-10 21:51:25 +0000
@@ -7,7 +7,7 @@
       <field name="inherit_id" ref="base.sequence_view"/>
       <field name="type">form</field>
       <field name="arch" type="xml">
-        <xpath expr="/form//separator[@string='Legend (for prefix, suffix)']" position="after">
+        <xpath expr="/form/sheet/notebook/page/group[@string='Legend (for prefix, suffix)']" position="after">
           <group colspan="4" col="1">
             <label colspan="1" string="Current Fiscal Year: %%(fy)s (see sequence code in fiscalyear)"/>
             <label colspan="1" string="Abbreviated name of the journal: %%(jn)s"/>
@@ -27,7 +27,7 @@
             <field name="inherit_id" ref="base.sequence_view"/>
             <field name="arch" type="xml">
                 <page position="after">
-                    <page string="Periods" groups="base.group_extended">
+                    <page string="Periods" >
                         <field name="period_ids" nolabel="1" colspan="4">
                             <tree string="Period Sequences" editable="bottom">
                                 <field name="period_id"/>

=== added directory 'c2c_sequence_fy/security'
=== added file 'c2c_sequence_fy/security/ir.model.access.csv'
--- c2c_sequence_fy/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ c2c_sequence_fy/security/ir.model.access.csv	2013-07-10 21:51:25 +0000
@@ -0,0 +1,3 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"ir_sequence_period","account.sequence.period","model_account_sequence_period","account.group_account_user",1,1,1,0
+"ir_sequence","account.sequence","model_ir_sequence","account.group_account_user",1,1,1,0

=== modified file 'c2c_stock/__openerp__.py'
--- c2c_stock/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_stock/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -35,7 +35,7 @@
        ],
     #'update_xml': ['product_view.xml'],
     'demo_xml': [],
-    'installable': False,
+    'installable': True,
     'active': False,
 }
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'c2c_stock/stock_view.xml'
--- c2c_stock/stock_view.xml	2012-03-03 07:38:01 +0000
+++ c2c_stock/stock_view.xml	2013-07-10 21:51:25 +0000
@@ -2,11 +2,10 @@
 <openerp>
   <data>
     <!-- location -->
-    <record model="ir.ui.view" id="view_move_tree_values">
-      <field name="name">move_tree_view_values.view</field>
-      <field name="model">stock.move</field>
-      <field name="inherit_id" ref="stock.view_move_tree"/>
-      <field name="type">tree</field>
+    <record model="ir.ui.view" id="view_location_ext_form">
+      <field name="name">view.location.ext.form</field>
+      <field name="model">stock.location</field>
+      <field name="inherit_id" ref="stock.view_location_form"/>
       <field name="arch" type="xml">
         <field name="posz" position="after">
           <field name="capacity"/>
@@ -14,7 +13,7 @@
         </field>
       </field>
     </record>
-
+<!--
     <record model="ir.ui.view" id="view_warehouse_address">
       <field name="name">move_tree_warehouse_address.view</field>
       <field name="model">stock.warehouse</field>
@@ -26,6 +25,6 @@
         </field>
       </field>
     </record>
-
+-->
   </data>
 </openerp>

=== modified file 'c2c_stock_accounting/__init__.py'
--- c2c_stock_accounting/__init__.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_accounting/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #    Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
@@ -16,7 +16,7 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 

=== modified file 'c2c_stock_accounting/__openerp__.py'
--- c2c_stock_accounting/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_accounting/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -40,7 +40,7 @@
 ToDo
 * stock reports
 ** partly DONE report/report_stock_move.py - need in/out values for internal locations too
-* generate analytic lines       
+* generate analytic lines
 * Recalculate move_value_cost of out moves if value correction or in move is prior of out moves
 ** correct real time accounting
 * automatic handling of value roundings if qty_available is 0 after posting

=== added file 'c2c_stock_accounting/report/print_computed_product.mako'
--- c2c_stock_accounting/report/print_computed_product.mako	1970-01-01 00:00:00 +0000
+++ c2c_stock_accounting/report/print_computed_product.mako	2013-07-10 21:51:25 +0000
@@ -0,0 +1,209 @@
+<html>
+%if context['data'] and context['data'].get('form'):
+  <%form = True%>
+%else:
+  <%form = False%>
+%endif
+
+%if form  and context['data']['form']['display_with_zero_qty'] ==1:
+  <%all_zero = True%>
+%else:
+  <%all_zero = False%>
+%endif
+
+
+ <%
+      categ = ''
+      stock_account = ''
+      expense_account = ''
+      cumul_categ_qty = 0.0
+      cumul_categ_valuation = 0.0
+      cumul_categ_valuation2 = 0.0
+      cumul_categ_valuation_diff = 0.0
+      cumul_qty = 0.0
+      cumul_valuation = 0.0
+      cumul_valuation2 = 0.0
+      cumul_valuation_diff = 0.0
+ %>
+
+
+<head>
+    <style type="text/css">
+        ${css}
+        pre {font-family:helvetica; font-size:12;}
+    </style>
+<h1>${_("Product List")}</h1>
+</head>
+<body>
+    <style  type="text/css">
+     table {
+       width: 100%;
+       page-break-after:auto;
+       border-collapse: collapse;
+       cellspacing="0";
+       font-size:10px;
+           }
+     td { margin: 0px; padding: 3px; border: 1px solid lightgrey;  vertical-align: top; }
+     th { margin: 0px; padding: 3px; border: 0px solid lightgrey;  vertical-align: top; }
+     pre {font-family:helvetica; font-size:15;}
+    </style>
+   
+${_("Selection")}
+<table>
+<tr>
+ <td>${_("Location")}</td>
+ <td style="width:16%;">${_("From")}</td>
+ <td style="width:16%;">${_("To")}</td>
+ <td style="width:16%;">${_("From Compare")}</td>
+ <td style="width:16%;">${_("To Compare")}</td>
+</tr>
+<tr>
+ <td>${context['location_name'] or ''}</td>
+ <td>${context['local_from_date1'] or ''}</td>
+ <td>${context['local_to_date1'] or ''}</td>
+ <td>${context['local_from_date2'] or ''}</td>
+ <td>${context['local_to_date2'] or ''}</td>
+<!--
+ <td>${context['data']['form']['from_date'] or ''}</td>
+ <td>${context['data']['form']['to_date'] or ''}</td>
+ <td>${context['data']['form']['from_date2'] or ''}</td>
+ <td>${context['data']['form']['to_date2'] or ''}</td>
+-->
+</tr>
+</table>
+<br>
+<table>
+
+        <thead>
+          <tr>
+            <th style="text-align:left;white-space:nowrap">${_("Product")}</th>
+            <th style="text-align:right;white-space:nowrap">${_("Qty")}</th>
+            <th style="text-align:left;white-space:nowrap">${_("UoM")}</th>
+            <th style="text-align:right">${_("Avg Price")}</th>
+            <th style="text-align:right">${_("Valuation")}</th>
+            <th style="text-align:right">${_("Valuation Comp")}</th>
+            <th style="text-align:right">${_("Valuation Diff")}</th>
+         </tr>
+        </thead>
+<%
+sorted_objects = sorted(objects, key=lambda o : o.categ_id.name + o.name) 
+%>
+%for prod in sorted_objects :
+        <tbody>
+%if (all_zero or prod.qty_available !=0  or prod.valuation1 !=0 or prod.valuation2 !=0 ):
+
+%if categ and categ != prod.categ_id.name:
+          <tr>
+            <th style="text-align:left;white-space:nowrap">${categ} ${_("TOTAL")}</th>
+            <th style="text-align:right;white-space:nowrap">${  formatLang(cumul_categ_qty)}</th>
+            <th style="text-align:left;white-space:nowrap"></th>
+            <th style="text-align:left;white-space:nowrap"></th>
+            <th style="text-align:right;white-space:nowrap;">${  formatLang(cumul_categ_valuation)}</th>
+            <th style="text-align:right;white-space:nowrap;">${  formatLang(cumul_categ_valuation2)}</th>
+            <th style="text-align:left;white-space:nowrap"></th>
+         </tr>
+         <tr>
+%if cumul_categ_valuation_diff > 0.0:
+            <th style="text-align:right;white-space:nowrap">${stock_account} : ${expense_account}</th>
+%else:
+            <th style="text-align:right;white-space:nowrap">${expense_account} : ${stock_account}</th>
+%endif
+            <th style="text-align:right;white-space:nowrap"></th>
+            <th style="text-align:right;white-space:nowrap"></th>
+            <th style="text-align:left;white-space:nowrap"></th>
+            <th style="text-align:left;white-space:nowrap"></th>
+            <th style="text-align:left;white-space:nowrap"></th>
+%if cumul_categ_valuation_diff < 0.0:
+            <th style="text-align:right;white-space:nowrap;">${  formatLang( -cumul_categ_valuation_diff)}</th>
+%else:
+            <th style="text-align:right;white-space:nowrap;">${  formatLang(cumul_categ_valuation_diff)}</th>
+%endif
+         </tr>
+
+ <%
+      cumul_categ_qty = 0.0
+      cumul_categ_valuation = 0.0
+      cumul_categ_valuation2 = 0.0
+      cumul_categ_valuation_diff = 0.0
+ %>
+
+%endif
+          <tr>
+            <td>${prod.name}</td>
+            <td style="text-align:right">${prod.qty_available}</td>
+            <td>${prod.uom_id.name or ''}</td>
+%if prod.qty_available == 0:
+            <td style="text-align:left;white-space:nowrap"></td>
+%else:
+            <td style="text-align:right">${  formatLang(prod.valuation1/prod.qty_available)}</td>
+%endif
+            <td style="text-align:right;white-space:nowrap;">${prod.valuation1}</td>
+            <td style="text-align:right;white-space:nowrap;">${prod.valuation2}</td>
+            <td style="text-align:right;white-space:nowrap;">${prod.valuation_diff}</td>
+
+ <%
+      categ = prod.categ_id.name
+      if prod.stock_account_id and prod.stock_account_id.code and prod.stock_account_id.name:
+          stock_account = prod.stock_account_id.code  + ' ' + prod.stock_account_id.name 
+      else:
+          stock_account = _('Undefined Stock Account')
+      if prod.expense_account_id and prod.expense_account_id.code and prod.expense_account_id.name:
+          expense_account = prod.expense_account_id.code + ' ' + prod.expense_account_id.name
+      else:
+          expense_account = _('Undefined Expense Account')
+      cumul_categ_qty += prod.qty_available
+      cumul_categ_valuation += prod.valuation1
+      cumul_categ_valuation2 += prod.valuation2
+      cumul_categ_valuation_diff += prod.valuation_diff
+      cumul_qty += prod.qty_available
+      cumul_valuation += prod.valuation1
+      cumul_valuation2 += prod.valuation2
+      cumul_valuation_diff += prod.valuation_diff
+ %>
+         </tr>
+%endif
+        </tbody>
+%endfor
+        <tfoot>
+                  <tr>
+            <th style="text-align:left;white-space:nowrap">${categ} ${_("TOTAL")}</th>
+            <th style="text-align:right;white-space:nowrap">${  formatLang(cumul_categ_qty)}</th>
+            <th style="text-align:left;white-space:nowrap"></th>
+            <th style="text-align:left;white-space:nowrap"></th>
+            <th style="text-align:right;white-space:nowrap;">${  formatLang(cumul_categ_valuation)}</th>
+            <th style="text-align:right;white-space:nowrap;">${  formatLang(cumul_categ_valuation2)}</th>
+            <th style="text-align:left;white-space:nowrap"></th>
+         </tr>
+         <tr>
+%if cumul_categ_valuation_diff > 0.0:
+            <th style="text-align:right;white-space:nowrap">${stock_account} : ${expense_account}</th>
+%else:
+            <th style="text-align:right;white-space:nowrap">${expense_account} : ${stock_account}</th>
+%endif
+            <th style="text-align:right;white-space:nowrap"></th>
+            <th style="text-align:left;white-space:nowrap"></th>
+            <th style="text-align:left;white-space:nowrap"></th>
+            <th style="text-align:left;white-space:nowrap"></th>
+            <th style="text-align:left;white-space:nowrap"></th>
+%if cumul_categ_valuation_diff < 0.0:
+            <th style="text-align:right";white-space:nowrap;>${  formatLang( -cumul_categ_valuation_diff)}</th>
+%else:
+            <th style="text-align:right">${  formatLang(cumul_categ_valuation_diff)}</th>
+%endif
+         </tr>
+
+          <tr>
+            <th style="text-align:left;white-space:nowrap">${_("GRAND TOTAL")}</th>
+            <th style="text-align:right;white-space:nowrap">${ formatLang(cumul_qty)}</th>
+            <th style="text-align:left;white-space:nowrap"></th>
+            <th style="text-align:left;white-space:nowrap"></th>
+            <th style="text-align:right;white-space:nowrap;">${ formatLang(cumul_valuation)}</th>
+            <th style="text-align:right;white-space:nowrap;">${ formatLang(cumul_valuation2)}</th>
+            <th style="text-align:right;white-space:nowrap;">${ formatLang(cumul_valuation_diff)}</th>
+         </tr>
+        </tfoot>
+</table>
+
+</body>
+
+</html>

=== modified file 'c2c_stock_accounting/stock.py'
--- c2c_stock_accounting/stock.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_accounting/stock.py	2013-07-10 21:51:25 +0000
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -*: utf-8 -*-
 ##############################################################################
 #
 #    OpenERP, Open Source Management Solution
@@ -23,6 +23,7 @@
 from osv import osv, fields
 import decimal_precision as dp
 from tools.translate import _
+import time
 import logging
 
 
@@ -39,18 +40,18 @@
         """
         if context is None:
             context = {}
-        
+
         _logger.debug('FGF stock_location_product context %s',context)
         location_obj = self.pool.get('stock.location')
         warehouse_obj = self.pool.get('stock.warehouse')
         shop_obj = self.pool.get('sale.shop')
-        
+
         states = context.get('states',[])
         if not states:
-                states = ['done']
+            states = ['done']
         what = context.get('what',())
         if what == ():
-           what = ('in','out')
+            what = ('in','out')
         if not ids:
             ids = self.search(cr, uid, [])
         res = {}.fromkeys(ids, 0.0)
@@ -84,7 +85,7 @@
         if context.get('compute_child',True):
             child_location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', location_ids)])
             location_ids = child_location_ids or location_ids
-        
+
         # this will be a dictionary of the UoM resources we need for conversion purposes, by UoM id
         uoms_o = {}
         # this will be a dictionary of the product UoM by product id
@@ -158,7 +159,7 @@
             results2 = cr.fetchall()
             #for i in results2:
             #   _logger.debug('FGF stock_location_product out  %s',i)
-            
+
         #TOCHECK: before change uom of product, stock move line are in old uom.
         context.update({'raise-exception': False})
         # Compute the incoming vlaues
@@ -175,7 +176,7 @@
         ctx['to_date'] = context.get('to_date1',False)
         res=super(product_product, self)._product_available(cr, uid, ids, field_name, arg, context=ctx)
         return res
-        
+
 
     def _get_product_valuation1(self, cr, uid, ids, field_name, arg, context=None):
         ctx1 = dict(context)
@@ -194,32 +195,32 @@
     def _get_valuation_diff(self, cr, uid, ids, field_name, arg, context=None):
         res = {}
         for product in self.browse(cr, uid, ids, context=context):
-                 res[product.id] = product.valuation1 - product.valuation2
+            res[product.id] = product.valuation1 - product.valuation2
         return res
 
 
     def _get_avg_price(self, cr, uid, ids, field_name, arg, context=None):
-         res = {}
-         for product in self.browse(cr, uid, ids, context=context):
-             if product.qty_available >0 and product.valuation1 >0 :
-                 res[product.id] = product.valuation1 / product.qty_available
-             else:
-                 res[product.id] = 0
-         return res
+        res = {}
+        for product in self.browse(cr, uid, ids, context=context):
+            if product.qty_available >0 and product.valuation1 >0 :
+                res[product.id] = product.valuation1 / product.qty_available
+            else:
+                res[product.id] = 0
+        return res
 
     def _get_expense_account(self, cr, uid, ids, field_name, arg, context=None):
-         res = {}
-         for product in self.browse(cr, uid, ids, context=context):
-             res[product.id] =  product.property_account_expense.id  or product.categ_id.property_account_expense_categ.id or None
-         return res
+        res = {}
+        for product in self.browse(cr, uid, ids, context=context):
+            res[product.id] =  product.property_account_expense.id  or product.categ_id.property_account_expense_categ.id or None
+        return res
 
     def _get_product_expense(self, cr, uid, ids, context=None):
-         _logger  = logging.getLogger(__name__)
-         _logger.debug('FGF _get_product_expense ids %s' % ids)
-         product_ids = []
-         product_ids = self.pool.get('product.product').search(cr, uid, [('categ_id','in', ids)])
-         _logger.debug('FGF _get_product_expense product_ids %s' % product_ids)
-         return product_ids
+        _logger  = logging.getLogger(__name__)
+        _logger.debug('FGF _get_product_expense ids %s' % ids)
+        product_ids = []
+        product_ids = self.pool.get('product.product').search(cr, uid, [('categ_id','in', ids)])
+        _logger.debug('FGF _get_product_expense product_ids %s' % product_ids)
+        return product_ids
 
 
     _columns = {
@@ -235,7 +236,7 @@
             #                }
                    ),
            }
-           
+
     def fields_to_check(self, cr, uid):
         fields = super(product_product, self).fields_to_check(cr, uid)
         if fields:
@@ -269,7 +270,7 @@
             ids3.append(d[date])
         self._logger.debug('FGF ids3 `%s`', ids3)
         return self._compute_move_value_cost2(cr, uid, ids3, context)
-        
+
     def _compute_move_value_cost2(self, cr, uid, ids2,  context):
         res_curr_acc = self.pool.get('res.currency')
         self._logger.debug('sql sorted ids `%s`', ids2)
@@ -280,8 +281,8 @@
         self._logger.debug('digits `%s`', digits)
         for move in self.browse(cr, uid, ids2):
             self._logger.debug('type cost `%s`', move.picking_id.type)
-            #if move.state in ['done','cancel']: 
-            if move.state in ['cancel']: 
+            #if move.state in ['done','cancel']:
+            if move.state in ['cancel']:
                 result[move.id] = 0
 
             if move.value_correction:
@@ -293,8 +294,8 @@
                     result[move.id] = round(move.product_qty * move.price_unit,digits)
                 else:
                     rate = res_curr_acc._get_conversion_rate(cr, uid, move.purchase_line_id.order_id.pricelist_id.currency_id, move.company_id.currency_id, context=context)
-                    result[move.id] = round(move.purchase_line_id.price_subtotal / move.purchase_line_id.product_qty * move.product_qty * rate ,digits) 
-            elif move.location_id.usage == 'internal': 
+                    result[move.id] = round(move.purchase_line_id.price_subtotal / move.purchase_line_id.product_qty * move.product_qty * rate ,digits)
+            elif move.location_id.usage == 'internal':
                 loc_id = str(move.location_id.id)
                 self._logger.debug('loc_id `%s`', loc_id)
                 # compute avg price per stock location
@@ -308,18 +309,18 @@
                   and (location_id = '+loc_id+' or location_dest_id = '+loc_id+') \
                   and date <= to_date(\''+ move.date + '\',\'YYYY-MM-DD HH24:MI:SS\') and id != '+ str(move.id)
                 if move.prodlot_id:
-                   sql = sql + ' and prodlot_id = ' + str(move.prodlot_id.id )
+                    sql = sql + ' and prodlot_id = ' + str(move.prodlot_id.id )
                 #self._logger.debug('sql move_value_cost`%s`', sql)
                 cr.execute(sql)
                 for r in cr.dictfetchall():
-                   sum_amount = r['sum_amount']
-                   sum_qty    = r['sum_qty']
-                   self._logger.debug('FGF sum product %s %s %s %s' % (move.product_id.id, move.date,sum_amount, sum_qty))
-                   if sum_qty and sum_qty > 0.0 and sum_amount > 0.0:
-                       avg_price = sum_amount / sum_qty 
-                       result[move.id] = round(move.product_qty * avg_price,digits)
-                   else :
-                       result[move.id] = round(move.product_qty * move.product_id.standard_price,digits)
+                    sum_amount = r['sum_amount']
+                    sum_qty    = r['sum_qty']
+                    self._logger.debug('FGF sum product %s %s %s %s' % (move.product_id.id, move.date,sum_amount, sum_qty))
+                    if sum_qty and sum_qty > 0.0 and sum_amount > 0.0:
+                        avg_price = sum_amount / sum_qty
+                        result[move.id] = round(move.product_qty * avg_price,digits)
+                    else :
+                        result[move.id] = round(move.product_qty * move.product_id.standard_price,digits)
             else:
                 if move.price_unit and move.price_unit != 0:
                     result[move.id] = round(move.product_qty * move.price_unit,digits)
@@ -330,19 +331,22 @@
                 sql = 'update stock_move set move_value_cost = round(%s,%s) where id = %d' % (result[move.id],digits,move.id)
                 self._logger.debug('sql init sql %s' % (sql))
                 cr.execute(sql)
-                
+
         self._logger.debug('FGF result `%s`', result)
         return result
 
     def _compute_move_value_sale(self, cr, uid, ids, name, args, context):
         self._logger.debug('value_sale')
+        res_curr_acc = self.pool.get('res.currency')
+        digits = self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')
         if not ids: return {}
         result = {}
         for move in self.browse(cr, uid, ids):
             if move.state in ['done','cancel']: return {}
             self._logger.debug('type sale `%s`', move.picking_id.type)
             if move.sale_line_id:
-                result[move.id] = move.product_qty * move.sale_line_id.price_unit
+                rate = res_curr_acc._get_conversion_rate(cr, uid, move.sale_line_id.order_id.pricelist_id.currency_id, move.company_id.currency_id, context=context)
+                result[move.id] = round(move.product_qty * move.sale_line_id.price_unit * rate, digits)
                 self._logger.debug('value_sale `%s`', result[move.id])
         return result
 
@@ -354,51 +358,53 @@
             avg_price = 0.0
             if move.picking_id.type == 'out' and move.state != 'cancel' and move.product_qty and move.product_qty != 0:
                 self._logger.debug('type sale `%s`', move.picking_id.type)
-                avg_price = move.move_value_sale / move.product_qty 
+                avg_price = move.move_value_sale / move.product_qty
             result[move.id] = avg_price
             self._logger.debug('value_sale `%s`', result[move.id])
         return result
 
 
     def _period_id(self, cr, uid, ids, name, arg, context):
-         result = {}
-         for move in self.browse(cr, uid, ids):
-             #period_ids= self.pool.get('account.period').search(cr,uid,[('date_start','<=',move.date),('date_stop','>=',move.date ), ('special','=',False)])
-             period_ids= self.pool.get('account.period').search(cr,uid,[('date_start','<=',move.date),('date_stop','>=',move.date ),('special','!=', True)])
-             
-             if len(period_ids):
-                 result[move.id] = period_ids[0]
-             
-         return result
+        result = {}
+        for move in self.browse(cr, uid, ids):
+            #period_ids= self.pool.get('account.period').search(cr,uid,[('date_start','<=',move.date),('date_stop','>=',move.date ), ('special','=',False)])
+            #period_ids= self.pool.get('account.period').search(cr,uid,[('date_start','<=',move.date),('date_stop','>=',move.date ),('special','!=', True)])
+            period_ids= self.pool.get('account.period').search(cr,uid,[('date_start','<=',move.date_expected),('date_stop','>=',move.date_expected ),('special','!=', True)])
+
+            if len(period_ids):
+                result[move.id] = period_ids[0]
+
+        return result
 
     def _get_purchase_order_line(self, cr, uid, ids, context=None):
-         result = {}
-         for line in self.pool.get('purchase.order.line').browse(cr, uid, ids, context=context):
-             ids2 = self.search(cr, uid, [('purchase_line_id','=',int(line.id))])
-         return ids2
+        result = {}
+        for line in self.pool.get('purchase.order.line').browse(cr, uid, ids, context=context):
+            ids2 = self.search(cr, uid, [('purchase_line_id','=',int(line.id))])
+        return ids2
 
     def _get_sale_order_line(self, cr, uid, ids, context=None):
-         result = {}
-         for line in self.pool.get('sale.order.line').browse(cr, uid, ids, context=context):
-             ids2 = self.search(cr, uid, [('sale_line_id','=',line.id)])
-         return ids2
+        result = {}
+        for line in self.pool.get('sale.order.line').browse(cr, uid, ids, context=context):
+            ids2 = self.search(cr, uid, [('sale_line_id','=',line.id)])
+        return ids2
 
     def _get_stock_move(self, cr, uid, ids, context=None):
-         result = {}
-         for line in self.browse(cr, uid, ids, context=context):
-             ids2 = self.search(cr, uid, [('product_id','=',line.product_id.id),('date','>=', line.date)])
-         return ids2
-  
+        result = {}
+        for line in self.browse(cr, uid, ids, context=context):
+            ids2 = self.search(cr, uid, [('product_id','=',line.product_id.id),('date','>=', line.date)])
+        return ids2
+ 
+ 
 
-    _columns = { 
-        'move_value_cost'    : fields.function(_compute_move_value_cost, method=True, string='Amount', digits_compute=dp.get_precision('Account'),type='float' ,  
+    _columns = {
+        'move_value_cost'    : fields.function(_compute_move_value_cost, method=True, string='Amount', digits_compute=dp.get_precision('Account'),type='float' ,
            store={
                'stock.move': (lambda self, cr, uid, ids, c={}: ids, ['product_qty', 'price_unit','price_unit_pu','value_correction', 'state'], 20),
                #'stock.move': (_get_stock_move,  ['product_qty', 'price_unit', 'value_correction', 'state'], 20),
                #'purchase.order.line': (_get_purchase_order_line, ['product_qty', 'price_subtotal'], 20),
                  },
                             help="""Product's cost for accounting valuation.""") ,
-        'move_value_sale'    : fields.function(_compute_move_value_sale, method=True, string='Amount Sale', digits_compute=dp.get_precision('Account'),type='float' , 
+        'move_value_sale'    : fields.function(_compute_move_value_sale, method=True, string='Amount Sale', digits_compute=dp.get_precision('Account'),type='float' ,
            store={
                'stock.move': (lambda self, cr, uid, ids, c={}: ids, ['product_qty', 'state'], 20),
                #'sale.order.line': (_get_sale_order_line, ['product_qty', 'price_subtotal'], 20),
@@ -408,11 +414,36 @@
         'price_unit_sale'    : fields.function(_compute_price_unit_sale, method=True, string='Sale Price',  digits_compute=dp.get_precision('Account') ),
         'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'),
         'value_correction'   : fields.float('Value correction', digits_compute=dp.get_precision('Account'),\
-                             help="This field allows to enter value correction of product stock per lot and location. positive to increase, negative to decrease value")
-
+                             help="This field allows to enter value correction of product stock per lot and location. positive to increase, negative to decrease value"),
+        #'date_move'          : fields.related('picking_id', 'date', type='datetime', string='move Date'),
+        'date_done'          : fields.datetime('Date Done'),
+ 
     }
 
 
+    _defaults = {
+        'date': None,
+        }
+
+    def onchange_date(self, cr, uid, ids, date, date_expected, context=None):
+        return {'value': {}}
+
+    def onchange_date_move(self, cr, uid, ids, date, date_expected, move_date, context=None):
+        """ On change of Scheduled Date uses Move date.
+        @param date_expected: Scheduled Date
+        @param date: Move Date
+        @return: Move Date
+        """
+        #self._logger.debug('change ids %s context %s' % (ids,context))
+        
+        vals = {}
+        if move_date:
+            if not date:
+                vals['date'] = move_date 
+            #if not date_expected:
+                vals['date_expected'] = move_date 
+        return {'value': vals}
+
     def init(self, cr):
         ids2 = []
         sql = 'select id, date , product_id\
@@ -440,7 +471,7 @@
         # find inventory location
 
         return res
-        
+
 #    def init(self, cr):
       # Purchase
 #      cr.execute("""
@@ -470,13 +501,35 @@
         move_ids = []
         for move in self.browse(cr, uid, ids, context=context):
             if move.state in ['done','cancel']:
+                continue
+            move_ids.append(move.id)
+            date1 = move.date
+        res = super(stock_move, self).action_done(cr, uid, move_ids, context)
+        self.write(cr, uid, move_ids, {'date': date1, 'date_expected' : date1,'date_done': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
+        return res
+
+    def action_done(self, cr, uid, ids, context=None):
+        """to be able to post moves for past dates (mainly corrections) it is necessary to store the date_expected instead of the current date
+          the date field is used to select records in the location structure and others
+          for accounting purpose it is absolutely necessary to be able to do this.
+          * correct errors
+          * do valuation correction
+        """
+        move_ids = []
+        for move in self.browse(cr, uid, ids, context=context):
+            if move.state in ['done','cancel']:
                  continue
             move_ids.append(move.id)
             date1 = move.date
         res = super(stock_move, self).action_done(cr, uid, move_ids, context)
-        self.write(cr, uid, move_ids, {'date': date1, 'date_expected' : date1}, context=context)
+          
+        self.write(cr, uid, move_ids, {'date': date1, 'date_expected' : date1, 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
         return res
 
+
+
+
+
 stock_move()
 
 class stock_location(osv.osv):
@@ -492,43 +545,43 @@
             self._logger.debug('FGF product_get standard %s', context )
             return super(stock_location, self)._product_get(cr, uid, id, product_ids, context, states)
         else:
-          # FIXME
-          # we shell use product_qty_calc definend in  /stock_product_zero/inventory.py instead recomputing
-          # recomputing always bears the risk that someone posts move in the meantime
-
-          move_obj = self.pool.get('stock.move')
-          uom_obj = self.pool.get('product.uom')
-          product_obj = self.pool.get('product.product')
-          res = {}
-
-          if not isinstance(product_ids,list):
-              product_ids = [ product_ids ]
-
-          for prod in product_obj.browse(cr, uid, product_ids, context):
+            # FIXME
+            # we shell use product_qty_calc definend in  /stock_product_zero/inventory.py instead recomputing
+            # recomputing always bears the risk that someone posts move in the meantime
+
             move_obj = self.pool.get('stock.move')
             uom_obj = self.pool.get('product.uom')
-            location = context['location']
-            prodlot_id = context['prodlot_id']
-
-            if prodlot_id:
-               move_ids = move_obj.search(cr, uid, [('location_dest_id','=',id),('product_id','=',prod.id),('prodlot_id','=',prodlot_id), ('state','=','done')], )
-               move_ids2 = move_obj.search(cr, uid, [('location_id','=',id),('product_id','=',prod.id),('prodlot_id','=',prodlot_id), ('state','=','done')], )
-            else:
-               move_ids = move_obj.search(cr, uid, [('location_dest_id','=',id),('product_id','=',prod.id),('prodlot_id','=',False), ('state','=','done')], )
-               move_ids2 = move_obj.search(cr, uid, [('location_id','=',id),('product_id','=',prod.id),('prodlot_id','=',False), ('state','=','done')], )
-
-            qty = 0.0
-            for move in move_obj.browse(cr, uid, move_ids, context=context):
-                qty += uom_obj._compute_qty(cr, uid, move.product_uom.id,move.product_qty, move.product_id.uom_id.id)
-            for move in move_obj.browse(cr, uid, move_ids2, context=context):
-                qty -= uom_obj._compute_qty(cr, uid, move.product_uom.id,move.product_qty, move.product_id.uom_id.id)
-
-
-            res[prod.id] = qty
-            self._logger.debug('FGF product_get inventur %s %s %s' % ( qty, prod.name, context) )
-          return res
- 
-       
+            product_obj = self.pool.get('product.product')
+            res = {}
+
+            if not isinstance(product_ids,list):
+                product_ids = [ product_ids ]
+
+            for prod in product_obj.browse(cr, uid, product_ids, context):
+                move_obj = self.pool.get('stock.move')
+                uom_obj = self.pool.get('product.uom')
+                location = context['location']
+                prodlot_id = context['prodlot_id']
+
+                if prodlot_id:
+                    move_ids = move_obj.search(cr, uid, [('location_dest_id','=',id),('product_id','=',prod.id),('prodlot_id','=',prodlot_id), ('state','=','done')], )
+                    move_ids2 = move_obj.search(cr, uid, [('location_id','=',id),('product_id','=',prod.id),('prodlot_id','=',prodlot_id), ('state','=','done')], )
+                else:
+                    move_ids = move_obj.search(cr, uid, [('location_dest_id','=',id),('product_id','=',prod.id),('prodlot_id','=',False), ('state','=','done')], )
+                    move_ids2 = move_obj.search(cr, uid, [('location_id','=',id),('product_id','=',prod.id),('prodlot_id','=',False), ('state','=','done')], )
+
+                qty = 0.0
+                for move in move_obj.browse(cr, uid, move_ids, context=context):
+                    qty += uom_obj._compute_qty(cr, uid, move.product_uom.id,move.product_qty, move.product_id.uom_id.id)
+                for move in move_obj.browse(cr, uid, move_ids2, context=context):
+                    qty -= uom_obj._compute_qty(cr, uid, move.product_uom.id,move.product_qty, move.product_id.uom_id.id)
+
+
+                res[prod.id] = qty
+                self._logger.debug('FGF product_get inventur %s %s %s' % ( qty, prod.name, context) )
+            return res
+
+
 
 stock_location()
 
@@ -551,7 +604,7 @@
         self._logger.debug('FGF inv line hook %s %s' % ( line, value)  )
         change = line.product_qty - line.product_qty_calc
         location_id = line.product_id.product_tmpl_id.property_stock_inventory.id
-        
+
         if change > 0:
             value.update( {
                 'product_qty': change,
@@ -566,7 +619,7 @@
             })
         self._logger.debug('FGF inv line hook after %s %s %s' % (change, line, value)  )
         return super(stock_inventory, self)._inventory_line_hook(cr, uid, line, value)
-        
+
     def action_confirm(self, cr, uid, ids, context=None):
         """ Confirm the inventory and writes its finished date
         computes difference between data entry and computed values for the inventory
@@ -584,11 +637,11 @@
             move_ids = []
             for line in inv.inventory_line_id:
                 pid = line.product_id.id
-                
+
                 #product_context.update(uom=line.product_uom.id, to_date=inv.date, date=inv.date, prodlot_id=line.prod_lot_id.id)
                 #amount = location_obj._product_get(cr, uid, line.location_id.id, [pid], product_context)[pid]
 
-                change = line.product_qty - line.product_qty_calc 
+                change = line.product_qty - line.product_qty_calc
                 lot_id = line.prod_lot_id.id
                 if change:
                     location_id = line.product_id.product_tmpl_id.property_stock_inventory.id
@@ -614,7 +667,7 @@
                             'location_dest_id': location_id,
                         })
                         move_ids.append(self._inventory_line_hook(cr, uid, line, value))
-            if move_ids:            
+            if move_ids:
                 message = _("Inventory '%s' is done.") %(inv.name)
                 self.log(cr, uid, inv.id, message)
                 self.write(cr, uid, [inv.id], {'state': 'confirm', 'move_ids': [(6, 0, move_ids)]})
@@ -631,13 +684,13 @@
         """
         res = super(stock_inventory, self).action_done(cr, uid, ids, context)
 
-        move_obj = self.pool.get('stock.move') 
+        move_obj = self.pool.get('stock.move')
         move_ids = []
         for inv in self.browse(cr, uid, ids):
             for m in inv.move_ids:
                 move_ids.append(m.id)
         move_obj.write(cr, uid, move_ids, {'date':  inv.date,'date_expected': inv.date})
-        
+
         return True
 
 stock_inventory()
@@ -648,3 +701,13 @@
           'check_lot' : fields.related('product_id','track_internal',type='boolean',string='Lot required',readonly=True,help="posting needs lot"),
         }
 stock_inventory_line()
+
+
+class stock_picking(osv.osv):
+    _inherit = "stock.picking"
+
+    _defaults = {
+     'date' : None,
+    }
+
+stock_picking()

=== modified file 'c2c_stock_accounting/stock_view.xml'
--- c2c_stock_accounting/stock_view.xml	2012-10-22 12:21:57 +0000
+++ c2c_stock_accounting/stock_view.xml	2013-07-10 21:51:25 +0000
@@ -2,12 +2,13 @@
 <openerp>
   <data>
     <!-- move values internal Form-->
+<!--
     <record model="ir.ui.view" id="picking_values_view">
       <field name="name">view_picking_values.view</field>
       <field name="model">stock.picking</field>
       <field name="inherit_id" ref="stock.view_picking_form"/>
       <field name="arch" type="xml">
-        <xpath expr="/form/notebook/page[@string='Products']/field[@name='move_lines']/form[@string='Stock Moves']" position="inside">
+        <xpath expr="/form/sheet/notebook/page[@string='Products']/field[@name='move_lines']/form[@string='Stock Moves']" position="inside">
           <group colspan="2" col="2" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant">
             <separator string="Values" colspan="2"/>
             <field name="move_value_cost" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant"/>
@@ -17,13 +18,15 @@
         </xpath>
       </field>
     </record>
+-->
     <!-- move values Incoming-->
+<!--
     <record model="ir.ui.view" id="picking_in_values_view">
       <field name="name">view_picking_in_values.view</field>
       <field name="model">stock.picking</field>
       <field name="inherit_id" ref="stock.view_picking_in_form"/>
       <field name="arch" type="xml">
-        <xpath expr="/form/notebook/page[@string='General Information']/field[@name='move_lines']/form[@string='Stock Moves']" position="inside">
+        <xpath expr="/form/sheet/notebook/page[@string='General Information']/field[@name='move_lines']/form[@string='Stock Moves']" position="inside">
           <group colspan="2" col="2" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant">
             <separator string="Values" colspan="2"/>
             <field name="move_value_cost" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant"/>
@@ -33,13 +36,15 @@
         </xpath>
       </field>
     </record>
+-->
     <!-- move values Outgoing -->
+<!--
     <record model="ir.ui.view" id="picking_out_values_view">
       <field name="name">view_picking_out_values.view</field>
       <field name="model">stock.picking</field>
       <field name="inherit_id" ref="stock.view_picking_out_form"/>
       <field name="arch" type="xml">
-        <xpath expr="/form/notebook/page[@string='Products']/field[@name='move_lines']/form[@string='Stock Moves']" position="inside">
+        <xpath expr="/form/sheet/notebook/page[@string='Products']/field[@name='move_lines']/form[@string='Stock Moves']" position="inside">
           <group colspan="2" col="2" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant">
             <separator string="Values" colspan="2"/>
             <field name="move_value_cost" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant"/>
@@ -50,12 +55,12 @@
         </xpath>
       </field>
     </record>
+-->
     <!-- move  list  -->
     <record model="ir.ui.view" id="view_move_tree_values">
       <field name="name">move_tree_view_values.view</field>
       <field name="model">stock.move</field>
       <field name="inherit_id" ref="stock.view_move_tree"/>
-      <field name="type">tree</field>
       <field name="arch" type="xml">
         <field name="product_uom" position="after">
           <field name="move_value_cost" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant" sum="Value Cost"/>
@@ -68,7 +73,6 @@
       <field name="name">move_tree_view_values.view</field>
       <field name="model">stock.move</field>
       <field name="inherit_id" ref="stock.stock_move_tree"/>
-      <field name="type">tree</field>
       <field name="arch" type="xml">
         <field name="product_uom" position="after">
           <field name="move_value_cost" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant" sum="Value Cost"/>
@@ -81,7 +85,6 @@
       <field name="name">move_tree2_view_values.view</field>
       <field name="model">stock.move</field>
       <field name="inherit_id" ref="stock.stock_move_tree2"/>
-      <field name="type">tree</field>
       <field name="arch" type="xml">
         <field name="product_uom" position="after">
           <field name="move_value_cost" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant" sum="Value Cost"/>
@@ -96,7 +99,7 @@
       <field name="model">stock.move</field>
       <field name="inherit_id" ref="stock.view_move_form"/>
       <field name="arch" type="xml">
-        <xpath expr="/form[@string='Stock Moves']" position="inside">
+        <xpath expr="/form/sheet/group/group[@string='Traceability']" position="after">
           <group colspan="2" col="2" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant">
             <separator string="Values" colspan="2"/>
             <field name="move_value_cost" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant"/>
@@ -122,16 +125,18 @@
 
 
     <!-- product form -->
-    <record model="ir.ui.view" id="product_normal_form_rigths_view">
+<!--
+    <record model="ir.ui.view" id="product_normal_form_rights_view">
       <field name="name">product.normal.rights.form</field>
       <field name="model">product.product</field>
       <field name="inherit_id" ref="product.product_normal_form_view"/>
       <field name="arch" type="xml">
-              <xpath expr="/form/notebook/page[@string='Information']/group[2]" position="attributes">
+              <xpath expr="/form/sheet/notebook/page[@string='Information']/group/group[0]/field[@name='list_price']" position="attributes">
                  <attribute name="groups">c2c_stock_accounting.group_c2c_stock_accounting_accountant</attribute>
               </xpath>                
         </field>
     </record>
+-->
 
     <!-- product search-->
     <record id="product_search_form_account_view" model="ir.ui.view">
@@ -168,7 +173,7 @@
                         
 
     <!-- product moves IN/OUT - make refrenece mandatory -->
-    <record model="ir.ui.view" id="view_move_tree_reception_referenc_picking">
+    <record model="ir.ui.view" id="view_move_tree_reception_reference_picking">
         <field name="name">stock.move.tree.ref.picking</field>
         <field name="model">stock.move</field>
         <field name="inherit_id" ref="stock.view_move_tree_reception_picking"/>
@@ -178,6 +183,7 @@
             </field>
         </field>
     </record>
+<!--
     <record model="ir.ui.view" id="view_move_view_move_form_reference_picking">
         <field name="name">stock.move.form.ref.picking</field>
         <field name="model">stock.move</field>
@@ -188,7 +194,8 @@
             </field>
         </field>
     </record>
-    view_move_form_reception_picking
+-->
+<!--
         <record model="ir.ui.view" id="view_move_form_reception_picking_reference_picking">
             <field name="name">stock.move.form.in.ref.picking</field>
             <field name="model">stock.move</field>
@@ -199,7 +206,7 @@
                 </field>
             </field>
         </record>
-    
+   --> 
 
    <!-- value correction -->
    <record id="view_move_value_correction_search" model="ir.ui.view">
@@ -325,10 +332,10 @@
        <field name="act_window_id" ref="action_value_correction_move"/>
    </record>
    
-   <menuitem action="action_value_correction_move" id="menu_action_value_correction" parent="stock.menu_stock_products_moves" sequence="2" groups="base.group_extended"/>
+   <menuitem action="action_value_correction_move" id="menu_action_value_correction" parent="stock.menu_stock_products_moves" sequence="2" />
    
    <!-- search Product Moves -->
-
+<!--
    <record id="view_move_search_extended_reception_incoming_picking" model="ir.ui.view">
        <field name="name">stock.move.incoming.extended.search2</field>
        <field name="model">stock.move</field>
@@ -340,6 +347,8 @@
            </field>
        </field>
    </record>
+-->
+<!--
    <record id="view_move_search_extended_reception_outcoming_picking" model="ir.ui.view">
        <field name="name">stock.move.outcoming.extended.search2</field>
        <field name="model">stock.move</field>
@@ -351,7 +360,7 @@
            </field>
        </field>
    </record>
-
+-->
    <!-- Valuation acount -->
         <record id="view_normal_property_acc_stock_form" model="ir.ui.view">
             <field name="name">product.normal.stock.acc.stock.property.formt</field>
@@ -360,37 +369,37 @@
             <field name="inherit_id" ref="stock.view_normal_property_acc_form"/>
             <field name="priority">26</field>
             <field name="arch" type="xml">
-                    <xpath expr="/form/notebook/page[@string='Accounting']/group/group/field[@name='valuation']" position="after">
+                    <xpath expr="/form/sheet/notebook/page[@string='Accounting']/group/group/field[@name='valuation']" position="after">
                             <field name="stock_account_id" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant"/>
                             <field name="expense_account_id" groups="c2c_stock_accounting.group_c2c_stock_accounting_accountant"/>
                     </xpath>
            </field>
        </record>
 
-   <!-- display indicator for lot reuqirement -->
+   <!-- display indicator for lot requirement -->
         <record id="stock_inventory_line_lot_tree" model="ir.ui.view">
             <field name="name">stock.inventory.line.lot.tree</field>
             <field name="model">stock.inventory.line</field>
             <field name="inherit_id" ref="stock.stock_inventory_line_tree"/>
             <field name="arch" type="xml">
                 <field name="prod_lot_id" position = "before" >
-                    <field name="check_lot" groups="base.group_extended"/>
+                    <field name="check_lot" />
                 </field>
             </field>
         </record>
-
+<!--
         <record id="view_inventory_lot_form" model="ir.ui.view">
             <field name="name">stock.inventory.lot.form</field>
             <field name="model">stock.inventory.line.</field>
             <field name="inherit_id" ref="stock.view_inventory_form"/>
             
             <field name="arch" type="xml">
-                <field name="prod_lot_id" position = "before" >
-                    <field name="check_lot" groups="base.group_extended"/>
-                </field>
+                <xpath expr="/form/sheet/notebook/page[@string='General Information']/field[@name='inventory_line_id']/tree/field[@name='state']" position="before">
+                    <field name="check_lot" />
+                </xpath>
             </field>
         </record>
-
+-->
 
    <!-- display selected location  -->
         <record id="stock_inventory_loc_form" model="ir.ui.view">
@@ -406,6 +415,20 @@
                 </field>
             </field>
         </record>
-   
+
+
+    <!-- stock move -->
+<!-- does not exist any more
+    <record model="ir.ui.view" id="view_picking_form_change">
+      <field name="name">stock.picking.change.form</field>
+      <field name="model">stock.picking</field>
+      <field name="inherit_id" ref="stock.view_picking_form"/>
+      <field name="arch" type="xml">
+              <xpath expr="/form/sheet/notebook/page[@string='Products']/field/form/group/field[@name='date_expected']" position="replace">
+                 <field name="date_expected" on_change="onchange_date_move(date,date_expected,parent.date)"/>
+              </xpath>                
+        </field>
+    </record>
+--> 
   </data>
 </openerp>

=== modified file 'c2c_stock_extension/__init__.py'
--- c2c_stock_extension/__init__.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_extension/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #    Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
@@ -16,7 +16,7 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 

=== modified file 'c2c_stock_negative/__init__.py'
--- c2c_stock_negative/__init__.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_negative/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #    Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
@@ -16,7 +16,7 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 

=== modified file 'c2c_stock_negative/stock.py'
--- c2c_stock_negative/stock.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_negative/stock.py	2013-07-10 21:51:25 +0000
@@ -23,10 +23,10 @@
 from osv import osv, fields
 #import decimal_precision as dp
 
-import re  
+import re
 from tools.translate import _
-import logging        
-        
+import logging
+
 #----------------------------------------------------------
 #  Product Category
 #----------------------------------------------------------
@@ -36,10 +36,10 @@
     _columns = {
         'allow_negative_stock' : fields.boolean('Allow Negative Stock', help="Allows negative stock quantities per location / lot for this category - use with care !"),
     }
-     
+
 product_category()
 
-       
+
 #----------------------------------------------------------
 #  Product
 #----------------------------------------------------------
@@ -59,27 +59,34 @@
     # FIXME - check does not raise error
     # allow_negative_stock is defined for product_template
     def _check_allow_negative_stock(self, cr, uid, ids, context=None):
-          
+
         for move in self.browse(cr, uid, ids):
             do_check = True
             if move.product_id.allow_negative_stock or move.product_id.categ_id.allow_negative_stock:
-               do_check = False
+                do_check = False
             if do_check:
-               # name field = product qty
-               cr.execute(
-               "select sum(name) \
-                  from chricar_stock_product_by_location_prodlot \
-                 where product_id = %d \
-                   and company_id = %d \
-                 group by product_id, location_id,prodlot_id \
-                having sum(name) < 0" % ( move.product_id.id, move.company_id.id )) 
-            if cr.fetchone():
-                   return False
+                # name field = product qty
+                cr.execute(
+               "select product_id,location_id,prodlot_id,sum(name) as qty \
+                   from chricar_stock_product_by_location_prodlot \
+                  where product_id = %d \
+                    and company_id = %d \
+                  group by product_id, location_id,prodlot_id \
+                 having sum(name) < 0" % ( move.product_id.id, move.company_id.id ))
+               for check in  cr.fetchall():
+                    product= self.pool.get('product.product').browse(cr,uid,[check[0]], context)[0].name
+                    location = self.pool.get('stock.location').browse(cr,uid,[check[1]], context)[0].name
+                    if check[2]:
+                        lot = self.pool.get('stock.production.lot').browse(cr,uid,[check[2]], context)[0].name
+                    else:
+                        lot = ''
+                    raise osv.except_osv(_('Error !'), _('negative quantity %s not llowed for product: %s, location: %s, lot: %s  !') % (check[3],product,location, lot ) )
+
         return True
-        
+
     _constraints = [ (_check_allow_negative_stock, 'Error: Negative quantities for location and/or lots are not allowed for this product or product category', ['name']), ]
 
-     
+
 stock_move()
 
 
@@ -100,11 +107,11 @@
                 for r in res:
                     _logger.debug('FGF lot res negative r %s,%s' % (r, res))
                     if r[0] in lots_to_show:
-                       res1.append(r)
-                       #_logger.debug('FGF lot res negative res 1%s' % (res1))
+                        res1.append(r)
+                        #_logger.debug('FGF lot res negative res 1%s' % (res1))
         else:
             res1 = res
-            
+
         return res1
 
 stock_production_lot()
@@ -130,13 +137,13 @@
                 for r in res:
                     _logger.debug('FGF loc res negative r %s,%s' % (r, res))
                     if r[0] in loc_to_show:
-                       res1.append(r)
-            else: # FIXME workaround 
+                        res1.append(r)
+            else: # FIXME workaround
                 res1 = res
 
-                
+
         else:
-           res1 = res
-        return res1 
+            res1 = res
+        return res1
 
 stock_location()

=== modified file 'c2c_stock_negative/stock_view.xml'
--- c2c_stock_negative/stock_view.xml	2011-04-30 20:34:01 +0000
+++ c2c_stock_negative/stock_view.xml	2013-07-10 21:51:25 +0000
@@ -1,27 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <openerp>
   <data>
+<!--
     <record model="ir.ui.view" id="c2c_product_category_negative_form_view">
       <field name="name">c2c.product.category.negative.form</field>
       <field name="model">product.category</field>
-      <field name="inherit_id" ref="product.product_category_form_view"/>
-      <field name="type">form</field>
+      <field name="inherit_id" ref="stock.view_normal_property_acc_form"/>
       <field name="arch" type="xml">
-        <field name="type" position="after">
+        <field name="valuation" position="after">
           <field name="allow_negative_stock"/>
         </field>
       </field>
     </record>
+-->
+<!--
     <record model="ir.ui.view" id="c2c_product_negative_form_view">
       <field name="name">c2c.product.negative.form</field>
       <field name="model">product.product</field>
       <field name="inherit_id" ref="stock.view_normal_stock_property_form"/>
-      <field name="type">form</field>
       <field name="arch" type="xml">
         <field name="virtual_available" position="after">
           <field name="allow_negative_stock"/>
         </field>
       </field>
     </record>
+-->
   </data>
 </openerp>

=== modified file 'c2c_stock_track_internal/__init__.py'
--- c2c_stock_track_internal/__init__.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_track_internal/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #    Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
@@ -16,7 +16,7 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 

=== modified file 'c2c_stock_track_internal/__openerp__.py'
--- c2c_stock_track_internal/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_track_internal/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -26,7 +26,7 @@
     'version': '0.7',
     'category': 'Warehouse Management',
     'description': """
-Requires production lot for internal moves 
+Requires production lot for internal moves
 """,
     'author': 'Camptocamp',
     'depends': [ 'stock' ],

=== modified file 'c2c_stock_track_internal/stock.py'
--- c2c_stock_track_internal/stock.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_track_internal/stock.py	2013-07-10 21:51:25 +0000
@@ -23,11 +23,11 @@
 from osv import osv, fields
 #import decimal_precision as dp
 
-import re  
+import re
 from tools.translate import _
-        
-
-       
+
+
+
 #----------------------------------------------------------
 #  Product
 #----------------------------------------------------------
@@ -37,32 +37,32 @@
     _columns = {
       'track_internal' : fields.boolean('Track Internal Lots', help="Force to use a Production Lot during internal moves"),
     }
-     
+
 product_product()
 
 class stock_move(osv.osv):
-   _inherit = 'stock.move'
+    _inherit = 'stock.move'
 
-   def _check_tracking(self, cr, uid, ids, context=None):
-     """ Checks if production lot is assigned to stock move or not.
-     @return: True or False
-     """
-# WARNING 
+    def _check_tracking(self, cr, uid, ids, context=None):
+        """ Checks if production lot is assigned to stock move or not.
+        @return: True or False
+        """
+# WARNING
 # the check must be state independent - IMHO does not make sense to allow "wrong" data entry and fail only in state done
 # this would prohibit generation of pickings form SO/PO
 # added track_internal - OpenERP must be able to provied a complete tracking
-     for move in self.browse(cr, uid, ids, context=context):
-        if move_state == 'done' and not move.prodlot_id and \
-        ( \
-        (move.product_id.track_production and move.location_id.usage == 'production') or \
-        (move.product_id.track_production and move.location_dest_id.usage == 'production') or \
-        (move.product_id.track_incoming and move.location_id.usage == 'supplier') or \
-        (move.product_id.track_outgoing and move.location_dest_id.usage == 'customer') or \
-        (move.product_id.track_internal and ( move.location_id.usage=='internal' or move.location_dest_id.usage=='internal')) \
-        ):
-           raise osv.except_osv(_('Error !'), _('Missing lot for product %s') % move.product_id.name)
-           return False
-     return True
-    
-  
-stock_move()  
+        for move in self.browse(cr, uid, ids, context=context):
+            if move_state == 'done' and not move.prodlot_id and \
+            ( \
+            (move.product_id.track_production and move.location_id.usage == 'production') or \
+            (move.product_id.track_production and move.location_dest_id.usage == 'production') or \
+            (move.product_id.track_incoming and move.location_id.usage == 'supplier') or \
+            (move.product_id.track_outgoing and move.location_dest_id.usage == 'customer') or \
+            (move.product_id.track_internal and ( move.location_id.usage=='internal' or move.location_dest_id.usage=='internal')) \
+            ):
+                raise osv.except_osv(_('Error !'), _('Missing lot for product %s') % move.product_id.name)
+                return False
+        return True
+
+
+stock_move()

=== modified file 'c2c_stock_track_internal/stock_view.xml'
--- c2c_stock_track_internal/stock_view.xml	2011-04-30 20:34:01 +0000
+++ c2c_stock_track_internal/stock_view.xml	2013-07-10 21:51:25 +0000
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <openerp>
   <data>
-    <record model="ir.ui.view" id="c2c_product_track_interna_form_view">
+    <record model="ir.ui.view" id="c2c_product_track_internal_form_view">
       <field name="name">c2c.product.track.internal.form</field>
       <field name="model">product.product</field>
-      <field name="inherit_id" ref="stock.view_normal_stock_property_form"/>
+      <field name="inherit_id" ref="stock.view_normal_procurement_locations_form"/>
       <field name="type">form</field>
       <field name="arch" type="xml">
         <field name="track_outgoing" position="after">

=== modified file 'c2c_stock_track_mrp/__init__.py'
--- c2c_stock_track_mrp/__init__.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_track_mrp/__init__.py	2013-07-10 21:51:25 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #    Copyright (C) 2010-2012 Camptocamp (<http://www.camptocamp.at>)
@@ -16,7 +16,7 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 

=== modified file 'c2c_stock_track_mrp/__openerp__.py'
--- c2c_stock_track_mrp/__openerp__.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_track_mrp/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -26,7 +26,7 @@
     'version': '0.9',
     'category': 'Warehouse Management',
     'description': """
-adds prod lot to mrp produce 
+adds prod lot to mrp produce
 """,
     'author': 'Camptocamp',
     'depends': [ 'mrp','c2c_stock_track_internal' ],
@@ -35,7 +35,7 @@
        ],
     #'update_xml': ['product_view.xml'],
     'demo_xml': [],
-    'installable': True,
+    'installable': False,
     'active': False,
     'auto_install': True,
 }

=== modified file 'c2c_stock_track_mrp/mrp.py'
--- c2c_stock_track_mrp/mrp.py	2012-12-20 15:30:00 +0000
+++ c2c_stock_track_mrp/mrp.py	2013-07-10 21:51:25 +0000
@@ -23,11 +23,11 @@
 from osv import osv, fields
 #import decimal_precision as dp
 
-import re  
+import re
 from tools.translate import _
-        
-
-       
+
+
+
 #----------------------------------------------------------
 #  Product
 #----------------------------------------------------------

=== modified file 'chricar_account_analytic/__openerp__.py'
--- chricar_account_analytic/__openerp__.py	2012-12-20 15:30:00 +0000
+++ chricar_account_analytic/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -62,8 +62,9 @@
 , "category"     : "Accounting & Finance"
 , "depends"      : ["account", "chricar_bank_vat", "sale", "stock"]
 , "init_xml"     : []
-, "demo_xml"     : []
+, "demo"         : []
 , "update_xml"   : ["account_analytic_view.xml"]
 , "auto_install" : False
 , "installable"  : True
+, 'application'  : False
 }

=== modified file 'chricar_account_analytic/account_analytic.py'
--- chricar_account_analytic/account_analytic.py	2012-12-20 15:30:00 +0000
+++ chricar_account_analytic/account_analytic.py	2013-07-10 21:51:25 +0000
@@ -28,20 +28,20 @@
 
 class account_account(osv.osv):
     _inherit = "account.account"
-        
+
     def get_analytic(self, cr, uid, ids, account_id):
         result = {}
         if account_id:
             account = self.browse(cr, uid,  account_id)
             if account.analytic_account_id:
                 analytic_id = account.analytic_account_id.id
-                # due to inconsistent naming we return both variables 
+                # due to inconsistent naming we return both variables
                 result = {'value': {
                 'analytic_account_id': analytic_id,
                 'account_analytic_id': analytic_id,
                 }}
         return result
-        
+
 
 
     _columns = {
@@ -75,7 +75,7 @@
             if account.type == 'view':
                 return 'none'
             else:
-                return 
+                return
 
     _defaults = {
       'account_analytic_usage' : _analytic_account_type,
@@ -87,33 +87,33 @@
             return {'value':{'account_analytic_usage': 'none'}}
         if account.type == 'other' and user_type and account.user_type.close_method == 'none':
             return {'value':{'account_analytic_usage': 'mandatory'}}
-        return {}           
- 
+        return {}
+
 
 #
 # checks for account_account
 #
     def _check_analytic_account_usage(self, cr, uid, ids):
-         account = self.browse(cr, uid, ids[0])
-         if account.type != 'view' and account.user_type.close_method == 'none' and account.account_analytic_usage not in ('mandatory','fixed'):
-             return False
-         return True
+        account = self.browse(cr, uid, ids[0])
+        if account.type != 'view' and account.user_type.close_method == 'none' and account.account_analytic_usage not in ('mandatory','fixed'):
+            return False
+        return True
 
     def _check_analytic_account_id(self, cr, uid, ids):
-         account = self.browse(cr, uid, ids[0])
-         if account.type != 'view':
-             if account.account_analytic_usage in ('fixed') and not account.analytic_account_id :
+        account = self.browse(cr, uid, ids[0])
+        if account.type != 'view':
+            if account.account_analytic_usage in ('fixed') and not account.analytic_account_id :
                 return False
-         # FIXME - do we need the following check? -
-         #    if account.analytic_account_id and account.account_analytic_usage not in ('fixed','mandatory'):
-         #       return False
-         return True
+        # FIXME - do we need the following check? -
+        #    if account.analytic_account_id and account.account_analytic_usage not in ('fixed','mandatory'):
+        #       return False
+        return True
 
     def _check_analytic_account_view(self, cr, uid, ids):
-         account = self.browse(cr, uid, ids[0])
-         if account.type == 'view' and account.account_analytic_usage != ('none'):
-                return False
-         return True
+        account = self.browse(cr, uid, ids[0])
+        if account.type == 'view' and account.account_analytic_usage != ('none'):
+            return False
+        return True
 
 
     _constraints = [
@@ -128,33 +128,33 @@
 
 
     def init(self, cr):
-      # We set some resonable values
-      # P & L accounts - mandatory
-      # other no analytic account
-      cr.execute("""
-         update account_account
-           set account_analytic_usage = (
-                select distinct
-                   case when close_method = 'none' and code != 'view' then 'mandatory' when code = 'view'  then null else 'none' end
-                  from account_account_type aat
-                 where aat.id = user_type)
-          where account_analytic_usage is null;
-      """)
+        # We set some resonable values
+        # P & L accounts - mandatory
+        # other no analytic account
+        cr.execute("""
+           update account_account
+             set account_analytic_usage = (
+                  select distinct
+                     case when close_method = 'none' and code != 'view' then 'mandatory' when code = 'view'  then null else 'none' end
+                    from account_account_type aat
+                   where aat.id = user_type)
+            where account_analytic_usage is null;
+        """)
 
 
     def create(self, cr, uid, vals, context=None):
         if context is None:
             context = {}
-        
+
         if not vals.get('account_analytic_usage'):
             usage = 'none'
             if vals.get('type') == 'other' :
-               user_type_obj =  self.pool.get('account.account.type').search(cr, uid,[('id','=', vals.get('user_type'))])
-               for user_type in self.pool.get('account.account.type').browse(cr, uid, user_type_obj):
-                   if user_type.close_method == 'none':
-                      usage = 'mandatory'
-            vals.update({'account_analytic_usage': usage})           
-                       
+                user_type_obj =  self.pool.get('account.account.type').search(cr, uid,[('id','=', vals.get('user_type'))])
+                for user_type in self.pool.get('account.account.type').browse(cr, uid, user_type_obj):
+                    if user_type.close_method == 'none':
+                        usage = 'mandatory'
+            vals.update({'account_analytic_usage': usage})
+
         res = super(account_account, self).create(cr, uid, vals, context)
         return res
 
@@ -162,22 +162,22 @@
     def add_default(self, cr, uid, ids, vals, context=None):
         res=[]
         if not vals.get('analytic_account_id',False) and  vals.get('account_id',False):
-             account_id = vals.get('account_id',False)
-             accounts =  self.pool.get('account.account').search(cr, uid, [('id','=',account_id)] )
-             for account_obj in self.pool.get('account.account').browse(cr, uid, accounts):
+            account_id = vals.get('account_id',False)
+            accounts =  self.pool.get('account.account').search(cr, uid, [('id','=',account_id)] )
+            for account_obj in self.pool.get('account.account').browse(cr, uid, accounts):
                 if account_obj.account_analytic_usage in ['mandatory','fixed'] and account_obj.analytic_account_id:
-                   vals['analytic_account_id'] = account_obj.analytic_account_id.id
-                   res.append(vals)
-                   for res_account in self.browse(cr, uid, ids):
-                      res_account = { 'value' : {'analytic_account_id' : account_obj.analytic_account_id.id}}
-                      res.append(res_account)
+                    vals['analytic_account_id'] = account_obj.analytic_account_id.id
+                    res.append(vals)
+                    for res_account in self.browse(cr, uid, ids):
+                        res_account = { 'value' : {'analytic_account_id' : account_obj.analytic_account_id.id}}
+                        res.append(res_account)
         return res
 
     def _check_analytic_account_view(self, cr, uid, ids):
-         account = self.browse(cr, uid, ids[0])
-         if account.type == 'view' and account.account_analytic_usage != ('none'):
-                return False
-         return True
+        account = self.browse(cr, uid, ids[0])
+        if account.type == 'view' and account.account_analytic_usage != ('none'):
+            return False
+        return True
 
 #
 # checks for move lines
@@ -191,7 +191,7 @@
         return True
 
     def check_analytic_account_fixed(self, cr, uid, ids, account_id, analytic_account_id):
-        
+
         if account_id:
             account = self.browse(cr, uid,  account_id)
             if analytic_account_id:
@@ -217,7 +217,7 @@
 # ************************************
 class account_move_line(osv.osv):
     _inherit = "account.move.line"
-   
+
 
     def _analytic_account_id(self, cr, uid, ids=False, context=None):
         # FIXME - do not know if this ever will return a valid analytic account
@@ -227,12 +227,12 @@
             if not line.analytic_account_id and line.account_id and line.account_id.analytic_account_id:
                 res = line.account_id.analytic_account_id.id
         return res
- 
+
     _columns = {
        # FIXME why readonly ?? FGF 20111231
        #'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True)
     }
- 
+
     _defaults = {
        'analytic_account_id' :  _analytic_account_id,
     }
@@ -241,9 +241,9 @@
     def onchange_account(self, cr, uid, ids, account_id,tax_id, amount, partner_id):
 
         result = super(account_move_line,self).onchange_account_id( cr, uid, ids, account_id, partner_id)
-        if not account_id: 
-             return {}
-        
+        if not account_id:
+            return {}
+
         account_obj =  self.pool.get('account.account')
         res = account_obj.get_analytic(cr, uid, ids, account_id)
         if result and res:
@@ -254,10 +254,10 @@
         return result
 
     def _check_analytic_account_exists(self, cr, uid, ids):
-        for move in self.browse(cr, uid, ids):  
+        for move in self.browse(cr, uid, ids):
             account_obj = self.pool.get('account.account')
             if move.move_id.state == 'posted':
-               return  account_obj.check_analytic_account_exists(cr,uid,ids,move.account_id.id,move.analytic_account_id.id)
+                return  account_obj.check_analytic_account_exists(cr,uid,ids,move.account_id.id,move.analytic_account_id.id)
             return True
 
     def _check_analytic_account_fixed(self, cr, uid, ids):
@@ -271,7 +271,7 @@
         for move in self.browse(cr, uid, ids):
             account_obj = self.pool.get('account.account')
             return  account_obj.check_analytic_account_none(cr,uid,ids,move.account_id.id,move.analytic_account_id.id)
-        
+
     _constraints = [
         (_check_analytic_account_exists,
             'You must assign an analytic account.(move_line) ', ['analytic_account_id']),
@@ -283,12 +283,12 @@
 
     def create(self, cr, uid, vals, context=None, check=True):
         if not vals.get('analytic_account_id') :
-             account_id = vals.get('account_id')
-             if account_id:
-               for account in self.pool.get('account.account').browse(cr, uid, [account_id] , context=context):
-                 if account.account_analytic_usage in [ 'fixed', 'mandatory'] and account.analytic_account_id:
-                     vals['analytic_account_id'] = account.analytic_account_id.id 
-        return super(account_move_line, self).create(cr, uid, vals, context=context) 
+            account_id = vals.get('account_id')
+            if account_id:
+                for account in self.pool.get('account.account').browse(cr, uid, [account_id] , context=context):
+                    if account.account_analytic_usage in [ 'fixed', 'mandatory'] and account.analytic_account_id:
+                        vals['analytic_account_id'] = account.analytic_account_id.id
+        return super(account_move_line, self).create(cr, uid, vals, context=context)
 
 account_move_line()
 
@@ -301,7 +301,7 @@
     _logger = logging.getLogger(__name__)
 
     def _check_analytic_account_exists(self, cr, uid, ids):
-        for move in self.browse(cr, uid, ids):  
+        for move in self.browse(cr, uid, ids):
             account_obj = self.pool.get('account.account')
             return  account_obj.check_analytic_account_exists(cr,uid,ids,move.account_id.id,move.analytic_account_id.id)
 
@@ -328,9 +328,9 @@
         _logger = logging.getLogger(__name__)
 
         result = super(account_bank_statement_line,self).onchange_account( cr, uid, ids, account_id,tax_id, amount, partner_id)
-        if not account_id: 
-             return {}
-        
+        if not account_id:
+            return {}
+
         account_obj =  self.pool.get('account.account')
         res = account_obj.get_analytic(cr, uid, ids, account_id)
         _logger.debug('FGF bank change %s:%s', result, res)
@@ -339,7 +339,7 @@
             result['value'].update( res['value'])
         elif not result and res:
             result = res
-        
+
         return result
 
 
@@ -372,28 +372,28 @@
     # we need this to fill default analytic for imported invoice lines
     def write(self, cr, uid, ids, vals, context=None):
         if not vals.get('account_analytic_id',False) and  vals.get('account_id',False):
-             account_id = vals.get('account_id',False)
-             account_obj =  self.pool.get('account.account')
-             res = account_obj.get_analytic(cr, uid, ids, account_id)
-             vals['account_analytic_id'] = res.get('account_analytic_id',False)
+            account_id = vals.get('account_id',False)
+            account_obj =  self.pool.get('account.account')
+            res = account_obj.get_analytic(cr, uid, ids, account_id)
+            vals['account_analytic_id'] = res.get('account_analytic_id',False)
 
         return super(account_invoice_line, self).write(cr, uid, ids, vals, context)
 
     def onchange_account(self, cr, uid, ids, product_id, partner_id, inv_type, fiscal_position, account_id, account_analytic_id):
         result = super(account_invoice_line,self).onchange_account_id(cr, uid, ids, product_id, partner_id, inv_type, fiscal_position,account_id)
-        if not account_id or account_analytic_id: 
-             return result
+        if not account_id or account_analytic_id:
+            return result
         account_obj =  self.pool.get('account.account')
         res = account_obj.get_analytic(cr, uid, ids, account_id)
         if result and res:
             result['value'].update( res['value'])
         elif not result and res:
             result = res
-            
+
         return result
 
     def _check_analytic_account_exists(self, cr, uid, ids):
-        for move in self.browse(cr, uid, ids):  
+        for move in self.browse(cr, uid, ids):
             account_obj = self.pool.get('account.account')
             if move.invoice_id.state == 'open':
                 return  account_obj.check_analytic_account_exists(cr,uid,ids,move.account_id.id,move.account_analytic_id.id)
@@ -403,7 +403,7 @@
         for move in self.browse(cr, uid, ids):
             account_obj = self.pool.get('account.account')
             if move.invoice_id.state == 'open':
-                 return  account_obj.check_analytic_account_fixed(cr,uid,ids,move.account_id.id,move.account_analytic_id.id)
+                return  account_obj.check_analytic_account_fixed(cr,uid,ids,move.account_id.id,move.account_analytic_id.id)
             return True
 
     def _check_analytic_account_none(self, cr, uid, ids):
@@ -412,7 +412,7 @@
             if move.invoice_id.state == 'open':
                 return  account_obj.check_analytic_account_none(cr,uid,ids,move.account_id.id,move.account_analytic_id.id)
             return  True
-        
+
     _constraints = [
         (_check_analytic_account_exists,
             'You must assign an analytic account.(invoiceline)', ['analytic_account_id']),
@@ -429,28 +429,28 @@
     _inherit = "account.invoice"
 
     def _check_analytic_account_exists(self, cr, uid, ids):
-        for invoice in self.browse(cr, uid, ids):  
-          for move in invoice.invoice_line:
-            account_obj = self.pool.get('account.account')
-            if move.invoice_id.state == 'open':
-                return  account_obj.check_analytic_account_exists(cr,uid,ids,move.account_id.id,move.account_analytic_id.id)
-          return True
+        for invoice in self.browse(cr, uid, ids):
+            for move in invoice.invoice_line:
+                account_obj = self.pool.get('account.account')
+                if move.invoice_id.state == 'open':
+                    return  account_obj.check_analytic_account_exists(cr,uid,ids,move.account_id.id,move.account_analytic_id.id)
+            return True
 
     def _check_analytic_account_fixed(self, cr, uid, ids):
         for  invoice in self.browse(cr, uid, ids):
-          for move in invoice.invoice_line:
-            account_obj = self.pool.get('account.account')
-            if move.invoice_id.state == 'open':
-               return  account_obj.check_analytic_account_fixed(cr,uid,ids,move.account_id.id,move.account_analytic_id.id)
-          return True
+            for move in invoice.invoice_line:
+                account_obj = self.pool.get('account.account')
+                if move.invoice_id.state == 'open':
+                    return  account_obj.check_analytic_account_fixed(cr,uid,ids,move.account_id.id,move.account_analytic_id.id)
+            return True
 
     def _check_analytic_account_none(self, cr, uid, ids):
         for  invoice in self.browse(cr, uid, ids):
-          for move in invoice.invoice_line:
-            account_obj = self.pool.get('account.account')
-            if move.invoice_id.state == 'open':
-                return  account_obj.check_analytic_account_none(cr,uid,ids,move.account_id.id,move.account_analytic_id.id)
-          return True
+            for move in invoice.invoice_line:
+                account_obj = self.pool.get('account.account')
+                if move.invoice_id.state == 'open':
+                    return  account_obj.check_analytic_account_none(cr,uid,ids,move.account_id.id,move.account_analytic_id.id)
+            return True
 
     _constraints = [
         (_check_analytic_account_exists,
@@ -466,9 +466,25 @@
 
 class account_analytic_line(osv.osv):
     _inherit = "account.analytic.line"
+
+    def _get_period(self, cr, uid, ids, name, arg, context):
+        result = {}
+        for line in self.browse(cr, uid, ids):
+            period_id = ''
+            if line.move_id and line.move_id.move_id and line.move_id.move_id.period_id:
+            #if line.move_id and line.move_id.move_id:
+                result[line.id] = line.move_id.move_id.period_id.id
+            else:
+                period_ids= self.pool.get('account.period').search(cr,uid,[('company_id','=',line.company_id.id),('date_start','<=',line.date),('date_stop','>=',line.date ),('special','!=',True)])
+                if len(period_ids):
+                    result[line.id] = period_ids[0]
+
+        return result
+
+
     _columns = {
-        'period_id': fields.related('move_id', 'period_id', string='Period', type='many2one', relation='account.period', required=True, select=True, readonly=True,)
-    } 
+        'period_id': fields.function(_get_period, string='Period', method=True, store=True, type='many2one', relation='account.period', select="1")
+
+    }
 
 account_analytic_line()
-

=== modified file 'chricar_account_analytic/account_analytic_view.xml'
--- chricar_account_analytic/account_analytic_view.xml	2012-08-13 21:14:02 +0000
+++ chricar_account_analytic/account_analytic_view.xml	2013-07-10 21:51:25 +0000
@@ -12,16 +12,17 @@
       <field name="model">account.account</field>
       <field name="type">form</field>
       <field name="arch" type="xml">
-        <separator string="Default Taxes" position="before">
+        <xpath expr="/form/group/group" position="after">
+
           <group col="2" colspan="2">
             <separator string="Analytic" colspan="2"/>
-            <field name="account_analytic_usage" select="2"/>
+            <field name="account_analytic_usage" />
             <field
               domain="[('type','&lt;&gt;','view')]"
               name="analytic_account_id"
-              select="2"/>
+              />
           </group>
-        </separator>
+        </xpath>
       </field>
     </record>
     <record model="ir.ui.view" id="account_analytic_tree">
@@ -64,7 +65,7 @@
       <field name="model">account.move</field>
       <field name="type">form</field>
       <field name="arch" type="xml">
-        <xpath expr="/form/notebook/page[@string='Journal Items']/field/form/notebook/page[@string='Information']/group/field[@name='account_id']" position="replace">
+        <xpath expr="/form/sheet/notebook/page[@string='Journal Items']/field/form/notebook/page[@string='Information']/group/group[@string='Amount']/field[@name='account_id']" position="replace">
           <field
             domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','view'),('company_id','=',parent.company_id)]"
             name="account_id"
@@ -79,7 +80,7 @@
       <field name="type">form</field>
       <field name="arch" type="xml">
         <!-- not nice, should be after partner_id but partner_id is defined twice-->
-        <xpath expr="/form/notebook/page[@string='Journal Items']/field/tree/field[@name='account_id']" position="replace">
+        <xpath expr="/form/sheet/notebook/page[@string='Journal Items']/field/tree/field[@name='account_id']" position="replace">
           <field
             domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','view'),('company_id','=',parent.company_id)]"
             name="account_id"
@@ -136,7 +137,7 @@
       <field name="model">account.bank.statement</field>
       <field name="type">form</field>
       <field name="arch" type="xml">
-        <xpath expr="/form/notebook/page[@string='Transaction']/field/tree/field[@name='account_id']" position="replace">
+        <xpath expr="/form/sheet/notebook/page[@string='Transactions']/field/tree/field[@name='account_id']" position="replace">
           <field
             domain="[('journal_id','=',parent.journal_id), ('type', '&lt;&gt;', 'view')]"
             name="account_id"
@@ -150,7 +151,7 @@
       <field name="model">account.bank.statement</field>
       <field name="type">form</field>
       <field name="arch" type="xml">
-        <xpath expr="/form/notebook/page[@string='Transaction']/field/form/field[@name='account_id']" position="replace">
+        <xpath expr="/form/sheet/notebook/page[@string='Transactions']/field/form/group/field[@name='account_id']" position="replace">
           <field
             domain="[('journal_id','=',parent.journal_id), ('type', '&lt;&gt;', 'view')]"
             name="account_id"
@@ -207,7 +208,7 @@
             <field name="type">search</field>
             <field name="inherit_id" ref="account.view_account_analytic_line_filter"/>
             <field name="arch" type="xml">
-               <xpath expr="/search/group/field[@name='date']" position="after">
+               <xpath expr="/search/field[@name='date']" position="after">
                   <field name="period_id"/>
                   <field name="general_account_id"/>
                   <field name="journal_id"/>

=== modified file 'chricar_account_analytic/sale_make_invoice_advance.py'
--- chricar_account_analytic/sale_make_invoice_advance.py	2012-04-18 07:35:42 +0000
+++ chricar_account_analytic/sale_make_invoice_advance.py	2013-07-10 21:51:25 +0000
@@ -25,8 +25,10 @@
     _inherit = "sale.advance.payment.inv"
     _logger = logging.getLogger(__name__)
 
-    def create_invoices(self, cr, uid, ids, context=None):
+    def create_invoices_wrong(self, cr, uid, ids, context=None):
         """
+             NOT COMPATIBLE WITH V7
+
              To create invoices.
 
              @param self: The object pointer.
@@ -57,11 +59,12 @@
                              that is defined as 'Automatic Invoice after delivery'."))
                 val = obj_lines.product_id_change(cr, uid, [], sale_adv_obj.product_id.id,
                         uom = False, partner_id = sale.partner_id.id, fposition_id = sale.fiscal_position.id)
+
                 self._logger.debug('advance val `%s`', val)
                 product = self.pool.get('product.product').browse(cr, uid, sale_adv_obj.product_id.id, context)
-                
+
                 line_id = obj_lines.create(cr, uid, {
-                    'name': val['value']['name'],
+                    'name': val['value']['name'] or product.name ,
                     'account_id': product.property_account_income.id or product.categ_id.property_account_income_categ.id,
                     'price_unit': sale_adv_obj.amount,
                     'quantity': sale_adv_obj.qtty,
@@ -83,7 +86,7 @@
                     'account_id': sale.partner_id.property_account_receivable.id,
                     'partner_id': sale.partner_id.id,
                     'address_invoice_id': sale.partner_invoice_id.id,
-                    'address_contact_id': sale.partner_order_id.id,
+                    'address_contact_id': sale.partner_id.id,
                     'invoice_line': [(6, 0, create_ids)],
                     'currency_id': sale.pricelist_id.currency_id.id,
                     'comment': '',
@@ -120,14 +123,28 @@
 
         context.update({'invoice_id':list_inv})
 
+#        return {
+#            'name': 'Open Invoice',
+#            'view_type': 'form',
+#            'view_mode': 'form',
+#            'res_model': 'account.invoice',
+#            'type': 'ir.actions.act_window',
+#            'target': 'new',
+#            'context': context
+#        }
+
         return {
-            'name': 'Open Invoice',
+            'name': _('Advance Invoice'),
             'view_type': 'form',
-            'view_mode': 'form',
-            'res_model': 'sale.open.invoice',
+            'view_mode': 'form,tree',
+            'res_model': 'account.invoice',
+            'res_id': invoice_ids[0],
+            'view_id': False,
+            'views': [(form_id, 'form'), (tree_id, 'tree')],
+            'context': "{'type': 'out_invoice'}",
             'type': 'ir.actions.act_window',
-            'target': 'new',
-            'context': context
         }
 
+
+
 sale_advance_payment_inv()

=== modified file 'chricar_account_analytic/stock.py'
--- chricar_account_analytic/stock.py	2012-12-20 15:30:00 +0000
+++ chricar_account_analytic/stock.py	2013-07-10 21:51:25 +0000
@@ -42,10 +42,9 @@
         inv_line = inv_line_obj.browse(cr,uid,invoice_line_id)
         if not inv_line.account_analytic_id and inv_line.account_id.analytic_account_id:
             analytic_id = inv_line.account_id.analytic_account_id.id
-            inv_line_obj.write(cr, uid, invoice_line_id, {'account_analytic_id' : analytic_id}) 
-        
+            inv_line_obj.write(cr, uid, invoice_line_id, {'account_analytic_id' : analytic_id})
+
         return  super(stock_picking, self)._invoice_line_hook(cr, uid, move_line, invoice_line_id)
 
- 
+
 stock_picking()
-

=== modified file 'chricar_account_move_line_deloitte/__init__.py'
--- chricar_account_move_line_deloitte/__init__.py	2012-03-04 05:57:28 +0000
+++ chricar_account_move_line_deloitte/__init__.py	2013-07-10 21:51:25 +0000
@@ -5,4 +5,3 @@
 ##############################################
 import account_move_line_deloitte
 import wizard
-

=== modified file 'chricar_account_move_line_deloitte/__openerp__.py'
--- chricar_account_move_line_deloitte/__openerp__.py	2012-06-17 11:04:07 +0000
+++ chricar_account_move_line_deloitte/__openerp__.py	2013-07-10 21:51:25 +0000
@@ -8,8 +8,8 @@
 , "category"     : "Client Modules/ChriCar Addons"
 , "depends"      : ["account"]
 , "init_xml"     : []
-, "demo_xml"     : []
-, "update_xml"   : 
+, "demo"         : []
+, "update_xml"   :
     [ "account_move_line_deloitte_view.xml"
     , "wizard/moves_deloitte_view.xml"
     , "wizard/move_deloitte_delete.xml"
@@ -17,5 +17,5 @@
     ]
 , "auto_install" : False
 , "installable"  : True
+, 'application'  : False
 }
-

=== modified file 'chricar_account_move_line_deloitte/account_move_line_deloitte.py'
--- chricar_account_move_line_deloitte/account_move_line_deloitte.py	2012-08-13 21:14:02 +0000
+++ chricar_account_move_line_deloitte/account_move_line_deloitte.py	2013-07-10 21:51:25 +0000
@@ -40,506 +40,506 @@
 import logging
 
 class chricar_account_move_import_deny(osv.osv):
-     _name = "chricar.account_move_import_deny"
+    _name = "chricar.account_move_import_deny"
 
-     _columns = {
-       'company_id'         : fields.many2one('res.company', 'Company'),
-       'name'               : fields.char    ('Voucher', size=16, required=True),
-       'code'               : fields.char    ('Code', size=8),
-       'date_start'         : fields.date    ('Date Start'),
-       'date_stop'          : fields.date    ('Date Stop'),
-}
-     _defaults = {
-}
-     _order = "code"
+    _columns = {
+      'company_id'         : fields.many2one('res.company', 'Company'),
+      'name'               : fields.char    ('Voucher', size=16, required=True),
+      'code'               : fields.char    ('Code', size=8),
+      'date_start'         : fields.date    ('Date Start'),
+      'date_stop'          : fields.date    ('Date Stop'),
+}
+    _defaults = {
+}
+    _order = "code"
 chricar_account_move_import_deny()
 
 class chricar_account_tax_code_deloitte(osv.osv):
-     _name = "chricar.account_tax_code_deloitte"
+    _name = "chricar.account_tax_code_deloitte"
 
-     _columns = {
-       'company_id'         : fields.many2one('res.company', 'Company'),
-       'name'               : fields.char    ('Tax Name', size=32, required=True),
-       'code'               : fields.char    ('Code', size=8, required=True),
-       'account_id'         : fields.many2one('account.account','Tax Account',required=True),
-       'percent'            : fields.float   ('Percent', digits=(8,4), required=True, help=""),
+    _columns = {
+      'company_id'         : fields.many2one('res.company', 'Company'),
+      'name'               : fields.char    ('Tax Name', size=32, required=True),
+      'code'               : fields.char    ('Code', size=8, required=True),
+      'account_id'         : fields.many2one('account.account','Tax Account',required=True),
+      'percent'            : fields.float   ('Percent', digits=(8,4), required=True, help=""),
 }
-     _order = "code"
+    _order = "code"
 chricar_account_tax_code_deloitte()
 
 class chricar_account_opening_deloitte(osv.osv):
-     _name = "chricar.account_opening_deloitte"
+    _name = "chricar.account_opening_deloitte"
 
-     _columns = {
-       'company_id'         : fields.many2one('res.company', 'Company'),
-       'account'            : fields.char    ('Account', size=8, required=True),
-       'amount'             : fields.float   ('Amount', required=True, digits=(16,2)),
-       'name'               : fields.char    ('Account Name', size=64, required=True),
-       'date'               : fields.char    ('Date', size=16, required=True),
+    _columns = {
+      'company_id'         : fields.many2one('res.company', 'Company'),
+      'account'            : fields.char    ('Account', size=8, required=True),
+      'amount'             : fields.float   ('Amount', required=True, digits=(16,2)),
+      'name'               : fields.char    ('Account Name', size=64, required=True),
+      'date'               : fields.char    ('Date', size=16, required=True),
 }
-     _order = "account"
+    _order = "account"
 
 chricar_account_opening_deloitte()
 
 
 class chricar_account_move_line_deloitte(osv.osv):
-     _name = "chricar.account_move_line_deloitte"
-
-     def _analytic_account_id(self, cr, uid, ids, name, arg, context):
-         result = {}
-         for move in self.browse(cr, uid, ids):
-             result[move.id] = False
-             if move.analytic_account and move.company_id:
-                 account_ids= self.pool.get('account.analytic.account').search(cr,uid,[('company_id','=',move.company_id.id),('code','=',move.analytic_account)])
-                 if len(account_ids):
-                     result[move.id] = account_ids[0]
-         return result
-
-     def _account_id(self, cr, uid, ids, name, arg, context):
-         result = {}
-         for move in self.browse(cr, uid, ids):
-             result[move.id] = False
-             if move.account and move.company_id:
-                 #if len(move.account) in [3, 4]:
-                 #    acc = move.account
-                 #else:
-                 #    acc = move.account[:2]+'00'
-                 if move.account[:2] in ['23','33']:
-                      acc = move.account[:2]+'00'
-                 else:
-                      acc =  move.account
-
-             account_ids= self.pool.get('account.account').search(cr,uid,[('company_id','=',move.company_id.id),('code','=',acc),('type','!=','view')])
-             if not account_ids and len(move.counter_account)==3:
-                    account_ids= self.pool.get('account.account').search(cr,uid,[('company_id','=',move.company_id.id),('code','=','0'+acc),('type','!=','view')])
-             if len(account_ids):
-                 result[move.id] = account_ids[0]
-         return result
-
-     def _counter_account_id(self, cr, uid, ids, name, arg, context):
-         result = {}
-         for move in self.browse(cr, uid, ids):
-             result[move.id] = False
-             if move.counter_account and move.company_id:
-                 #if len(move.counter_account) == 4:
-                 #    acc = move.counter_account
-                 #else:
-                 #    acc = move.counter_account[:2]+'00'
-                 if move.counter_account[:2] in ['23','33']:
-                      acc = move.counter_account[:2]+'00'
-                 else:
-                      acc =  move.counter_account
-
-                 account_ids= self.pool.get('account.account').search(cr,uid,[('company_id','=',move.company_id.id),('code','=',acc),('type','!=','view')])
-                 if not account_ids and len(move.counter_account)==3:
-                    account_ids= self.pool.get('account.account').search(cr,uid,[('company_id','=',move.company_id.id),('code','=','0'+acc),('type','!=','view')])
-
-                 if len(account_ids):
-                     result[move.id] = account_ids[0]
-         return result
-
-     
-     def _period_id(self, cr, uid, ids, name, arg, context):
-         result = {}
-         for move in self.browse(cr, uid, ids):
-             date = False
-             try:
-                 date = time.strptime(move.date,'%d.%m.%y')
-             except:
-                 try:
+    _name = "chricar.account_move_line_deloitte"
+
+    def _analytic_account_id(self, cr, uid, ids, name, arg, context):
+        result = {}
+        for move in self.browse(cr, uid, ids):
+            result[move.id] = False
+            if move.analytic_account and move.company_id:
+                account_ids= self.pool.get('account.analytic.account').search(cr,uid,[('company_id','=',move.company_id.id),('code','=',move.analytic_account)])
+                if len(account_ids):
+                    result[move.id] = account_ids[0]
+        return result
+
+    def _account_id(self, cr, uid, ids, name, arg, context):
+        result = {}
+        for move in self.browse(cr, uid, ids):
+            result[move.id] = False
+            if move.account and move.company_id:
+                #if len(move.account) in [3, 4]:
+                #    acc = move.account
+                #else:
+                #    acc = move.account[:2]+'00'
+                if move.account[:2] in ['23','33']:
+                    acc = move.account[:2]+'00'
+                else:
+                    acc =  move.account
+
+            account_ids= self.pool.get('account.account').search(cr,uid,[('company_id','=',move.company_id.id),('code','=',acc),('type','!=','view')])
+            if not account_ids and len(move.counter_account)==3:
+                account_ids= self.pool.get('account.account').search(cr,uid,[('company_id','=',move.company_id.id),('code','=','0'+acc),('type','!=','view')])
+            if len(account_ids):
+                result[move.id] = account_ids[0]
+        return result
+
+    def _counter_account_id(self, cr, uid, ids, name, arg, context):
+        result = {}
+        for move in self.browse(cr, uid, ids):
+            result[move.id] = False
+            if move.counter_account and move.company_id:
+                #if len(move.counter_account) == 4:
+                #    acc = move.counter_account
+                #else:
+                #    acc = move.counter_account[:2]+'00'
+                if move.counter_account[:2] in ['23','33']:
+                    acc = move.counter_account[:2]+'00'
+                else:
+                    acc =  move.counter_account
+
+                account_ids= self.pool.get('account.account').search(cr,uid,[('company_id','=',move.company_id.id),('code','=',acc),('type','!=','view')])
+                if not account_ids and len(move.counter_account)==3:
+                    account_ids= self.pool.get('account.account').search(cr,uid,[('company_id','=',move.company_id.id),('code','=','0'+acc),('type','!=','view')])
+
+                if len(account_ids):
+                    result[move.id] = account_ids[0]
+        return result
+
+
+    def _period_id(self, cr, uid, ids, name, arg, context):
+        result = {}
+        for move in self.browse(cr, uid, ids):
+            date = False
+            try:
+                date = time.strptime(move.date,'%d.%m.%y')
+            except:
+                try:
                     date = time.strptime(move.date,'%d/%m/%y')
-                 except:
+                except:
                     try:
-                       date = time.strptime(move.date,'%d-%m-%y')
+                        date = time.strptime(move.date,'%d-%m-%y')
                     except:
-                       continue
-             date = datetime.fromtimestamp(mktime(date))
-             if date: 
-                 period_ids= self.pool.get('account.period').search(cr,uid,[('company_id','=',move.company_id.id),('date_start','<=',date),('date_stop','>=',date )])
-
-             if len(period_ids):
-                 result[move.id] = period_ids[0]
-
-         return result
-
-     _columns = {
-       'company_id'         : fields.many2one('res.company', 'Company'),
-       'account'            : fields.char    ('Account Deloitte', size=8, required=True),
-       'account_id'         : fields.function(_account_id, method=True, string="Account",type='many2one', relation='account.account',  select="1", store=True ),
-       'account_type_name'  : fields.related ('account_id', 'user_type', string="Account Type",type='many2one', relation='account.account.type',  select="1", store=True ),
-       'amount'             : fields.float   ('Amount', required=True, digits=(16,2)),
-       'analytic_account'   : fields.char    ('Analytic Account Deloitte', size=8),
-       'analytic_account_id': fields.function(_analytic_account_id, method=True, string="Analytic Account",type='many2one', relation='account.analytic.account',  select="1", store=True ),
-
-       'ba'                 : fields.char    ('BA', size=8),
-       'bc'                 : fields.char    ('BC', size=8),
-       'counter_account'    : fields.char    ('Counter Account Deloitte', size=8),
-       'counter_account_id' : fields.function(_counter_account_id, method=True, string="Counter Account",type='many2one', relation='account.account',  select="1", store=True ),
-       'date'               : fields.char    ('Date', size=16, required=True),
-       'period_id'          : fields.function(_period_id, method=True, string="Period",type='many2one', relation='account.period', store=True, select="1",  ),
-       'fiscalyear_id'      : fields.related ('period_id', 'fiscalyear_id', string='Fiscal Year', type='many2one', relation='account.fiscalyear', store=True),
-       'description'        : fields.char    ('text', size=128),
-       'fix'                : fields.char    ('Fix', size=8),
-       'fnr'                : fields.char    ('FNR', size=8),
-       'lc'                 : fields.char    ('LC', size=8),
-       'name'               : fields.char    ('Voucher', size=16, required=True),
-       'symbol'             : fields.char    ('Symbol', size=8),
-       'tax_code'           : fields.char    ('Tax Code', size=8),
-       'state'              : fields.selection([('draft','Draft'), ('progress','Progress'), ('done','Done')], 'State', required=True,)
-}
-     _defaults = {
-       'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
-        'state' : 'draft',
-}
-     _order = "name"
-
-     def autodetect(self, cr, uid, ids, context=None):
-         _logger = logging.getLogger(__name__)
-         if not context:
+                        continue
+            date = datetime.fromtimestamp(mktime(date))
+            if date:
+                period_ids= self.pool.get('account.period').search(cr,uid,[('company_id','=',move.company_id.id),('date_start','<=',date),('date_stop','>=',date )])
+
+            if len(period_ids):
+                result[move.id] = period_ids[0]
+
+        return result
+
+    _columns = {
+      'company_id'         : fields.many2one('res.company', 'Company'),
+      'account'            : fields.char    ('Account Deloitte', size=8, required=True),
+      'account_id'         : fields.function(_account_id, method=True, string="Account",type='many2one', relation='account.account',  select="1", store=True ),
+      'account_type_name'  : fields.related ('account_id', 'user_type', string="Account Type",type='many2one', relation='account.account.type',  select="1", store=True ),
+      'amount'             : fields.float   ('Amount', required=True, digits=(16,2)),
+      'analytic_account'   : fields.char    ('Analytic Account Deloitte', size=8),
+      'analytic_account_id': fields.function(_analytic_account_id, method=True, string="Analytic Account",type='many2one', relation='account.analytic.account',  select="1", store=True ),
+
+      'ba'                 : fields.char    ('BA', size=8),
+      'bc'                 : fields.char    ('BC', size=8),
+      'counter_account'    : fields.char    ('Counter Account Deloitte', size=8),
+      'counter_account_id' : fields.function(_counter_account_id, method=True, string="Counter Account",type='many2one', relation='account.account',  select="1", store=True ),
+      'date'               : fields.char    ('Date', size=16, required=True),
+      'period_id'          : fields.function(_period_id, method=True, string="Period",type='many2one', relation='account.period', store=True, select="1",  ),
+      'fiscalyear_id'      : fields.related ('period_id', 'fiscalyear_id', string='Fiscal Year', type='many2one', relation='account.fiscalyear', store=True),
+      'description'        : fields.char    ('text', size=128),
+      'fix'                : fields.char    ('Fix', size=8),
+      'fnr'                : fields.char    ('FNR', size=8),
+      'lc'                 : fields.char    ('LC', size=8),
+      'name'               : fields.char    ('Voucher', size=16, required=True),
+      'symbol'             : fields.char    ('Symbol', size=8),
+      'tax_code'           : fields.char    ('Tax Code', size=8),
+      'state'              : fields.selection([('draft','Draft'), ('progress','Progress'), ('done','Done')], 'State', required=True,)
+}
+    _defaults = {
+      'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
+       'state' : 'draft',
+}
+    _order = "name"
+
+    def autodetect(self, cr, uid, ids, context=None):
+        _logger = logging.getLogger(__name__)
+        if not context:
             context = {}
-         account_obj = self.pool.get('account.account')
-         analytic_obj = self.pool.get('account.analytic.account')
-         analytic_line_obj = self.pool.get('account.analytic.line')
-         analytic_jour_obj = self.pool.get('account.analytic.journal')
-         move_obj = self.pool.get('account.move')
-         move_line_obj = self.pool.get('account.move.line')
-         analytic_line_obj = self.pool.get('account.analytic.line')
-         period_obj = self.pool.get('account.period')
-         journal_obj = self.pool.get('account.journal')
-         top_obj = self.pool.get('chricar.top')
-         location_obj = self.pool.get('stock.location')
-         now =  time.strftime("%Y%m%d%H%M%S")
-
-         if context.get('company_id'):
-              company_id = context.get('company_id')
-         else:
-              company_id = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.id
-              context['company_id'] = company_id
-
-         acc_deloitte_ids = self.search(cr, uid, [('company_id','=',company_id),('state','not in',('progress','done'))])
-         if not acc_deloitte_ids:
-             return True
-         self.write(cr, uid, acc_deloitte_ids, {'state': 'progress'} )
-         acc_ids = account_obj.search(cr, uid, [('company_id','=',company_id)])
-         _logger.debug('FGF account ids %s' % (acc_ids))
-         acc_codes = []
-         for acc in  account_obj.browse(cr, uid, acc_ids, context=None):
-             if acc.code not in acc_codes:
-                 acc_codes.append(acc.code)
-         #_logger.debug('FGF account names %s' % (acc_codes))
-
-         _logger.debug('FGF account deloitte ids %s' % (acc_deloitte_ids))
-         acc_deloitte_codes = []
-
-         for deloitte_acc in  self.browse(cr, uid, acc_deloitte_ids, context=None):
-           das = [deloitte_acc.account, deloitte_acc.counter_account]
-           _logger.debug('FGF missing das %s' % (das))
-           for da in das:
+        account_obj = self.pool.get('account.account')
+        analytic_obj = self.pool.get('account.analytic.account')
+        analytic_line_obj = self.pool.get('account.analytic.line')
+        analytic_jour_obj = self.pool.get('account.analytic.journal')
+        move_obj = self.pool.get('account.move')
+        move_line_obj = self.pool.get('account.move.line')
+        analytic_line_obj = self.pool.get('account.analytic.line')
+        period_obj = self.pool.get('account.period')
+        journal_obj = self.pool.get('account.journal')
+        top_obj = self.pool.get('chricar.top')
+        location_obj = self.pool.get('stock.location')
+        now =  time.strftime("%Y%m%d%H%M%S")
+
+        if context.get('company_id'):
+            company_id = context.get('company_id')
+        else:
+            company_id = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.id
+            context['company_id'] = company_id
+
+        acc_deloitte_ids = self.search(cr, uid, [('company_id','=',company_id),('state','not in',('progress','done'))])
+        if not acc_deloitte_ids:
+            return True
+        self.write(cr, uid, acc_deloitte_ids, {'state': 'progress'} )
+        acc_ids = account_obj.search(cr, uid, [('company_id','=',company_id)])
+        _logger.debug('FGF account ids %s' % (acc_ids))
+        acc_codes = []
+        for acc in  account_obj.browse(cr, uid, acc_ids, context=None):
+            if acc.code not in acc_codes:
+                acc_codes.append(acc.code)
+        #_logger.debug('FGF account names %s' % (acc_codes))
+
+        _logger.debug('FGF account deloitte ids %s' % (acc_deloitte_ids))
+        acc_deloitte_codes = []
+
+        for deloitte_acc in  self.browse(cr, uid, acc_deloitte_ids, context=None):
+            das = [deloitte_acc.account, deloitte_acc.counter_account]
+            _logger.debug('FGF missing das %s' % (das))
+            for da in das:
                 if da and len(da)<4:
-                  da = '0'+da
+                    da = '0'+da
                 _logger.debug('FGF da %s' % (da))
                 if da and da[:2] not in ['23','33'] \
                              and da not in acc_codes \
                              and da not in acc_deloitte_codes:
-                     acc_deloitte_codes.append(da)
-                     _logger.debug('FGF missing da %s %s' % (da, acc_deloitte_codes))
-             
-         _logger.debug('FGF missing acc_deloitte_codes %s' % (acc_deloitte_codes))
-         
-         counter= 0
-         user_type = self.pool.get('account.account.type').search(cr, uid, [('code','=','view')])[0]
-         parent_id = account_obj.search(cr, uid, [('company_id','=',company_id),('parent_id','=',False)])[0]
-         for acc_deloitte_code in acc_deloitte_codes:
-                 counter += 1
-                 vals = {
-                   'code' : acc_deloitte_code,
-                   'name' : 'i-'+now+'-'+str(counter),
-                   'type' : 'other',
-                   'user_type' : user_type,
-                   'currency_mode' : 'current',
-                   'parent_id' : parent_id,
-                 }
-                 _logger.debug('FGF new account %s' % (vals))
-                 account_obj.create(cr, uid, vals, context)
-
-         # create missing analytic accounts
-         aacc_ids = analytic_obj.search(cr, uid, [('company_id','=',company_id),('company_id','=',company_id)])
-         aacc_codes = []
-         for aacc in  analytic_obj.browse(cr, uid, aacc_ids, context=None):
-             if aacc.code:
-                  aacc_codes.append(aacc.code)
-
-         aacc_deloitte_ids = self.search(cr, uid, [('company_id','=',company_id),('company_id','=',company_id)])
-         aacc_deloitte_codes = []
-         for deloitte_aacc in  self.browse(cr, uid, aacc_deloitte_ids, context=None):
-             if deloitte_aacc.analytic_account \
-                             and deloitte_aacc.analytic_account not in aacc_deloitte_codes \
-                             and deloitte_aacc.analytic_account not in aacc_codes:
-                  aacc_deloitte_codes.append(deloitte_aacc.analytic_account)
-
-         counter= 0
-
-         _logger.debug('FGF aacc_codes %s' % (aacc_codes))
-         _logger.debug('FGF missing aacc_deloitte_codes %s' % (aacc_deloitte_codes))
-         for aacc_deloitte_code in aacc_deloitte_codes:
-                 counter += 1
-                 val = {
-                   'code' : aacc_deloitte_code,
-                   'name' : 'i-'+now+'-'+str(counter),
-                 }
-                 analytic_obj.create(cr, uid, val)
-                 _logger.debug('FGF create aacc_deloitte_codes %s' % (val))
-
-         # update deloitte moves
-         for deloitte_move in self.browse(cr, uid, acc_deloitte_ids, context=context):
-              vals = {}
-              if not deloitte_move.account_id and deloitte_move.account[:2] not in ['23','33']:
-                   vals['account_id'] =  account_obj.search(cr, uid, [('company_id','=',company_id),('code','=', deloitte_move.account)])
-                   if not  vals['account_id'] and len(deloitte_move.account)< 4:
-                        vals['account_id'] =  account_obj.search(cr, uid, [('company_id','=',company_id),('code','=', '0'+deloitte_move.account)])
-              if deloitte_move.counter_account and not deloitte_move.counter_account_id and deloitte_move.counter_account[:2] not in ['23','33']:
-                   vals['counter_account_id'] =  account_obj.search(cr, uid, [('company_id','=',company_id),('code','=', deloitte_move.counter_account)])
-                   if not vals['counter_account_id'] and len(deloitte_move.counter_account)<4:
-                   #if not vals.get('counter_account_id',False)  and deloitte_move.counter_account and len(deloitte_move.counter_account)<4:
-                        vals['counter_account_id'] =  account_obj.search(cr, uid, [('company_id','=',company_id),('code','=', '0'+deloitte_move.counter_account)])
-                 
-              if deloitte_move.analytic_account and not deloitte_move.analytic_account_id:
-                   vals['analytic_account_id'] =  analytic_obj.search(cr, uid, [('company_id','=',company_id),('code','=', deloitte_move.analytic_account)])
-              if vals:
-                  _logger.debug('FGF create aacc_deloitte_codes %s' % (vals))
-                  self.write(cr, uid, deloitte_move.id, vals ,context)
-         return True
-
-     def create_move(self, cr, uid, line, vals, context ):
-     #def create_move(self, cr, uid, v ):
-         _logger = logging.getLogger(__name__)
-         account_obj = self.pool.get('account.account')
-         move_line_obj = self.pool.get('account.move.line')
-         analytic_line_obj = self.pool.get('account.analytic.line')
-         l = dict(line)
-         l['journal_id'] = vals['journal_id']
-         l['state'] = 'draft'
-         l['date'] = vals['date']
-         l['period_id'] = vals['period_id']
-         l['move_id'] = context['move_id']
-         analytic_usage = ''
-         #_logger.debug('FGF move_line = %s' % (l))
-         for acc in account_obj.browse(cr, uid, [line['account_id']], context):
-                 analytic_usage =  acc.account_analytic_usage
-                 if analytic_usage == 'none':
-                     l['analytic_account_id'] = ''
-                 #_logger.debug('FGF move_line = %s' % (l))
-                 move_line_id = move_line_obj.create(cr, uid, l, context)
-                 #move_line_id = super(account_move_line, self).create(cr, uid, l, context)
-
-                 if l.get('analytic_account_id',False):
-                    l['general_account_id'] = line['account_id']
-                    l['account_id'] = line['analytic_account_id']
-                    l['journal_id'] = context['journal_analytic_id']
-                    l['ref'] = line['name']
-                    l['move_id'] = move_line_id
-                    if l['debit'] > 0.0 :
-                       l['amount'] = -l['debit']
-                    else:
-                       l['amount'] = l['credit']
-                    #_logger.debug('FGF move_analyitc line = %s' % (l))
-                    del l['analytic_account_id']
-                    del l['analytic_lines']
-                    del l['state']
-                    del l['credit']
-                    del l['debit']
-                    #analytic_line_obj.create(cr, uid, l, context)
-
-
-
-
-     def transfer_deloitte_moves(self, cr, uid, ids, context=None):
-         _logger = logging.getLogger(__name__)
-         if not context:
+                    acc_deloitte_codes.append(da)
+                    _logger.debug('FGF missing da %s %s' % (da, acc_deloitte_codes))
+
+        _logger.debug('FGF missing acc_deloitte_codes %s' % (acc_deloitte_codes))
+
+        counter= 0
+        user_type = self.pool.get('account.account.type').search(cr, uid, [('code','=','view')])[0]
+        parent_id = account_obj.search(cr, uid, [('company_id','=',company_id),('parent_id','=',False)])[0]
+        for acc_deloitte_code in acc_deloitte_codes:
+            counter += 1
+            vals = {
+              'code' : acc_deloitte_code,
+              'name' : 'i-'+now+'-'+str(counter),
+              'type' : 'other',
+              'user_type' : user_type,
+              'currency_mode' : 'current',
+              'parent_id' : parent_id,
+            }
+            _logger.debug('FGF new account %s' % (vals))
+            account_obj.create(cr, uid, vals, context)
+
+        # create missing analytic accounts
+        aacc_ids = analytic_obj.search(cr, uid, [('company_id','=',company_id),('company_id','=',company_id)])
+        aacc_codes = []
+        for aacc in  analytic_obj.browse(cr, uid, aacc_ids, context=None):
+            if aacc.code:
+                aacc_codes.append(aacc.code)
+
+        aacc_deloitte_ids = self.search(cr, uid, [('company_id','=',company_id),('company_id','=',company_id)])
+        aacc_deloitte_codes = []
+        for deloitte_aacc in  self.browse(cr, uid, aacc_deloitte_ids, context=None):
+            if deloitte_aacc.analytic_account \
+                            and deloitte_aacc.analytic_account not in aacc_deloitte_codes \
+                            and deloitte_aacc.analytic_account not in aacc_codes:
+                aacc_deloitte_codes.append(deloitte_aacc.analytic_account)
+
+        counter= 0
+
+        _logger.debug('FGF aacc_codes %s' % (aacc_codes))
+        _logger.debug('FGF missing aacc_deloitte_codes %s' % (aacc_deloitte_codes))
+        for aacc_deloitte_code in aacc_deloitte_codes:
+            counter += 1
+            val = {
+              'code' : aacc_deloitte_code,
+              'name' : 'i-'+now+'-'+str(counter),
+            }
+            analytic_obj.create(cr, uid, val)
+            _logger.debug('FGF create aacc_deloitte_codes %s' % (val))
+
+        # update deloitte moves
+        for deloitte_move in self.browse(cr, uid, acc_deloitte_ids, context=context):
+            vals = {}
+            if not deloitte_move.account_id and deloitte_move.account[:2] not in ['23','33']:
+                vals['account_id'] =  account_obj.search(cr, uid, [('company_id','=',company_id),('code','=', deloitte_move.account)])
+                if not  vals['account_id'] and len(deloitte_move.account)< 4:
+                    vals['account_id'] =  account_obj.search(cr, uid, [('company_id','=',company_id),('code','=', '0'+deloitte_move.account)])
+            if deloitte_move.counter_account and not deloitte_move.counter_account_id and deloitte_move.counter_account[:2] not in ['23','33']:
+                vals['counter_account_id'] =  account_obj.search(cr, uid, [('company_id','=',company_id),('code','=', deloitte_move.counter_account)])
+                if not vals['counter_account_id'] and len(deloitte_move.counter_account)<4:
+                #if not vals.get('counter_account_id',False)  and deloitte_move.counter_account and len(deloitte_move.counter_account)<4:
+                    vals['counter_account_id'] =  account_obj.search(cr, uid, [('company_id','=',company_id),('code','=', '0'+deloitte_move.counter_account)])
+
+            if deloitte_move.analytic_account and not deloitte_move.analytic_account_id:
+                vals['analytic_account_id'] =  analytic_obj.search(cr, uid, [('company_id','=',company_id),('code','=', deloitte_move.analytic_account)])
+            if vals:
+                _logger.debug('FGF create aacc_deloitte_codes %s' % (vals))
+                self.write(cr, uid, deloitte_move.id, vals ,context)
+        return True
+
+    def create_move(self, cr, uid, line, vals, context ):
+    #def create_move(self, cr, uid, v ):
+        _logger = logging.getLogger(__name__)
+        account_obj = self.pool.get('account.account')
+        move_line_obj = self.pool.get('account.move.line')
+        analytic_line_obj = self.pool.get('account.analytic.line')
+        l = dict(line)
+        l['journal_id'] = vals['journal_id']
+        l['state'] = 'draft'
+        l['date'] = vals['date']
+        l['period_id'] = vals['period_id']
+        l['move_id'] = context['move_id']
+        analytic_usage = ''
+        #_logger.debug('FGF move_line = %s' % (l))
+        for acc in account_obj.browse(cr, uid, [line['account_id']], context):
+            analytic_usage =  acc.account_analytic_usage
+            if analytic_usage == 'none':
+                l['analytic_account_id'] = ''
+            #_logger.debug('FGF move_line = %s' % (l))
+            move_line_id = move_line_obj.create(cr, uid, l, context)
+            #move_line_id = super(account_move_line, self).create(cr, uid, l, context)
+
+            if l.get('analytic_account_id',False):
+                l['general_account_id'] = line['account_id']
+                l['account_id'] = line['analytic_account_id']
+                l['journal_id'] = context['journal_analytic_id']
+                l['ref'] = line['name']
+                l['move_id'] = move_line_id
+                if l['debit'] > 0.0 :
+                    l['amount'] = -l['debit']
+                else:
+                    l['amount'] = l['credit']
+                #_logger.debug('FGF move_analyitc line = %s' % (l))
+                del l['analytic_account_id']
+                del l['analytic_lines']
+                del l['state']
+                del l['credit']
+                del l['debit']
+                #analytic_line_obj.create(cr, uid, l, context)
+
+
+
+
+    def transfer_deloitte_moves(self, cr, uid, ids, context=None):
+        _logger = logging.getLogger(__name__)
+        if not context:
             context = {}
-         account_obj = self.pool.get('account.account')
-         analytic_obj = self.pool.get('account.analytic.account')
-         analytic_line_obj = self.pool.get('account.analytic.line')
-         analytic_jour_obj = self.pool.get('account.analytic.journal')
-         move_obj = self.pool.get('account.move')
-         move_line_obj = self.pool.get('account.move.line')
-         analytic_line_obj = self.pool.get('account.analytic.line')
-         period_obj = self.pool.get('account.period')
-         journal_obj = self.pool.get('account.journal')
-         top_obj = self.pool.get('chricar.top')
-         location_obj = self.pool.get('stock.location')
-         
-         if context.get('company_id'):
-              company_id = context.get('company_id')
-         else:
-              company_id = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.id
-              context['company_id'] = company_id
-
-         acc_deloitte_ids = self.search(cr, uid, [('company_id','=',company_id),('state','=','progress')])
-         if not acc_deloitte_ids:
-             return True
-
-         journal_id = journal_obj.search(cr, uid, [('company_id','=',company_id),('code','=','DE')], context=context)
-         if journal_id: 
-                 journal_id = journal_id[0] 
-         _logger.debug('FGF journal_id  %s' % (journal_id))
-         #if not journal_id:
-         #    journal_id = journal_obj.create(cr, uid, {'company_id':company_id, 'code':'DE', 'name':'Deloitte', 'type','general'})
-         journal_analytic_id = analytic_jour_obj.search(cr, uid, [('company_id','=',company_id),('name','=','Deloitte')], context=context)
-         if journal_analytic_id: 
-                 journal_analytic_id = journal_analytic_id[0] 
-         context['journal_analytic_id'] = journal_analytic_id
- 
-         to_post = []
-         cr.execute("""select  distinct company_id, period_id, symbol||'-'||name||'-D' as name, date
-                  from chricar_account_move_line_deloitte
-                 where id in (%s)  """ % (','.join(map(str,acc_deloitte_ids)) ))
-         period_ids = [] 
-         for move in cr.dictfetchall():
-             vals = dict(move)
-             try:
+        account_obj = self.pool.get('account.account')
+        analytic_obj = self.pool.get('account.analytic.account')
+        analytic_line_obj = self.pool.get('account.analytic.line')
+        analytic_jour_obj = self.pool.get('account.analytic.journal')
+        move_obj = self.pool.get('account.move')
+        move_line_obj = self.pool.get('account.move.line')
+        analytic_line_obj = self.pool.get('account.analytic.line')
+        period_obj = self.pool.get('account.period')
+        journal_obj = self.pool.get('account.journal')
+        top_obj = self.pool.get('chricar.top')
+        location_obj = self.pool.get('stock.location')
+
+        if context.get('company_id'):
+            company_id = context.get('company_id')
+        else:
+            company_id = self.pool.get('res.users').browse(cr, uid, uid, context).company_id.id
+            context['company_id'] = company_id
+
+        acc_deloitte_ids = self.search(cr, uid, [('company_id','=',company_id),('state','=','progress')])
+        if not acc_deloitte_ids:
+            return True
+
+        journal_id = journal_obj.search(cr, uid, [('company_id','=',company_id),('code','=','DE')], context=context)
+        if journal_id:
+            journal_id = journal_id[0]
+        _logger.debug('FGF journal_id  %s' % (journal_id))
+        #if not journal_id:
+        #    journal_id = journal_obj.create(cr, uid, {'company_id':company_id, 'code':'DE', 'name':'Deloitte', 'type','general'})
+        journal_analytic_id = analytic_jour_obj.search(cr, uid, [('company_id','=',company_id),('name','=','Deloitte')], context=context)
+        if journal_analytic_id:
+            journal_analytic_id = journal_analytic_id[0]
+        context['journal_analytic_id'] = journal_analytic_id
+
+        to_post = []
+        cr.execute("""select  distinct company_id, period_id, symbol||'-'||name||'-D' as name, date
+                 from chricar_account_move_line_deloitte
+                where id in (%s)  """ % (','.join(map(str,acc_deloitte_ids)) ))
+        period_ids = []
+        for move in cr.dictfetchall():
+            vals = dict(move)
+            try:
                 d =  datetime.strptime(move['date'],"%d.%m.%y")
-             except:
+            except:
                 try:
-                   d =  datetime.strptime(move['date'],"%d/%m/%y")
+                    d =  datetime.strptime(move['date'],"%d/%m/%y")
                 except:
-                   pass
-             date = d.strftime('%Y-%m-%d') 
-             vals.update({
-                'journal_id' : journal_id,
-                'state'      : 'draft',
-                'date'       : date,
-                #'journal_analytic_id': journal_analytic_id,
-             })
-             #_logger.debug('FGF move vals %s' % (vals))
-             c = {}
-             c['novalidate'] = True
-             # moves_lines from ONE move may have different dates
-             _logger.debug('FGF move_id before %s', vals  )
-             move_id = move_obj.search(cr,uid, [('company_id','=',vals['company_id']), ('period_id','=',vals['period_id']), ('name','=',vals['name']) ])
-             if move_id:
+                    pass
+            date = d.strftime('%Y-%m-%d')
+            vals.update({
+               'journal_id' : journal_id,
+               'state'      : 'draft',
+               'date'       : date,
+               #'journal_analytic_id': journal_analytic_id,
+            })
+            #_logger.debug('FGF move vals %s' % (vals))
+            c = {}
+            c['novalidate'] = True
+            # moves_lines from ONE move may have different dates
+            _logger.debug('FGF move_id before %s', vals  )
+            move_id = move_obj.search(cr,uid, [('company_id','=',vals['company_id']), ('period_id','=',vals['period_id']), ('name','=',vals['name']) ])
+            if move_id:
                 continue
-             else:
+            else:
                 move_id = move_obj.create(cr, uid, vals,  c )
-             to_post.append(move_id)
-             #move_id = super(account_move, self).create(cr, uid, vals, {} )
-             context['move_id'] = move_id 
-             vals['move_id'] = move_id 
-             _logger.debug('FGF move_id = %s' % (move_id))
-             # FGF 20120304 - this code is copied from a 2 years old working sql procedure !
-             # writing in python from scratch would look much different
-             cr.execute("""
+            to_post.append(move_id)
+            #move_id = super(account_move, self).create(cr, uid, vals, {} )
+            context['move_id'] = move_id
+            vals['move_id'] = move_id
+            _logger.debug('FGF move_id = %s' % (move_id))
+            # FGF 20120304 - this code is copied from a 2 years old working sql procedure !
+            # writing in python from scratch would look much different
+            cr.execute("""
 select d.account_id,date, d.description as name, d.analytic_account_id,
-       case when d.amount > 0 then d.amount else 0 end as debit,
-       case when d.amount < 0 then -d.amount else 0 end as credit,
-       'valid' as state 
-  from chricar_account_move_line_deloitte d,
-       account_account ac,
-       account_account_type at
- where 
-   ac.id = d.account_id
-   and at.id = ac.user_type
-   and d.company_id = %s
-   and d.period_id = %s
-   and symbol||'-'||d.name||'-D' = '%s'
-   and (at.close_method != 'none' or tax_code is null)
+      case when d.amount > 0 then d.amount else 0 end as debit,
+      case when d.amount < 0 then -d.amount else 0 end as credit,
+      'valid' as state
+ from chricar_account_move_line_deloitte d,
+      account_account ac,
+      account_account_type at
+where
+  ac.id = d.account_id
+  and at.id = ac.user_type
+  and d.company_id = %s
+  and d.period_id = %s
+  and symbol||'-'||d.name||'-D' = '%s'
+  and (at.close_method != 'none' or tax_code is null)
 union all
 -- tax code account - net
 select d.account_id,date, d.description as name, d.analytic_account_id,
-       case when d.amount > 0 then round( d.amount / (1+tc.percent),2) else 0 end as debit,
-       case when d.amount < 0 then round(-d.amount / (1+tc.percent),2) else 0 end as credit,
-       'valid' as state
-  from chricar_account_move_line_deloitte d,
-       account_account ac,
-       account_account_type at,
-       chricar_account_tax_code_deloitte tc
- where 
-   ac.id = d.account_id
-   and tc.code = d.tax_code
-   and tc.company_id = d.company_id
-   and at.id = ac.user_type
-   and at.close_method = 'none'
-   and d.company_id = %s
-   and d.period_id = %s
-   and symbol||'-'||d.name||'-D' = '%s'
+      case when d.amount > 0 then round( d.amount / (1+tc.percent),2) else 0 end as debit,
+      case when d.amount < 0 then round(-d.amount / (1+tc.percent),2) else 0 end as credit,
+      'valid' as state
+ from chricar_account_move_line_deloitte d,
+      account_account ac,
+      account_account_type at,
+      chricar_account_tax_code_deloitte tc
+where
+  ac.id = d.account_id
+  and tc.code = d.tax_code
+  and tc.company_id = d.company_id
+  and at.id = ac.user_type
+  and at.close_method = 'none'
+  and d.company_id = %s
+  and d.period_id = %s
+  and symbol||'-'||d.name||'-D' = '%s'
 union all
 -- tax code account - tax - avoid rounding differnces !!!
 select tc.account_id,date, d.description as name, d.analytic_account_id,
-       case when d.amount > 0 then  d.amount - round( d.amount / (1+tc.percent),2) else 0 end as debit,
-       case when d.amount < 0 then -d.amount - round(-d.amount / (1+tc.percent),2) else 0 end as credit,
-       'valid' as state
-  from chricar_account_move_line_deloitte d,
-       account_account ac,
-       account_account_type at,
-       chricar_account_tax_code_deloitte tc
- where 
-   ac.id = d.account_id
-   and tc.code = d.tax_code
-   and tc.company_id = d.company_id
-   and at.id = ac.user_type
-   and at.close_method = 'none'
-   and percent > 0
-   and d.company_id = %s
-   and d.period_id = %s
-   and symbol||'-'||d.name||'-D' = '%s'
+      case when d.amount > 0 then  d.amount - round( d.amount / (1+tc.percent),2) else 0 end as debit,
+      case when d.amount < 0 then -d.amount - round(-d.amount / (1+tc.percent),2) else 0 end as credit,
+      'valid' as state
+ from chricar_account_move_line_deloitte d,
+      account_account ac,
+      account_account_type at,
+      chricar_account_tax_code_deloitte tc
+where
+  ac.id = d.account_id
+  and tc.code = d.tax_code
+  and tc.company_id = d.company_id
+  and at.id = ac.user_type
+  and at.close_method = 'none'
+  and percent > 0
+  and d.company_id = %s
+  and d.period_id = %s
+  and symbol||'-'||d.name||'-D' = '%s'
 
 union all
 -- counter account
--- no tax code account 
+-- no tax code account
 select d.counter_account_id,date, d.description as name, d.analytic_account_id,
-       case when d.amount < 0 then -d.amount else 0 end as debit,
-       case when d.amount > 0 then  d.amount else 0 end as credit,
-       'valid' as state
-  from chricar_account_move_line_deloitte d,
-       account_account ac,
-       account_account_type at
- where 
-   ac.id = d.counter_account_id
-   and at.id = ac.user_type
-   and (at.close_method != 'none' or tax_code is null)
-   and d.company_id = %s
-   and d.period_id = %s
-   and symbol||'-'||d.name||'-D' = '%s'
+      case when d.amount < 0 then -d.amount else 0 end as debit,
+      case when d.amount > 0 then  d.amount else 0 end as credit,
+      'valid' as state
+ from chricar_account_move_line_deloitte d,
+      account_account ac,
+      account_account_type at
+where
+  ac.id = d.counter_account_id
+  and at.id = ac.user_type
+  and (at.close_method != 'none' or tax_code is null)
+  and d.company_id = %s
+  and d.period_id = %s
+  and symbol||'-'||d.name||'-D' = '%s'
 union all
 -- tax code account - net
 select d.counter_account_id,date, d.description as name, d.analytic_account_id,
-       case when d.amount < 0 then round(-d.amount / (1+tc.percent),2) else 0 end as debit,
-       case when d.amount > 0 then round( d.amount / (1+tc.percent),2) else 0 end as credit,
-       'valid' as state
-  from chricar_account_move_line_deloitte d,
-       account_account ac,
-       account_account_type at,
-       chricar_account_tax_code_deloitte tc
- where 
-   ac.id = d.counter_account_id
-   and tc.code = d.tax_code
-   and tc.company_id = d.company_id
-   and at.id = ac.user_type
-   and at.close_method = 'none'
-   and d.company_id = %s
-   and d.period_id = %s
-   and symbol||'-'||d.name||'-D' = '%s'
+      case when d.amount < 0 then round(-d.amount / (1+tc.percent),2) else 0 end as debit,
+      case when d.amount > 0 then round( d.amount / (1+tc.percent),2) else 0 end as credit,
+      'valid' as state
+ from chricar_account_move_line_deloitte d,
+      account_account ac,
+      account_account_type at,
+      chricar_account_tax_code_deloitte tc
+where
+  ac.id = d.counter_account_id
+  and tc.code = d.tax_code
+  and tc.company_id = d.company_id
+  and at.id = ac.user_type
+  and at.close_method = 'none'
+  and d.company_id = %s
+  and d.period_id = %s
+  and symbol||'-'||d.name||'-D' = '%s'
 union all
 -- tax code account - tax - avoid rounding differnces !!!
 select tc.account_id,date, d.description as name, d.analytic_account_id,
-       case when d.amount < 0 then -d.amount - round(-d.amount / (1+tc.percent),2) else 0 end as debit,
-       case when d.amount > 0 then  d.amount - round( d.amount / (1+tc.percent),2) else 0 end as credit,
-       'valid' as state
-  from chricar_account_move_line_deloitte d,
-       account_account ac,
-       account_account_type at,
-       chricar_account_tax_code_deloitte tc
- where 
-   ac.id = d.counter_account_id
-   and tc.code = d.tax_code
-   and tc.company_id = d.company_id
-   and at.id = ac.user_type
-   and at.close_method = 'none'
-   and percent > 0
-   and d.company_id = %s
-   and d.period_id = %s
-   and symbol||'-'||d.name||'-D' = '%s' 
-            """ % ( 
+      case when d.amount < 0 then -d.amount - round(-d.amount / (1+tc.percent),2) else 0 end as debit,
+      case when d.amount > 0 then  d.amount - round( d.amount / (1+tc.percent),2) else 0 end as credit,
+      'valid' as state
+ from chricar_account_move_line_deloitte d,
+      account_account ac,
+      account_account_type at,
+      chricar_account_tax_code_deloitte tc
+where
+  ac.id = d.counter_account_id
+  and tc.code = d.tax_code
+  and tc.company_id = d.company_id
+  and at.id = ac.user_type
+  and at.close_method = 'none'
+  and percent > 0
+  and d.company_id = %s
+  and d.period_id = %s
+  and symbol||'-'||d.name||'-D' = '%s'
+           """ % (
 company_id, vals['period_id'], vals['name'], \
 company_id, vals['period_id'], vals['name'], \
 company_id, vals['period_id'], vals['name'], \
@@ -547,119 +547,118 @@
 company_id, vals['period_id'], vals['name'], \
 company_id, vals['period_id'], vals['name'], )
 )
-             moves= []
-             for line in cr.dictfetchall():
-                 # FIXME - performance 
-                 v = dict(line)
-                 #_logger.debug('FGF create_move v %s' % (v))
-                 v.update(vals)
-                 _logger.debug('FGF create_move v %s' % (v))
-                 v.update(context)
-                 #_logger.debug('FGF create_move v %s' % (v))
-                 #_logger.debug('FGF create_move line %s' % (line))
-                 #_logger.debug('FGF create_move vals %s' % (vals))
-                 #_logger.debug('FGF create_move context %s' % (context))
-                 #moves.append( (v))
-                 #try:
-                     #self.create_move(cr, uid, line, vals, context )
-                 #self.create_move(cr, uid, line, v, context )
-                 self.create_move(cr, uid, line, v, context )
-                 if vals['period_id'] not in period_ids:
-                     period_ids.append(vals['period_id'])
-                 #except:
-                     #raise osv.except_osv(_('Error :'), _('FGF insert deloitte move %s %s') % (line, vals))
-                 #    raise osv.except_osv(_('Error :'), _('FGF insert deloitte move %s ') % ( v))
-
-             #_logger.debug('FGF create_move moves %s' % (moves))
-             #self.create_move(cr, uid, moves)
-        
-         journal_id = journal_obj.search(cr, uid, [('company_id','=',company_id),('code','=','DEN')], context=context)
-         if journal_id:
-             journal_id = journal_id[0]
-         #journal_analytic_id = analytic_jour_obj.search(cr, uid, [('code','=','Deloitte')], context=context)[0]
-         #context['journal_analytic_id'] = journal_analytic_id
-         _logger.debug('FGF create_move neutral period_ids %s', period_ids )
-         ##########################
-         #create a move to neutralize the OpenERP move_lines
-         ##########################
-         cr.execute("""
-             select distinct period_id, date_stop as date
-               from chricar_account_move_line_deloitte d,
-                    account_period p
-              where p.id = d.period_id
-                and period_id in (%s)""" % (','.join(map(str,period_ids)) ))
-         for move in cr.dictfetchall():
-             _logger.debug('FGF create_move neutral move %s', move)
-             vals = move
-             vals.update({
-                'journal_id' : journal_id,
-                'state'      : 'draft',
-                'name'       : 'neutral-'+ move['date'],
-                'ref'       : 'neutral-'+ move['date'],
-             })
-             _logger.debug('FGF move vals %s' % (vals))
-             move_id = move_obj.create(cr, uid, vals,{} )
-             to_post.append(move_id)
-             context['move_id'] = move_id
-             cr.execute("""
+            moves= []
+            for line in cr.dictfetchall():
+            # FIXME - performance
+                v = dict(line)
+                #_logger.debug('FGF create_move v %s' % (v))
+                v.update(vals)
+                _logger.debug('FGF create_move v %s' % (v))
+                v.update(context)
+                #_logger.debug('FGF create_move v %s' % (v))
+                #_logger.debug('FGF create_move line %s' % (line))
+                #_logger.debug('FGF create_move vals %s' % (vals))
+                #_logger.debug('FGF create_move context %s' % (context))
+                #moves.append( (v))
+                #try:
+                #self.create_move(cr, uid, line, vals, context )
+                #self.create_move(cr, uid, line, v, context )
+                self.create_move(cr, uid, line, v, context )
+                if vals['period_id'] not in period_ids:
+                    period_ids.append(vals['period_id'])
+                #except:
+                    #raise osv.except_osv(_('Error :'), _('FGF insert deloitte move %s %s') % (line, vals))
+                #    raise osv.except_osv(_('Error :'), _('FGF insert deloitte move %s ') % ( v))
+
+            #_logger.debug('FGF create_move moves %s' % (moves))
+            #self.create_move(cr, uid, moves)
+
+        journal_id = journal_obj.search(cr, uid, [('company_id','=',company_id),('code','=','DEN')], context=context)
+        if journal_id:
+            journal_id = journal_id[0]
+        #journal_analytic_id = analytic_jour_obj.search(cr, uid, [('code','=','Deloitte')], context=context)[0]
+        #context['journal_analytic_id'] = journal_analytic_id
+        _logger.debug('FGF create_move neutral period_ids %s', period_ids )
+        ##########################
+        #create a move to neutralize the OpenERP move_lines
+        ##########################
+        cr.execute("""
+            select distinct period_id, date_stop as date
+              from chricar_account_move_line_deloitte d,
+                   account_period p
+             where p.id = d.period_id
+               and period_id in (%s)""" % (','.join(map(str,period_ids)) ))
+        for move in cr.dictfetchall():
+            _logger.debug('FGF create_move neutral move %s', move)
+            vals = move
+            vals.update({
+               'journal_id' : journal_id,
+               'state'      : 'draft',
+               'name'       : 'neutral-'+ move['date'],
+               'ref'       : 'neutral-'+ move['date'],
+            })
+            _logger.debug('FGF move vals %s' % (vals))
+            move_id = move_obj.create(cr, uid, vals,{} )
+            to_post.append(move_id)
+            context['move_id'] = move_id
+            cr.execute("""
 select account_id,analytic_account_id,
-   case when sum(case when debit is null then 0 else debit end) > 0 then  sum(case when debit is null then 0 else debit end) else 0 end as credit,
-   case when sum(case when debit is null then 0 else debit end) < 0 then -sum(case when debit is null then 0 else debit end) else 0 end as debit
-  from account_move_line aml,
-       account_move am,
-       account_journal aj
- where aj.id = am.journal_id
-   and aj.name not in ( 'Deloitte')
-   and aj.is_opening_balance = False
-   and aml.move_id = am.id
-   and aml.state='valid'
-   and am.company_id = %s
-   and am.period_id = %s
-   --and am.state='posted'
- group by account_id,analytic_account_id
- having sum(case when debit is null then 0 else debit end) != 0
+  case when sum(case when debit is null then 0 else debit end) > 0 then  sum(case when debit is null then 0 else debit end) else 0 end as credit,
+  case when sum(case when debit is null then 0 else debit end) < 0 then -sum(case when debit is null then 0 else debit end) else 0 end as debit
+ from account_move_line aml,
+      account_move am,
+      account_journal aj
+where aj.id = am.journal_id
+  and aj.name not in ( 'Deloitte')
+  and aj.is_opening_balance = False
+  and aml.move_id = am.id
+  and aml.state='valid'
+  and am.company_id = %s
+  and am.period_id = %s
+  --and am.state='posted'
+group by account_id,analytic_account_id
+having sum(case when debit is null then 0 else debit end) != 0
 union all
 select aml.account_id, analytic_account_id,
-   case when sum(case when credit is null then 0 else credit end) < 0 then -sum(case when credit is null then 0 else credit end) else 0 end as credit,
-   case when sum(case when credit is null then 0 else credit end) > 0 then  sum(case when credit is null then 0 else credit end) else 0 end as debit
-  from account_move_line aml,
-       account_move am,
-       account_journal aj 
- where aj.id = am.journal_id
-   and aj.code != 'DE'
-   and aj.is_opening_balance = False
-   and aml.move_id = am.id
-   and aml.state='valid'
-   and am.company_id = %s
-   and am.period_id = %s
-   --and am.state='posted'
- group by account_id,analytic_account_id
+  case when sum(case when credit is null then 0 else credit end) < 0 then -sum(case when credit is null then 0 else credit end) else 0 end as credit,
+  case when sum(case when credit is null then 0 else credit end) > 0 then  sum(case when credit is null then 0 else credit end) else 0 end as debit
+ from account_move_line aml,
+      account_move am,
+      account_journal aj
+where aj.id = am.journal_id
+  and aj.code != 'DE'
+  and aj.is_opening_balance = False
+  and aml.move_id = am.id
+  and aml.state='valid'
+  and am.company_id = %s
+  and am.period_id = %s
+  --and am.state='posted'
+group by account_id,analytic_account_id
 having sum(case when credit is null then 0 else credit end) != 0
 """ % (company_id,move['period_id'],
-      company_id,move['period_id']))
-        
-             for line in cr.dictfetchall():
-                 #try:
-                    line['name'] = 'neutral-'+ move['date'],
-                    _logger.debug('FGF create_move neutral move line %s %s' % ( vals,context))
-                    self.create_move(cr, uid, line, vals, context )
-                 #except:
-                 #   raise osv.except_osv(_('Error :'), _('FGF Er

Follow ups