diff --git a/addons/account/__terp__.py b/addons/account/__terp__.py index 591828da489..28b23c23cde 100644 --- a/addons/account/__terp__.py +++ b/addons/account/__terp__.py @@ -18,6 +18,7 @@ "account_demo.xml", "project/project_demo.xml", "project/analytic_account_demo.xml", + "account_unit_test.xml", ], "update_xml" : [ "account_wizard.xml", @@ -36,6 +37,8 @@ "project/project_report.xml", "product_data.xml", "product_view.xml", + + "account_assert_test.xml", ], # "translations" : { # "fr": "i18n/french_fr.csv" diff --git a/addons/account/account.py b/addons/account/account.py index 5ae52dc23fd..862118e5f9f 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -175,7 +175,9 @@ class account_account(osv.osv): def _balance(self, cr, uid, ids, field_name, arg, context={}): if not 'fiscalyear' in context: - context['fiscalyear'] = self.pool.get('account.fiscalyear').find(cr, uid) + context['fiscalyear'] = self.pool.get('account.fiscalyear').find(cr, uid, exception=False) + if not context['fiscalyear']: + return dict(map(lambda x: (x, 0.0), ids)) ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) acc_set = ",".join(map(str, ids2)) diff --git a/addons/account/account_assert_test.xml b/addons/account/account_assert_test.xml new file mode 100644 index 00000000000..1de20f0da83 --- /dev/null +++ b/addons/account/account_assert_test.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 7a4d4cc529c..9bacc2f8e87 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -298,8 +298,7 @@ class account_move_line(osv.osv): raise osv.except_osv('Error', 'The account is not defined to be reconcile !') if r[0][1] != None: raise Exception('Some entries are already reconciled !') - if not self.pool.get('res.currency').is_zero(cr, uid, - account.company_id.currency_id, writeoff): + if not self.pool.get('res.currency').is_zero(cr, uid, account.company_id.currency_id, writeoff): if not writeoff_acc_id: raise osv.except_osv('Warning', 'You have to provide an account for the write off entry !') if writeoff > 0: diff --git a/addons/account/account_unit_test.xml b/addons/account/account_unit_test.xml new file mode 100644 index 00000000000..1a61882c334 --- /dev/null +++ b/addons/account/account_unit_test.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + draft + out_invoice + + Test invoice 1 + + + + Basic computer with Dvorak keyboard and left-handed mouse + + 250 + 1 + + + + Little server with raid 1 and 512ECC ram + + 800 + 2 + + + + + EUR + + + + + + + + + + + open + + + + + + + + + + + + + + + + paid + + + \ No newline at end of file diff --git a/addons/l10n_be/account_demo.xml b/addons/l10n_be/account_demo.xml index a8213f56b05..9824232e5ff 100644 --- a/addons/l10n_be/account_demo.xml +++ b/addons/l10n_be/account_demo.xml @@ -13,14 +13,14 @@ Sample invoice - + Basic computer with Dvorak keyboard and left-handed mouse 250 1 - + Little server with raid 1 and 512ECC ram 800 diff --git a/addons/purchase/__terp__.py b/addons/purchase/__terp__.py index fe6e7be99e7..458f404662d 100644 --- a/addons/purchase/__terp__.py +++ b/addons/purchase/__terp__.py @@ -6,7 +6,7 @@ "depends" : ["base", "account", "stock"], "category" : "Generic Modules/Sales & Purchases", "init_xml" : [], - "demo_xml" : ["purchase_demo.xml"], + "demo_xml" : ["purchase_demo.xml", "purchase_unit_test.xml"], "update_xml" : [ "purchase_workflow.xml", "purchase_sequence.xml", diff --git a/addons/purchase/purchase_unit_test.xml b/addons/purchase/purchase_unit_test.xml new file mode 100644 index 00000000000..4a2a2a5dff1 --- /dev/null +++ b/addons/purchase/purchase_unit_test.xml @@ -0,0 +1,140 @@ + + + + + + + Test purchase + + + + + + + + + + + [PC1] Basic PC + + + + 450 + 2 + + + + [MB1] Mainboard ASUStek A7N8X + + + + 88 + 3 + + + + + + + + + + confirmed + + + + + + approved + + + + + + + + + + + draft + + + + + + + + + + + + + + + + + + + paid + + + + + + + + + + + + + + + + + + + + + + done + + + + done + + + \ No newline at end of file diff --git a/addons/sale/__terp__.py b/addons/sale/__terp__.py index 618e692ad99..4f710ba2090 100644 --- a/addons/sale/__terp__.py +++ b/addons/sale/__terp__.py @@ -6,7 +6,7 @@ "depends" : ["product", "stock", "mrp"], "category" : "Generic Modules/Sales & Purchases", "init_xml" : [], - "demo_xml" : ["sale_demo.xml"], + "demo_xml" : ["sale_demo.xml", "sale_unit_test.xml"], "description": """ The base module to manage quotations and sales orders. diff --git a/addons/sale/sale_unit_test.xml b/addons/sale/sale_unit_test.xml new file mode 100644 index 00000000000..70272b691d8 --- /dev/null +++ b/addons/sale/sale_unit_test.xml @@ -0,0 +1,122 @@ + + + + + + Test order 1 + + + + + + + + + + + + [PC1] Basic PC + + + 450 + 2 + 2 + make_to_stock + + + + [RAM512] DDR 512MB PC400 + + + 90 + 3 + 3 + make_to_stock + + + + + + + + + + manual + + + + + + progress + + + + + + + + + + + draft + + + + + + + + + + + + + + + + + + + paid + + + + + + + + + + confirmed + + + + + + + + + assigned + + + + + + + + + + + + + done + + + + + + + done + + +