-
  In order to test the auction module in the OpenERP I start the process by creating a product.
- 
  !record {model: product.product, id: product_product_furniture0}:
    categ_id: product.cat1
    cost_method: standard
    mes_type: fixed
    name: Furniture
    procure_method: make_to_stock
    standard_price: 1.0
    supply_method: buy
    type: product
    uom_id: product.product_uom_unit
    uom_po_id: product.product_uom_unit
    volume: 0.0
    warranty: 0.0
    weight: 0.0
    weight_net: 0.0
    
-
  I create a new artist for an object. 
- 
  !record {model: auction.artists, id: auction_artists_vincentvangogh0}:
    birth_death_dates: 1853-1900
    name: Vincent van Gogh
 
- 
  I am modifying an expenses journal record for analytic journal. 
- 
  !record {model: account.journal, id: account.expenses_journal}:
    analytic_journal_id: account.exp
- 
  I am modifying a sales journal record for analytic journal. 
- 
  !record {model: account.journal, id: account.sales_journal}:
    analytic_journal_id: account.cose_journal_sale    
-
  I'm creating new Seller "Mr. Pinakin" with him email "info@mycustomer.com".
- 
  !record {model: res.partner, id: res_partner_mrpinakin0}:
    address:
        - city: Namur
          country_id: base.be
          phone: (+32).10.45.18.77
          street: 23, street ways
          type: default
          zip: '2324324'
          email: 'info@mycustomer.com'
    name: Mr. Pinakin

-      
  I'm creating new Buyer "Mr. Patel" with his email "info@myinfobid.com".
- 
  !record {model: res.partner, id: res_partner_mrpatel0}:
    address:
      - city: Bruxelles
        country_id: base.be
        street: Rue des Palais 51, bte 33
        type: default
        zip: '1000'
        email: 'info@myinfobid.com'
    name: Mr. Patel
        
-      
  I'm creating new Buyer "Mr. Johnson" with his email "info@mrkjohnson.com".
- 
  !record {model: res.partner, id: res_partner_mrkjohnson0}:
    address:
      - city: paris
        country_id: base.fr
        name: Mark Johnson
        street: 1 rue Rockfeller
        type: invoice
        zip: '75016'
        email: 'info@mrkjohnson.com'
    name: Mr. Mark Johnson
        
-      
  I'm creating new Buyer "Mr. Rahi" with his email "info@poalrahi.com".
- 
  !record {model: res.partner, id: res_partner_poalrahi0}:
    address:
      - city: Bruxelles
        country_id: base.be
        street: Rue des Palais 51, bte 33
        type: default
        zip: '1000'
        email: 'info@poalrahi.com'
    name: Mr. Rahi
        
    
-
  I create an Account tax with 0.03 amount to give Buyer "3%" Commission.
- 
  !record {model: account.tax, id: account_tax_buyer0}:
    amount: 0.029999999999999999
    applicable_type: 'true'
    company_id: base.main_company
    domain: auction
    name: Buyer Costs(%3)
    sequence: 1
    type: percent
    type_tax_use: all
-
  I create another Account tax with 0.04 amount to give seller "4%" commission.
- 
  !record {model: account.tax, id: account_tax_sellercosts0}:
    amount: 0.040000000000000001
    applicable_type: 'true'
    company_id: base.main_company
    domain: auction
    name: Seller Costs(%4)
    sequence: 1
    type: percent
    type_tax_use: all      
                  
-
  Now I want to associate an object with the auction so for that I create an auction "Antique furniture exhibition" which
  start from 1 Aug to 31 Aug with Seller Commission 4%, buyer commission 3%.
-
  !record {model: auction.dates, id: auction_dates_antiquefurnitureexhibition0}:
    acc_expense: account.a_pay
    acc_income: account.a_recv
    account_analytic_id: account.analytic_root
    auction1: '2010-08-01'
    auction2: '2010-08-31'
    expo1: '2010-08-01'
    expo2: '2010-08-31'
    journal_id: account.expenses_journal
    journal_seller_id: account.sales_journal
    name: Antique furniture exhibition
    seller_costs:
      - auction.account_tax_sellercosts0
    buyer_costs:
      - auction.account_tax_buyer0       
