From 392559d25f15ea568d8716f4e42618cb814fbfca Mon Sep 17 00:00:00 2001
From: ced <>
Date: Thu, 7 Jun 2007 12:00:30 +0000
Subject: [PATCH] KERNEL: add test for duplicate report and wizard
Remove/Fix all the duplicate report and wizard
Don't instanciate auto report when update as there are already
Instanciate auto report only if it don't exist in netsvc
bzr revid: ced-56a64c2e91044d9c71d325adc716d53a6d477d33
---
.../account_simulation_view.xml | 1 +
.../wizard/wizard_account_chart.py | 2 +-
.../hr_timesheet_invoice_report.xml | 4 +-
.../report/cost_ledger.py | 2 +-
.../hr_timesheet_invoice/wizard/__init__.py | 1 +
...ard_account_analytic_cost_ledger_report.py | 55 +++++++++
.../purchase_discount_report.xml | 2 +-
addons/purchase_discount/report/order.py | 2 +-
addons/sale/sale_wizard.xml | 1 -
addons/sale/wizard/__init__.py | 1 -
addons/sale/wizard/makesale.py | 104 ------------------
11 files changed, 63 insertions(+), 112 deletions(-)
create mode 100644 addons/hr_timesheet_invoice/wizard/wizard_account_analytic_cost_ledger_report.py
delete mode 100644 addons/sale/wizard/makesale.py
diff --git a/addons/account_simulation/account_simulation_view.xml b/addons/account_simulation/account_simulation_view.xml
index 8530bdcb30e..c112f89d831 100644
--- a/addons/account_simulation/account_simulation_view.xml
+++ b/addons/account_simulation/account_simulation_view.xml
@@ -71,6 +71,7 @@
id="menu_action_account_journal_tree"
action="action_account_journal_tree"/>
+
diff --git a/addons/account_simulation/wizard/wizard_account_chart.py b/addons/account_simulation/wizard/wizard_account_chart.py
index 36885f12231..dc0c50fce8f 100644
--- a/addons/account_simulation/wizard/wizard_account_chart.py
+++ b/addons/account_simulation/wizard/wizard_account_chart.py
@@ -78,4 +78,4 @@ class wizard_account_chart(wizard.interface):
'result': {'type': 'action', 'action':_account_chart_open_window, 'state':'end'}
}
}
-wizard_account_chart('account.chart')
+wizard_account_chart('account.simulation.chart')
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
index 65b8ef9b969..c86f38c04f2 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml
@@ -6,7 +6,7 @@
id="account_analytic_account_cost_ledger"
string="Cost Ledger"
model="account.analytic.account"
- name="account.analytic.account.cost_ledger"
+ name="hr.timesheet.invoice.account.analytic.account.cost_ledger"
rml="account/project/report/cost_ledger.rml"
auto="False"
menu="False"/>
@@ -15,7 +15,7 @@
id="account_analytic_account_cost_ledger_report"
string="Cost Ledger"
model="account.analytic.account"
- name="account.analytic.account.cost_ledger.report"
+ name="hr.timesheet.invoice.account.analytic.account.cost_ledger.report"
keyword="client_print_multi"/>
+'''
+
+dates_fields = {
+ 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
+ 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
+}
+
+class wizard_report(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
+ },
+ 'report': {
+ 'actions': [],
+ 'result': {'type':'print', 'report':'hr.timesheet.invoice.account.analytic.account.cost_ledger', 'state':'end'}
+ }
+ }
+wizard_report('hr.timesheet.invoice.account.analytic.account.cost_ledger.report')
+
+
diff --git a/addons/purchase_discount/purchase_discount_report.xml b/addons/purchase_discount/purchase_discount_report.xml
index 91bccdd6177..16d44d03e03 100644
--- a/addons/purchase_discount/purchase_discount_report.xml
+++ b/addons/purchase_discount/purchase_discount_report.xml
@@ -2,7 +2,7 @@
-
-"""
-
-sale_fields = {
- 'name' : {'string' : 'Order name', 'type': 'char'},
- 'shop_id' : {'string' : 'Shop', 'type' : 'many2one', 'relation' : 'sale.shop'},
- 'state' : {'string' : "Order's state", 'type' : 'selection', 'selection' : [('draft', 'Draft Order'), ('confirm', 'Confirm Order')]},
- 'partner_id' : {'string' : 'Partner', 'type' : 'many2one', 'relation' : 'res.partner', 'readonly':True},
- 'picking_policy': {'string': 'Picking policy', 'type': 'selection', 'selection' : [('direct','Direct Delivery'),('one','All at once')]},
-}
-
-ack_form = """
-"""
-
-ack_fields = {}
-
-class make_sale(wizard.interface):
- def _selectPartner(self, cr, uid, data, context):
- service = netsvc.LocalService("object_proxy")
- case = service.execute(cr.dbname, uid, data['model'], 'read', data['ids'], ['partner_id'])
- return {'partner_id': case[0]['partner_id']}
-
- def _makeOrder(self, cr, uid, data, context):
- case = pooler.get_pool(cr.dbname).get('crm.case')
- sale = pooler.get_pool(cr.dbname).get('sale.order')
- partner_addr = pooler.get_pool(cr.dbname).get('res.partner').address_get(cr, uid, [data['form']['partner_id']], ['invoice', 'delivery'])
- pricelist = ir.ir_get(cr, uid,
- [('meta','res.partner'), ('name','product.pricelist')],
- [('id',str(data['form']['partner_id'])), ('uid',str(uid))])[0][2]
- ddata = {
- 'origin': 'BO: %s' % str(data['ids'][0]),
- 'picking_policy': data['form']['picking_policy'],
- 'shop_id': data['form']['shop_id'],
- 'state': data['form']['state'],
- 'partner_id': data['form']['partner_id'],
- 'pricelist_id': pricelist,
- 'partner_invoice_id': partner_addr['invoice'],
- 'partner_shipping_id': partner_addr['delivery'],
- 'order_policy': 'manual',
- 'date_order': now(),
- }
- if data['form']['name']:
- ddata['name'] = data['form']['name']
- nid = sale.create(cr, uid, ddata)
- case.write(cr, uid, data['ids'], {'ref': 'sale.order,%s' % nid})
- return {}
-
- states = {
- 'init' : {
- 'actions' : [_selectPartner],
- 'result' : {'type' : 'form', 'arch' : sale_form, 'fields' : sale_fields, 'state' : [('end', 'Cancel'),('order', 'Make an order')]}
- },
- 'order' : {
- 'actions' : [_makeOrder],
- 'result' : {'type' : 'form', 'arch' : ack_form, 'fields' : ack_fields, 'state' : [('end', 'Ok')]}
- }
- }
-make_sale('crm.case.make_order')