[MERGE] forward port of branch 7.0 up to revid 9535 odo@openerp.com-20131021124748...
authorChristophe Simonis <chs@openerp.com>
Mon, 21 Oct 2013 14:14:31 +0000 (16:14 +0200)
committerChristophe Simonis <chs@openerp.com>
Mon, 21 Oct 2013 14:14:31 +0000 (16:14 +0200)
bzr revid: chs@openerp.com-20131021141431-5bdk9waai17julkb

addons/account/test/account_fiscalyear_close.yml
addons/l10n_fr/fr_fiscal_templates.xml
addons/procurement/procurement.py

index b80cfd0..cc683ca 100644 (file)
@@ -4,31 +4,27 @@
   !record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}:
     code: !eval "'FY%s'% (datetime.now().year+1)"
     company_id: base.main_company
-    date_start: !eval "'%s-01-01' %(datetime.now().year+1)"
-    date_stop: !eval "'%s-12-31' %(datetime.now().year+1)"
-    name: !eval "'Fiscal Year %s' %(datetime.now().year+1)"
+    date_start: !eval "'%s-01-01' %(datetime.now().year-1)"
+    date_stop: !eval "'%s-12-31' %(datetime.now().year-1)"
+    name: !eval "'Fiscal Year %s' %(datetime.now().year-1)"
 -
-  I create a period for the opening entries for the new fiscalyear
+  I generate periods for the new fiscalyear
 -
-  !record {model: account.period, id: account_period_jan11}:
-    company_id: base.main_company
-    date_start: !eval "'%s-01-01'% (datetime.now().year+1)"
-    date_stop: !eval "'%s-01-01'% (datetime.now().year+1)"
-    fiscalyear_id: account_fiscalyear_fiscalyear0
-    name: !eval "'OP %s' %(datetime.now().year+1)"
-    special: 1
+  !python {model: account.fiscalyear}: |
+    self.create_period(cr, uid, [ref("account_fiscalyear_fiscalyear0")])
 -
-  I create a new account invoice a the partner in current fiscalyear
+  I create a new account invoice in the created fiscalyear
 -
   !record {model: account.invoice, id: account_invoice_current1}:
     partner_id: base.res_partner_2
+    date_invoice: !eval "'%s-01-02' %(datetime.now().year-1)"
     invoice_line:
       - partner_id: base.res_partner_2
         quantity: 1.0
         price_unit: 15.00
         name: Bying stuff
 -
-  I validate it the invoice
+  I validate the invoice
 -
   !workflow {model: account.invoice, action: invoice_open, ref: account.account_invoice_current1}
 -
     company_id: base.main_company
     centralisation: 1
 -
-  I called the Generate Fiscalyear Opening Entries wizard
+  I call the Generate Fiscalyear Opening Entries wizard
 -
   !record {model: account.fiscalyear.close, id: account_fiscalyear_close_0}:
-    fy2_id: account_fiscalyear_fiscalyear0
-    fy_id: account.data_fiscalyear
+    fy2_id: account.data_fiscalyear
+    fy_id: account_fiscalyear_fiscalyear0
     journal_id: account.close_journal
-    period_id: account_period_jan11
+    period_id: account.period_1
     report_name: End of Fiscal Year Entry
 -
   I clicked on create Button
@@ -63,7 +59,7 @@
   I close the previous fiscalyear
 -
   !record {model: account.fiscalyear.close.state, id: account_fiscalyear_close_state_0}:
-    fy_id: data_fiscalyear
+    fy_id: account_fiscalyear_fiscalyear0
 -
   I clicked on Close States Button to close fiscalyear
 -
 -
   I check that the fiscalyear state is now "Done"
 -
-  !assert {model: account.fiscalyear, id: data_fiscalyear, string: Fiscal Year is in Done state}:
+  !assert {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0, string: Fiscal Year is in Done state}:
     - state == 'done'
 -
   I check that the past accounts are taken into account in partner credit
 -
-  !assert {model: res.partner, id: base.res_partner_2}:
-    - credit == 15.0, "Total Receivable does not takes unreconciled previous moves"
+  !assert {model: res.partner, id: base.res_partner_2, string: Total Receivable does not takes unreconciled moves of previous years}:
+    - credit == 15.0
index b11f8d4..bf49d15 100644 (file)
@@ -2,6 +2,12 @@
 <openerp>
     <data>
 
+    <!-- To solve bug 1240265, we have to delete all fiscal position templates before each update.
+         The valid ones will be re-created later during the update.
+         /!\ This must be executed *before* loading the fiscal position templates!! -->
+    <delete model="account.fiscal.position.template" search="[('chart_template_id','=',ref('l10n_fr_pcg_chart_template'))]"/>
+
+
     <!-- = = = = = = = = = = = = = = = -->
     <!-- Fiscal Position Templates     -->
     <!-- = = = = = = = = = = = = = = = -->
index 2ce046f..032952a 100644 (file)
@@ -139,7 +139,7 @@ class procurement_order(osv.osv):
             if not proc.note or '_first_pass_done_' not in proc.note or proc.state not in ('confirmed', 'exception'):
                 super(procurement_order, self).message_track(cr, uid, [proc.id], tracked_fields, initial_values, context=context)
                 if proc.state == 'exception':
-                    cr.execute("""UPDATE procurement_order set note = CONCAT(note, %s) WHERE id = %s""", ('_first_pass_done_',proc.id))
+                    cr.execute("""UPDATE procurement_order set note = TRIM(both E'\n' FROM COALESCE(note, '') || %s) WHERE id = %s""", ('\n\n_first_pass_done_',proc.id))
 
         return True