-
  An object is being deposited for an auction,I create a seller's deposit record with deposit cost.  
-
  !record {model: auction.deposit, id: auction_deposit_ad0}:
    date_dep: '2010-08-01'
    method: keep
    name: AD/006
    partner_id: res_partner_mrpinakin0
    specific_cost_ids:
      - account: auction.auction_expense
        amount: 200.0
        name: Transfer Cost    
-
  I create a new object wooden-chair which is to be auctioned.
-
  !record {model: auction.lots, id: auction_lots_woodenchair0}:
    ach_uid: res_partner_mrkjohnson0
    artist_id: auction_artists_vincentvangogh0
    auction_id: auction_dates_antiquefurnitureexhibition0
    bord_vnd_id: auction_deposit_ad0
    lot_est1: 3000.0
    lot_est2: 5000.0
    lot_num: 1
    name: wooden-chair
    name2: antique wooden chair
    obj_num: 1
    obj_price: 4000.0
    obj_ret: 0.0
    product_id: 'product_product_furniture0'
    state: draft
    vnd_lim: 5000.0
-
  I create a bid for an object "wooden-chair" which is to be auctioned in Antique furniture exhibition bid by Mr.Patel.
-
  !record {model: auction.bid, id: auction_bid_bid0}:
    auction_id: auction_dates_antiquefurnitureexhibition0
    contact_tel: (+32)2 211 34 83
    name: bid/001
    partner_id: res_partner_mrpatel0
-
  I create a bid line.
-
  !record {model: auction.bid_line, id: auction_bid_line_0}:
    auction: Antique furniture exhibition
    bid_id: auction_bid_bid0
    lot_id: auction.auction_lots_woodenchair0
    price: 3100.0

-
  I create another bid for an object "wooden-chair" bid by a Mr.poalrahi
-  
  !record {model: auction.bid, id: auction_bid_bid1}:
    auction_id: auction_dates_antiquefurnitureexhibition0
    name: bid/002
    partner_id: res_partner_poalrahi0
-
  I create a bid line.
-
  !record {model: auction.bid_line, id: auction_bid_line_1}:
    auction: Antique furniture exhibition
    bid_id: 'auction_bid_bid1'
    call: 1
    lot_id: auction.auction_lots_woodenchair0
    price: 3200.0
 
-
  I create another bid for an object "wooden-chair" bid by a Mr.Johnson
-  
  !record {model: auction.bid, id: auction_bid_bid2}:
    auction_id: auction_dates_antiquefurnitureexhibition0
    name: bid/003
    partner_id: res_partner_mrkjohnson0
-
  I create a bid line.
-
  !record {model: auction.bid_line, id: auction_bid_line_2}:
    auction: Antique furniture exhibition
    bid_id: 'auction_bid_bid2'
    call: 1
    lot_id: auction.auction_lots_woodenchair0
    price: 4000.0
-
  Mr. MarkJohnson bid are selected as the Finalist Bid with 4000 Euro
-
  I check that buyer price and seller price gets bound with the value
-
  !python {model: auction.lots}: |
    from tools.translate import _
    auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
    assert auc_id.buyer_price and auc_id.seller_price, _('Buyer price and seller price are not available!')
-
  Now, An object has been sold,so I click on the "Sold" button.
-
  !python {model: auction.lots}: |
    self.button_bought(cr, uid, [ref("auction_lots_woodenchair0")], {"lang": "en_US", "tz":
      False, "active_model": "ir.ui.menu", "active_ids": [ref("auction.auction_lots_woodenchair0")],
      "active_id": ref("auction.auction_lots_woodenchair0")})   
-
  I click on the "Create all invoices" button for all Objects in this Auction.
