Skip to content

Commit 4feef3a

Browse files
committed
[T-8592][MIG] partner_code_program_purchase: migration to 18.0
1 parent 49346b8 commit 4feef3a

10 files changed

Lines changed: 101 additions & 38 deletions

File tree

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
1-
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2-
:target: http://www.gnu.org/licenses/agpl
3-
:alt: License: AGPL-3
4-
51
=============================
6-
Partner code program Purchase
2+
Partner Code Program Purchase
73
=============================
84

9-
This module adds the partner code program in porchase orders and purchase reports
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:cd3aaf73c6bbd35d86c3ca47af0d5e5d0c32cd04af8182b0602028e8f63c171c
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1012
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-sygel--technology%2Fsy--partner--contact-lightgray.png?logo=github
20+
:target: https://github.com/sygel-technology/sy-partner-contact/tree/18.0/partner_code_program_purchase
21+
:alt: sygel-technology/sy-partner-contact
1122

12-
Usage
13-
=====
23+
|badge1| |badge2| |badge3|
1424

15-
To use this module, you need to:
25+
This module adds the partner code program in porchase orders and
26+
purchase reports
1627

17-
#. Create new program codes in Contacts / Configuration / Code Programs
18-
#. Edit the code program of a partner of type company in the address field of the partner form
19-
#. Create a purchase order with that partner. Now you can filter and group by code program
28+
**Table of contents**
2029

30+
.. contents::
31+
:local:
2132

2233
Installation
2334
============
@@ -26,52 +37,52 @@ To install this module, you need to:
2637

2738
#. Only install
2839

29-
3040
Configuration
3141
=============
3242

3343
To configure this module, you need to:
3444

3545
#. Only install
3646

47+
Usage
48+
=====
49+
50+
To use this module, you need to:
51+
52+
#. Create new program codes in Contacts / Configuration / Code Programs
53+
#. Edit the code program of a partner of type company in the address
54+
field of the partner form #. Create a purchase order with that partner.
55+
Now you can filter and group by code program
3756

3857
Bug Tracker
3958
===========
4059

41-
Bugs and errors are managed in `issues of GitHub <https://github.com/sygel-technology/sy-partner-contact/issues>`_.
42-
In case of problems, please check if your problem has already been
43-
reported. If you are the first to discover it, help us solving it by indicating
44-
a detailed description `here <https://github.com/sygel-technology/sy-partner-contact/issues/new>`_.
60+
Bugs are tracked on `GitHub Issues <https://github.com/sygel-technology/sy-partner-contact/issues>`_.
61+
In case of trouble, please check there if your issue has already been reported.
62+
If you spotted it first, help us to smash it by providing a detailed and welcomed
63+
`feedback <https://github.com/sygel-technology/sy-partner-contact/issues/new?body=module:%20partner_code_program_purchase%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
4564

4665
Do not contact contributors directly about support or help with technical issues.
4766

48-
4967
Credits
5068
=======
5169

5270
Authors
53-
~~~~~~~
54-
55-
* Sygel, Odoo Community Association (OCA)
71+
-------
5672

73+
* Sygel
5774

5875
Contributors
59-
~~~~~~~~~~~~
60-
61-
* Valentin Vinagre <valentin.vinagre@sygel.es>
62-
* Alberto Martínez <alberto.martinez@sygel.es>
63-
64-
65-
Maintainer
66-
~~~~~~~~~~
76+
------------
6777

68-
This module is maintained by Sygel.
78+
- `Sygel <https://www.sygel.es>`__:
6979

70-
.. image:: https://www.sygel.es/logo.png
71-
:alt: Sygel
72-
:target: https://www.sygel.es
80+
- Valentín Vinagre
81+
- Alberto Martínez
7382

74-
This module is part of the `Sygel/sy-partner-contact <https://github.com/sygel-technology/sy-partner-contact>`_.
83+
Maintainers
84+
-----------
7585

76-
To contribute to this module, please visit https://github.com/sygel-technology/.
86+
This module is part of the `sygel-technology/sy-partner-contact <https://github.com/sygel-technology/sy-partner-contact/tree/18.0/partner_code_program_purchase>`_ project on GitHub.
7787

88+
You are welcome to contribute.

partner_code_program_purchase/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "Partner Code Program Purchase",
55
"summary": "Adds the partner code program fields on purchases",
6-
"version": "17.0.1.0.0",
6+
"version": "18.0.1.0.0",
77
"category": "Partner Management",
88
"website": "https://github.com/sygel-technology/sy-partner-contact",
99
"author": "Sygel",

partner_code_program_purchase/models/purchase_report.py

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

44
from odoo import fields, models
5+
from odoo.tools import SQL
56

67

78
class PurchaseReport(models.Model):
@@ -13,7 +14,7 @@ class PurchaseReport(models.Model):
1314
)
1415

1516
def _select(self):
16-
return super()._select() + ", partner.code_program_id as code_program_id"
17+
return SQL("%s, partner.code_program_id as code_program_id", super()._select())
1718

1819
def _group_by(self):
19-
return super()._group_by() + ", partner.code_program_id"
20+
return SQL("%s, partner.code_program_id", super()._group_by())
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To configure this module, you need to:
2+
3+
#. Only install
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- [Sygel](https://www.sygel.es):
2+
- Valentín Vinagre
3+
- Alberto Martínez
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module adds the partner code program in porchase orders and purchase reports
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
To install this module, you need to:
2+
3+
#. Only install
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
To use this module, you need to:
2+
3+
#. Create new program codes in Contacts / Configuration / Code Programs
4+
#. Edit the code program of a partner of type company in the address field of the partner form
5+
#. Create a purchase order with that partner. Now you can filter and group by code program
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import test_partner_code_program_purchase
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from odoo.tests.common import TransactionCase
2+
3+
4+
class TestPartnerCodeProgramPurchase(TransactionCase):
5+
@classmethod
6+
def setUpClass(cls):
7+
super().setUpClass()
8+
9+
cls.partner_code_program = cls.env["res.partner.code.program"].create(
10+
{
11+
"name": "Program test",
12+
"code": "CP-001",
13+
}
14+
)
15+
16+
cls.partner = cls.env["res.partner"].create(
17+
{
18+
"name": "Partner test",
19+
"code_program_id": cls.partner_code_program.id,
20+
}
21+
)
22+
23+
cls.purchase_report = cls.env["purchase.report"]
24+
25+
def test_code_program_id(self):
26+
self.assertIn("code_program_id", self.purchase_report._fields)
27+
28+
def test_select(self):
29+
self.assertIn(
30+
"partner.code_program_id as code_program_id",
31+
str(self.purchase_report._select()),
32+
)
33+
34+
def test_group_by(self):
35+
self.assertIn("partner.code_program_id", str(self.purchase_report._group_by()))

0 commit comments

Comments
 (0)