Skip to content

Commit 622d558

Browse files
xavierjimenezmoylop260
authored andcommitted
[MIG] product_supplierinfo_for_customer_sale: Migration to 11.0
- New field name from type to supplierinfo_type - Remove copyright for __init__.py - Re-using variables from tests - Manifest bump version and using module url - Get commit history from https://github.com/OCA/product-attribute/tree/8.0/product_supplierinfo_for_customer_sale - Run 2to3 script - view fixing
1 parent 89fd8db commit 622d558

11 files changed

+86
-64
lines changed

product_supplierinfo_for_customer_sale/README.rst

+49-26
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
1-
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
2-
:target: https://www.gnu.org/licenses/agpl
3-
:alt: License: AGPL-3
4-
51
======================================
6-
Product Supplierinfo for customer sale
2+
Product Supplierinfo for Customer Sale
73
======================================
84

5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Beta
13+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15+
:alt: License: AGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
17+
:target: https://github.com/OCA/sale-workflow/tree/11.0-mig-product_supplierinfo_for_customer_sale/product_supplierinfo_for_customer_sale
18+
:alt: OCA/sale-workflow
19+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20+
:target: https://translation.odoo-community.org/projects/sale-workflow-11-0-mig-product_supplierinfo_for_customer_sale/sale-workflow-11-0-mig-product_supplierinfo_for_customer_sale-product_supplierinfo_for_customer_sale
21+
:alt: Translate me on Weblate
22+
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23+
:target: https://runbot.odoo-community.org/runbot/167/11.0-mig-product_supplierinfo_for_customer_sale
24+
:alt: Try me on Runbot
25+
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
27+
928
Based on product_supplierinfo_for_customer, this module loads in every sale order the
1029
customer code defined in the product and allows
1130
use the product codes and product name configured in each products in sale
@@ -43,52 +62,56 @@ To use this module, you need:
4362
:alt: Search by exist customer code
4463
:width: 600 px
4564

46-
Known issues
47-
============
65+
66+
**Table of contents**
67+
68+
.. contents::
69+
:local:
70+
71+
Known issues / Roadmap
72+
======================
4873

4974
* Putting a minimum qty in a pricelist rule means the system will use the
5075
option 'list price' instead of any option you chose.
5176

5277
Bug Tracker
5378
===========
5479

55-
Bugs are tracked on `GitHub Issues
56-
<https://github.com/OCA/sale-workflow/issues>`_. In case of trouble, please
57-
check there if your issue has already been reported. If you spotted it first,
58-
help us smash it by providing detailed and welcomed feedback.
59-
60-
Usage
61-
=====
80+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
81+
In case of trouble, please check there if your issue has already been reported.
82+
If you spotted it first, help us smashing it by providing a detailed and welcomed
83+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20product_supplierinfo_for_customer_sale%0Aversion:%2011.0-mig-product_supplierinfo_for_customer_sale%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
6284

63-
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
64-
:alt: Try me on Runbot
65-
:target: https://runbot.odoo-community.org/runbot/95/10.0
85+
Do not contact contributors directly about support or help with technical issues.
6686

6787
Credits
6888
=======
6989

70-
Images
71-
------
90+
Authors
91+
~~~~~~~
7292

73-
* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.
93+
* Agile Business Group
7494

7595
Contributors
76-
------------
96+
~~~~~~~~~~~~
7797

98+
* Xavier Jimenez <xavier.jimenez@qubiq.es>
7899
* Nicola Malcontenti <nicola.malcontenti@agilebg.com>
79100
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
80101

81-
Maintainer
82-
----------
102+
Maintainers
103+
~~~~~~~~~~~
104+
105+
This module is maintained by the OCA.
83106

84107
.. image:: https://odoo-community.org/logo.png
85108
:alt: Odoo Community Association
86109
:target: https://odoo-community.org
87110

88-
This module is maintained by the OCA.
89-
90111
OCA, or the Odoo Community Association, is a nonprofit organization whose
91112
mission is to support the collaborative development of Odoo features and
92113
promote its widespread use.
93114

