-
-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] purchase_stock_picking_invoice_link: black, isort, prettier
- Loading branch information
1 parent
5c97597
commit ace98ec
Showing
5 changed files
with
73 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,38 @@ | ||
# Copyright 2019 Vicent Cubells <[email protected]> | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from odoo.tests import common | ||
from odoo import fields | ||
from odoo.tests import common | ||
|
||
|
||
class TestPurchaseSTockPickingInvoiceLink(common.SavepointCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super(TestPurchaseSTockPickingInvoiceLink, cls).setUpClass() | ||
|
||
cls.supplier = cls.env['res.partner'].create({ | ||
'name': 'Supplier for Test', | ||
'supplier': True, | ||
}) | ||
product = cls.env['product.product'].create({ | ||
'name': 'Product for Test', | ||
}) | ||
cls.po = cls.env['purchase.order'].create({ | ||
'partner_id': cls.supplier.id, | ||
'order_line': [(0, 0, { | ||
'product_id': product.id, | ||
'name': product.name, | ||
'product_qty': 1.0, | ||
'date_planned': fields.date.today(), | ||
'product_uom': product.uom_po_id.id, | ||
'price_unit': 15.0, | ||
})] | ||
}) | ||
cls.supplier = cls.env["res.partner"].create( | ||
{"name": "Supplier for Test", "supplier": True,} | ||
) | ||
product = cls.env["product.product"].create({"name": "Product for Test",}) | ||
cls.po = cls.env["purchase.order"].create( | ||
{ | ||
"partner_id": cls.supplier.id, | ||
"order_line": [ | ||
( | ||
0, | ||
0, | ||
{ | ||
"product_id": product.id, | ||
"name": product.name, | ||
"product_qty": 1.0, | ||
"date_planned": fields.date.today(), | ||
"product_uom": product.uom_po_id.id, | ||
"price_unit": 15.0, | ||
}, | ||
) | ||
], | ||
} | ||
) | ||
|
||
def test_puchase_stock_picking_invoice_link(self): | ||
# Purchase order confirm | ||
|
@@ -39,19 +44,21 @@ def test_puchase_stock_picking_invoice_link(self): | |
picking.move_lines.quantity_done = 1.0 | ||
picking.button_validate() | ||
# Invoice purchase | ||
self.invoice = self.env['account.invoice'].create({ | ||
'partner_id': self.supplier.id, | ||
'purchase_id': self.po.id, | ||
'account_id': self.supplier.property_account_payable_id.id, | ||
'type': 'in_invoice', | ||
}) | ||
self.invoice = self.env["account.invoice"].create( | ||
{ | ||
"partner_id": self.supplier.id, | ||
"purchase_id": self.po.id, | ||
"account_id": self.supplier.property_account_payable_id.id, | ||
"type": "in_invoice", | ||
} | ||
) | ||
self.invoice.purchase_order_change() | ||
self.invoice.action_invoice_open() | ||
# Only one invoice line has been created | ||
self.assertEqual(len(self.invoice.invoice_line_ids), 1) | ||
line = self.invoice.invoice_line_ids | ||
# Move lines are set in invoice lines | ||
self.assertEqual(len(line.mapped('move_line_ids')), 1) | ||
self.assertEqual(line.mapped('move_line_ids'), picking.move_lines) | ||
self.assertEqual(len(line.mapped("move_line_ids")), 1) | ||
self.assertEqual(line.mapped("move_line_ids"), picking.move_lines) | ||
# Invoices are set in pickings | ||
self.assertEqual(picking.invoice_ids, self.invoice) |
14 changes: 8 additions & 6 deletions
14
purchase_stock_picking_invoice_link/views/account_invoice_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<record id="invoice_supplier_form" model="ir.ui.view"> | ||
<field name="name">account.invoice.supplier.form</field> | ||
<field name="model">account.invoice</field> | ||
<field name="inherit_id" ref="account.invoice_supplier_form"/> | ||
<field name="inherit_id" ref="account.invoice_supplier_form" /> | ||
<field name="arch" type="xml"> | ||
<notebook position="inside"> | ||
<page string="Pickings" name="pickings" attrs="{'invisible': [('picking_ids', '=', [])]}"> | ||
<field name="picking_ids"/> | ||
<page | ||
string="Pickings" | ||
name="pickings" | ||
attrs="{'invisible': [('picking_ids', '=', [])]}" | ||
> | ||
<field name="picking_ids" /> | ||
</page> | ||
</notebook> | ||
</field> | ||
</record> | ||
|
||
</odoo> |