purchase_customer_requisition: passing first test
This commit is contained in:
parent
e767591739
commit
f54ff1496f
3 changed files with 29 additions and 46 deletions
|
|
@ -1,26 +1,28 @@
|
|||
{
|
||||
'name': 'Purchase Customer Requisition',
|
||||
'version': '1.0',
|
||||
'category': 'Purchase',
|
||||
'summary': 'Link customer requisition references to purchase orders',
|
||||
'description': """
|
||||
"name": "Purchase Customer Requisition",
|
||||
"version": "1.0",
|
||||
"category": "Purchase",
|
||||
"summary": "Link customer requisition references to purchase orders",
|
||||
"description": """
|
||||
This module allows to:
|
||||
* Store customer-specific requisition references for suppliers
|
||||
* Automatically add these references to purchase order lines
|
||||
* Track customer requisition numbers across purchase orders
|
||||
""",
|
||||
'license': 'LGPL-3',
|
||||
'depends': [
|
||||
'purchase_stock',
|
||||
'sale_purchase',
|
||||
'purchase_requisition'
|
||||
"license": "LGPL-3",
|
||||
"depends": [
|
||||
"sale",
|
||||
"purchase",
|
||||
"stock",
|
||||
"purchase_requisition_stock",
|
||||
"purchase_requisition",
|
||||
],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'views/purchase_views.xml',
|
||||
'views/purchase_requisition_views.xml',
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"views/purchase_views.xml",
|
||||
"views/purchase_requisition_views.xml",
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': False,
|
||||
}
|
||||
"installable": True,
|
||||
"application": False,
|
||||
"auto_install": False,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class PurchaseOrderLine(models.Model):
|
|||
line.requisition_id = requisition_lines.filtered(
|
||||
lambda req_line: req_line.requisition_id
|
||||
== line.order_id.requisition_id
|
||||
)
|
||||
).requisition_id
|
||||
if not line.requisition_id and requisition_lines:
|
||||
line.requisition_id = requisition_lines[0].requisition_id
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -19,13 +19,12 @@ class TestPurchaseOrder(TransactionCase):
|
|||
{
|
||||
"name": "SuperProduct",
|
||||
"is_storable": True,
|
||||
"route_ids": [(6, 0, (cls.mto_route + cls.buy_route).ids)],
|
||||
"route_ids": [Command.set((cls.mto_route + cls.buy_route).ids)],
|
||||
"seller_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
Command.create(
|
||||
{
|
||||
"partner_id": cls.supplier.id,
|
||||
"price": 1000,
|
||||
},
|
||||
)
|
||||
],
|
||||
|
|
@ -36,36 +35,18 @@ class TestPurchaseOrder(TransactionCase):
|
|||
{
|
||||
"name": "SuperProduct2",
|
||||
"is_storable": True,
|
||||
"route_ids": [(6, 0, (cls.mto_route + cls.buy_route).ids)],
|
||||
"route_ids": [Command.set((cls.mto_route + cls.buy_route).ids)],
|
||||
"seller_ids": [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
Command.create(
|
||||
{
|
||||
"partner_id": cls.supplier.id,
|
||||
"price": 2000,
|
||||
},
|
||||
)
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
cls.env["product.supplierinfo"].create(
|
||||
[
|
||||
{
|
||||
"partner_id": cls.supplier.id,
|
||||
"product_id": cls.product_1.id,
|
||||
"product_tmpl_id": cls.product_1.product_tmpl_id.id,
|
||||
"price": 2000,
|
||||
},
|
||||
{
|
||||
"partner_id": cls.supplier.id,
|
||||
"product_id": cls.product_2.id,
|
||||
"product_tmpl_id": cls.product_1.product_tmpl_id.id,
|
||||
"price": 3000,
|
||||
},
|
||||
]
|
||||
)
|
||||
|
||||
cls.agreement_1 = cls.env["purchase.requisition"].create(
|
||||
{
|
||||
"name": "ATRACK 123",
|
||||
|
|
@ -128,7 +109,7 @@ class TestPurchaseOrder(TransactionCase):
|
|||
)
|
||||
sale_order.action_confirm()
|
||||
|
||||
purchase_line = sale_order.order_line[0].purchase_line_ids
|
||||
self.assertTrue(purchase_line)
|
||||
self.assertTrue(sale_order._get_purchase_orders())
|
||||
purchase_line = sale_order._get_purchase_orders()[0].order_line[0]
|
||||
self.assertEqual(purchase_line.order_id.partner_id, self.supplier)
|
||||
self.assertEqual(purchase_line.requisition_id, self.agreement_1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue