[auction] merged clean work
authorHarry (OpenERP) <hmo@tinyerp.com>
Wed, 4 Aug 2010 13:56:17 +0000 (19:26 +0530)
committerHarry (OpenERP) <hmo@tinyerp.com>
Wed, 4 Aug 2010 13:56:17 +0000 (19:26 +0530)
bzr revid: hmo@tinyerp.com-20100804135617-11z6ng0lus5cy0fe

20 files changed:
1  2 
addons/auction/__openerp__.py
addons/auction/auction.py
addons/auction/auction_data.xml
addons/auction/auction_demo.xml
addons/auction/auction_view.xml
addons/auction/report/ach_bordereau.xml
addons/auction/report/ach_bordereau.xsl
addons/auction/report/ach_bordereau_photo.xsl
addons/auction/report/catalog2.py
addons/auction/report/corporate_defaults.xsl
addons/auction/report/deposit.xsl
addons/auction/report/rml_template.xsl
addons/auction/wizard/auction_lots_buyer_map.py
addons/auction/wizard/auction_lots_buyer_map_view.xml
addons/auction/wizard/auction_lots_cancel_view.xml
addons/auction/wizard/auction_lots_sms_send.py
addons/auction/wizard/auction_lots_sms_send_view.xml
addons/auction/wizard/auction_pay_buy_view.xml
addons/base_setup/base_setup_installer.xml
addons/base_setup/installer.py

          'wizard/auction_taken_view.xml',
          'wizard/auction_lots_auction_move_view.xml',
          'wizard/auction_pay_buy_view.xml',
-         'wizard/auction_payer_sel_view.xml',
+         #'wizard/auction_payer_sel_view.xml',
          'wizard/auction_lots_sms_send_view.xml',
          'wizard/auction_catalog_flagey_view.xml',
- #        'wizard/auction_aie_send_view.xml',
- #        'wizard/auction_aie_send_result_view.xml',
 -        #'wizard/auction_lots_buyer_map_view.xml',
 +        'wizard/auction_lots_buyer_map_view.xml',
- #        'wizard/auction_lots_numerotate_view.xml',
          'auction_view.xml',
          'auction_report.xml',
+         'report/report_auction_view.xml',
          'auction_wizard.xml',
          'board_auction_view.xml',
          'board_auction_manager_view.xml',
@@@ -94,69 -103,59 +103,46 @@@ class auction_dates(osv.osv)
  
          RETURN: True
          """
--        # objects vendus mais non factures
--        #TODO: convert this query to tiny API
+         if not context:
+             context={}
          lots_obj = self.pool.get('auction.lots')
-         cr.execute('select count(*) as c from auction_lots where auction_id IN %s and state=%s and obj_price>0', (tuple(ids),'draft',))
-         cr.execute('SELECT COUNT(*) AS c '
-                    'FROM auction_lots '
-                    'WHERE auction_id IN %s '
-                    'AND state=%s AND obj_price>0', (tuple(ids), 'draft'))
-         nbr = cr.fetchone()[0]
-         ach_uids = {}
-         cr.execute('SELECT id FROM auction_lots '
-                    'WHERE auction_id IN %s '
-                    'AND state=%s AND obj_price>0', (tuple(ids), 'draft'))
-         r = lots_obj.lots_invoice(cr, uid, [x[0] for x in cr.fetchall()],{},None)
-         cr.execute('select id from auction_lots where auction_id IN %s and obj_price>0',(tuple(ids),))
-         ids2 = [x[0] for x in cr.fetchall()]
-     #   for auction in auction_ids:
-         c = lots_obj.seller_trans_create(cr, uid, ids2, {})
-         self.write(cr, uid, ids, {'state':'closed'}) #close the auction
+         lots_ids = lots_obj.search(cr, uid, [('auction_id', 'in', ids), ('state', '=', 'draft'), ('obj_price', '>', 0)])
+         new_buyer_invoice = lots_obj.lots_invoice(cr, uid, lots_ids, {}, None)
+         lots_ids2 = lots_obj.search(cr, uid, [('auction_id', 'in', ids), ('obj_price', '>', 0)])
+         new_seller_invoice = lots_obj.seller_trans_create(cr, uid, lots_ids2, {})
+         self.write(cr, uid, ids, {'state': 'closed'}) #close the auction
          return True
+     
  auction_dates()
  
  #----------------------------------------------------------
  # Deposits
  #----------------------------------------------------------
- def _inv_uniq(cr, ids):
-     cr.execute('SELECT id FROM auction_lots '
-                    'WHERE auction_id IN %s '
-                    'AND obj_price>0', (tuple(ids),))
-     for datas in cr.fetchall():
-         cr.execute('select count(*) from auction_deposit where name=%s', (datas[0],))
-         if cr.fetchone()[0]>1:
-             return False
-     return True
 -#def _inv_uniq(cr, ids):
 -#    cr.execute('SELECT id FROM auction_lots '
 -#                   'WHERE auction_id IN %s '
 -#                   'AND obj_price>0', (tuple(ids),))
 -#    for datas in cr.fetchall():
 -#        cr.execute('select count(*) from auction_deposit where name=%s', (datas[0],))
 -#        if cr.fetchone()[0]>1:
 -#            return False
 -#    return True
 -
  class auction_deposit(osv.osv):
+     """Auction Deposit Border"""
+     
      _name = "auction.deposit"
-     _description="Deposit Border"
+     _description=__doc__
      _order = "id desc"
      _columns = {
-         'transfer' : fields.boolean('Transfer'),
-         'name': fields.char('Depositer Inventory', size=64, required=True),
-         'partner_id': fields.many2one('res.partner', 'Seller', required=True, change_default=True),
-         'date_dep': fields.date('Deposit date', required=True),
-         'method': fields.selection((('keep','Keep until sold'),('decease','Decrease limit of 10%'),('contact','Contact the Seller')), 'Withdrawned method', required=True),
-         'tax_id': fields.many2one('account.tax', 'Expenses'),
-         'create_uid': fields.many2one('res.users', 'Created by', readonly=True),
-         'info': fields.char('Description', size=64),
-         'lot_id': fields.one2many('auction.lots', 'bord_vnd_id', 'Objects'),
-         'specific_cost_ids': fields.one2many('auction.deposit.cost', 'deposit_id', 'Specific Costs'),
-         'total_neg': fields.boolean('Allow Negative Amount'),
+         'transfer' : fields.boolean('Transfer'), 
+         'name': fields.char('Depositer Inventory', size=64, required=True), 
+         'partner_id': fields.many2one('res.partner', 'Seller', required=True, change_default=True), 
+         'date_dep': fields.date('Deposit date', required=True), 
+         'method': fields.selection((('keep', 'Keep until sold'), ('decease', 'Decrease limit of 10%'), ('contact', 'Contact the Seller')), 'Withdrawned method', required=True), 
+         'tax_id': fields.many2one('account.tax', 'Expenses'), 
+         'create_uid': fields.many2one('res.users', 'Created by', readonly=True), 
+         'info': fields.char('Description', size=64), 
+         'lot_id': fields.one2many('auction.lots', 'bord_vnd_id', 'Objects'), 
+         'specific_cost_ids': fields.one2many('auction.deposit.cost', 'deposit_id', 'Specific Costs'), 
+         'total_neg': fields.boolean('Allow Negative Amount'), 
      }
      _defaults = {
--#       'date_dep': lambda *a: time.strftime('%Y-%m-%d'),
-         'method': lambda *a: 'keep',
-         'total_neg': lambda *a: False,
-         'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'auction.deposit'),
+         'method': lambda *a: 'keep', 
+         'total_neg': lambda *a: False, 
+         'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'auction.deposit'), 
      }
-     _constraints = [
-     ]
-     def partner_id_change(self, cr, uid, ids, part):
-         return {}
  auction_deposit()
  
  #----------------------------------------------------------
@@@ -175,323 -178,308 +165,254 @@@ auction_deposit_cost(
  #----------------------------------------------------------
  # Lots Categories
  #----------------------------------------------------------
 -
 -def _type_get(self, cr, uid, context=None):
 -    if not context:
 -        context = {}
 -    obj = self.pool.get('auction.lot.category')
 -    ids = obj.search(cr, uid, [])
 -    res = obj.read(cr, uid, ids, ['name'], context)
 -    res = [(r['name'], r['name']) for r in res]   
 -    return res 
 -
 -
+ class aie_category(osv.osv):
+     
+     _name="aie.category"
+     _order = "name"
+     _columns={
+        'name': fields.char('Name', size=64, required=True), 
+        'code':fields.char('Code', size=64), 
+        'parent_id': fields.many2one('aie.category', 'Parent aie Category', ondelete='cascade'), 
+        'child_ids': fields.one2many('aie.category', 'parent_id', help="Childs aie category")       
+     }
+     
+     def name_get(self, cr, uid, ids, context=None):
+         if not context:
+             context = {}
 -
+         res = []
+         if not ids:
+             return res
+         reads = self.read(cr, uid, ids, ['name', 'parent_id'], context)
+         for record in reads:
+             name = record['name']
+             if record['parent_id']:
+                 name = record['parent_id'][1] + ' / ' + name
+             res.append((record['id'], name))
+         return res
+     
+ aie_category()   
+     
  class auction_lot_category(osv.osv):
+     """Auction Lots Category"""
+     
      _name = 'auction.lot.category'
+     _description=__doc__
      _columns = {
-         'name': fields.char('Category Name', required=True, size=64),
-         'priority': fields.float('Priority'),
-         'active' : fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the auction lot category without removing it."),
-         'aie_categ' : fields.selection([('41',"Unclassifieds"),
-             ('2',"Antiques"),
-             ('42',"Antique/African Arts"),
-             ('59',"Antique/Argenterie"),
-             ('45',"Antique/Art from the Ivory Coast"),
-             ('46',"Antique/Art from the Ivory Coast/African Arts"),
-             ('12',"Antique/Books, manuscripts, eso."),
-             ('11',"Antique/Carpet and textilles"),
-             ('14',"Antique/Cartoons"),
-             ('26',"Antique/Clocks and watches"),
-             ('31',"Antique/Collectible & art objects"),
-             ('33',"Antique/Engravings"),
-             ('10',"Antique/Furnitures"),
-             ('50',"Antique/Graphic Arts"),
-             ('37',"Antique/Jewelry"),
-             ('9',"Antique/Lightings"),
-             ('52',"Antique/Metal Ware"),
-             ('51',"Antique/Miniatures / Collections"),
-             ('53',"Antique/Musical Instruments"),
-             ('19',"Antique/Old weapons and militaria"),
-             ('43',"Antique/Oriental Arts"),
-             ('47',"Antique/Oriental Arts/Chineese furnitures"),
-             ('24',"Antique/Others"),
-             ('8',"Antique/Painting"),
-             ('25',"Antique/Porcelain, Ceramics, Glassmaking, ..."),
-             ('13',"Antique/Posters"),
-             ('56',"Antique/Religiosa"),
-             ('54',"Antique/Scientific Instruments"),
-             ('18',"Antique/Sculpture, bronze, eso."),
-             ('55',"Antique/Tin / Copper wares"),
-             ('16',"Antique/Toys"),
-             ('57',"Antique/Verreries"),
-             ('17',"Antique/Wine"),
-             ('1',"Contemporary Art"),
-             ('58',"Cont. Art/Arts"),
-             ('27',"Cont. Art/Curiosa"),
-             ('15',"Cont. Art/Jewelry"),
-             ('30',"Cont. Art/Other Media"),
-             ('3',"Cont. Art/Photo"),
-             ('4',"Cont. Art/Painting"),
-             ('5',"Cont. Art/Sculpture"),
-             ('48',"Cont. Art/Shows")],
-             'Aie Category'),
+         'name': fields.char('Category Name', required=True, size=64), 
+         'priority': fields.float('Priority'), 
+         'active' : fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the auction lot category without removing it."), 
+         'aie_categ': fields.many2one('aie.category', 'Category', ondelete='cascade'), 
      }
      _defaults = {
-         'active' : lambda *a: 1,
-         'aie_categ' : lambda *a:1,
+         'active' : lambda *a: 1, 
      }
  auction_lot_category()
  
  #----------------------------------------------------------
  # Lots
  #----------------------------------------------------------
- def _inv_constraint(cr, ids):
-     cr.execute('SELECT id, bord_vnd_id, lot_num FROM auction_lots '
-                'WHERE id IN %s',
-                (tuple(ids),))
-     for datas in cr.fetchall():
-         cr.execute('select count(*) from auction_lots where bord_vnd_id=%s and lot_num=%s', (datas[1],datas[2]))
-         if cr.fetchone()[0]>1:
-             return False
-     return True
 -def _inv_constraint(self, cr, uid, ids):
 -    cr.execute('SELECT id, bord_vnd_id, lot_num FROM auction_lots '
 -               'WHERE id IN %s', 
 -               (tuple(ids),))
 -    for datas in cr.fetchall():
 -        cr.execute('select count(*) from auction_lots where bord_vnd_id=%s and lot_num=%s', (datas[1], datas[2]))
 -        if cr.fetchone()[0]>1:
 -            return False
 -    return True
++def _type_get(self, cr, uid, context=None):
++    if not context:
++        context = {}
++    obj = self.pool.get('auction.lot.category')
++    ids = obj.search(cr, uid, [])
++    res = obj.read(cr, uid, ids, ['name'], context)
++    res = [(r['name'], r['name']) for r in res]   
++    return res 
  
  class auction_lots(osv.osv):
+     
+     """Auction Object"""
      _name = "auction.lots"
      _order = "obj_num,lot_num,id"
-     _description="Object"
-     def button_not_bought(self,cr,uid,ids,*a):
-         return self.write(cr,uid,ids, {'state':'unsold'})
-     def button_taken_away(self,cr,uid,ids,*a):
-         return self.write(cr,uid,ids, {'state':'taken_away'})
-     def button_unpaid(self,cr,uid,ids,*a):
-         return self.write(cr,uid,ids, {'state':'draft'})
-     def button_draft(self,cr,uid,ids,*a):
-         return self.write(cr,uid,ids, {'state':'draft'})
-     def button_bought(self,cr,uid,ids,*a):
-         return self.write(cr,uid,ids, {'state':'sold'})
-     def _buyerprice(self, cr, uid, ids, name, args, context):
-         res={}
-         lots=self.pool.get('auction.lots').browse(cr,uid,ids)
-         pt_tax=self.pool.get('account.tax')
-         for lot in lots:
-             amount_total=0.0
-     #       if ((lot.obj_price==0) and (lot.state=='draft')):
-     #           montant=lot.lot_est1
-     #       else:
-             montant=lot.obj_price or 0.0
-             taxes = []
-             if lot.author_right:
-                 taxes.append(lot.author_right)
-             if lot.auction_id:
-                 taxes += lot.auction_id.buyer_costs
-             tax=pt_tax.compute(cr,uid,taxes,montant,1)
-             for t in tax:
-                 amount_total+=t['amount']
-             amount_total += montant
-             res[lot.id] = amount_total
-         return res
-     def _sellerprice(self, cr, uid, ids,*a):
-         res={}
-         lots=self.pool.get('auction.lots').browse(cr,uid,ids)
-         pt_tax=self.pool.get('account.tax')
+     _description=__doc__
+     def button_not_bought(self, cr, uid, ids, context=None):
+         if not context:
+             context={}
+         return self.write(cr, uid, ids, {'state':'unsold'})
+     
+     def button_taken_away(self, cr, uid, ids, context=None):
+         if not context:
+             context={}
+         return self.write(cr, uid, ids, {'state':'taken_away', 'ach_emp': True})
+     def button_unpaid(self, cr, uid, ids, context=None):
+         if not context:
+             context={}
+         return self.write(cr, uid, ids, {'state':'draft'})
+     def button_bought(self, cr, uid, ids, context=None):
+         if not context:
+             context={}
+         return self.write(cr, uid, ids, {'state':'sold'})
 -    def _getprice(self, cr, uid, ids, name, args, context=None):
++    def _getprice(self, cr, uid, ids, fields, args, context=None):
+         """This Function compute amount total with tax for buyer and seller.
+         @param ids: List of  auction lots's id
+         @param name: List of function fields.
+         @param context: A standard dictionary for contextual values
+         @return: Dictionary of function fields value.
+         """
+         if not context:
 -            context={}
 -        name=name[0]    
 -        res={}
++            context = {}
++        
++        res = {}
++        account_analytic_line_obj = self.pool.get('account.analytic.line')
+         lots = self.browse(cr, uid, ids, context)
 -        pt_tax=self.pool.get('account.tax')
++        pt_tax = self.pool.get('account.tax')
          for lot in lots:
--            amount_total=0.0
-         #   if ((lot.obj_price==0) and (lot.state=='draft')):
-         #       montant=lot.lot_est1
-         #   else:
-             montant=lot.obj_price
-             taxes = []
-             if lot.bord_vnd_id.tax_id:
-                 taxes.append(lot.bord_vnd_id.tax_id)
-             elif lot.auction_id and lot.auction_id.seller_costs:
-                 taxes += lot.auction_id.seller_costs
-             tax=pt_tax.compute(cr,uid,taxes,montant,1)
-             for t in tax:
-                 amount_total+=t['amount']
-             res[lot.id] =  montant+amount_total
-         return res
-     def _grossprice(self, cr, uid, ids, name, args, context):
-         """gross revenue"""
-         res={}
-         auction_lots_obj = self.read(cr,uid,ids,['seller_price','buyer_price','auction_id'])
-         for auction_data in auction_lots_obj:
              total_tax = 0.0
-             if auction_data['auction_id']:
-                 total_tax += auction_data['buyer_price']-auction_data['seller_price']
-             res[auction_data['id']] = total_tax
-         return res
-     def _grossmargin(self, cr, uid, ids, name, args, context):
-         """
-         gross Margin : Gross revenue * 100 / Adjudication
-         (state==unsold or obj_ret_price>0): adj_price = 0 (=> gross margin = 0, net margin is negative)
-         """
-         res={}
-         for lot in self.browse(cr, uid, ids, context):
-             if ((lot.obj_price==0) and (lot.state=='draft')):
-                 montant=lot.lot_est1
-             else:
-                 montant=lot.obj_price
-             if lot.obj_price>0:
-                 total=(lot.gross_revenue*100.0) /lot.obj_price
-             else:
-                 total = 0.0
-             res[lot.id]=round(total,2)
 -    #       if ((lot.obj_price==0) and (lot.state=='draft')):
 -    #           montant=lot.lot_est1
 -    #       else:
+             taxes = []
 -            res[lot.id]={
 -                 'buyer_price': False,
 -                 'seller_price': False,
 -                 'gross_margin': False,
 -                 'gross_revenue': False,
 -                 'net_margin': False,
 -                 'net_revenue': False,
 -                 'paid_ach': False,
 -                 'paid_vnd': False
 -                 }
 -                
 -            if name=="buyer_price":
 -                amount=lot.obj_price or 0.0
 -                if lot.author_right:
 -                    taxes.append(lot.author_right)
 -                if lot.auction_id:
 -                    taxes += lot.auction_id.buyer_costs
 -                tax=pt_tax.compute_all(cr, uid, taxes, amount, 1)['taxes']
 -                for t in tax:
 -                    amount_total+=t['amount']
 -                amount_total += amount
 -                res[lot.id]['buyer_price'] = amount_total
 -                
 -            if name=="seller_price":
 -                amount=lot.obj_price or 0.0
 -                if lot.bord_vnd_id.tax_id:
 -                    taxes.append(lot.bord_vnd_id.tax_id)
 -                elif lot.auction_id and lot.auction_id.seller_costs:
 -                    taxes += lot.auction_id.seller_costs
 -                tax=pt_tax.compute_all(cr, uid, taxes, amount, 1)['taxes']
 -                for t in tax:
 -                    amount_total+=t['amount']
 -                res[lot.id]['seller_price'] =  amount+amount_total
 -                
 -            if name=="gross_margin":
 -                if ((lot.obj_price==0) and (lot.state=='draft')):
 -                    amount=lot.lot_est1 or 0.0
 -                else:
 -                    amount=lot.obj_price or 0.0
 -                if amount>0:
 -                    total=(lot.gross_revenue*100.0) /amount
 -                else:
 -                    total = 0.0
 -                res[lot.id]['gross_margin']=round(total, 2)  
 -                
 -            if name=="gross_revenue":
 -                if lot.auction_id:
 -                    total_tax += lot.buyer_price - lot.seller_price
 -                res[lot.id]['gross_revenue'] = total_tax   
 -                  
 -            if name=="net_revenue":
 -                if lot.auction_id:
 -                    total_tax += lot.buyer_price -lot.seller_price -lot.costs
 -                res[lot.id]['net_revenue'] = total_tax  
 -                                              
 -            if name=="net_margin":
 -                if ((lot.obj_price==0) and (lot.state=='draft')):
 -                    amount=lot.lot_est1
 -                else: 
 -                    amount=lot.obj_price
 -                if amount>0:
 -                    total_tax += (lot.net_revenue*100)/amount
 -                else:
 -                    total_tax=0
 -                res[lot.id]['net_margin'] =  total_tax
 -                   
 -            if name=="paid_ach":
 -                if lot.ach_inv_id:
 -                    if lot.ach_inv_id.state == 'paid':
 -                        res[lot.id]['paid_ach'] = True
++            for name in fields:
++                res[lot.id] = {name: False}
++                amount = lot.obj_price or 0.0
++                result = 0.0
++                if name == "buyer_price":
++                    if lot.author_right:
++                        taxes.append(lot.author_right)
++                    if lot.auction_id:
++                        taxes += lot.auction_id.buyer_costs
++                    tax = pt_tax.compute_all(cr, uid, taxes, amount, 1)['taxes']
++                    for t in tax:
++                        result += t['amount']
++                    result += amount
++                elif name == "seller_price":
++                    if lot.bord_vnd_id.tax_id:
++                        taxes.append(lot.bord_vnd_id.tax_id)
++                    elif lot.auction_id and lot.auction_id.seller_costs:
++                        taxes += lot.auction_id.seller_costs
++                    tax = pt_tax.compute_all(cr, uid, taxes, amount, 1)['taxes']
++                    for t in tax:
++                        result += t['amount']
++                    result += amount
++                elif name == "gross_revenue":
++                    if lot.auction_id:
++                        result = lot.buyer_price - lot.seller_price
++                elif name == "net_revenue":
++                    if lot.auction_id:
++                        result = lot.buyer_price - lot.seller_price - lot.costs
++
++                elif name == "net_margin":
++                    if ((lot.obj_price==0) and (lot.state=='draft')):
++                        amount = lot.lot_est1
++                    else: 
++                        amount = lot.obj_price
++                    if amount > 0:
++                        result = (lot.net_revenue * 100) / amount
++                elif name == "costs":
++                    # costs: Total credit of analytic account
++                    # objects sold during this auction (excluding analytic lines that are in the analytic journal of the auction date)
++                    som = 0.0
++                    if lot.auction_id:
++                        auct_id = lot.auction_id.id
++                        lot_count = self.search(cr, uid, [('auction_id', '=', auct_id)], count=True)
++                        line_ids = account_analytic_line_obj.search(cr, uid, [
++                                    ('account_id', '=', lot.auction_id.account_analytic_id.id), 
++                                    ('journal_id', '<>', lot.auction_id.journal_id.id), 
++                                    ('journal_id', '<>', lot.auction_id.journal_seller_id.id)])
++                        indir_cost = lot.bord_vnd_id.specific_cost_ids
++                        for r in lot.bord_vnd_id.specific_cost_ids:
++                            som += r.amount
++                        for line in account_analytic_line_obj.browse(cr, uid, line_ids, context=context):
++                            if line.amount:
++                                som -= line.amount
++                        result = som/lot_count
++                    
++                elif name=="paid_ach":
++                    result = False
++                    if lot.ach_inv_id and lot.ach_inv_id.state == 'paid':
++                        result = True
+                                         
 -            if name=="paid_vnd":
 -                if lot.sel_inv_id:
 -                    if lot.sel_inv_id.state == 'paid':
 -                        res[lot.id]['paid_vnd']= True       
++                elif name=="paid_vnd":
++                    result = False
++                    if lot.sel_inv_id and lot.sel_inv_id.state == 'paid':
++                        result = True  
++    
++                res[lot.id][name] = result
++                
++            
          return res
  
-     def onchange_obj_ret(self, cr, uid, ids, obj_ret, *args):
+     def onchange_obj_ret(self, cr, uid, ids, obj_ret, context=None):
+         if not context:
+             context={}
          if obj_ret:
              return {'value': {'obj_price': 0}}
          return {}
  
-     def _costs(self,cr,uid,ids,context,*a):
-         """
-         costs: Total credit of analytic account
-         / # objects sold during this auction
-         (excluding analytic lines that are in the analytic journal of the auction date).
-         """
-         res={}
-         for lot in self.browse(cr,uid,ids):
-             som=0.0
-             if not lot.auction_id:
-                 res[lot.id] = 0.0
-                 continue
-             auct_id=lot.auction_id.id
-             cr.execute('select count(*) from auction_lots where auction_id=%s', (auct_id,))
-             nb = cr.fetchone()[0]
-             account_analytic_line_obj = self.pool.get('account.analytic.line')
-             line_ids = account_analytic_line_obj.search(cr, uid, [('account_id', '=', lot.auction_id.account_analytic_id.id),('journal_id', '<>', lot.auction_id.journal_id.id),('journal_id', '<>', lot.auction_id.journal_seller_id.id)])
-             #indir_cost=lot.bord_vnd_id.specific_cost_ids
-             #for r in lot.bord_vnd_id.specific_cost_ids:
-             #   som+=r.amount
-             for line in account_analytic_line_obj.browse(cr,uid,line_ids):
-                 if line.amount:
-                     som-=line.amount
-             res[lot.id]=som/nb
-         return res
-     def _netprice(self, cr, uid, ids, name, args, context):
-         """This is the net revenue"""
-         res={}
-         auction_lots_obj = self.read(cr,uid,ids,['seller_price','buyer_price','auction_id','costs'])
-         for auction_data in auction_lots_obj:
-             total_tax = 0.0
-             if auction_data['auction_id']:
-                 total_tax += auction_data['buyer_price']-auction_data['seller_price']-auction_data['costs']
-             res[auction_data['id']] = total_tax
-         return res
-     def _netmargin(self, cr, uid, ids, name, args, context):
-         res={}
-         total_tax = 0.0
-         total=0.0
-         montant=0.0
-         auction_lots_obj = self.read(cr,uid,ids,['net_revenue','auction_id','lot_est1','obj_price','state'])
-         for auction_data in auction_lots_obj:
-             if ((auction_data ['obj_price']==0) and (auction_data['state']=='draft')):
-                 montant=auction_data['lot_est1']
-             else: montant=auction_data ['obj_price']
-             if montant>0:
-                 total_tax += (auction_data['net_revenue']*100)/montant
-             else:
-                 total_tax=0
-             res[auction_data['id']] =  total_tax
-         return res
-     def _is_paid_vnd(self,cr,uid,ids,*a):
-         res = {}
-         lots=self.browse(cr,uid,ids)
-         for lot in lots:
-             res[lot.id] = False
-             if lot.sel_inv_id:
-                 if lot.sel_inv_id.state == 'paid':
-                     res[lot.id] = True
-         return res
-     def _is_paid_ach(self,cr,uid,ids,*a):
-         res = {}
-         lots=self.browse(cr,uid,ids)
-         for lot in lots:
-             res[lot.id] = False
-             if lot.ach_inv_id:
-                 if lot.ach_inv_id.state == 'paid':
-                     res[lot.id] = True
-         return res
 -    def _costs(self, cr, uid, ids, context, *a):
 -        """
 -        costs: Total credit of analytic account
 -        / # objects sold during this auction
 -        (excluding analytic lines that are in the analytic journal of the auction date).
 -        """
 -        res={}
 -        for lot in self.browse(cr, uid, ids, context={}):
 -            som=0.0
 -            if not lot.auction_id:
 -                res[lot.id] = 0.0
 -                continue
 -            auct_id=lot.auction_id.id
 -            lot_count = self.search(cr, uid, [('auction_id', '=', auct_id)], count=True)
 -          #  cr.execute('select count(*) from auction_lots where auction_id=%s', (auct_id,))
 -          #  nb = cr.fetchone()[0]
 -            account_analytic_line_obj = self.pool.get('account.analytic.line')
 -            line_ids = account_analytic_line_obj.search(cr, uid, [('account_id', '=', lot.auction_id.account_analytic_id.id), ('journal_id', '<>', lot.auction_id.journal_id.id), ('journal_id', '<>', lot.auction_id.journal_seller_id.id)])
 -            #indir_cost=lot.bord_vnd_id.specific_cost_ids
 -            #for r in lot.bord_vnd_id.specific_cost_ids:
 -            #   som+=r.amount
 -            for line in account_analytic_line_obj.browse(cr, uid, line_ids):
 -                if line.amount:
 -                    som-=line.amount
 -            res[lot.id]=som/lot_count
 -        return res
 -
      _columns = {
-         'bid_lines':fields.one2many('auction.bid_line','lot_id', 'Bids'),
-         'auction_id': fields.many2one('auction.dates', 'Auction Date', select=1),
-         'bord_vnd_id': fields.many2one('auction.deposit', 'Depositer Inventory', required=True),
-         'name': fields.char('Short Description',size=64, required=True),
-         'name2': fields.char('Short Description (2)',size=64),
-         'lot_type': fields.selection(_type_get, 'Object category', size=64),
-         'author_right': fields.many2one('account.tax', 'Author rights'),
-         'lot_est1': fields.float('Minimum Estimation'),
-         'lot_est2': fields.float('Maximum Estimation'),
-         'lot_num': fields.integer('List Number', required=True, select=1 ),
-         'create_uid': fields.many2one('res.users', 'Created by', readonly=True),
-         'history_ids':fields.one2many('auction.lot.history', 'lot_id', 'Auction history'),
-         'lot_local':fields.char('Location',size=64),
-         'artist_id':fields.many2one('auction.artists', 'Artist/Author'),
-         'artist2_id':fields.many2one('auction.artists', 'Artist/Author 2'),
-         'important':fields.boolean('To be Emphatized'),
-         'product_id':fields.many2one('product.product', 'Product', required=True),
-         'obj_desc': fields.text('Object Description'),
-         'obj_num': fields.integer('Catalog Number'),
-         'obj_ret': fields.float('Price retired'),
-         'obj_comm': fields.boolean('Commission'),
-         'obj_price': fields.float('Adjudication price'),
-         'ach_avance': fields.float('Buyer Advance'),
-         'ach_login': fields.char('Buyer Username',size=64),
-         'ach_uid': fields.many2one('res.partner', 'Buyer'),
-         'ach_emp': fields.boolean('Taken Away'),
-         'is_ok': fields.boolean('Buyer\'s payment'),
-         'ach_inv_id': fields.many2one('account.invoice','Buyer Invoice', readonly=True, states={'draft':[('readonly',False)]}),
-         'sel_inv_id': fields.many2one('account.invoice','Seller Invoice', readonly=True, states={'draft':[('readonly',False)]}),
-         'vnd_lim': fields.float('Seller limit'),
-         'vnd_lim_net': fields.boolean('Net limit ?',readonly=True),
-         'image': fields.binary('Image'),
- #       'paid_vnd':fields.function(_is_paid_vnd,string='Seller Paid',method=True,type='boolean',store=True),
-         'paid_vnd':fields.boolean('Seller Paid'),
-         'paid_ach':fields.function(_is_paid_ach,string='Buyer invoice reconciled',method=True, type='boolean',store=True),
+         'bid_lines':fields.one2many('auction.bid_line', 'lot_id', 'Bids'), 
+         'auction_id': fields.many2one('auction.dates', 'Auction Date', select=1), 
+         'bord_vnd_id': fields.many2one('auction.deposit', 'Depositer Inventory', required=True), 
+         'name': fields.char('Short Description', size=64, required=True), 
+         'name2': fields.char('Short Description (2)', size=64), 
+         'lot_type': fields.selection(_type_get, 'Object category', size=64), 
+         'author_right': fields.many2one('account.tax', 'Author rights'), 
+         'lot_est1': fields.float('Minimum Estimation'), 
+         'lot_est2': fields.float('Maximum Estimation'), 
+         'lot_num': fields.integer('List Number', required=True, select=1), 
+         'create_uid': fields.many2one('res.users', 'Created by', readonly=True), 
+         'history_ids':fields.one2many('auction.lot.history', 'lot_id', 'Auction history'), 
+         'lot_local':fields.char('Location', size=64), 
+         'artist_id':fields.many2one('auction.artists', 'Artist/Author'), 
+         'artist2_id':fields.many2one('auction.artists', 'Artist/Author 2'), 
+         'important':fields.boolean('To be Emphatized'), 
+         'product_id':fields.many2one('product.product', 'Product', required=True), 
+         'obj_desc': fields.text('Object Description'), 
+         'obj_num': fields.integer('Catalog Number'), 
+         'obj_ret': fields.float('Price retired'), 
+         'obj_comm': fields.boolean('Commission'), 
+         'obj_price': fields.float('Adjudication price'), 
+         'ach_avance': fields.float('Buyer Advance'), 
+         'ach_login': fields.char('Buyer Username', size=64), 
+         'ach_uid': fields.many2one('res.partner', 'Buyer'), 
+         'ach_emp': fields.boolean('Taken Away', readonly=True), 
+         'is_ok': fields.boolean('Buyer\'s payment'), 
+         'ach_inv_id': fields.many2one('account.invoice', 'Buyer Invoice', readonly=True, states={'draft':[('readonly', False)]}), 
+         'sel_inv_id': fields.many2one('account.invoice', 'Seller Invoice', readonly=True, states={'draft':[('readonly', False)]}), 
+         'vnd_lim': fields.float('Seller limit'), 
+         'vnd_lim_net': fields.boolean('Net limit ?', readonly=True), 
+         'image': fields.binary('Image'), 
+         'paid_vnd':fields.function(_getprice, string='Seller Paid', method=True, type='boolean', store=True, multi="paid_vnd"), 
 -        #'paid_vnd':fields.boolean('Seller Paid', readonly=True), 
+         'paid_ach':fields.function(_getprice, string='Buyer invoice reconciled', method=True, type='boolean', store=True, multi="paid_ach"), 
          'state': fields.selection((
-             ('draft','Draft'),
-             ('unsold','Unsold'),
-             ('paid','Paid'),
-             ('sold','Sold'),
-             ('taken_away','Taken away')),'State', required=True, readonly=True,
+             ('draft', 'Draft'), 
+             ('unsold', 'Unsold'), 
+             ('paid', 'Paid'), 
+             ('sold', 'Sold'), 
+             ('taken_away', 'Taken away')), 'State', required=True, readonly=True, 
              help=' * The \'Draft\' state is used when a object is encoding as a new object. \
                  \n* The \'Unsold\' state is used when object does not sold for long time, user can also set it as draft state after unsold. \
                  \n* The \'Paid\' state is used when user pay for the object \
-                 \n* The \'Sold\' state is used when user buy the object.'),
-         'buyer_price': fields.function(_buyerprice, method=True, string='Buyer price',store=True),
-         'seller_price': fields.function(_sellerprice, method=True, string='Seller price',store=True),
-         'gross_revenue':fields.function(_grossprice, method=True, string='Gross revenue',store=True),
-         'gross_margin':fields.function(_grossmargin, method=True, string='Gross Margin (%)',store=True),
-         'costs':fields.function(_costs,method=True,string='Indirect costs',store=True),
-         'statement_id': fields.many2many('account.bank.statement.line', 'auction_statement_line_rel','auction_id', 'statement','Payment'),
-         'net_revenue':fields.function(_netprice, method=True, string='Net revenue',store=True),
-         'net_margin':fields.function(_netmargin, method=True, string='Net Margin (%)',store=True),
+                 \n* The \'Sold\' state is used when user buy the object.'), 
+         'buyer_price': fields.function(_getprice, method=True, string='Buyer price', store=True, multi="buyer_price"), 
+         'seller_price': fields.function(_getprice, method=True, string='Seller price', store=True, multi="seller_price"), 
+         'gross_revenue':fields.function(_getprice, method=True, string='Gross revenue', store=True, multi="gross_revenue"), 
+         'gross_margin':fields.function(_getprice, method=True, string='Gross Margin (%)', store=True, multi="gross_margin"), 
 -        'costs':fields.function(_costs, method=True, string='Indirect costs', store=True), 
++        'costs':fields.function(_getprice, method=True, string='Indirect costs', store=True, multi="costs"), 
+         'statement_id': fields.many2many('account.bank.statement.line', 'auction_statement_line_rel', 'auction_id', 'statement', 'Payment'), 
+         'net_revenue':fields.function(_getprice, method=True, string='Net revenue', store=True, multi="net_revenue"), 
+         'net_margin':fields.function(_getprice, method=True, string='Net Margin (%)', store=True, multi="net_margin"), 
      }
      _defaults = {
-         'state':lambda *a: 'draft',
-         'lot_num':lambda *a:1,
-         'is_ok': lambda *a: False
+         'state':lambda *a: 'draft', 
+         'lot_num':lambda *a:1, 
+         'is_ok': lambda *a: False, 
      }
--    _constraints = [
--#       (_inv_constraint, 'Twice the same inventory number !', ['lot_num','bord_vnd_id'])
--    ]
--
-     def name_get(self, cr, user, ids, context={}):
-         if not len(ids):
++    
+     def name_get(self, cr, user, ids, context=None):
+         if not context:
+             context={}
+         if not ids:
              return []
-         result = [ (r['id'], str(r['obj_num'])+' - '+r['name']) for r in self.read(cr, user, ids, ['name','obj_num'])]
+         result = [ (r['id'], str(r['obj_num'])+' - '+r['name']) for r in self.read(cr, user, ids, ['name', 'obj_num'])]
          return result
  
-     def name_search(self, cr, user, name, args=None, operator='ilike', context={}):
-         if not len(args):
+     def name_search(self, cr, user, name, args=None, operator='ilike', context=None):
+         if not context:
+             context={}
+         if not args:
              args = []
          ids = []
          if name:
      def compute_buyer_costs(self, cr, uid, ids):
          amount_total = {}
          lots = self.browse(cr, uid, ids)
- ##CHECKME: est-ce que ca vaudrait la peine de faire des groupes de lots qui ont les memes couts pour passer des listes de lots a compute?
 -##CHECKME: Is that AC would be worthwhile to make groups of lots that have the same costs to spend a lot of lists compute?
++        ##CHECKME: Is that AC would be worthwhile to make groups of lots that have the same costs to spend a lot of lists compute?
          taxes = []
          amount=0.0
          pt_tax = self.pool.get('account.tax')
                  taxes.append(lot.author_right)
              elif lot.auction_id:
                  taxes += lot.auction_id.buyer_costs
-             tax=pt_tax.compute(cr,uid,taxes,lot.obj_price,1)
+             tax=pt_tax.compute_all(cr, uid, taxes, lot.obj_price, 1)['taxes']
              for t in tax:
                  amount+=t['amount']
--            #amount+=lot.obj_price*0.2
--            #amount+=lot.obj_price
          amount_total['value']= amount
          amount_total['amount']= amount
+         
          return amount_total
  
  
      def _compute_lot_seller_costs(self, cr, uid, lot, manual_only=False):
          costs = []
          tax_cost_ids=[]
--#       tax_cost_ids = [i.id for i in lot.auction_id.seller_costs]
--        # if there is a specific deposit cost for this depositer, add it
++
          border_id = lot.bord_vnd_id
          if border_id:
              if border_id.tax_id:
                  c.update({'type': 0})
  ######
          if lot.vnd_lim_net<0 and lot.obj_price>0:
- #FIXME: la string 'remise lot' devrait passer par le systeme de traductions
 -#FIXME:the string passes have lot 'should go through the system translations.
++            #FIXME:the string passes have lot 'should go through the system translations.
              obj_price_wh_costs = reduce(lambda x, y: x + y['amount'], tax_costs, lot.obj_price)
              if obj_price_wh_costs < lot.vnd_lim:
-                 costs.append({  'type': 1,
-                                 'id': lot.obj_num,
-                                 'name': 'Remise lot '+ str(lot.obj_num),
+                 costs.append({  'type': 1, 
+                                 'id': lot.obj_num, 
+                                 'name': 'Remise lot '+ str(lot.obj_num), 
                                  'amount': lot.vnd_lim - obj_price_wh_costs}
--                                #'account_id': lot.auction_id.acc_refund.id
                              )
          return costs
+     
      def compute_seller_costs(self, cr, uid, ids, manual_only=False):
          lots = self.browse(cr, uid, ids)
          costs = []
                          total_cost += c['amount']
                      costs.extend(bord_costs)
              if (total_adj+total_cost)<0:
--#FIXME: translate tax name
++                #FIXME: translate tax name
                  new_id = bord and bord.id or 0
--                c = {'type':3, 'id':new_id, 'amount':-total_cost-total_adj, 'name':'Ristourne'}#, 'account_id':lots[0].auction_id.acc_refund.id}
++                c = {'type':3, 'id':new_id, 'amount':-total_cost-total_adj, 'name':'Ristourne'}
                  costs.append(c)
          return self._sum_taxes_by_type_and_id(costs)
  
          for tax in taxes:
              if tax['type'] == 1:
                  tax['id'] = 0
--    #FIXME: translate tax names
-                 tax['name'] = 'Remise limite nette'
++                #FIXME: translate tax names
+                 tax['name'] = 'Discount sharp boundary'
              elif tax['type'] == 2:
                  tax['id'] = 0
-                 tax['name'] = 'Frais divers'
+                 tax['name'] = 'Miscellaneous expenditure'
              elif tax['type'] == 3:
                  tax['id'] = 0
-                 tax['name'] = 'Rist.'
+                 tax['name'] = 'Cross.'
              key = (tax['type'], tax['id'])
              if key in taxes_summed:
                  taxes_summed[key]['amount'] += tax['amount']
                  taxes_summed[key] = tax
          return taxes_summed.values()
  
-     def buyer_proforma(self,cr,uid,ids,context):
+     def buyer_proforma(self, cr, uid, ids, context=None):
+         
+         if not context:
+             context={}
          invoices = {}
          inv_ref = self.pool.get('account.invoice')
-         partner_r = self.pool.get('res.partner')
+         res_obj = self.pool.get('res.partner')
          inv_line_obj = self.pool.get('account.invoice.line')
          wf_service = netsvc.LocalService('workflow')
--#       acc_receiv=self.pool.get('account.account').search([cr,uid,[('code','=','4010')]])
-         for lot in self.browse(cr,uid,ids,context):
+         for lot in self.browse(cr, uid, ids, context):
              if not lot.obj_price>0:
                  continue
              if not lot.ach_uid.id:
                      taxes.append(lot.author_right.id)
  
                  inv_line= {
-                     'invoice_id': inv_id,
-                     'quantity': 1,
-                     'product_id': lot.product_id.id,
-                     'name': 'proforma'+'['+str(lot.obj_num)+'] '+ lot.name,
-                     'invoice_line_tax_id': [(6,0,taxes)],
-                     'account_analytic_id': lot.auction_id.account_analytic_id.id,
-                     'account_id': lot.auction_id.acc_income.id,
-                     'price_unit': lot.obj_price,
+                     'invoice_id': inv_id, 
+                     'quantity': 1, 
+                     'product_id': lot.product_id.id, 
+                     'name': 'proforma'+'['+str(lot.obj_num)+'] '+ lot.name, 
+                     'invoice_line_tax_id': [(6, 0, taxes)], 
+                     'account_analytic_id': lot.auction_id.account_analytic_id.id, 
+                     'account_id': lot.auction_id.acc_income.id, 
+                     'price_unit': lot.obj_price, 
                  }
-                 inv_line_obj.create(cr, uid, inv_line,context)
-             #   inv_ref.button_compute(cr, uid, [inv_id])
-             #   wf_service = netsvc.LocalService('workflow')
-             #   wf_service.trg_validate(uid, 'account.invoice', inv_id, 'invoice_open', cr)
+                 inv_line_obj.create(cr, uid, inv_line, context)
 -            #   inv_ref.button_compute(cr, uid, [inv_id])
 -            #   wf_service = netsvc.LocalService('workflow')
 -            #   wf_service.trg_validate(uid, 'account.invoice', inv_id, 'invoice_open', cr)
              inv_ref.button_compute(cr, uid, invoice.values())
              wf_service.trg_validate(uid, 'account.invoice', inv_id, 'invoice_proforma2', cr)
          return invoices.values()
                  contact_addr_id = res['contact']
                  invoice_addr_id = res['invoice']
                  inv = {
-                     'name': 'Auction:' +lot.name,
-                     'journal_id': lot.auction_id.journal_seller_id.id,
-                     'partner_id': lot.bord_vnd_id.partner_id.id,
-                     'type': 'in_invoice',
+                     'name': 'Auction:' +lot.name, 
+                     'journal_id': lot.auction_id.journal_seller_id.id, 
+                     'partner_id': lot.bord_vnd_id.partner_id.id, 
+                     'type': 'in_invoice', 
                  }
-                 inv.update(inv_ref.onchange_partner_id(cr,uid, [], 'in_invoice', lot.bord_vnd_id.partner_id.id)['value'])
-             #   inv['account_id'] = inv['account_id'] and inv['account_id'][0]
+                 inv.update(inv_ref.onchange_partner_id(cr, uid, [], 'in_invoice', lot.bord_vnd_id.partner_id.id)['value'])
 -            #   inv['account_id'] = inv['account_id'] and inv['account_id'][0]
                  inv_id = inv_ref.create(cr, uid, inv, context)
                  invoices[lot.bord_vnd_id.id] = inv_id
  
          inv_line_obj = self.pool.get('account.invoice.line')
          wf_service = netsvc.LocalService('workflow')
          invoices={}
-         for lot in self.browse(cr, uid, ids,context):
-         #   partner_ref = lot.ach_uid.id
+         for lot in self.browse(cr, uid, ids, context):
 -        #   partner_ref = lot.ach_uid.id
              if not lot.auction_id.id:
                  continue
              if not lot.ach_uid.id:
                  }
                  if invoice_number:
                      inv['number'] = invoice_number
-                 inv.update(inv_ref.onchange_partner_id(cr,uid, [], 'out_invoice', lot.ach_uid.id)['value'])
-                 #inv['account_id'] = inv['account_id'] and inv['account_id'][0]
+                 inv.update(inv_ref.onchange_partner_id(cr, uid, [], 'out_invoice', lot.ach_uid.id)['value'])
 -                #inv['account_id'] = inv['account_id'] and inv['account_id'][0]
                  inv_id = inv_ref.create(cr, uid, inv, context)
-                 invoices[(lot.auction_id.id,lot.ach_uid.id)] = inv_id
-             self.write(cr,uid,[lot.id],{'ach_inv_id':inv_id,'state':'sold'})
+                 invoices[(lot.auction_id.id, lot.ach_uid.id)] = inv_id
+             self.write(cr, uid, [lot.id], {'ach_inv_id':inv_id, 'state':'sold'})
              #calcul des taxes
              taxes = map(lambda x: x.id, lot.product_id.taxes_id)
              taxes+=map(lambda x:x.id, lot.auction_id.buyer_costs)
                  taxes.append(lot.author_right.id)
  
              inv_line= {
-                 'invoice_id': inv_id,
-                 'quantity': 1,
-                 'product_id': lot.product_id.id,
-                 'name': '['+str(lot.obj_num)+'] '+ lot.name,
-                 'invoice_line_tax_id': [(6,0,taxes)],
-                 'account_analytic_id': lot.auction_id.account_analytic_id.id,
-                 'account_id': lot.auction_id.acc_income.id,
-                 'price_unit': lot.obj_price,
+                 'invoice_id': inv_id, 
+                 'quantity': 1, 
+                 'product_id': lot.product_id.id, 
+                 'name': '['+str(lot.obj_num)+'] '+ lot.name, 
+                 'invoice_line_tax_id': [(6, 0, taxes)], 
+                 'account_analytic_id': lot.auction_id.account_analytic_id.id, 
+                 'account_id': lot.auction_id.acc_income.id, 
+                 'price_unit': lot.obj_price, 
              }
-             inv_line_obj.create(cr, uid, inv_line,context)
-     #   inv_ref.button_compute(cr, uid, [inpq tu dis cav_id])
-     #       inv_ref.button_compute(cr, uid, [inv_id])
+             inv_line_obj.create(cr, uid, inv_line, context)
 -    #   inv_ref.button_compute(cr, uid, [inpq tu dis cav_id])
 -    #       inv_ref.button_compute(cr, uid, [inv_id])
              inv_ref.button_compute(cr, uid, [inv_id])
          for l in  inv_ref.browse(cr, uid, invoices.values(), context):
--        #   wf_service.trg_validate(uid, 'account.invoice',l.id, 'invoice_proforma', cr)
-             wf_service.trg_validate(uid, 'account.invoice',l.id, 'invoice_open', cr)
+             wf_service.trg_validate(uid, 'account.invoice', l.id, 'invoice_open', cr)
          return invoices.values()
  
-     def numerotate(self, cr, uid, ids):
-         cr.execute('select auction_id from auction_lots where id=%s', (ids[0],))
-         auc_id = cr.fetchone()[0]
-         cr.execute('select max(obj_num) from auction_lots where auction_id=%s', (auc_id,))
-         try:
-             max = cr.fetchone()[0]
-         except:
-             max = 0
-         for id in ids:
-             max+=1
-             cr.execute('update auction_lots set obj_num=%s where id=%s', (max, id))
-         return []
 -#    def numerotate(self, cr, uid, ids, context=None):
 -#                
 -#        cr.execute('select auction_id from auction_lots where id=%s', (ids[0],))
 -#        auc_id = cr.fetchone()[0]
 -#        cr.execute('select max(obj_num) from auction_lots where auction_id=%s', (auc_id,))
 -#        try:
 -#            max = cr.fetchone()[0]
 -#        except:
 -#            max = 0
 -#        for id in ids:
 -#            max+=1
 -#            cr.execute('update auction_lots set obj_num=%s where id=%s', (max, id))
 -#        return []
 -
  auction_lots()
  
  #----------------------------------------------------------
@@@ -893,18 -895,18 +790,12 @@@ class auction_bid_lines(osv.osv)
      _name = "auction.bid_line"
      _description="Bid"
  
--#   def get_nom(self,cr,uid,ids,*a):
--#       res = {}
--#       lots=self.browse(cr,uid,ids)
--#       for lot in lots:
--#           res[lot.id] = lot.lot_id.auction_id.name
--#       return res
      _columns = {
-         'name': fields.char('Bid date',size=64),
-         'bid_id': fields.many2one('auction.bid','Bid ID', required=True, ondelete='cascade'),
-         'lot_id': fields.many2one('auction.lots','Object', required=True, ondelete='cascade'),
-         'call': fields.boolean('To be Called'),
-         'price': fields.float('Maximum Price'),
+         'name': fields.char('Bid date', size=64), 
+         'bid_id': fields.many2one('auction.bid', 'Bid ID', required=True, ondelete='cascade'), 
+         'lot_id': fields.many2one('auction.lots', 'Object', required=True, ondelete='cascade'), 
+         'call': fields.boolean('To be Called'), 
+         'price': fields.float('Maximum Price'), 
          'auction': fields.char(string='Auction Name', size=64)
      }
      _defaults = {
  <?xml version="1.0"?>
  <openerp>
  <data>
--      <record model="account.account" id="auction_income_view">
--              <field name="name">Auction Adjudications</field>
--              <field name="code">0</field>
--              <field name="type">view</field>
--              <field name="currency_id" search="[('name','=','EUR')]"/>
-               <field name="parent_id" type="list">
-                       <value search="[('type','=','view')]" model="account.account"/>
-               </field>
-       </record>
 -              <field name="parent_id" eval="0">
 -                      <value search="[('type','=','view')]" model="account.account"/>
 -              </field>
 -              <field name="user_type" ref="account.account_type_root"/>
 -      </record>
++      
+       
+       <!-- Auction lots category data -->
+       
+     <record model="aie.category" id="aie_category_anti_view">
+         <field name="name">Antiques</field>
+         <field name="code">ANTI</field>
+     </record>
+     
+     <record model="aie.category" id="aie_category_paint_view">
+         <field name="name">Painting</field>
+         <field name="code">PAINT</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>
+     
+     <record model="aie.category" id="aie_category_furn_view">
+         <field name="name">Furnitures</field>
+         <field name="code">FURN</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>
+     
+    <record model="aie.category" id="aie_category_pcg_view">
+         <field name="name">Porcelain, Ceramics, Glassmaking, ...</field>
+         <field name="code">PCG</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>
  
-       <record model="account.account" id="auction_expense_view">
-               <field name="name">Auction Adjudication Expenses</field>
-               <field name="code">0</field>
-               <field name="type">view</field>
-               <field name="currency_id" search="[('name','=','EUR')]"/>
-               <field name="parent_id" type="list">
-                       <value search="[('type','=','view')]" model="account.account"/>
-               </field>
-       </record>
+    <record model="aie.category" id="aie_category_sbe_view">
+         <field name="name">Sculpture, bronze, eso</field>
+         <field name="code">SBE</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>    
+     
+      <record model="aie.category" id="aie_category_clock_view">
+         <field name="name">Clocks and watches</field>
+         <field name="code">CLW</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>  
+     
+     <record model="aie.category" id="aie_category_caob_view">
+         <field name="name">Collectible and art objects</field>
+         <field name="code">COAO</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+    <record model="aie.category" id="aie_category_engr_view">
+         <field name="name">Engravings</field>
+         <field name="code">ENGR</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>       
+     
+     <record model="aie.category" id="aie_category_gart_view">
+         <field name="name">Graphic Arts</field>
+         <field name="code">GART</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_light_view">
+         <field name="name">Lightings</field>
+         <field name="code">LGT</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>   
+     
+     <record model="aie.category" id="aie_category_metal_view">
+         <field name="name">Metal Ware</field>
+         <field name="code">MW</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_mini_view">
+         <field name="name">Miniatures</field>
+         <field name="code">MAT</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>  
+     
+     <record model="aie.category" id="aie_category_collect_view">
+         <field name="name">Collections</field>
+         <field name="code">CLT</field>
+         <field name="parent_id" ref="aie_category_mini_view"/>
+     </record>    
+     
+     <record model="aie.category" id="aie_category_mi_view">
+         <field name="name">Musical Instruments</field>
+         <field name="code">MI</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_owm_view">
+         <field name="name">Old weapons and militaria</field>
+         <field name="code">OWM</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_oart_view">
+         <field name="name">Oriental Arts</field>
+         <field name="code">OART</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_chf_view">
+         <field name="name">Chineese furnitures</field>
+         <field name="code">CHF</field>
+         <field name="parent_id" ref="aie_category_oart_view"/>
+     </record>    
+     
+     <record model="aie.category" id="aie_category_othr_view">
+         <field name="name">Others</field>
+         <field name="code">OTR</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_pst_view">
+         <field name="name">Posters</field>
+         <field name="code">PST</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_rel_view">
+         <field name="name">Religiosa</field>
+         <field name="code">REL</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_sin_view">
+         <field name="name">Scientific Instruments</field>
+         <field name="code">SIN</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+         
+     <record model="aie.category" id="aie_category_tin_view">
+         <field name="name">Tin</field>
+         <field name="code">TIN</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_cwa_view">
+         <field name="name">Copper wares</field>
+         <field name="code">CWA</field>
+         <field name="parent_id" ref="aie_category_tin_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_ty_view">
+         <field name="name">Toys</field>
+         <field name="code">TY</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_vrs_view">
+         <field name="name">Verreries</field>
+         <field name="code">VRS</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_wne_view">
+         <field name="name">Wine</field>
+         <field name="code">WNE</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record> 
+     
+     <!--  -->
  
-       <record model="account.account" id="auction_income">
-               <field name="name">Auction Adjudications</field>
-               <field name="code">7x*</field>
-               <field name="type">income</field>
-               <field name="currency_id" search="[('name','=','EUR')]"/>
-               <field name="parent_id" eval="[auction_income_view]"/>
-       </record>
-       <record model="account.account" id="auction_expense">
-               <field name="name">Auction Adjudication Expenses</field>
-               <field name="code">6x*</field>
-               <field name="type">expense</field>
-               <field name="currency_id" search="[('name','=','EUR')]"/>
-               <field name="parent_id" eval="[auction_expense_view]"/>
-       </record>
+     <record model="aie.category" id="aie_category_con_view">
+         <field name="name">Contemporary Art</field>
+         <field name="code">CONTEM</field>
+     </record>
+     
+     <record model="aie.category" id="aie_category_con_art_view">
+         <field name="name">Arts</field>
+         <field name="code">ARTS</field>
+         <field name="parent_id" ref="aie_category_con_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_con_curi_view">
+         <field name="name">Curiosa</field>
+         <field name="code">CRS</field>
+         <field name="parent_id" ref="aie_category_con_view"/>
+     </record> 
+     
+     <record model="aie.category" id="aie_category_con_ome_view">
+         <field name="name">Other Media</field>
+         <field name="code">OME</field>
+         <field name="parent_id" ref="aie_category_con_view"/>
+     </record> 
+        
+     <record model="aie.category" id="aie_category_con_pht_view">
+         <field name="name">Photo</field>
+         <field name="code">PHT</field>
+         <field name="parent_id" ref="aie_category_con_view"/>
+     </record>     
+     
+     <record model="aie.category" id="aie_category_con_paint_view">
+         <field name="name">Painting</field>
+         <field name="code">CPAINT</field>
+         <field name="parent_id" ref="aie_category_con_view"/>
+     </record>  
+     
+     <record model="aie.category" id="aie_category_con_scul_view">
+         <field name="name">Sculpture</field>
+         <field name="code">SCUL</field>
+         <field name="parent_id" ref="aie_category_con_view"/>
+     </record>      
  
-       <record model="account.account" id="auction_income_costs">
-               <field name="name">Auction Buyer Costs</field>
-               <field name="code">7x*</field>
-               <field name="type">tax</field>
-               <field name="currency_id" search="[('name','=','EUR')]"/>
-               <field name="parent_id" eval="[auction_income_view]"/>
-       </record>
-       <record model="account.account" id="auction_expense_costs">
-               <field name="name">Auction Seller Costs</field>
-               <field name="code">6x*</field>
-               <field name="type">tax</field>
-               <field name="currency_id" search="[('name','=','EUR')]"/>
-               <field name="parent_id" eval="[auction_expense_view]"/>
-       </record>
+     <record model="aie.category" id="aie_category_con_cshe_view">
+         <field name="name">Shows</field>
+         <field name="code">CSHW</field>
+         <field name="parent_id" ref="aie_category_con_view"/>
+     </record>  
+     
+     <record model="aie.category" id="aie_category_jew_view">
+         <field name="name">Jewelry</field>
+         <field name="code">JWL</field>
+         <field name="parent_id" ref="aie_category_con_view"/>
+     </record>
+     
+     <!--  -->
  
-       <record model="account.tax" id="tax_buyer_author">
-               <field name="name">Author rights (4%)</field>
-               <field name="type">percent</field>
-               <field name="applicable_type">code</field>
-               <field name="amount">0.04</field>
-               <field name="domain">sabam</field>
-               <field name="account_collected_id" ref="auction_income_costs"/>
-               <field name="account_paid_id" ref="auction_income_costs"/>
-               <field name="python_applicable">result = (price_unit&gt;=1250)</field>
-       </record>
-       <record model="account.tax" id="tax_buyer">
-               <field name="name">Buyer Costs (20%)</field>
-               <field name="type">percent</field>
-               <field name="amount">0.20</field>
-               <field name="domain">auction</field>
-               <field name="account_collected_id" ref="auction_income_costs"/>
-               <field name="account_paid_id" ref="auction_income_costs"/>
-       </record>
-       <record model="account.tax" id="tax_seller">
-               <field name="name">Seller Costs (12%)</field>
-               <field name="type">percent</field>
-               <field name="amount">-0.12</field>
-               <field name="domain">auction</field>
-               <field name="account_collected_id" ref="auction_expense_costs"/>
-               <field name="account_paid_id" ref="auction_expense_costs"/>
-       </record>
+     <record model="aie.category" id="aie_category_uncla_view">
+         <field name="name">Unclassifieds</field>
+         <field name="code">UNCLASS</field>
+     </record>
+     
+     <record model="aie.category" id="aie_category_afrart_view">
+         <field name="name">African Arts</field>
+         <field name="code">AFART</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>
+     
+     <record model="aie.category" id="aie_category_argen_view">
+         <field name="name">Argenterie</field>
+         <field name="code">ARGENT</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>
+     
+     <record model="aie.category" id="aie_category_artfrom_view">
+         <field name="name">Art from the Ivory Coast</field>
+         <field name="code">ARTFORM</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>
+     
+     <record model="aie.category" id="aie_category_afrec_view">
+         <field name="name">African Arts</field>
+         <field name="code">AFRART</field>
+         <field name="parent_id" ref="aie_category_artfrom_view"/>
+     </record>
+     
+    <record model="aie.category" id="aie_category_book_view">
+         <field name="name">Books, manuscripts, eso.</field>
+         <field name="code">BME</field>
+          <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>
+     
+    <record model="aie.category" id="aie_category_carpet_view">
+         <field name="name">Carpet and textilles</field>
+         <field name="code">CARPTEX</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>
+     
+     <record model="aie.category" id="aie_category_cartoon_view">
+         <field name="name">Cartoons</field>
+         <field name="code">CATOON</field>
+         <field name="parent_id" ref="aie_category_anti_view"/>
+     </record>
+     
+     <!-- End Of Auction Lots Category -->
  
-       <ir_set>
-               <field name="keys" eval="[('meta','res.partner'),('name','auction.seller.costs')]"/>
-               <field name="args" eval="[]"/>
-               <field name="name">account.seller.costs</field>
-               <field name="value" eval="tax_seller"/>
-               <field name="meta" eval="{'type':'many2one', 'string':'Seller Costs', 'relation':'account.tax'}"/>
-       </ir_set>
-       <record id="product.product_product_pc2" model="product.product">
-               <field name="list_price">770.0</field>
-               <field name="standard_price">700.0</field>
-       </record>
 -      <record model="account.account" id="auction_expense_view">
 -              <field name="name">Auction Adjudication Expenses</field>
 -              <field name="code">1</field>
 -              <field name="type">view</field>
 -              <field name="currency_id" search="[('name','=','EUR')]"/>
 -              <field name="parent_id" eval="0">
 -                      <value search="[('type','=','view')]" model="account.account"/>
 -              </field>
 -              <field name="user_type" ref="account.account_type_expense"/>
 -      </record>
 -
 -      <record model="account.account" id="auction_income">
 -              <field name="name">Auction Adjudications</field>
 -              <field name="code">7x*</field>
 -               <field name="user_type" ref="account.account_type_income"/> 
 -              <field name="type">view</field>
 -              <field name="currency_id" search="[('name','=','EUR')]"/>
 -              <field name="parent_id" eval="auction_income_view"/>
 -<!--          <field name="user_type" ref="account.account_type_root"/>-->
 -      </record>
 -      
 -      <record model="account.account" id="auction_expense">
 -              <field name="name">Auction Adjudication Expenses</field>
 -              <field name="code">6x*</field>
 -              <field name="user_type" ref="account.account_type_expense"/>
 -              <field name="type">view</field>
 -              <field name="currency_id" search="[('name','=','EUR')]"/>
 -              <field name="parent_id" eval="auction_expense_view"/>
 -<!--          <field name="user_type" ref="account.account_type_root"/>-->
 -      </record>
 -
 -      <record model="account.account" id="auction_income_costs">
 -              <field name="name">Auction Buyer Costs</field>
 -              <field name="code">8x*</field>
 -<!--          <field name="type">tax</field>-->
 -              <field name="type">payable</field>
 -              <field name="currency_id" search="[('name','=','EUR')]"/>
 -              <field name="parent_id" eval="auction_income_view"/>
 -              <field name="user_type" ref="account.account_type_payable"/>
 -      </record>
 -      <record model="account.account" id="auction_expense_costs">
 -              <field name="name">Auction Seller Costs</field>
 -              <field name="code">9x*</field>
 -<!--          <field name="type">tax</field>-->
 -              <field name="type">receivable</field>
 -              <field name="currency_id" search="[('name','=','EUR')]"/>
 -              <field name="parent_id" eval="auction_expense_view"/>
 -              <field name="user_type" ref="account.account_type_receivable"/>
 -      </record>
 -
 -      <record model="account.tax" id="tax_buyer_author">
 -              <field name="name">Author rights (4%)</field>
 -              <field name="type">percent</field>
 -              <field name="applicable_type">code</field>
 -              <field name="amount">0.04</field>
 -              <field name="domain">sabam</field>
 -              <field name="account_collected_id" ref="auction_income_costs"/>
 -              <field name="account_paid_id" ref="auction_income_costs"/>
 -              <field name="python_applicable">result = (price_unit&gt;=1250)</field>
 -      </record>
 -      <record model="account.tax" id="tax_buyer">
 -              <field name="name">Buyer Costs (20%)</field>
 -              <field name="type">percent</field>
 -              <field name="amount">0.20</field>
 -              <field name="domain">auction</field>
 -              <field name="account_collected_id" ref="auction_income_costs"/>
 -              <field name="account_paid_id" ref="auction_income_costs"/>
 -      </record>
 -      <record model="account.tax" id="tax_seller">
 -              <field name="name">Seller Costs (12%)</field>
 -              <field name="type">percent</field>
 -              <field name="amount">-0.12</field>
 -              <field name="domain">auction</field>
 -              <field name="account_collected_id" ref="auction_expense_costs"/>
 -              <field name="account_paid_id" ref="auction_expense_costs"/>
 -      </record>
+       
 -      <record id="product.product_product_pc2" model="product.product">
 -              <field name="list_price">770.0</field>
 -              <field name="standard_price">700.0</field>
 -      </record>
  
  </data>
  </openerp>
@@@ -2,6 -2,6 +2,102 @@@
  <openerp>
  <data noupdate="1">
  
++    <!-- demo data for Account -->
++    <record model="account.account.type" id="account.account_type_tax">
++          <field name="name">Tax</field>
++          <field name="code">tax</field>
++          <field name="close_method">unreconciled</field>
++    </record>
++
++    <record model="account.account" id="auction_income_view">
++              <field name="name">Auction Adjudications</field>
++              <field name="code">0</field>
++              <field name="type">view</field>
++              <field name="currency_id" search="[('name','=','EUR')]"/>
++              <field name="parent_id" eval="0">
++                      <value search="[('type','=','view')]" model="account.account"/>
++              </field>
++              <field name="user_type" ref="account.account_type_root"/>
++      </record>
++
++    <record model="account.account" id="auction_expense_view">
++              <field name="name">Auction Adjudication Expenses</field>
++              <field name="code">1</field>
++              <field name="type">view</field>
++              <field name="currency_id" search="[('name','=','EUR')]"/>
++              <field name="parent_id" eval="0">
++                      <value search="[('type','=','view')]" model="account.account"/>
++              </field>
++              <field name="user_type" ref="account.account_type_expense"/>
++      </record>
++
++      <record model="account.account" id="auction_income">
++              <field name="name">Auction Adjudications</field>
++              <field name="code">7x*</field>
++               <field name="user_type" ref="account.account_type_income"/> 
++              <field name="type">receivable</field>
++              <field name="currency_id" search="[('name','=','EUR')]"/>
++              <field name="parent_id" eval="auction_income_view"/>
++      </record>
++      
++      <record model="account.account" id="auction_expense">
++              <field name="name">Auction Adjudication Expenses</field>
++              <field name="code">6x*</field>
++              <field name="user_type" ref="account.account_type_expense"/>
++              <field name="type">payable</field>
++              <field name="currency_id" search="[('name','=','EUR')]"/>
++              <field name="parent_id" eval="auction_expense_view"/>
++      </record>
++
++      <record model="account.account" id="auction_income_costs">
++              <field name="name">Auction Buyer Costs</field>
++              <field name="code">8x*</field>
++              <field name="type">payable</field>
++              <field name="currency_id" search="[('name','=','EUR')]"/>
++              <field name="parent_id" eval="auction_income_view"/>
++              <field name="user_type" ref="account.account_type_tax"/>
++      </record>
++      <record model="account.account" id="auction_expense_costs">
++              <field name="name">Auction Seller Costs</field>
++              <field name="code">9x*</field>
++              <field name="type">receivable</field>
++              <field name="currency_id" search="[('name','=','EUR')]"/>
++              <field name="parent_id" eval="auction_expense_view"/>
++              <field name="user_type" ref="account.account_type_tax"/>
++      </record>
++
++      <record model="account.tax" id="tax_buyer_author">
++              <field name="name">Author rights (4%)</field>
++              <field name="type">percent</field>
++              <field name="applicable_type">code</field>
++              <field name="amount">0.04</field>
++              <field name="domain">sabam</field>
++              <field name="account_collected_id" ref="auction_income_costs"/>
++              <field name="account_paid_id" ref="auction_income_costs"/>
++              <field name="python_applicable">result = (price_unit&gt;=1250)</field>
++      </record>
++      <record model="account.tax" id="tax_buyer">
++              <field name="name">Buyer Costs (20%)</field>
++              <field name="type">percent</field>
++              <field name="amount">0.20</field>
++              <field name="domain">auction</field>
++              <field name="account_collected_id" ref="auction_income_costs"/>
++              <field name="account_paid_id" ref="auction_income_costs"/>
++      </record>
++      <record model="account.tax" id="tax_seller">
++              <field name="name">Seller Costs (12%)</field>
++              <field name="type">percent</field>
++              <field name="amount">-0.12</field>
++              <field name="domain">auction</field>
++              <field name="account_collected_id" ref="auction_expense_costs"/>
++              <field name="account_paid_id" ref="auction_expense_costs"/>
++      </record>
++      <!--demo data for the product-->
++      <record id="product.product_product_pc2" model="product.product">
++              <field name="list_price">770.0</field>
++              <field name="standard_price">700.0</field>
++      </record>
++
  
      <!--demo data for the partner-->
  
  <!--===========================================================================================-->
          <!-- start == demo data for the auction_lot_Category object-->
      <record model="auction.lot.category" id="auction_cat_1">
--        <field name="name">painting</field>
++        <field name="name">Painting</field>
          <field name="priority">1</field>
-         <field name="aie_categ">8</field>
+         <field name="aie_categ" ref="aie_category_paint_view"/>
      </record>
+     
      <record model="auction.lot.category" id="auction_cat_2">
          <field name="name">Furniture</field>
          <field name="priority">2</field>
      </record>
  
      <record model="auction.lot.category" id="auction_cat_3">
--        <field name="name">glass</field>
++        <field name="name">Glass</field>
          <field name="priority">2</field>
-         <field name="aie_categ">25</field>
+          <field name="aie_categ"  ref="aie_category_pcg_view"/>
      </record>
+     
      <record model="auction.lot.category" id="auction_cat_4">
--        <field name="name">sculpture</field>
++        <field name="name">Sculpture</field>
          <field name="priority">10</field>
-         <field name="aie_categ">18</field>
+         <field name="aie_categ"  ref="aie_category_sbe_view"/>
      </record>
  
      <record model="auction.lot.category" id="auction_cat_5">
          <field name="arch" type="xml">
              <form string="Auctions">
                  <field name="name" colspan="2" select="1"/>
-                 <separator string="Dates" colspan="4"/>
-                 <field name="expo1"/>
-                 <field name="expo2"/>
-                 <field name="auction1" select="1"/>
-                 <field name="auction2" select="1"/>
-                 <separator string="Commissions" colspan="4"/>
-                 <field name="seller_costs" domain="[('parent_id','=',False),('domain','=','auction'),('type_tax_use','&lt;&gt;','purchase')]"/>
-                 <field name="buyer_costs" domain="[('parent_id','=',False),('domain','=','auction'),('type_tax_use','&lt;&gt;','sale')]"/>
-                 <separator string="Accounting" colspan="4"/>
-                 <field name="acc_expense"/>
-                 <field name="acc_income"/>
-                 <separator string="Analytic" colspan="4"/>
-                 <field name="journal_id"/>
-                 <field name="journal_seller_id"/>
-                 <field name="account_analytic_id"/>
-                 <separator string="State" colspan="4"/>
-                 <field name="state"/>
-                 <button name="close" states="draft" string="Close + Create all invoices" type="object" colspan="2" icon="gtk-print"/>
+                 <notebook colspan="4">
+                     <page string="Auction Dates">
+                         <separator string="Exposition Dates" colspan="4"/>
+                         <field name="expo1"/>
+                         <field name="expo2"/>
+                         <separator string="Auction Dates" colspan="4"/>
+                         <field name="auction1" select="1"/>
+                         <field name="auction2" select="1"/>
+                         <label string="" colspan="4"/>
+                         <field name="state"/>
+                         <button name="close" states="draft" string="Create Invoices" type="object" colspan="2" icon="gtk-yes"/>
+                     </page>
+                     <page string="Accounting" >
+                         <separator string="Accounting" colspan="4"/>
 -                        <field name="acc_expense"/>
 -                        <field name="acc_income"/>
++                        <field name="acc_expense" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
++                        <field name="acc_income" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
+                         <separator string="Analytic" colspan="4"/>
+                         <field name="journal_id"/>
+                         <field name="journal_seller_id"/>
+                         <field name="account_analytic_id"/>
+                     </page>  
+                     <page string="Commissions">
+                         <group col="4" colspan="4">
+                             <group col="2" colspan="4">
+                                <separator string="Buyer Commissions" colspan="4"/>
+                                 <field name="buyer_costs" domain="[('parent_id','=',False),('domain','=','auction'),('type_tax_use','&lt;&gt;','sale')]" nolabel="1" colspan="4"/>
+                              </group>
+                              <group col="2" colspan="4">
+                                  <separator string="Seller Commissions" colspan="4"/>
+                                  <field name="seller_costs" domain="[('parent_id','=',False),('domain','=','auction'),('type_tax_use','&lt;&gt;','purchase')]" nolabel="1" colspan="4"/>
+                              </group>
+                         </group>
+                     </page>
+                 </notebook>
              </form>
          </field>
      </record>
          </field>
      </record>
  
-     <record model="ir.ui.view" id="auction_lot_graph">
-         <field name="name">Auction lots</field>
-         <field name="model">auction.lots</field>
-         <field name="type">graph</field>
-         <field name="arch" type="xml">
-             <graph string="Lots" type="bar">
-                 <field name="lot_type"/>
-                 <field name="lot_est1" operator="+"/>
-                 <field name="lot_est2" operator="+"/>
-                 <field name="obj_price" operator="+"/>
-             </graph>
-         </field>
+     <record model="ir.actions.act_window" id="action_auction_dates_next">
+         <field name="name">Next Auctions Dates</field>
+         <field name="res_model">auction.dates</field>
+         <field name="view_type">form</field>
+         <field name="view_mode">tree,form,calendar</field>  
+         <field name="search_view_id" ref="view_auction_dates_filter"/>
+         <field name="context">{"search_default_draft": "1"}</field>
      </record>
  
+     <act_window name="Open lots"
+         domain="[('auction_id', '=', active_id)]"
+         res_model="auction.lots"
+         src_model="auction.dates"
+         id="act_auction_lot_line_open"/>
  
-     <!-- tree2 form2 for Catalog, All object and Unclassified objects -->
-     <record model="ir.ui.view" id="v7">
+     <menuitem name="Auction Dates" parent="auction_menu_root" id="auction_date_menu" sequence="1"/>
+     <menuitem name="Next Auction Dates" parent="auction_date_menu" id="menu_auction_dates_next1" action="action_auction_dates_next"/>
+     
+     
 -  <!--  Auction Management/Auction Dates/Reporting  -->
 -    
 -    <!-- tree1 form1 for NEW object in the deposit border -->
 -    
 -<!--    <record model="ir.ui.view" id="v5">-->
 -<!--        <field name="name">Auction lots</field>-->
 -<!--        <field name="model">auction.lots</field>-->
 -<!--        <field name="type">tree</field>-->
 -<!--        <field name="arch" type="xml">-->
 -<!--                <tree string="Auction Objects">-->
 -<!--                    <field name="lot_num"/>-->
 -<!--                    <field name="obj_num"/>-->
 -<!--                    <field name="name"/>-->
 -<!--                    <field name="auction_id"/>-->
 -<!--                    <field name="vnd_lim"/>-->
 -<!--                    <field name="lot_est1"/>-->
 -<!--                    <field name="lot_est2"/>-->
 -<!--                    <field name="buyer_price"/>-->
 -<!--                    <field name="is_ok"/>-->
 -<!--                    <field name="seller_price"/>-->
 -<!--                    <field name="gross_revenue"/>-->
 -<!--                    <field name="net_revenue"/>-->
 -<!--                    <field name="gross_margin"/>-->
 -<!--                    <field name="net_margin"/>-->
 -<!--                    <field name="costs"/>-->
 -<!--                    <field name="obj_price_l"/>-->
 -<!--                </tree>-->
 -<!--        </field>-->
 -<!--    </record>-->
 -<!--    -->
 -<!--    <record model="ir.ui.view" id="auction_lot_simplified">-->
 -<!--        <field name="name">Auction lots</field>-->
 -<!--        <field name="model">auction.lots</field>-->
 -<!--        <field name="type">form</field>-->
 -<!--        <field name="arch" type="xml">-->
 -<!--            <form string="All Objects">-->
 -<!--                <field name="auction_id"/>-->
 -<!--                <field name="obj_num"/>-->
 -<!--                <field name="bord_vnd_id"/>-->
 -<!--                <field name="lot_num"/>-->
 -<!--                <field name="buyer_price"/>-->
 -<!--                <field name="seller_price"/>-->
 -<!--                <field name="gross_revenue"/>-->
 -<!--                <field name="net_revenue"/>-->
 -<!--                <field name="gross_margin"/>-->
 -<!--                <field name="net_margin"/>-->
 -<!--                <field name="costs"/>-->
 -<!--                <newline/>-->
 -<!--                <field name="name"/>-->
 -<!--                <field name="lot_type" select="1"/>-->
 -<!--                <field name="name2"/>-->
 -<!--                <newline/>-->
 -<!--                <field name="artist_id"/>-->
 -<!--                <field name="artist2_id"/>-->
 -<!--                <field name="obj_desc" colspan="4"/>-->
 -<!--                <field name="vnd_lim"/>-->
 -<!--                <field name="vnd_lim_net"/>-->
 -<!--                <field name="lot_est1"/>-->
 -<!--                <field name="author_right" domain="[('domain','=','sabam'),('parent_id','=',False),('type_tax_use','&lt;&gt;','sale')]"/>-->
 -<!--                <field name="lot_est2"/>-->
 -<!--                <field name="product_id"/>-->
 -<!--                <field name="state" readonly="1"/>-->
 -<!--            </form>-->
 -<!--        </field>-->
 -<!--    </record>-->
 -
 -
 -    <!-- tree2 form2 for Catalog, All object and Unclassified objects -->
 -    <record model="ir.ui.view" id="v7">
++ 
++    <record model="ir.ui.view" id="view_auction_lot_tree">
          <field name="name">Auction lots</field>
          <field name="model">auction.lots</field>
          <field name="type">tree</field>
          <field name="priority" eval="1"/>
          <field name="arch" type="xml">
-             <tree colors="blue:state in ('unsold','draft');black:state in ('sold','taken_away');gray:state in ('paid') " string="Catalog">
 -            <tree colors="blue:state in ('unsold','draft');black:state in ('sold','taken_away');gray:state in ('paid') " string="All Objects">
++            <tree colors="blue:state in ('unsold','draft');black:state in ('sold','taken_away');gray:state in ('paid') " string="Objects">
                  <field name="obj_num" string="Ref" select="1"/>
                  <field name="name" select="1"/>
+                 <field name="ach_uid"/>
                  <field name="ach_login"/>
                  <field name="obj_price" sum="Total Adj."/>
                  <field name="state" select="1"/>
          <field name="type">form</field>
          <field name="priority" eval="8"/>
          <field name="arch" type="xml">
-             <form string="Catalog">
-                 <notebook>
-                 <page string="Object">
-                     <group colspan="2" col="2">
-                         <field name="obj_num" select="1"/>
-                         <field name="name" select="1"/>
-                         <field name="name2"/>
-                         <field name="artist_id"/>
-                         <field name="artist2_id"/>
-                         <field name="product_id"/>
-                     </group>
-                     <field widget="image" name="image" nolabel="1" colspan="2"/>
 -            <form string="All Objects">
++            <form string="Objects">
+               <group colspan="4" col="4">
+                   <group colspan="2" col="4">  
+                     <field colspan="2" name="name"/>
+                     <field name="obj_num" select="1"/>
+                     <field name="lot_type"/>
+                     <field name="auction_id" select="1"/>
+                     <field name="artist_id"/>
+                     <field name="artist2_id"/>
                      <field name="lot_est1"/>
                      <field name="lot_est2"/>
-                     <field name="auction_id" colspan="2" select="1"/>
-                     <field name="lot_type"/>
+                     <field name="product_id"/>
                      <field name="lot_local"/>
                      <field name="bord_vnd_id" select="1"/>
                      <field name="lot_num"/>
-                     <separator string="Description" colspan="4"/>
-                     <field name="obj_desc" colspan="4" nolabel="1"/>
-                     <field name="state" colspan="1"/>
-                      <group col="8" colspan="2">
-                         <button name="button_bought" string="Sold" states="draft" type="object" icon="gtk-jump-to"/>
-                        <button name="button_not_bought" string="Not sold" states="draft" type="object" icon="gtk-undo"/>
-                        <button name="button_taken_away" string="Taken away" states="sold" type="object" icon="gtk-goto-last"/>
-                        <button name="button_draft" string="Set to draft" states="sold,unsold" type="object" icon="gtk-convert"/>
-                        <button name="button_unpaid" string="Set to draft" states="paid" type="object" icon="gtk-convert"/>
-                     </group>
-                 </page>
-                 <page string="Seller">
-                     <separator string="Seller information" colspan="4"/>
-                     <field name="vnd_lim"/>
-                     <field name="vnd_lim_net"/>
-                     <field name="sel_inv_id"/>
-                     <field name="paid_vnd"/>
-                     <field name="history_ids" colspan="4" readonly="1">
-                         <tree string="History">
-                             <field name="name"/>
-                             <field name="lot_id"/>
-                             <field name="auction_id"/>
-                             <field name="price"/>
-                         </tree>
-                     </field>
-                     </page>
-                 <page string="Buyer">
-                     <separator string="Buyer information" colspan="4"/>
-                     <field name="ach_uid" />
-                     <field name="ach_login" select="1" />
-                     <field name="obj_price"/>
-                     <field name="obj_comm"/>
-                     <field name="obj_ret"/>
-                     <field name="ach_emp"/>
-                     <field name="author_right" domain="[('domain','=','sabam'),('parent_id','=',False),('type_tax_use','&lt;&gt;','sale')]"/>
-                     <field name="buyer_price"/>
-                     <field name="seller_price"/>
-                     <field name="gross_revenue"/>
-                     <field name="net_revenue"/>
-                     <field name="gross_margin"/>
-                     <field name="net_margin"/>
-                     <field name="costs"/>
                      <newline/>
-                     <field name="ach_inv_id"/>
-                     <field name="paid_ach"/>
-                     <field name="is_ok"/>
-                     <field name="statement_id" domain="[('state','=','draft')]" colspan="4" nolabel="1"
-                         widget="one2many_list">
-                         <tree string="Payment's history">
-                             <field name="statement_id"/>
-                             <field name="amount"/>
-                             <field name="date"/>
-                         </tree>
-                     </field>
-                 </page>
-             <page string="Bids">
-                 <field name="bid_lines" colspan="4" nolabel="1" editable="top">
-                         <tree string="Bids"  editable="top">
-                             <field name="bid_id"/>
-                             <field name="price"/>
-                             <field name="call"/>
-                         </tree>
-                     </field>
-             </page>
+                    </group> 
+                   <group colspan="2" col="1">
+                     <field name="image" widget='image' nolabel="1"/>
+                   </group>
+               </group>
+               <notebook colspan="4">
+                   <page string="Buyer">
+                       <separator string="Buyer information" colspan="4"/>
+                       <group colspan="4" col="6">
+                           <field name="ach_uid" />
+                           <field name="ach_login" select="1" />
+                           <field name="author_right" domain="[('domain','=','sabam'),('parent_id','=',False),('type_tax_use','&lt;&gt;','sale')]"/>
+                           <field name="obj_price"/>
+                           <field name="obj_ret"/>
+                           <field name="obj_comm"/>
+                           <field name="buyer_price"/>
+                           <field name="seller_price"/>
+                           <field name="ach_emp"/>
 -<!--                          <button name="auction_lots_enable" string="Unmark" type="object" icon="gtk-execute" attrs="{'invisible':[('ach_emp','=', False)]}"/>-->
+                           <field name="gross_revenue"/>
+                           <field name="net_revenue"/>
+                           <field name="gross_margin"/>
+                           <field name="net_margin"/>
+                           <field name="costs"/>
+                           <newline/>
+                           <field name="ach_inv_id"/>
+                           <field name="paid_ach"/>
+                           <field name="is_ok"/>
+                        </group>
+                       <field name="statement_id" domain="[('state','=','draft')]" colspan="4" nolabel="1"
+                           widget="one2many_list">
+                           <tree string="Payment's history">
+                               <field name="statement_id"/>
+                               <field name="amount"/>
+                               <field name="date"/>
+                           </tree>
+                           <form string="Bank Statement">
+                               <field name="name"/>
+                               <field name="sequence"/>
+                               <field name="date"/>
+                               <field name="partner_id"/>
+                               <field name="account_id"/>
+                               <field name="type"/>
+                               <field name="statement_id"/>
+                               <field name="reconcile_id"/>
+                               <field name="amount"/>
+                               <field name="reconcile_amount"/>
+                           </form>
+                       </field>
+                       <field name="state" colspan="1"/>
+                       <group col="8" colspan="2">
+                           <button name="button_bought" string="Sold" states="draft" type="object" icon="gtk-jump-to"/>
+                           <button name="button_not_bought" string="Not sold" states="draft" type="object" icon="gtk-undo"/>
+                           <button name="button_taken_away" string="Taken away" states="sold" type="object" icon="gtk-goto-last"/>
+                           <button name="button_unpaid" string="Set to draft" states="sold,unsold,paid" type="object" icon="gtk-convert"/>
+                       </group> 
+                    </page>
+                    <page string="Seller">
+                        <separator string="Seller information" colspan="4"/>
+                        <field name="vnd_lim"/>
+                        <field name="vnd_lim_net"/>
+                        <field name="sel_inv_id"/>
+                        <field name="paid_vnd"/>
+                        <field name="history_ids" colspan="4" readonly="1" nolabel="1">
+                            <tree string="History">
+                                <field name="name"/>
+                                <field name="lot_id"/>
+                                <field name="auction_id"/>
+                                <field name="price"/>
+                            </tree>
+                        </field>
+                     </page>
+                     <page string="Bids">
+                         <field name="bid_lines" colspan="4" nolabel="1" editable="top">
+                             <tree string="Bids"  editable="top">
+                                 <field name="bid_id"/>
+                                 <field name="price"/>
+                                 <field name="call"/>
+                             </tree>
+                             <form string="Bids" >
+                                 <field name="bid_id"/>
+                                 <field name="lot_id" domain="[('auction_id','=',parent['auction_id'])]" on_change="onchange_name(lot_id)"/>
+                                 <field name="price"/>
+                                 <field name="call"/>
+                             </form>
+                         </field>
+                     </page>
+                     <page string="Note">
+                         <field name="obj_desc" colspan="4" nolabel="1"/>
+                     </page>
                  </notebook>
-             </form>
+            </form>
+         </field>
+     </record>
+     
+     <record id="view_auction_lots_filter" model="ir.ui.view">
+          <field name="name">Auction Lots search</field>
+          <field name="model">auction.lots</field>
+          <field name="type">search</field>
+          <field name="arch" type="xml">
+              <search string="Search Auction Lots">
+                  <filter icon="terp-document-new"
+                      string="Draft"  help="New Object"
+                      name="draft"
+                      domain="[('state','=', 'draft')]"/>
+                  <filter icon="terp-dolar_ok!"
+                      string="Sold"  help="Buy object"
+                      domain="[('state','=','sold')]"/>
+                  <separator orientation="vertical"/>
+                  <field name="name" string="Object Name"/>
+                  <field name="lot_type"/>
+                  <field name="state"/>
+                  <newline/>
+                  <group expand="0" string="Group By..." colspan="16">
+                      <filter string="Buyer"
+                          icon="terp-personal"
+                          help="Buyer" domain="[]"
+                          context="{'group_by':'ach_uid'}"/>
+                      <separator orientation="vertical" />
+                      <filter string="Auction"
+                          icon="terp-purchase"
+                          help="Auction" domain="[]"
+                          context="{'group_by':'auction_id'}"/>
+                      <filter string="Inventory"
+                          icon="terp-purchase"
+                          help="Depositer Inventory" domain="[]"
+                          context="{'group_by':'bord_vnd_id'}"/>
+                      <separator orientation="vertical" />
+                      <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
+                      <filter string="Type"
+                          icon="terp-stock_symbol-selection"
+                          help="Object Category" domain="[]"
+                          context="{'group_by':'lot_type'}"/>
+                  </group>
+              </search>
+         </field>
+     </record>
+   
+   <!-- Graph view for Auction Lots -->  
+     
+     <record model="ir.ui.view" id="auction_lot_graph">
+         <field name="name">Auction lots</field>
+         <field name="model">auction.lots</field>
+         <field name="type">graph</field>
+         <field name="arch" type="xml">
+             <graph string="Lots" type="bar">
+                 <field name="lot_type"/>
+                 <field name="lot_est1" operator="+"/>
+                 <field name="lot_est2" operator="+"/>
+                 <field name="obj_price" operator="+"/>
+             </graph>
          </field>
      </record>
  
      </record>
  
      <menuitem name="Objects" parent="auction_menu_root" id="auction_objects_menu" sequence="2"/>
--    <menuitem name="All objects" action="action_all_objects" parent="auction_objects_menu" id="auction_all_objects_menu"/>
--
-     <record model="ir.actions.act_window" id="action_all_objects_to_sell">
-         <field name="name">Objects to sell</field>
-         <field name="res_model">auction.lots</field>
-         <field name="view_type">form</field>
-         <field name="view_mode">tree,form</field>
-         <field name="domain">[('state','&lt;&gt;','sold')]</field>
-         <field name="filter" eval="True"/>
-     </record>
-     <record model="ir.actions.act_window" id="action_all_objects_unplanned">
-         <field name="name">Unplanned objects</field>
-         <field name="res_model">auction.lots</field>
-         <field name="view_type">form</field>
-         <field name="view_mode">tree,form</field>
-         <field name="domain">[('auction_id','=', False),('state','=','draft')]</field>
-         <field name="filter" eval="True"/>
-     </record>
-     <!--        for the sold object  start-->
-     <record model="ir.actions.act_window" id="action_all_objects_unsold">
-         <field name="name">Unsold objects</field>
-         <field name="res_model">auction.lots</field>
-         <field name="view_type">form</field>
-         <field name="domain">[('state','=','unsold')]</field>
-         <field name="filter" eval="True"/>
-     </record>
--    <!-- form3: simplified form meant for during the sale (action button in dates) -->
--    <!--form par defaut-->
-     <record model="ir.ui.view" id="auction_lots_sell_form">
-         <field name="name">auction.lots.form3</field>
-         <field name="model">auction.lots</field>
-         <field name="type">form</field>
-         <field name="arch" type="xml">
-             <form string="Auction">
-                 <notebook>
-                 <page string="Auction">
-                     <field name="obj_num" readonly="1" select="1"/>
-                     <field name="auction_id"/>
-                     <field name="obj_price" select="1"/>
-                     <field name="ach_login" select="1" comparator="="/>
-                     <field name="ach_emp"/>
-                     <field name="obj_comm"/>
-                     <field name="obj_ret" on_change="onchange_obj_ret(obj_ret)"/>
-                     <newline/>
-                     <field name="name" readonly="1" select="1"/>
-                     <field name="name2" readonly="2" select="1"/>
-                     <field name="artist_id" readonly="1"/>
-                     <field name="author_right" domain="[('domain','=','sabam'),('parent_id','=',False),('type_tax_use','&lt;&gt;','sale')]"/>
-                     <newline/>
-                     <field name="buyer_price"/>
-                     <field name="is_ok" select="1"/>
-                     <field name="obj_desc" readonly="1" colspan="4"/>
-                     <field name="lot_est1" readonly="1"/>
-                     <field name="lot_est2" readonly="1"/>
-                     <field name="vnd_lim" readonly="1"/>
-                     <field name="vnd_lim_net"/>
-                     <field name="bid_lines" colspan="4" readonly="1">
-                         <tree string="Bids">
-                             <field name="name"/>
-                             <field name="bid_id"/>
-                             <field name="price"/>
-                             <field name="call"/>
-                         </tree>
-                     </field>
-                     <field name="state" readonly="1"/>
-                     <group colspan="2" col="4">
-                         <button name="button_bought" string="Sold" states="draft" type="object" icon="gtk-jump-to" />
-                         <button name="button_not_bought" string="Not sold" states="draft" type="object" icon="gtk-undo"/>
-                         <button name="button_draft" string="Set to draft" states="sold,unsold" type="object" icon="gtk-convert"/>
-                         <button name="button_taken_away" string="Taken away" states="sold" type="object" icon="gtk-goto-last"/>
-                     </group>
-                 </page>
-                 <page string="Statements">
-                     <field name="statement_id" domain="[('state','=','draft')]" colspan="4" nolabel="1"
-                         widget="one2many_list">
-                         <tree string="Payment's history" editable="top">
-                             <field name="name"/>
-                             <field name="amount"/>
-                             <field name="date"/>
-                 </tree>
-                     </field>
-                 </page>
-             </notebook>
-             </form>
-         </field>
-     </record>
-     =======================================================
-     Auction Management/seller
-     =======================================================
-     <record model="ir.actions.act_window" id="action_unclassified_objects">
-         <field name="name">Unclassified objects</field>
-         <field name="res_model">report.unclassified.objects</field>
-         <field name="view_type">form</field>
-         <field name="view_mode">tree,form</field>
-         <field name="filter" eval="True"/>
-      </record>
-     <record model="ir.ui.view" id="v12">
-         <field name="name">Auction.deposit.tree</field>
-         <field name="model">auction.deposit</field>
-         <field name="type">tree</field>
-         <field name="arch" type="xml">
-             <tree string="Deposit Border">
-                 <field name="name"/>
-                 <field name="partner_id"/>
-                 <field name="date_dep"/>
-             </tree>
-         </field>
-     </record>
 -    
 -<!--    <record model="ir.ui.view" id="auction_lots_sell_form">-->
 -<!--        <field name="name">auction.lots.form3</field>-->
 -<!--        <field name="model">auction.lots</field>-->
 -<!--        <field name="type">form</field>-->
 -<!--        <field name="arch" type="xml">-->
 -<!--            <form string="Auction">-->
 -<!--                <notebook>-->
 -<!--                <page string="Auction">-->
 -<!--                    <field name="obj_num" readonly="1" select="1"/>-->
 -<!--                    <field name="auction_id"/>-->
 -<!--                    <field name="obj_price" select="1"/>-->
 -<!--                    <field name="ach_login" select="1" comparator="="/>-->
 -<!--                    <field name="ach_emp"/>-->
 -<!--                    <field name="obj_comm"/>-->
 -<!--                    <field name="obj_ret" on_change="onchange_obj_ret(obj_ret)"/>-->
 -<!--                    <newline/>-->
 -<!--                    <field name="name" readonly="1" select="1"/>-->
 -<!--                    <field name="name2" readonly="2" select="1"/>-->
 -<!--                    <field name="artist_id" readonly="1"/>-->
 -<!--                    <field name="author_right" domain="[('domain','=','sabam'),('parent_id','=',False),('type_tax_use','&lt;&gt;','sale')]"/>-->
 -<!--                    <newline/>-->
 -<!--                    <field name="buyer_price"/>-->
 -<!--                    <field name="is_ok" select="1"/>-->
 -<!--                    <field name="obj_desc" readonly="1" colspan="4"/>-->
 -<!--                    <field name="lot_est1" readonly="1"/>-->
 -<!--                    <field name="lot_est2" readonly="1"/>-->
 -<!--                    <field name="vnd_lim" readonly="1"/>-->
 -<!--                    <field name="vnd_lim_net"/>-->
 -<!--                    <field name="bid_lines" colspan="4" readonly="1">-->
 -<!--                        <tree string="Bids">-->
 -<!--                            <field name="name"/>-->
 -<!--                            <field name="bid_id"/>-->
 -<!--                            <field name="price"/>-->
 -<!--                            <field name="call"/>-->
 -<!--                        </tree>-->
 -<!--                    </field>-->
 -<!--                    <field name="state" readonly="1"/>-->
 -<!--                    <group colspan="2" col="4">-->
 -<!--                        <button name="button_bought" string="Sold" states="draft" type="object" icon="gtk-jump-to" />-->
 -<!--                        <button name="button_not_bought" string="Not sold" states="draft" type="object" icon="gtk-undo"/>-->
 -<!--                        <button name="button_draft" string="Set to draft" states="sold,unsold" type="object" icon="gtk-convert"/>-->
 -<!--                        <button name="button_taken_away" string="Taken away" states="sold" type="object" icon="gtk-goto-last"/>-->
 -<!--                    </group>-->
 -<!--                </page>-->
 -<!--                <page string="Statements">-->
 -<!--                    <field name="statement_id" domain="[('state','=','draft')]" colspan="4" nolabel="1"-->
 -<!--                        widget="one2many_list">-->
 -<!--                        <tree string="Payment's history" editable="top">-->
 -<!--                            <field name="name"/>-->
 -<!--                            <field name="amount"/>-->
 -<!--                            <field name="date"/>-->
 -<!--                        </tree>-->
 -<!--                    </field>-->
 -<!--                </page>-->
 -<!--            </notebook>-->
 -<!--            </form>-->
 -<!--        </field>-->
 -<!--    </record>-->
 -
++    <menuitem name="Objects" action="action_all_objects" parent="auction_objects_menu" id="auction_all_objects_menu"/>
  
      <record model="ir.ui.view" id="view_deposit_border_form">
          <field name="name">auction.deposit.form</field>
          <field name="arch" type="xml">
              <tree string="Bids">
                  <field name="bid_id"/>
--            <!--    <field name="lot_id"/>-->
                  <field name="price"/>
                  <field name="call"/>
                  <field name="auction"/>
                  <field name="lot_id" domain="[('auction_id','=',parent['auction_id'])]" on_change="onchange_name(lot_id)" colspan="4"/>
                  <field name="call" colspan="4" select="1"/>
                  <field name="price"/>
--                <!--field name="auction"/-->
              </form>
          </field>
      </record>
          id="act_auction_lot_open_deposit"/>
  
  </data>
- </openerp>
+ </openerp> 
 - 
++ 
                        <street2 type="field" name="address.street2"/>
                        <zip type="field" name="address.zip"/>
                        <city type="field" name="address.city"/>
--                      <!--<country type="field" name="address.country.name"/>-->
                        <phone type="field" name="address.phone"/>
                        <mobile type="field" name="address.mobile"/>
                </client_info>
                <objects>
                        <cost type="call" name="compute_buyer_costs" args="">
                                        <amount value="amount"/>
                        </cost>
  
--                      <!--<cost type="field" name="auction_id.buyer_costs"/>
--                                      <name value="name"/>
--                                      <amount value="amount"/>
--                      </cost>-->
--
--
--                      <!--<cost type="call" name="compute_buyer_costs" args="">
--                              <name value="name"/>
--                                      <amount value="amount"/>
--                      </cost>-->
--
--
--
--
  
                        <object type="fields" name="obj_num,id">
                                <id type="field" name="id"/>
                                <barcode type="field" name="id" addchecksum="false" print-text="true"/>
--                              <!--<barcode value="id" addchecksum="false" print-text="true"/>
---->
++                              
                                <cost type="call" name="compute_buyer_costs" args="">
--                                      <!--<id value="id"/>-->
                                        <amount value="amount"/>
                                </cost>
                                <barcode type="field" name="id"/>
@@@ -1,8 -1,8 +1,9 @@@
  <?xml version="1.0" encoding="utf-8"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
  
-       <xsl:import href="../../base/report/corporate_defaults.xsl"/>
-       <xsl:import href="../../base/report/rml_template.xsl"/>
 -      <xsl:import href="base/report/corporate_defaults.xsl"/>
 -      <xsl:import href="/home/atp/workspace/trunk/server/bin/addons/base/report/rml_template.xsl"/>
++      <!-- TOFIX: Path Problem -->
++    <xsl:import href="corporate_defaults.xsl"/>
++      <xsl:import href="rml_template.xsl"/>
  
  
  
  <?xml version="1.0" encoding="utf-8"?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
-       <xsl:import href="../../base/report/corporate_defaults.xsl"/>
-       <xsl:import href="../../base/report/rml_template.xsl"/>
-       <xsl:template match="/">
-               <xsl:call-template name="rml"/>
-       </xsl:template>
-       <xsl:template name="stylesheet">
-               <paraStyle name="login-title" fontName="Helvetica" fontSize="12"/>
-               <paraStyle name="login" fontName="Helvetica-Bold" fontSize="16"/>
-               <blockTableStyle id="objects">
-                        <blockFont name="Helvetica-BoldOblique" size="12" start="0,0" stop="-1,0"/>
-                        <blockValign value="TOP"/>
-                        <blockAlignment value="RIGHT" start="-1,0" stop="-1,-1"/>
-                        <lineStyle kind="LINEBELOW" start="0,0" stop="-1,0"/>
-               </blockTableStyle>
-               <blockTableStyle id="object-totals">
-                        <blockValign value="TOP"/>
-                        <blockAlignment value="RIGHT"/>
-                        <lineStyle kind="LINEABOVE" start="-1,0" stop="-1,0"/>
-                        <lineStyle kind="LINEABOVE" start="-1,-1" stop="-1,-1"/>
-               </blockTableStyle>
-       </xsl:template>
-       <xsl:template name="story">
-               <xsl:apply-templates select="borderform-list"/>
-       </xsl:template>
-       <xsl:template match="borderform-list">
-               <xsl:apply-templates select="borderform">
-                       <xsl:sort order="ascending" select="client_info/name"/>
-               </xsl:apply-templates>
-       </xsl:template>
-       <xsl:template match="client_info">
-               <para>
-                       <b>
-                               <xsl:value-of select="title" />
-                               <xsl:text> </xsl:text>
-                               <xsl:value-of select="name"/>
-                       </b>
-               </para>
-               <para><xsl:value-of select="street"/></para>
-               <para><xsl:value-of select="street2"/></para>
-               <para>
-                       <xsl:value-of select="zip"/>
-                       <xsl:text> </xsl:text>
-                       <xsl:value-of select="city"/>
-               </para>
- <!--          <para><xsl:value-of select="country"/></para>-->
-       </xsl:template>
-       <xsl:template match="borderform">
-               <xsl:apply-templates select="client_info"/>
-               <setNextTemplate name="other_pages"/>
-               <nextFrame/>
-               <para style="login-title" t="1">Plate Number:</para>
-               <para style="login"><xsl:value-of select="login"/></para>
-               <spacer length="1cm"/>
-               <para>
-                       <b t="1">Document</b>: <xsl:text t="1">Buyer form</xsl:text>
-               </para><para>
-                       <b t="1">Auction</b>: <xsl:value-of select="title"/>
-               </para>
-               <xsl:if test="client_info">
-                       <para>
-                               <b t="1">Customer Contact</b>:
-                               <xsl:value-of select="client_info/phone"/>
-                               <xsl:if test="number(string-length(client_info/mobile) &gt; 0) + number(string-length(client_info/phone) &gt; 0) = 2">
-                                       <xsl:text> - </xsl:text>
-                               </xsl:if>
-                               <xsl:value-of select="client_info/mobile"/>
-                       </para><para>
-                               <b t="1">Customer Reference</b>: <xsl:value-of select="client_info/ref"/>
-                       </para>
-               </xsl:if>
-               <spacer length="1cm"/>
-               <xsl:apply-templates select="objects"/>
-               <setNextTemplate name="first_page"/>
-               <pageBreak/>
-       </xsl:template>
-       <xsl:template match="objects">
-               <blockTable colWidths="3.1cm,1.8cm,9.6cm,1.5cm,2.2cm" style="objects">
-                       <tr>
-                               <td/>
-                               <td t="1">Cat. N.</td>
-                               <td t="1">Description</td>
-                               <td t="1">Paid</td>
-                               <td t="1">Adj.(EUR)</td>
-                       </tr>
-                       <xsl:apply-templates select="object"/>
-               </blockTable>
-               <condPageBreak height="3.2cm"/>
-               <blockTable colWidths="3.1cm,1.8cm,9.6cm,1.5cm,2.2cm" style="object-totals">
-                       <tr>
-                               <td/>
-                               <td/>
-                               <td/>
-                               <td t="1">Subtotal:</td>
-                               <td><xsl:value-of select="format-number(sum(object[price != '']/price), '#,##0.00')"/></td>
-                       </tr>
-                       <xsl:apply-templates select="cost"/>
-                       <tr>
-                               <td/>
-                               <td/>
-                               <td/>
-                               <td t="1">Total:</td>
-                               <td><xsl:value-of select="format-number(sum(object[price != '']/price) + sum(cost/amount), '#,##0.00')"/></td>
-                       </tr>
-               </blockTable>
-       </xsl:template>
-       <xsl:template match="cost">
-               <tr>
-                       <td/>
-                       <td/>
-                       <td/>
-                       <td><xsl:value-of select="name"/>:</td>
-                       <td><xsl:value-of select="format-number(amount, '#,##0.00')"/></td>
-               </tr>
-       </xsl:template>
-       <xsl:template match="object">
-               <tr>
-                       <td>
-                               <xsl:if test="image">
-                                       <image width="2.5cm" height="2.2cm">
-                                               <xsl:attribute name="name"><xsl:value-of select="image"/></xsl:attribute>
-                                       </image>
-                               </xsl:if>
-                       </td>
-                       <td><xsl:value-of select="ref"/></td>
-                       <td>
-                               <para>
-                                       <b><xsl:value-of select="title"/><xsl:text>. </xsl:text></b>
-                                       <xsl:value-of select="desc"/>
-                               </para>
-                       </td>
-                       <td><xsl:if test="state='paid'"><xsl:text>X</xsl:text></xsl:if></td>
-                       <td>
-                               <xsl:if test="price!=''">
-                                       <xsl:value-of select="format-number(price, '#,##0.00')"/>
-                               </xsl:if>
-                       </td>
-               </tr>
-       </xsl:template>
- </xsl:stylesheet>
+ <xsl:stylesheet version="1.0"
+     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+     xmlns:fo="http://www.w3.org/1999/XSL/Format">
 -   <xsl:import href="../../base/report/corporate_defaults.xsl" />
++   <!-- TOFIX: Path Problem
++    <xsl:import href="../../base/report/corporate_defaults.xsl" /> -->
+     <xsl:template match="/">
+         <xsl:call-template name="rml" />
+     </xsl:template>
+     <xsl:template name="rml" match="/">
+         <document filename="example.pdf">
+             <template>
+                 <pageTemplate id="first">
+                     <frame id="first" x1="1cm" y1="2.5cm" width="19.0cm" height="23.0cm"/>
+                     <pageGraphics>
+                         <xsl:apply-imports />
+                     </pageGraphics>
+                 </pageTemplate>
+             </template>
+             <stylesheet>
+                 <paraStyle name="normal" fontName="Times-Roman" fontSize="12"  />
+                 <paraStyle name="title" fontName="Times-Bold" fontSize="15" alignment="center" />
+                 <paraStyle name="table_title" fontName="Times-Bold" fontSize="12" alignment="center" />
+                 <paraStyle name="product1" fontName="Times-Roman" fontSize="8" />
+                 <paraStyle name="categ" fontName="Times-Bold" fontSize="10"  textColor="blue"/>
+                 <paraStyle name="price" fontName="Times-Roman" fontSize="8" alignment="right" />
+                 <blockTableStyle id="main_title">
+                     <blockAlignment value="CENTER" />
+                     <lineStyle kind="GRID" colorName="black"/>
+                     <blockBackground colorName="#e6e6e6" />
+                     <blockValign value="TOP"/>
+                 </blockTableStyle>
+                 <blockTableStyle id="product">
+                     <blockAlignment value="LEFT" />
+                     <xsl:for-each select="/report/title">
+                         <xsl:variable name="col" select="attribute::number" />
+                         <blockBackground>
+                             <xsl:attribute name="colorName">#e6e6e6</xsl:attribute>
+                             <xsl:attribute name="start">
+                                 <xsl:value-of select="$col" />
+                                 <xsl:text>,0</xsl:text>
+                             </xsl:attribute>
+                             <xsl:attribute name="stop">
+                                 <xsl:value-of select="$col" />
+                                 <xsl:text>,0</xsl:text>
+                             </xsl:attribute>
+                         </blockBackground>
+                     </xsl:for-each>
+                     <lineStyle kind="LINEABOVE" colorName="black" start="0,0" stop="-1,-1" />
+                     <lineStyle kind="LINEBEFORE" colorName="black" start="0,0" stop="-1,-1"/>
+                     <lineStyle kind="LINEAFTER" colorName="black" start="-1,0" stop="-1,-1"/>
+                     <lineStyle kind="LINEBELOW" colorName="black" start="0,-1" stop="-1,-1"/>
+                     <blockValign value="TOP"/>
+                 </blockTableStyle>
+             </stylesheet >
+             <story>
+                 <xsl:call-template name="story"/>
+             </story>
+         </document>
+     </xsl:template>
@@@ -35,6 -35,6 +35,7 @@@ import base6
  import wizard
  import photo_shadow
  from tools import config
++import addons
  
  def _to_unicode(s):
      try:
@@@ -64,16 -64,16 +65,13 @@@ def _to_decode(s)
  class auction_catalog(report_rml):
  
      def create_xml(self, cr, uid, ids, data, context):
--
          xml = self.catalog_xml(cr, uid, ids, data, context)
--        temp=self.post_process_xml_data(cr, uid, xml, context)
++        temp = self.post_process_xml_data(cr, uid, xml, context)
  
          return temp
      def catalog_xml(self, cr, uid, ids, data, context, cwid="0"):
          impl = minidom.getDOMImplementation()
--
          doc = impl.createDocument(None, "report", None)
--
          catalog=doc.createElement('catalog')
          doc.documentElement.appendChild(catalog)
  
          commdb='comm'
          tab_avoid = []
          tab_no_photo=[]
--        for id in ids:
--            lot_ids=pooler.get_pool(cr.dbname).get('auction.lots').search(cr, uid, [('auction_id', '=', id)])
--            ab=pooler.get_pool(cr.dbname).get('auction.lots').read(cr, uid, lot_ids, ['auction_id','name','lot_num','lot_est1','lot_est2'], context)
--            auction_dates_ids = [x["auction_id"][0] for x in ab]
++        auction_lot_pool = pooler.get_pool(cr.dbname).get('auction.lots')
++        auction_dates_pool = pooler.get_pool(cr.dbname).get('auction.dates')
++        for auction in auction_dates_pool.browse(cr, uid, ids, context=context):
++            auction_lot_ids = auction_lot_pool.search(cr, uid, [('auction_id', '=', auction.id)])
++            #for lot in auction_lot_pool.browse(cr, uid, auction_lot_ids, context=context):
++            #    ab=pooler.get_pool(cr.dbname).get('auction.lots').read(cr, uid, lot_ids, ['auction_id','name','lot_num','lot_est1','lot_est2'], context)
++            #auction_dates_ids = [x["auction_id"][0] for x in ab]
  
              # name emelment
              key = 'name'
              categ = doc.createElement(key)
--            categ.appendChild(doc.createTextNode(_to_decode(res[0]["name"])))
++            categ.appendChild(doc.createTextNode(_to_decode(auction.name)))
              catalog.appendChild(categ)
  
               #Auctuion Date element
              categ = doc.createElement("AuctionDate1")
--            categ.appendChild(doc.createTextNode(_to_decode(res[0]['auction1'])))
++            categ.appendChild(doc.createTextNode(_to_decode(auction.auction1)))
              catalog.appendChild(categ)
  
              # Action Date 2 element
              categ = doc.createElement("AuctionDate2")
--            categ.appendChild(doc.createTextNode(_to_decode(res[0]['auction2'])))
++            categ.appendChild(doc.createTextNode(_to_decode(auction.auction2)))
              catalog.appendChild(categ)
  
--    #         promotion element
++            # promotion element
              promo = doc.createElement('promotion1')
--            fp = file(config['addons_path']+'/auction/report/images/flagey_logo.jpg','r')
++            fp = file(addons.get_module_resource('auction','report', 'images', 'flagey_logo.jpg'),'r')
              file_data = fp.read()
              promo.appendChild(doc.createTextNode(base64.encodestring(file_data)))
              catalog.appendChild(promo)
              promo = doc.createElement('promotion2')
--            fp = file(config['addons_path']+'/auction/report/images/flagey_logo.jpg','r')
++            fp = file(addons.get_module_resource('auction','report', 'images', 'flagey_logo.jpg'),'r')
              file_data = fp.read()
              promo.appendChild(doc.createTextNode(base64.encodestring(file_data)))
              catalog.appendChild(promo)
              catalog.appendChild(products)
              side = 0
              length = 0
--            auction_ids = []
--            for test in ab:
--                if test.has_key('auction_id'):
--                    auction_ids.append(test['auction_id'][0])
--            cr.execute('select * from auction_lots where auction_id IN %s',(tuple(auction_ids),))
--            res = cr.dictfetchall()
--            for cat in res:
--                product =doc.createElement('product')
++            for cat in auction_lot_pool.browse(cr, uid, auction_lot_ids, context=context):
++                product = doc.createElement('product')
                  products.appendChild(product)
--                if cat['obj_desc']:
++                if cat.obj_desc:
                      infos = doc.createElement('infos')
--                    lines = re.split('<br/>|\n', _to_unicode(cat['obj_desc']))
++                    lines = re.split('<br/>|\n', _to_unicode(cat.obj_desc))
                      for line in lines:
                          xline = doc.createElement('info')
                          xline.appendChild(doc.createTextNode(_to_decode(line)))
                          infos.appendChild(xline)
                      product.appendChild(infos)
--                    if cat['lot_num']:
++                    if cat.lot_num:
                          lnum = doc.createElement('lot_num')
--                        lnum.appendChild(doc.createTextNode(_to_decode(str(cat['lot_num']))))
++                        lnum.appendChild(doc.createTextNode(_to_decode(str(cat.lot_num))))
                          infos.appendChild(lnum)
  
--                    if cat['image']:
++                    if cat.image:
                          import random
                          import tempfile
                          limg = doc.createElement('photo_small')
  
                          file_name = tempfile.mktemp(prefix='openerp_auction_', suffix='.jpg')
                          fp = file(file_name, 'w')
--                        content = base64.decodestring(cat['image'])
++                        content = base64.decodestring(cat.image)
                          fp.write(content)
                          fp.close()
                          fp = file(file_name,'r')
                          limg.appendChild(doc.createTextNode(test_data))
                          infos.appendChild(limg)
  
--                for key in ('lot_est1','lot_est2'):
++                if cat.lot_est1:
                      ref2 = doc.createElement(key)
--                    ref2.appendChild(doc.createTextNode( _to_decode(str(cat[key] or 0.0))))
++                    ref2.appendChild(doc.createTextNode( _to_decode(str(cat.lot_est1 or 0.0))))
                      product.appendChild(ref2)
++                if cat.lot_est2:
++                    ref2 = doc.createElement(key)
++                    ref2.appendChild(doc.createTextNode( _to_decode(str(cat.lot_est2 or 0.0))))
++                    product.appendChild(ref2)
++
                  oldlength = length
                  length += 2.0
                  if length>23.7:
                      ref4 = doc.createElement('side')
                      ref4.appendChild(doc.createTextNode( "1" ))
                      product.appendChild(ref4)
--                xml1 = doc.toxml()
++        xml1 = doc.toxml()
          return xml1
  auction_catalog('report.auction.cat_flagy', 'auction.dates','','addons/auction/report/catalog2.xsl')
  
index 0000000,0000000..4140714
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,96 @@@
++<?xml version = '1.0' encoding="utf-8"?>
++
++<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
++      <xsl:variable name="signature" select="//corporate-header/user/signature"/>
++      <xsl:variable name="title">Open ERP Report</xsl:variable>
++      <xsl:variable name="leftMargin">1cm</xsl:variable>
++      <xsl:variable name="rightMargin">1cm</xsl:variable>
++      <xsl:variable name="topMargin">1cm</xsl:variable>
++      <xsl:variable name="bottomMargin">1cm</xsl:variable>
++      <xsl:variable name="pageSize">21cm,29.7cm</xsl:variable>
++
++      <xsl:variable name="page_format">a4_letter</xsl:variable>
++
++      <xsl:template name="first_page_graphics_corporation">
++              <!--logo-->
++              <setFont name="Helvetica" size="14"/>
++              <fill color="black"/>
++              <stroke color="black"/>
++              <drawString x="1cm" y="27.6cm"><xsl:value-of select="//corporate-header/corporation/name"/></drawString>
++              <lines>1cm 28.4cm 20cm 28.4cm</lines>
++              <lines>1cm 25.4cm 7cm 25.4cm</lines>
++
++              <setFont name="Helvetica" size="10"/>
++              <drawRightString x="20cm" y="28.5cm"><xsl:value-of select="//corporate-header/corporation/rml_header1"/></drawRightString>
++              <drawString x="1cm" y="27cm"><xsl:value-of select="//corporate-header/corporation/address/street"/></drawString>
++              <drawString x="1cm" y="26.5cm">
++                      <xsl:value-of select="//corporate-header/corporation/address/zip"/>
++                      <xsl:text> </xsl:text>
++                      <xsl:value-of select="//corporate-header/corporation/address/city"/>
++                      <xsl:text> - </xsl:text>
++                      <xsl:value-of select="//corporate-header/corporation/address/country"/>
++              </drawString>
++              <drawString x="1cm" y="26cm">Phone:</drawString>
++              <drawRightString x="7cm" y="26cm"><xsl:value-of select="//corporate-header/corporation/address/phone"/></drawRightString>
++              <drawString x="1cm" y="25.5cm">Mail:</drawString>
++              <drawRightString x="7cm" y="25.5cm"><xsl:value-of select="//corporate-header/corporation/address/email"/></drawRightString>
++
++
++              <!--page bottom-->
++
++              <lines>1.5cm 2.2cm 19.9cm 2.2cm</lines>
++              <drawCentredString x="10.5cm" y="1.7cm"><xsl:value-of select="//corporate-header/corporation/rml_footer1"/></drawCentredString>
++              <drawCentredString x="10.5cm" y="1.25cm"><xsl:value-of select="//corporate-header/corporation/rml_footer2"/></drawCentredString>
++              <drawCentredString x="10.5cm" y="0.8cm">Your contact : <xsl:value-of select="//corporate-header/user/name"/></drawCentredString>
++
++      </xsl:template>
++
++
++      <xsl:template name="other_pages_graphics_corporation">
++              <!--logo-->
++              <setFont name="Helvetica" size="14"/>
++              <fill color="black"/>
++              <stroke color="black"/>
++              <drawString x="1cm" y="27.6cm"><xsl:value-of select="//corporate-header/corporation/name"/></drawString>
++              <lines>1cm 25.4cm 20cm 25.4cm</lines>
++<!--          <lines>1cm 25.7cm 7cm 25.7cm</lines>-->
++
++              <setFont name="Helvetica" size="10"/>
++              <drawRightString x="1cm" y="27.5cm"><xsl:value-of select="//corporate-header/corporation/rml_header1"/></drawRightString>
++              <drawString x="1cm" y="27cm"><xsl:value-of select="//corporate-header/corporation/address/street"/></drawString>
++              <drawString x="1cm" y="26.5cm">
++                      <xsl:value-of select="//corporate-header/corporation/address/zip"/>
++                      <xsl:text> </xsl:text>
++                      <xsl:value-of select="//corporate-header/corporation/address/city"/>
++                      <xsl:text> - </xsl:text>
++                      <xsl:value-of select="//corporate-header/corporation/address/country"/>
++              </drawString>
++              <drawString x="1cm" y="26cm">Phone:</drawString>
++              <drawRightString x="7cm" y="26cm"><xsl:value-of select="//corporate-header/corporation/address/phone"/></drawRightString>
++              <drawString x="1cm" y="25.5cm">Mail:</drawString>
++              <drawRightString x="7cm" y="25.5cm"><xsl:value-of select="//corporate-header/corporation/address/email"/></drawRightString>
++
++              <!--page bottom-->
++
++              <lines>1.5cm 1.2cm 19.9cm 1.2cm</lines>
++              <drawCentredString x="10.5cm" y="1.7cm"><xsl:value-of select="//corporate-header/corporation/rml_footer1"/></drawCentredString>
++              <drawCentredString x="10.5cm" y="1.25cm"><xsl:value-of select="//corporate-header/corporation/rml_footer2"/></drawCentredString>
++<!--          <drawCentredString x="10.5cm" y="0.8cm">Your contact : <xsl:value-of select="//corporate-header/user/name"/></drawCentredString>-->
++      </xsl:template>
++
++      <xsl:template name="first_page_frames">
++              <xsl:if test="$page_format='a4_normal'">
++                      <frame id="main" x1="1cm" y1="2.5cm" width="19.0cm" height="22.0cm"/>
++              </xsl:if>
++
++              <xsl:if test="$page_format='a4_letter'">
++                      <frame id="address" x1="11cm" y1="21.5cm" width="6cm" height="4cm"/>
++                      <frame id="main" x1="1cm" y1="2.5cm" width="19.0cm" height="17.5cm"/>
++              </xsl:if>
++      </xsl:template>
++
++      <xsl:template name="other_pages_frames">
++              <frame id="main" x1="1cm" y1="2.5cm" width="19.0cm" height="22cm"/>
++      </xsl:template>
++
++</xsl:stylesheet>
@@@ -1,7 -1,7 +1,7 @@@
  <?xml version="1.0" encoding="utf-8"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
--      <xsl:import href="../../base/report/corporate_defaults.xsl"/>
--      <xsl:import href="../../base/report/rml_template.xsl"/>
++      <xsl:import href="corporate_defaults.xsl"/>
++      <xsl:import href="rml_template.xsl"/>
  
        <xsl:template match="/">
                <xsl:call-template name="rml"/>
index 0000000,0000000..2725dce
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,70 @@@
++<?xml version = '1.0' encoding="utf-8"?>
++
++<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
++
++      <xsl:template name="first_page_graphics_report"/>
++      <xsl:template name="other_pages_graphics_report"/>
++<!--  
++      <xsl:template name="first_page_graphics_corporation"/>
++      <xsl:template name="other_pages_graphics_corporation"/>
++      
++      <xsl:template name="first_page_frames"/>
++      <xsl:template name="other_pages_frames"/>
++-->
++      <xsl:template name="rml">
++              <document>
++                      <template author="Generated by OpenERP, Fabien Pinckaers">
++                              <xsl:attribute name="pageSize">
++                                      <xsl:value-of select="$pageSize"/>
++                              </xsl:attribute>
++
++                              <xsl:attribute name="leftMargin">
++                                      <xsl:value-of select="$leftMargin"/>
++                              </xsl:attribute>
++
++                              <xsl:attribute name="rightMargin">
++                                      <xsl:value-of select="$rightMargin"/>
++                              </xsl:attribute>
++                              
++                              <xsl:attribute name="topMargin">
++                                      <xsl:value-of select="$topMargin"/>
++                              </xsl:attribute>
++                              
++                              <xsl:attribute name="bottomMargin">
++                                      <xsl:value-of select="$bottomMargin"/>
++                              </xsl:attribute>
++
++                              <xsl:attribute name="title">
++                                      <xsl:value-of select="$title"/>
++                              </xsl:attribute>
++                              
++                              <pageTemplate id="first_page">
++                                      <pageGraphics>
++                                              <xsl:call-template name="first_page_graphics_corporation"/>
++                                              <xsl:call-template name="first_page_graphics_report"/>
++                                      </pageGraphics>
++
++                                      <xsl:call-template name="first_page_frames"/>
++                              </pageTemplate>
++
++                              <pageTemplate id="other_pages">
++                                      <pageGraphics>
++                                              <xsl:call-template name="other_pages_graphics_corporation"/>
++                                              <xsl:call-template name="other_pages_graphics_report"/>
++                                      </pageGraphics>
++                                      
++                                      <xsl:call-template name="other_pages_frames"/>
++                              </pageTemplate>
++                      </template>
++
++              <stylesheet>
++                      <xsl:call-template name="stylesheet"/>
++              </stylesheet>
++
++              <story>
++                      <xsl:call-template name="story"/>
++              </story>
++
++              </document>
++      </xsl:template>
++</xsl:stylesheet>
@@@ -42,19 -41,18 +41,17 @@@ class wiz_auc_lots_buyer_map(osv.osv_me
           @param context: A standard dictionary 
           @return: A dictionary which of fields with values. 
          """
