98 lines
4.8 KiB
XML
98 lines
4.8 KiB
XML
<?xml version="1.0"?>
|
|
<openerp>
|
|
<data>
|
|
<!-- Resource: purchase.order -->
|
|
<record model="purchase.order" id="test_purchase_1">
|
|
<field name="name">Test purchase</field>
|
|
<field name="dest_address_id" search="[]" model="res.partner.address"/>
|
|
<field name="pricelist_id" ref="list0"/>
|
|
<field name="partner_id" search="[]" model="res.partner"/>
|
|
<field name="partner_address_id" search="[]" model="res.partner.address"/>
|
|
<field name="location_id" ref="stock.stock_location_stock"/>
|
|
</record>
|
|
<record model="purchase.order.line" id="test_purchase_1_line_1">
|
|
<field name="order_id" ref="test_purchase_1"/>
|
|
<field name="name">[PC1] Basic PC</field>
|
|
<field name="date_planned" eval="time.strftime('%Y-%m-%d', time.localtime(time.time() + 2 * 86400))" />
|
|
<field name="product_id" ref="product.product_product_pc1"/>
|
|
<field name="product_uom" ref="product.product_uom_unit"/>
|
|
<field name="price_unit">450</field>
|
|
<field name="product_qty">2</field>
|
|
</record>
|
|
<record model="purchase.order.line" id="test_purchase_1_line_3">
|
|
<field name="order_id" ref="test_purchase_1"/>
|
|
<field name="name">[MB1] Mainboard ASUStek A7N8X</field>
|
|
<field name="date_planned" eval="time.strftime('%Y-%m-%d', time.localtime(time.time() + 2 * 86400))" />
|
|
<field name="product_id" ref="product.product_product_mb1"/>
|
|
<field name="product_uom" ref="product.product_uom_unit"/>
|
|
<field name="price_unit">88</field>
|
|
<field name="product_qty">3</field>
|
|
</record>
|
|
|
|
<assert model="purchase.order" id="test_purchase_1" string="The amount of Test purchase is correctly computed">
|
|
<test expr="sum([l.price_subtotal for l in order_line]) == amount_untaxed" />
|
|
</assert>
|
|
|
|
<workflow model="purchase.order" ref="test_purchase_1" action="purchase_confirm" />
|
|
|
|
<assert model="purchase.order" id="test_purchase_1" string="Test purchase is now in progress">
|
|
<test expr="state">approved</test>
|
|
</assert>
|
|
|
|
<!-- Treat generated invoice -->
|
|
<assert model="purchase.order" id="test_purchase_1" string="Test purchase has now a corresponding invoice" severity="fatal">
|
|
<test expr="bool(invoice_id)" />
|
|
</assert>
|
|
|
|
<assert model="purchase.order" id="test_purchase_1" string="Test purchase's invoice has the same amount and is currently a draft">
|
|
<test expr="invoice_id.state">draft</test>
|
|
</assert>
|
|
|
|
<workflow model="account.invoice" action="invoice_open">
|
|
<value model="purchase.order" eval="obj(ref('test_purchase_1')).invoice_id.id" />
|
|
</workflow>
|
|
|
|
<function model="account.invoice" name="pay_and_reconcile">
|
|
<value model="purchase.order" eval="[obj(ref('test_purchase_1')).invoice_id.id]" />
|
|
<value eval="1164" />
|
|
<value eval="ref('account.cash')"/>
|
|
<value eval="ref('account.period_' + str(int(time.strftime('%m'))))" />
|
|
<value eval="ref('account.bank_journal')" />
|
|
<value eval="ref('account.cash')"/>
|
|
<value eval="ref('account.period_' + str(int(time.strftime('%m'))))" />
|
|
<value eval="ref('account.bank_journal')" />
|
|
</function>
|
|
|
|
<assert model="purchase.order" id="test_purchase_1" string="Test purchase's invoice is now paid" severity="error">
|
|
<test expr="invoice_id.state">paid</test>
|
|
</assert>
|
|
|
|
<!-- Treat generated picking -->
|
|
<assert model="purchase.order" id="test_purchase_1" string="Test purchase has now a corresponding picking" severity="fatal">
|
|
<test expr="len(picking_ids) == 1" />
|
|
</assert>
|
|
|
|
<assert model="purchase.order" id="test_purchase_1" string="Test purchase's picking will be sent to the good address" severity="error">
|
|
<test expr="picking_ids[0].address_id == partner_address_id" />
|
|
</assert>
|
|
|
|
<!-- Do the same as in wizard_partial_picking lines 143-144 -->
|
|
<function model="stock.picking" name="action_move">
|
|
<value model="purchase.order" eval="[obj(ref('test_purchase_1')).picking_ids[0].id]" />
|
|
</function>
|
|
|
|
<workflow model="stock.picking" action="button_done">
|
|
<value model="purchase.order" eval="obj(ref('test_purchase_1')).picking_ids[0].id" />
|
|
</workflow>
|
|
|
|
<assert model="purchase.order" id="test_purchase_1" string="Test purchase's picking is now done" severity="error">
|
|
<test expr="picking_ids[0].state">done</test>
|
|
</assert>
|
|
|
|
<assert model="purchase.order" id="test_purchase_1" string="Test purchase is now completed" severity="fatal">
|
|
<test expr="state">done</test>
|
|
</assert>
|
|
</data>
|
|
</openerp>
|
|
|