[IMP]: usability and code improvement

bzr revid: atp@tinyerp.co.in-20100802123102-1x3s6ndjxiib0zmf
This commit is contained in:
atp (Open ERP) 2010-08-02 18:01:02 +05:30
parent 0d2501b77e
commit deaeed15cc
2 changed files with 11 additions and 18 deletions

View File

@ -38,20 +38,22 @@ class auction_taken(osv.osv_memory):
}
def _to_xml(s):
return s.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;')
return s.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
def process(self, cr, uid, ids, context):
def process(self, cr, uid, ids, context=None):
"""
Update Auction lots state to taken_away.
This Function update Auction lots state to taken_away.
@param cr: the current row, from the database cursor.
@param uid: the current users ID for security checks.
@param ids: List of Auction takens IDs
@return: dictionary of lot_ids fields with empty list
"""
if not context:
context={}
lot_obj = self.pool.get('auction.lots')
for data in self.read(cr, uid, ids):
if data['lot_ids']:
lot_obj.write(cr, uid, data['lot_ids'], {'state':'taken_away'})
for current in self.browse(cr, uid, ids, context):
for lot in current.lot_ids:
lot_obj.write(cr, uid, lot.id, {'state':'taken_away'})
return {'lot_ids': []}
auction_taken()

View File

@ -8,11 +8,11 @@
<field name="arch" type="xml">
<form string="Mark Lots">
<group colspan="4" >
<label string="Select lots which are Sold" colspan="4"/>
<separator string="Select lots which are Sold" colspan="4"/>
<field name="lot_ids" nolabel="1" colspan="4" domain="[('state','=','sold')]"/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<group colspan="4">
<button icon="gtk-ok" string="OK" name="process" type="object" />
</group>
</form>
@ -27,16 +27,7 @@
<field name="view_id" ref="view_auction_taken"/>
<field name="target">new</field>
</record>
<!-- <menuitem name="Tools Bar Codes"
id="auction_outils_menu"
parent="auction_menu_root" sequence="5"
/>
<menuitem name="Deliveries Management"
action="action_auction_taken"
id="menu_wizard_emporte"
parent="auction_outils_menu"
/> -->
</data>
</openerp>