-         ids = context and context.get('active_ids',False) or False
-         assert ids, _('Active IDs not Found')
          res = super(wiz_auc_lots_buyer_map,self).default_get(cr, uid, fields, context)
-         cr.execute('select id from auction_lots where (ach_uid is null and ach_login is not null)  ')
-         v_ids = [x[0] for x in cr.fetchall()]
-         for rec in self.pool.get('auction.lots').browse(cr, uid, v_ids, context):
 -        auction_lots_obj= self.pool.get('auction.lots')
++        auction_lots_obj = self.pool.get('auction.lots')
+         lots_ids = auction_lots_obj.search(cr, uid, [('ach_uid', '=', ''), ('ach_login', '!=', '')])
 -        for lots_id in lots_ids:
 -            for rec in self.pool.get('auction.lots').browse(cr, uid, lots_id, context):
 -                if (not rec.ach_uid or not rec.ach_login):
 -                    res.update(self._start(cr, uid, context.get('active_ids', []), context))
 -                    return res
++        for rec in auction_lots_obj.browse(cr, uid, lots_ids, context):
 +            if (not rec.ach_uid or not rec.ach_login):
-                 res.update(self._start(cr, uid, ids, context))
-                 return res
-         res.update(self._start(cr, uid, ids, context))
++                res.update(self._start(cr, uid, context.get('active_ids', []), context))
++            return res
+         res.update(self._start(cr, uid, context.get('active_ids', []), context))
          return res
      