-
  !python {model: auction.dates}: |
    self.close(cr, uid, [ref("auction.auction_dates_antiquefurnitureexhibition0")],
      {"active_model": "ir.ui.menu", "active_ids":
      [ref("auction.menu_auction_dates_next1")], "active_id": ref("auction.menu_auction_dates_next1")})
-
  I check that a record gets created in the "Supplier Invoices".
-
 !python {model: auction.lots}: |
    from tools.translate import _
    auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
    assert(auc_id.sel_inv_id), _('Seller Invoice has not been created!') 
    
-
  I create a buyer's invoice by using the "Invoice Buyer objects" wizard.
-
  !record {model: auction.lots.make.invoice.buyer, id: auction_lots_make_invoice_buyer_0}:
    amount: 3090.0
    buyer_id: res_partner_mrkjohnson0
    number: 2010/003
    objects: 1
-
  I click on the "Create Invoices" button.
-
  !python {model: auction.lots.make.invoice.buyer}: |
    self.makeInvoices(cr, uid, [ref("auction_lots_make_invoice_buyer_0")], {"active_model": "auction.lots", "active_ids": [ref("auction_lots_woodenchair0")],
      "active_id": ref("auction_lots_woodenchair0"), })
-
  I check that a "Buyer Invoice" field gets bound with the value.
-
  !python {model: auction.lots}: |
    from tools.translate import _
    auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
    assert(auc_id.ach_inv_id), _('Buyer Invoice has not been created!')     
- 
  Buyer pays the invoice
- 
  !python {model: account.invoice}: |
    obj_lots = self.pool.get('auction.lots')
    lots_id = obj_lots.browse(cr, uid, ref("auction_lots_woodenchair0"))
    self.pay_and_reconcile(cr, uid, [lots_id.ach_inv_id.id], 4120.0,
        ref('account.cash'), ref('account.period_8'),
        ref('account.cash_journal'), ref('account.cash'),
        ref('account.period_8'), ref('account.cash_journal'), name='Furniture')
-
  I check that "Buyer Invoice Reconciled" field is marked.
-
  !assert {model: auction.lots, id: auction_lots_woodenchair0}:
      - paid_ach == True, 'Buyer Invoice should be Reconciled.'
-
  I check that the order which was initially in the draft state has transit to sold state.
-
  !python {model: auction.lots}: |
    from tools.translate import _
    auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
    assert(auc_id.state == 'sold'), _('State not changed!')
-
  I click on the Taken Away button.
-
  !python {model: auction.lots}: |
    self.button_taken_away(cr, uid, [ref("auction_lots_woodenchair0")], {"lang":
      "en_US", "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("auction.auction_all_objects_menu")],
      "active_id": ref("auction.auction_all_objects_menu")})
-
  I check that the order which was initially in the sold state has transit to taken away state.
-
  !assert {model: auction.lots, id: auction_lots_woodenchair0}:
    - state == 'taken_away', "state is not taken Away"
-
  In order to change the auction for an object I use the "Change auction date" wizard.
  This will Erase The Object Adjudication Price and Its Buyer!
-
  !record {model: auction.lots.auction.move, id: auction_lots_auction_move_0}:
    auction_id: auction.auction_date_2
- 
  I click on the "Move to Auction date" button.
- 
  !python {model: auction.lots.auction.move}: |
    self.auction_move_set(cr, uid, [ref("auction_lots_auction_move_0")], {"lang":
      "en_US", "tz": False, "active_model": "auction.lots", "active_ids": [ref("auction_lots_woodenchair0")],
      "active_id": ref("auction_lots_woodenchair0"), })
-
  I check that a record gets created in the lot history.
-
  !python {model: auction.lots}: |
    from tools.translate import _
    auc_id=self.browse(cr, uid, ref("auction_lots_woodenchair0"))
    auc_lot_his=self.pool.get('auction.lot.history')
    ids=auc_lot_his.search(cr, uid, [('lot_id', '=', auc_id.id)])
    assert ids, _('Auction history does not exists!')     
