Skip to content

Commit b8d91c7

Browse files
committed
[IMP] purchase_requisition_line_description: black, isort, prettier
1 parent 6166616 commit b8d91c7

7 files changed

Lines changed: 55 additions & 36 deletions

File tree

purchase_requisition_line_description/__manifest__.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
33

44
{
5-
'name': 'Purchase Requisition Line Description',
6-
'summary': 'Extends the functionality of Purchase Agreements to '
7-
'show line description.',
8-
'version': '12.0.1.0.0',
9-
'category': 'Purchases',
10-
'website': 'https://github.com/OCA/purchase-workflow',
11-
'author': 'Camptocamp, Odoo Community Association (OCA)',
12-
'license': 'AGPL-3',
13-
'application': False,
14-
'installable': True,
15-
'depends': [
16-
'purchase_requisition',
5+
"name": "Purchase Requisition Line Description",
6+
"summary": "Extends the functionality of Purchase Agreements to "
7+
"show line description.",
8+
"version": "12.0.1.0.0",
9+
"category": "Purchases",
10+
"website": "https://github.com/OCA/purchase-workflow",
11+
"author": "Camptocamp, Odoo Community Association (OCA)",
12+
"license": "AGPL-3",
13+
"application": False,
14+
"installable": True,
15+
"depends": [
16+
"purchase_requisition",
1717
],
18-
'data': [
19-
'views/purchase_requisition.xml',
20-
'report/purchase_requisition_report.xml',
18+
"data": [
19+
"views/purchase_requisition.xml",
20+
"report/purchase_requisition_report.xml",
2121
],
2222
}

purchase_requisition_line_description/models/purchase_requisition_line.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class PurchaseRequisitionLine(models.Model):
1010

1111
name = fields.Text(string="Description")
1212

13-
@api.onchange('product_id')
13+
@api.onchange("product_id")
1414
def _onchange_product_id(self):
1515
res = super()._onchange_product_id()
1616
if self.product_id:
@@ -20,9 +20,10 @@ def _onchange_product_id(self):
2020
or first(self.requisition_id.mapped("purchase_ids")).partner_id
2121
)
2222
product_lang = self.product_id.with_context(
23-
lang=partner.lang, partner_id=partner.id,
23+
lang=partner.lang,
24+
partner_id=partner.id,
2425
)
2526
self.name = product_lang.display_name
2627
if product_lang.description_purchase:
27-
self.name += '\n' + product_lang.description_purchase
28+
self.name += "\n" + product_lang.description_purchase
2829
return res
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<odoo>
2-
<template id="purchase_requisition" name="Purchase Requisition" inherit_id="purchase_requisition.report_purchaserequisitions">
2+
<template
3+
id="purchase_requisition"
4+
name="Purchase Requisition"
5+
inherit_id="purchase_requisition.report_purchaserequisitions"
6+
>
37
<xpath expr="//t[@t-if='o.line_ids']/table//th[1]" position="replace">
48
<th><strong>Product</strong></th>
59
<th><strong>Description</strong></th>
610
</xpath>
711
<xpath expr="//t[@t-if='o.line_ids']/table//td[1]" position="after">
8-
<td><span t-field="line_ids.name"/></td>
9-
</xpath>
12+
<td><span t-field="line_ids.name" /></td>
13+
</xpath>
1014
</template>
1115
</odoo>
Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
# Copyright 2021 Camptocamp SA
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33

4-
from odoo.tests import common, Form
4+
from odoo.tests import Form, common
55

66

77
class TestPurchaseRequisitionLineDescription(common.SavepointCase):
88
@classmethod
99
def setUpClass(cls):
1010
super(TestPurchaseRequisitionLineDescription, cls).setUpClass()
11-
cls.partner = cls.env['res.partner'].create({
12-
'name': 'Test partner',
13-
})
14-
cls.product = cls.env['product.product'].create({
15-
'name': 'Product',
16-
'standard_price': 10,
17-
'description_purchase': 'description for purchase',
18-
})
11+
cls.partner = cls.env["res.partner"].create(
12+
{
13+
"name": "Test partner",
14+
}
15+
)
16+
cls.product = cls.env["product.product"].create(
17+
{
18+
"name": "Product",
19+
"standard_price": 10,
20+
"description_purchase": "description for purchase",
21+
}
22+
)
1923

2024
def test_onchange_product_id(self):
21-
with Form(self.env['purchase.requisition']) as purchase_form:
25+
with Form(self.env["purchase.requisition"]) as purchase_form:
2226
purchase_form.vendor_id = self.partner
2327
with purchase_form.line_ids.new() as line_form:
2428
line_form.product_id = self.product
2529
self.assertEqual(
2630
line_form.name,
27-
self.product.name+'\n'+self.product.description_purchase
31+
self.product.name + "\n" + self.product.description_purchase,
2832
)
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
<?xml version="1.0"?>
1+
<?xml version="1.0" ?>
22
<odoo>
33
<record model="ir.ui.view" id="purchase_requisition_chatter_view">
44
<field name="name">purchase_requisition_form</field>
55
<field name="model">purchase.requisition</field>
6-
<field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/>
6+
<field
7+
name="inherit_id"
8+
ref="purchase_requisition.view_purchase_requisition_form"
9+
/>
710
<field name="arch" type="xml">
811
<xpath expr="//field[@name='product_id']" position="after">
9-
<field name="name"/>
10-
</xpath>
12+
<field name="name" />
13+
</xpath>
1114
</field>
1215
</record>
1316
</odoo>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../purchase_requisition_line_description
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)

0 commit comments

Comments
 (0)