It is currently Tue May 22, 2012 11:26 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: referencing other test files in yaml
PostPosted: Thu Jun 09, 2011 11:33 am 
Offline

Joined: Tue Dec 01, 2009 6:39 pm
Posts: 22
Location: Hungary
Hi,

I've the following yaml snippets, first is meant to create an invoice, and the second checks if the amount_total is correct or not.
Code:
    !record {model: account.invoice, id: euplaza_invoice0}:
        account_id: account.a_recv
        address_contact_id: base.res_partner_address_3000
        address_invoice_id: base.res_partner_address_3000
        company_id: base.main_company
        currency_id: base.EUR
        invoice_line:
          - account_id: account.a_sale
            name: '[PC1] Basic PC'
            price_unit: 400.0
            quantity: 1.0
            product_id: commission_product
            uos_id: product.product_uom_unit
        journal_id: account.bank_journal
        partner_id: base.res_partner_desertic_hispafuentes
        user_id: base.user_root


and

Code:
    !python {model: account.invoice}: |
        inv = self.browse(cr, uid, ref("euplaza_invoice0"))
        assert inv.amount_total == 500


Quote:
ref("euplaza_invoice0")
gives
Quote:
ValueError: No references to base.euplaza_invoice0


I've already checked the yaml_import code, and tried adding forcecreate to !record, but it did not help much either. What do I miss with yaml files?

_________________
ToolPart Team LLC


Top
 Profile  
 
 Post subject: Re: referencing other test files in yaml
PostPosted: Thu Jun 09, 2011 12:17 pm 
Offline

Joined: Tue Mar 04, 2008 11:41 am
Posts: 319
Location: Athens, Greece
akasha wrote:
Quote:
ref("euplaza_invoice0")

gives
Quote:
ValueError: No references to base.euplaza_invoice0


I've already checked the yaml_import code, and tried adding forcecreate to !record, but it did not help much either. What do I miss with yaml files?


Perhaps the module name? Is it "base" or should you write
Code:
ref("account_foo.euplaza_invoice0")

instead?


Top
 Profile  
 
 Post subject: Re: referencing other test files in yaml
PostPosted: Thu Jun 09, 2011 2:39 pm 
Offline

Joined: Tue Dec 01, 2009 6:39 pm
Posts: 22
Location: Hungary
unfortunately, it does not work either.

I've checked and the yaml importer stores a dictionary of created resources in its "id_map" argument. But running !record without "forceupdate" does not add anything to id_map, and seemingly no record is created(!), and even with forceupdate, the created id_map points to a resource with id=0. What can't be used in other parts of the code.

_________________
ToolPart Team LLC


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP