# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo.addons.account.tests.common import AccountTestInvoicingCommon from odoo.tests import Form, tagged from datetime import datetime, timedelta @tagged('post_install', '-at_install') class TestPurchaseOrderReport(AccountTestInvoicingCommon): def test_00_purchase_order_report(self): uom_dozen = self.env.ref('uom.product_uom_dozen') po = self.env['purchase.order'].create({ 'partner_id': self.partner_a.id, 'currency_id': self.currency_data['currency'].id, 'order_line': [ (0, 0, { 'name': self.product_a.name, 'product_id': self.product_a.id, 'product_qty': 1.0, 'product_uom': uom_dozen.id, 'price_unit': 100.0, 'date_planned': datetime.today(), 'taxes_id': False, }), (0, 0, { 'name': self.product_b.name, 'product_id': self.product_b.id, 'product_qty': 1.0, 'product_uom': uom_dozen.id, 'price_unit': 200.0, 'date_planned': datetime.today(), 'taxes_id': False, }), ], }) po.button_confirm() f = Form(self.env['account.move'].with_context(default_move_type='in_invoice')) f.invoice_date = f.date f.partner_id = po.partner_id # # #