[ADD] account: test for added check
[odoo/odoo.git] / addons / account / test / account_fiscalyear_close.yml
index 1c3547c..40d1b1a 100644 (file)
     fiscalyear_id: account_fiscalyear_fiscalyear0
     name: !eval "'OP %s' %(datetime.now().year+1)"
     special: 1
-
+-
+  I create a new account invoice a the partner in current fiscalyear
+-
+  !record {model: account.invoice, id: account_invoice_current1}:
+    partner_id: base.res_partner_2
+    invoice_line:
+      - partner_id: base.res_partner_2
+        quantity: 1.0
+        price_unit: 15.00
+        name: Bying stuff
+-
+  I validate it the invoice
+-
+  !python {model: account.invoice}: |
+    import netsvc
+    wf_service = netsvc.LocalService("workflow")
+    wf_service.trg_validate(uid, 'account.invoice', ref('account.account_invoice_current1'), 'invoice_open', cr)
 -
   I made modification in journal so it can move entries
 -
     report_name: End of Fiscal Year Entry
 -
   I clicked on create Button
-
 -
   !python {model: account.fiscalyear.close}: |
     self.data_save(cr, uid, [ref("account_fiscalyear_close_0")], {"lang": 'en_US',
       "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close")],
-      "tz": False, "active_id": ref("account.menu_wizard_fy_close"), })
\ No newline at end of file
+      "tz": False, "active_id": ref("account.menu_wizard_fy_close"), })
+-
+  I close the previous fiscalyear
+-
+  !record {model: account.fiscalyear.close.state, id: account_fiscalyear_close_state_0}:
+    fy_id: data_fiscalyear
+-
+  I clicked on Close States Button to close fiscalyear
+-
+  !python {model: account.fiscalyear.close.state}: |
+    self.data_save(cr, uid, [ref("account_fiscalyear_close_state_0")], {"lang": 'en_US',
+      "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close_state")],
+      "tz": False, "active_id": ref("account.menu_wizard_fy_close_state"), })
+-
+  I check that the fiscalyear state is now "Done"
+-
+  !assert {model: account.fiscalyear, id: data_fiscalyear, 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"