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
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
id="menu_action_account_journal_tree"
|
||||
action="action_account_journal_tree"/>
|
||||
|
||||
<wizard string="Accounts Charts" menu="False" model="account.account" name="account.simulation.chart" id="account.wizard_account_chart"/>
|
||||
|
||||
</data>
|
||||
</terp>
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
<report
|
||||
|
||||
@@ -94,5 +94,5 @@ class account_analytic_cost_ledger(report_sxw.rml_parse):
|
||||
result[line.general_account_id.id][word] += (result[line.general_account_id.id]['lines'][-1][word] or 0.0)
|
||||
return result
|
||||
|
||||
report_sxw.report_sxw('report.account.analytic.account.cost_ledger', 'account.analytic.account', 'addons/hr_timesheet_invoice/report/cost_ledger.rml',parser=account_analytic_cost_ledger)
|
||||
report_sxw.report_sxw('report.hr.timesheet.invoice.account.analytic.account.cost_ledger', 'account.analytic.account', 'addons/hr_timesheet_invoice/report/cost_ledger.rml',parser=account_analytic_cost_ledger)
|
||||
|
||||
|
||||
@@ -30,3 +30,4 @@
|
||||
import hr_timesheet_invoice_create
|
||||
import account_analytic_profit
|
||||
import hr_timesheet_final_invoice_create
|
||||
import wizard_account_analytic_cost_ledger_report
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# 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 time
|
||||
import wizard
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Select period">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
</form>'''
|
||||
|
||||
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')
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<terp>
|
||||
<data>
|
||||
<report id="purchase.report_purchase_order"
|
||||
name="purchase.order"
|
||||
name="purchase.discount.order"
|
||||
string="Print Orders"
|
||||
model="purchase.order"
|
||||
rml="purchase_discount/report/order.rml"
|
||||
|
||||
@@ -85,4 +85,4 @@ class order(report_sxw.rml_parse):
|
||||
product_obj=pooler.get_pool(self.cr.dbname).get('product.product')
|
||||
return product_obj._product_code(self.cr, self.uid, [product_id], name=None, arg=None, context={'partner_id': partner_id})[product_id]
|
||||
|
||||
report_sxw.report_sxw('report.purchase.order','purchase.order','addons/purchase_discount/report/order.rml',parser=order)
|
||||
report_sxw.report_sxw('report.purchase.discount.order','purchase.order','addons/purchase_discount/report/order.rml',parser=order)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" ?>
|
||||
<terp>
|
||||
<data>
|
||||
<!-- <wizard string="Make an order" model="crm.case" name="crm.case.make_order" keyword="client_action_multi" /> -->
|
||||
<wizard string="Make invoices" model="sale.order" name="sale.order.make_invoice" keyword="client_action_multi" />
|
||||
|
||||
<wizard
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from makesale import make_sale
|
||||
from make_invoice import make_invoice
|
||||
|
||||
import wizard_sale_line_invoice
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id: makesale.py 1183 2005-08-23 07:43:32Z pinky $
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx.DateTime import now
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
sale_form = """<?xml version="1.0"?>
|
||||
<form string="Make an order">
|
||||
<separator string="Create a sale order from this opportunity"/>
|
||||
<field name="name" required="True" />
|
||||
<label string="(empty for default value)" colspan="2"/>
|
||||
<field name="shop_id" required="True" />
|
||||
<field name="partner_id" required="True" />
|
||||
<field name="state" required="True" />
|
||||
<field name="picking_policy" required="True" />
|
||||
</form>"""
|
||||
|
||||
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 = """<?xml version="1.0"?>
|
||||
<form string="Make an order">
|
||||
<separator string="The sale order is now created" />
|
||||
</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')
|
||||
Reference in New Issue
Block a user