94-
To contribute to this module, please visit https://odoo-community.org.
115+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/11.0-mig-product_supplierinfo_for_customer_sale/product_supplierinfo_for_customer_sale>`_ project on GitHub.
116+
117+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
# Copyright 2013-2017 Agile Business Group sagl
3-
# (<http://www.agilebg.com>)
41
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
52

63
from . import models

product_supplierinfo_for_customer_sale/__manifest__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright 2013-2017 Agile Business Group sagl
32
# (<http://www.agilebg.com>)
43
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
54
{
65
"name": "Product Supplierinfo for Customer Sale",
7-
"version": "10.0.1.0.0",
6+
"version": "11.0.1.0.0",
87
"summary": "Loads in every sale order line the customer code defined "
98
"in the product",
109
"author": "Agile Business Group,Odoo Community Association (OCA)",
11-
"website": "http://www.agilebg.com",
10+
"website": "https://github.com/OCA/sale-workflow/tree/11.0/product_supplierinfo_for_customer_sale", # noqa
1211
"category": "Sales Management",
1312
"license": "AGPL-3",
1413
"depends": [

product_supplierinfo_for_customer_sale/models/__init__.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
# Copyright 2013-2017 Agile Business Group sagl
3-
# (<http://www.agilebg.com>)
41
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
52

63
from . import sale

product_supplierinfo_for_customer_sale/models/sale.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright 2013-2017 Agile Business Group sagl
32
# (<http://www.agilebg.com>)
43
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
@@ -18,7 +17,7 @@ def _compute_get_product_customer_code(self):
1817
code_id = self.env['product.supplierinfo'].search([
1918
'|', ('product_tmpl_id', '=', product.product_tmpl_id.id),
2019
('product_id', '=', product.id),
21-
('type', '=', 'customer'),
20+
('supplierinfo_type', '=', 'customer'),
2221
('name', '=', line.order_id.partner_id.id),
2322
], limit=1)
2423
line.product_customer_code = code_id.product_code or ''
@@ -54,7 +53,7 @@ def product_id_change(self):
5453
code_id = self.env['product.supplierinfo'].search([
5554
'|', ('product_tmpl_id', '=', product.product_tmpl_id.id),
5655
('product_id', '=', product.id),
57-
('type', '=', 'customer'),
56+
('supplierinfo_type', '=', 'customer'),
5857
('name', '=', line.order_id.partner_id.id),
5958
], limit=1)
6059
if code_id and code_id.min_qty:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* Xavier Jimenez <xavier.jimenez@qubiq.es>
2+
* Nicola Malcontenti <nicola.malcontenti@agilebg.com>
3+
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Based on product_supplierinfo_for_customer, this module loads in every sale order the
2+
customer code defined in the product.
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* Putting a minimum qty in a pricelist rule means the system will use the
2+
option 'list price' instead of any option you chose.

product_supplierinfo_for_customer_sale/tests/test_product_name_search.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class TestProductNameSearch(TransactionCase):
1212
"""
1313
def setUp(self):
1414
super(TestProductNameSearch, self).setUp()
15-
self.customer = self.env.ref('base.res_partner_9')
15+
self.customer = self.env.ref('base.res_partner_1')
1616
self.customer_1 = self.env.ref('base.res_partner_2')
1717
self.product = self.env['product.product'].create(
1818
{'name': 'Name_product',
@@ -26,7 +26,7 @@ def setUp(self):
2626
'product_name': 'Name_test',
2727
'name': self.customer.id,
2828
'product_tmpl_id': self.product.product_tmpl_id.id,
29-
'type': 'customer',
29+
'supplierinfo_type': 'customer',
3030
}
3131

3232
def test_10_find_product_customer_code(self):
@@ -40,24 +40,24 @@ def test_10_find_product_customer_code(self):
4040

4141
# Search by product customer code
4242
product_names = self.product.name_search(name='code_test')
43-
self.assertEquals(len(product_names), 1)
44-
self.assertEquals(self.product.id, product_names[0][0])
45-
self.assertEquals('[code_test] Name_test', product_names[0][1])
43+
self.assertEqual(len(product_names), 1)
44+
self.assertEqual(self.product.id, product_names[0][0])
45+
self.assertEqual('[code_test] Name_test', product_names[0][1])
4646

4747
# Search by product default code with the customer used in
4848
# configuration customer
4949
product_names = self.product.name_search(name='code_product')
50-
self.assertEquals(len(product_names), 1)
51-
self.assertEquals(self.product.id, product_names[0][0])
52-
self.assertEquals('[code_test] Name_test', product_names[0][1])
50+
self.assertEqual(len(product_names), 1)
51+
self.assertEqual(self.product.id, product_names[0][0])
52+
self.assertEqual('[code_test] Name_test', product_names[0][1])
5353

5454
# Search by product default code with a different customer used in
5555
# configuration customer
5656
product_names = self.product.with_context(
5757
partner_id=self.customer_1.id).name_search(name='code_product')
58-
self.assertEquals(len(product_names), 1)
59-
self.assertEquals(self.product.id, product_names[0][0])
60-
self.assertEquals('[code_product] Name_product', product_names[0][1])
58+
self.assertEqual(len(product_names), 1)
59+
self.assertEqual(self.product.id, product_names[0][0])
60+
self.assertEqual('[code_product] Name_product', product_names[0][1])
6161

6262
# Create a product_1 with default_code similar to customer_code of
6363
# product, then name_search must find two products
@@ -71,7 +71,7 @@ def test_10_find_product_customer_code(self):
7171

7272
# Search by product customer code
7373
product_names = self.product.name_search(name='code_test')
74-
self.assertEquals(len(product_names), 2)
74+
self.assertEqual(len(product_names), 2)
7575
product_names = product_names[0] + product_names[1]
7676
self.assertIn(self.product.id, product_names)
7777
self.assertIn(self.product_1.id, product_names)

product_supplierinfo_for_customer_sale/tests/test_product_supplierinfo_for_customer_sale.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
32
# (http://www.eficent.com)
43
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
@@ -29,19 +28,19 @@ def _create_customer(self, name):
2928
'phone': 123456,
3029
})
3130

32-
def _create_supplierinfo(self, type, partner, product):
33-
return self.env['product.supplierinfo'].create({
31+
def _create_supplierinfo(self, supplierinfo_type, partner, product):
32+
return self.supplierinfo_model.create({
3433
'name': partner.id,
3534
'product_id': product.id,
3635
'product_name': 'product4',
3736
'product_code': '00001',
38-
'type': type,
37+
'supplierinfo_type': supplierinfo_type,
3938
'price': 100.0,
4039
'min_qty': 15.0,
4140
})
4241

4342
def _create_pricelist(self, name, product):
44-
return self.env['product.pricelist'].create({
43+
return self.pricelist_model.create({
4544
'name': name,
4645
'currency_id': self.env.ref('base.USD').id,
4746
'item_ids': [(0, 0, {

product_supplierinfo_for_customer_sale/views/sale_view.xml

+9-9
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
<attribute name="string">Supplierinfo</attribute>
3333
</xpath>
3434
<filter name="active" position="before">
35-
<filter string="Customer" domain="[('type','=','customer')]"
35+
<filter string="Customer" domain="[('supplierinfo_type','=','customer')]"
3636
name="is_customer_filter"/>
37-
<filter string="Supplier" domain="[('type','=','supplier')]"
37+
<filter string="Supplier" domain="[('supplierinfo_type','=','supplier')]"
3838
name="is_supplier_filter"/>
3939
</filter>
4040
<xpath expr="//search/group" position="attributes">
@@ -47,8 +47,8 @@
4747
name="gb_product_template"
4848
context="{'group_by':'product_tmpl_id'}"/>
4949
<separator />
50-
<filter string="Type" domain="[]" name="gb_type"
51-
context="{'group_by':'type'}"/>
50+
<filter string="Type" domain="[]" name="gb_supplierinfo_type"
51+
context="{'group_by':'supplierinfo_type'}"/>
5252
</xpath>
5353
</field>
5454
</record>
@@ -60,14 +60,14 @@
6060
<field name="priority" eval="20"/>
6161
<field name="arch" type="xml">
6262
<xpath expr="//field[@name='order_line']/form//field[@name='product_id']" position="attributes">
63-
<attribute name="context">{'partner_id': parent.partner_id, 'quantity': product_uos_qty,
64-
'pricelist': parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id,
63+
<attribute name="context">{'partner_id': parent.partner_id, 'quantity': product_uom_qty,
64+
'pricelist': parent.pricelist_id, 'uom': product_uom, 'company_id': parent.company_id,
6565
'supplierinfo_type': 'customer'}</attribute>
6666
</xpath>
6767
<xpath expr="//field[@name='order_line']/tree//field[@name='product_id']" position="attributes">
68-
<attribute name="context">{'partner_id': parent.partner_id, 'quantity': product_uos_qty,
69-
'pricelist': parent.pricelist_id, 'uom':product_uom, 'company_id': parent.company_id,
70-
'supplierinfo_type': 'customer'}</attribute>
68+
<attribute name="context">{'partner_id': parent.partner_id, 'quantity': product_uom_qty,
69+
'pricelist': parent.pricelist_id, 'uom': product_uom, 'company_id': parent.company_id,
70+
'default_lst_price': price_unit, 'supplierinfo_type': 'customer'}</attribute>
7171
</xpath>
7272
</field>
7373
</record>

0 commit comments

Comments
 (0)