-     def _start(self, cr, uid, ids, context):
+     def _start(self, cr, uid, ids, context=None):
          """ 
           Returns login if already there in the selected record.
           @param self: The object pointer.
           @param context: A standard dictionary 
           @return: New arch of view.
          """
-         record_ids = context and context.get('active_ids', False) or False
+         if not context:
+             context={}
+         record_ids = context and context.get('active_ids', []) or []
          res = super(wiz_auc_lots_buyer_map, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
++        if context.get('active_model','') != 'auction.lots':
++            return res
          lots_obj = self.pool.get('auction.lots')
          if record_ids:
              try:
                                    <field name="ach_uid" colspan="4"/>
                                    <separator colspan="4"/>
                                    <group col="4" colspan="4">
-                                       <button icon='gtk-cancel' special="cancel"
-                                       string="Exit" />
 -                                      <label string="" colspan="2"/> 
++                                      
+                                       <button icon='gtk-close' special="cancel"
+                                       string="Close" />
                                <button name="buyer_map_set" string="Update"
--                                      colspan="2" type="object" icon="gtk-go-forward" />
++                                       type="object" icon="gtk-go-forward" />
                                    </group>
                                </form>
                        </field>
@@@ -1,27 -1,27 +1,27 @@@
  <?xml version="1.0" encoding="utf-8"?>
  <openerp>
-                 <data>
-                         <record id="name_form" model="ir.ui.view">
-                                 <field name="name">auction.lots.cancel.form</field>
-                                 <field name="model">auction.lots.cancel</field>
-                                 <field name="type">form</field>
-                                 <field name="arch" type="xml">
-                                       <form string="Cancel Payment">
-                                                             <label string="Are you sure you want to refund this invoice ?"/>
-                                                             <button icon='gtk-cancel' special="cancel"
-                                                 string="Cancel" />
-                                                 <button name="cancel" string="Cancel Payment"
-                                                 colspan="1" type="object" icon="gtk-ok" />
-                                          </form>
-                                   </field>
-                         </record>
-                                      <act_window name="Cancel ittttttt"
-                                           res_model="auction.lots.cancel"
-                                           src_model="auction.lots"
-                                                   view_mode="form"
-                                                   target="new"        
-                                           key2="client_action_multi"    
-                                                   id="action_auction_lots_cancel"/>                        
-                         
-                 </data>
+     <data>
+        <record id="name_form" model="ir.ui.view">
+            <field name="name">auction.lots.cancel.form</field>
+            <field name="model">auction.lots.cancel</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+               <form string="Cancel Payment">
+                  <label string="Are you sure you want to refund this invoice ?"/>
+                  <button icon='gtk-close' special="cancel"
+                    string="Close" />
+                  <button name="cancel" string="Cancel Payment" colspan="1" type="object" icon="gtk-ok" />
+               </form>
+            </field>
+        </record>
+        
 -       <act_window name="Cancel ittttttt"
++       <act_window name="Cancel"
+           res_model="auction.lots.cancel"
+           src_model="auction.lots"
+           view_mode="form"
+           target="new"        
+           key2="client_action_multi"    
+           id="action_auction_lots_cancel"/>                        
+             
+     </data>
  </openerp>                
  
  from osv import fields, osv
  from tools.translate import _
--import netsvc
--import pooler
--import time
  import tools
--import wizard
  
  class auction_lots_sms_send(osv.osv_memory):
  
@@@ -36,7 -36,7 +32,7 @@@
                 'user':fields.char('Login', size=64, required=True),
                 'password':fields.char('Password', size=64, required=True),
                 'text':fields.text('SMS Message', required=True)
--               }
++    }
      
      def sms_send(self, cr, uid, ids, context):
          """
                      tools.smssend(data['user'], data['password'], data['app_id'], unicode(data['text'], 'utf-8').encode('latin1'), to)
                      nbr += 1
              return {'sms_sent': nbr}
--        
--            if to:
--                tools.smssend(data['user'], data['password'], data['app_id'], unicode(data['text'], 'utf-8').encode('latin1'), to)
--                nbr += 1
--            return {'sms_sent': nbr}
--#      
  auction_lots_sms_send()
  
  
@@@ -9,17 -9,17 +9,16 @@@
                  <form string="SMS - Gateway: clickatell','Bulk SMS send">
                        <group colspan="4" >
                                 <separator string="SMS - Gateway: clickatell','Bulk SMS send" colspan="4"/>
--                               <field name="app_id"/>
--                               <newline/>
++                               <field name="app_id" colspan="4"/>
                                 <field name="user"/>
                                 <field name="password"/>
--                               <newline/>
--                               <field name="text" colspan="3"/>
++                         <separator string="SMS Text" colspan="4" />
++                               <field name="text" colspan="4" nolabel="1"/>
                      </group>
--                              <separator string="" colspan="4" />
++                    <separator string="" colspan="4" />
                      <group colspan="4" col="6">
--                      <button icon="gtk-cancel" special="cancel" string="Cancel"/>
-                       <button icon="gtk-go-back" string="Send SMS" name="sms_send" type="object"/>
++                      <button icon="gtk-close" special="cancel" string="Close"/>
+                       <button icon="gtk-go-forward" string="Send SMS" name="sms_send" type="object"/>
                     </group>
                 </form>
              </field>
@@@ -8,6 -8,6 +8,7 @@@
              <field name="arch" type="xml">
                  <form string="Pay objects">
                        <group colspan="4" >
++                         <separator string="Pay Objects" colspan="4" />
                                 <field name="amount"/>
                                 <field name="statement_id1" domain="[('state','=','draft')]"/>
                                 <field name="amount2"/>
              <attribute name="string">Install Generic Modules</attribute>
            </separator>
            <group colspan="8">
--            <field name="crm" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/> <field name="sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/>
--            <field name="project" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/> <field name="knowledge" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/>
--            <field name="stock" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/> <field name="mrp" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/>
--            <field name="account" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/> <field name="purchase" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/>
--            <field name="hr" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/> <field name="point_of_sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/>
--            <field name="marketing" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/> <field name="misc_tools" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/>
--            <field name="report_designer" groups="base.group_extended" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/>
++            <field name="crm" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
++            <field name="project" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="knowledge" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
++            <field name="stock" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="mrp" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
++            <field name="account" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="purchase" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
++            <field name="hr" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="point_of_sale" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
++            <field name="marketing" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/> <field name="misc_tools" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
++            <field name="report_designer" groups="base.group_extended" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
              <separator string="Install Specific Business Modules" colspan="4"/>
--            <field name="association" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/>
--            <field name="profile_auction" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/>
--            <field name="profile_bookstore" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/>
--            <field name="product_expiry" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,profile_auction,profile_bookstore)"/>
++            <field name="association" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
++            <field name="auction" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
++            <field name="profile_bookstore" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
++            <field name="product_expiry" on_change="onchange_moduleselection(crm,sale,project,knowledge,stock,mrp,account,purchase,hr,point_of_sale,marketing,misc_tools,report_designer,association,auction,profile_bookstore)"/>
            </group>
          </data>
        </field>
@@@ -82,7 -82,7 +82,7 @@@ class base_setup_installer(osv.osv_memo
              help="Installs a preselected set of OpenERP "
                   "applications which will help you manage your association "
                   "more efficiently."),
--        'profile_auction':fields.boolean('Auction Houses',
++        'auction':fields.boolean('Auction Houses',
              help="Installs a preselected set of OpenERP "
                   "applications selected to help you manage your auctions "
                   "as well as the business processes around them."),