[ADD] auction: Added an osv_memory wizard 'Auction Catalog Flagey' on auction.dates object.

bzr revid: uco@tinyerp.co.in-20100319090858-i9rf8s1l1kavqyrb
This commit is contained in:
uco (OpenERP) 2010-03-19 14:38:58 +05:30
parent bc687bcc0a
commit d8975f4afc
5 changed files with 87 additions and 49 deletions

View File

@ -43,6 +43,7 @@
'wizard/auction_pay_buy_view.xml',
'wizard/auction_payer_sel_view.xml',
'wizard/auction_lots_sms_send_view.xml',
'wizard/auction_catalog_flagey_view.xml',
'auction_view.xml',
'auction_report.xml',

View File

@ -28,6 +28,7 @@ import auction_lots_auction_move
import auction_pay_buy
import auction_payer_sel
import auction_lots_sms_send
import auction_catalog_flagey_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,49 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import netsvc
import pooler
def _wo_check(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
current_auction=pool.get('auction.dates').browse(cr,uid,data['id'])
v_lots=pool.get('auction.lots').search(cr,uid,[('auction_id','=',current_auction.id)])
v_ids=pool.get('auction.lots').browse(cr,uid,v_lots)
for ab in v_ids:
if not ab.auction_id :
raise wizard.except_wizard('Error!','No Lots belong to this Auction Date')
return 'report'
class wizard_report(wizard.interface):
states = {
'init': {
'actions': [],
'result' : {'type': 'choice', 'next_state': _wo_check }
},
'report': {
'actions': [],
'result': {'type':'print', 'report':'auction.cat_flagy', 'state':'end'}
}
}
wizard_report('auction.catalog.flagey')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import osv, fields
import netsvc
class auction_catalog_flagey(osv.osv_memory):
_name = 'auction.catalog.flagey'
_description = 'Auction Catalog Flagey'
def default_get(self, cr, uid, fields, context):
res = super(auction_catalog_flagey, self).default_get(cr, uid, fields, context=context)
return res
def view_init(self, cr, uid, fields_list, context):
current_auction = self.pool.get('auction.dates').browse(cr,uid,context.get('active_ids', []))
v_lots = self.pool.get('auction.lots').search(cr,uid,[('auction_id','=',current_auction.id)])
v_ids = self.pool.get('auction.lots').browse(cr,uid,v_lots)
for ab in v_ids:
if not ab.auction_id :
raise osv.except_osv('Error!','No Lots belong to this Auction Date')
pass
def print_report(self, cr, uid, ids, context):
datas = {'ids': context.get('active_ids',[])}
return {
'type': 'ir.actions.report.xml',
'report_name': 'auction.cat_flagy',
'datas': datas,
}
auction_catalog_flagey()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Auction Catalog Flagey Report -->
<record id="view_auction_catalog_flagey_wizard" model="ir.ui.view">
<field name="name">Auction Catalog Flagey</field>
<field name="model">auction.catalog.flagey</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Catalog Flagey Report">
<label string="Print Auction Catalog Flagey Report..."/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="print_report" string="Ok"
colspan="1" type="object" icon="gtk-ok" />
</group>
</form>
</field>
</record>
<act_window name="Auction Catalog Flagey"
res_model="auction.catalog.flagey"
src_model="auction.dates"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_auction_catalog_flagey_wizard"/>
</data>
</openerp>