Skip to content

Commit e1f9b9b

Browse files
DariosiFernandoRomera
authored andcommitted
[13.0][MIG] purchase_allowed_product: migration to 13.0
[UPD] Update purchase_allowed_product.pot [UPD] README.rst
1 parent 9ef0120 commit e1f9b9b

14 files changed

+547
-806
lines changed

purchase_allowed_product/README.rst

+10-6
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ Purchase and Invoice Allowed Product
1414
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1515
:alt: License: AGPL-3
1616
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
17-
:target: https://github.com/OCA/purchase-workflow/tree/12.0/purchase_allowed_product
17+
:target: https://github.com/OCA/purchase-workflow/tree/13.0/purchase_allowed_product
1818
:alt: OCA/purchase-workflow
1919
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20-
:target: https://translation.odoo-community.org/projects/purchase-workflow-12-0/purchase-workflow-12-0-purchase_allowed_product
20+
:target: https://translation.odoo-community.org/projects/purchase-workflow-13-0/purchase-workflow-13-0-purchase_allowed_product
2121
:alt: Translate me on Weblate
2222
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23-
:target: https://runbot.odoo-community.org/runbot/142/12.0
23+
:target: https://runbot.odoo-community.org/runbot/142/13.0
2424
:alt: Try me on Runbot
2525

26-
|badge1| |badge2| |badge3| |badge4| |badge5|
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
2727

2828
This module adds a restriction in purchase and supplier invoices that has the
2929
mark "Order and invoice only supplied products" checked for allowing to select
@@ -44,7 +44,7 @@ Bug Tracker
4444
Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/issues>`_.
4545
In case of trouble, please check there if your issue has already been reported.
4646
If you spotted it first, help us smashing it by providing a detailed and welcomed
47-
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_allowed_product%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
47+
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_allowed_product%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
4848

4949
Do not contact contributors directly about support or help with technical issues.
5050

@@ -67,6 +67,10 @@ Contributors
6767
* Manuel Calero
6868
* Pedro M. Baeza
6969

70+
* `Via laurea <https://www.vialaurea.com>`__:
71+
72+
* Darius Žižys
73+
7074
Maintainers
7175
~~~~~~~~~~~
7276

@@ -80,6 +84,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
8084
mission is to support the collaborative development of Odoo features and
8185
promote its widespread use.
8286

83-
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/12.0/purchase_allowed_product>`_ project on GitHub.
87+
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/13.0/purchase_allowed_product>`_ project on GitHub.
8488

8589
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

purchase_allowed_product/__manifest__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
"name": "Purchase and Invoice Allowed Product",
77
"summary": "This module allows to select only products that can be "
88
"supplied by the vendor",
9-
"version": "12.0.1.0.0",
9+
"version": "13.0.1.0.0",
1010
"category": "Accounting & Finance",
1111
"website": "https://github.com/OCA/purchase-workflow",
1212
"author": "Akretion, Odoo Community Association (OCA)",
1313
"license": "AGPL-3",
14-
"installable": True,
15-
"depends": ["purchase",],
14+
"depends": ["purchase"],
1615
"data": [
1716
"views/res_partner_view.xml",
18-
"views/account_invoice_view.xml",
17+
"views/account_move_views.xml",
1918
"views/purchase_order_view.xml",
2019
],
20+
"installable": True,
2121
}

purchase_allowed_product/i18n/purchase_allowed_product.pot

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Translation of Odoo Server.
22
# This file contains the translation of the following modules:
3-
# * purchase_allowed_product
3+
# * purchase_allowed_product
44
#
55
msgid ""
66
msgstr ""
7-
"Project-Id-Version: Odoo Server 12.0\n"
7+
"Project-Id-Version: Odoo Server 13.0\n"
88
"Report-Msgid-Bugs-To: \n"
9-
"Last-Translator: <>\n"
9+
"Last-Translator: \n"
1010
"Language-Team: \n"
1111
"MIME-Version: 1.0\n"
1212
"Content-Type: text/plain; charset=UTF-8\n"
@@ -31,19 +31,22 @@ msgstr ""
3131
#. module: purchase_allowed_product
3232
#: model:ir.model.fields,help:purchase_allowed_product.field_res_partner__use_only_supplied_product
3333
#: model:ir.model.fields,help:purchase_allowed_product.field_res_users__use_only_supplied_product
34-
msgid "If checked, by default you will only be able to select products that can be supplied by this supplier when creating a supplier invoice or purchase for it. This value can be changed by invoice or purchase."
34+
msgid ""
35+
"If checked, by default you will only be able to select products that can be "
36+
"supplied by this supplier when creating a supplier invoice or purchase for "
37+
"it. This value can be changed by invoice or purchase."
3538
msgstr ""
3639

3740
#. module: purchase_allowed_product
38-
#: model:ir.model.fields,help:purchase_allowed_product.field_account_invoice__use_only_supplied_product
41+
#: model:ir.model.fields,help:purchase_allowed_product.field_account_move__use_only_supplied_product
3942
#: model:ir.model.fields,help:purchase_allowed_product.field_purchase_order__use_only_supplied_product
4043
#: model:ir.model.fields,help:purchase_allowed_product.field_supplied_product_mixin__use_only_supplied_product
4144
msgid "If checked, only the products provided by this supplier will be shown."
4245
msgstr ""
4346

4447
#. module: purchase_allowed_product
45-
#: model:ir.model,name:purchase_allowed_product.model_account_invoice
46-
msgid "Invoice"
48+
#: model:ir.model,name:purchase_allowed_product.model_account_move
49+
msgid "Journal Entries"
4750
msgstr ""
4851

4952
#. module: purchase_allowed_product
@@ -78,7 +81,7 @@ msgid "Supplier Pricelist"
7881
msgstr ""
7982

8083
#. module: purchase_allowed_product
81-
#: model:ir.model.fields,field_description:purchase_allowed_product.field_account_invoice__use_only_supplied_product
84+
#: model:ir.model.fields,field_description:purchase_allowed_product.field_account_move__use_only_supplied_product
8285
#: model:ir.model.fields,field_description:purchase_allowed_product.field_purchase_order__use_only_supplied_product
8386
#: model:ir.model.fields,field_description:purchase_allowed_product.field_supplied_product_mixin__use_only_supplied_product
8487
msgid "Use only allowed products"
@@ -93,4 +96,3 @@ msgstr ""
9396
#: model:ir.model.fields,help:purchase_allowed_product.field_product_supplierinfo__name
9497
msgid "Vendor of this product"
9598
msgstr ""
96-
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from . import res_partner
22
from . import supplied_product_mixin
3-
from . import account_invoice
3+
from . import account_move
44
from . import product
55
from . import purchase_order
66
from . import product_supplierinfo

purchase_allowed_product/models/account_invoice.py purchase_allowed_product/models/account_move.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
from odoo import models
55

66

7-
class AccountInvoice(models.Model):
8-
_inherit = ["account.invoice", "supplied.product.mixin"]
9-
_name = "account.invoice"
7+
class AccountMove(models.Model):
8+
_inherit = ["account.move", "supplied.product.mixin"]
9+
_name = "account.move"

purchase_allowed_product/models/product.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@ def _search(
1919
count=False,
2020
access_rights_uid=None,
2121
):
22-
use_only_supplied_product = self.env.context.get("use_only_supplied_product")
23-
if use_only_supplied_product:
22+
if self.env.context.get("use_only_supplied_product"):
2423
restrict_supplier_id = self.env.context.get("restrict_supplier_id")
25-
seller = self.env["res.partner"].browse(restrict_supplier_id)
26-
seller = seller.commercial_partner_id
24+
seller = (
25+
self.env["res.partner"]
26+
.browse(restrict_supplier_id)
27+
.commercial_partner_id
28+
)
2729
supplierinfos = self.env["product.supplierinfo"].search(
2830
[("name", "=", seller.id)]
2931
)
3032
args += [
3133
"|",
32-
("product_tmpl_id", "in", supplierinfos.mapped("product_tmpl_id").ids),
33-
("id", "in", supplierinfos.mapped("product_id").ids),
34+
("product_tmpl_id", "in", supplierinfos.product_tmpl_id.ids),
35+
("id", "in", supplierinfos.product_id.ids),
3436
]
3537
return super()._search(
3638
args,

purchase_allowed_product/models/supplied_product_mixin.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ class SuppliedProductMixin(models.AbstractModel):
1515
)
1616

1717
@api.onchange("partner_id")
18-
def partner_id_change(self):
19-
only_supp_prod = self.partner_id.use_only_supplied_product
20-
if not only_supp_prod:
21-
only_supp_prod = (
22-
self.partner_id.commercial_partner_id.use_only_supplied_product
23-
)
24-
self.use_only_supplied_product = only_supp_prod
18+
def _onchange_partner_id_supplied_product(self):
19+
self.use_only_supplied_product = (
20+
self.partner_id.use_only_supplied_product
21+
or self.partner_id.commercial_partner_id.use_only_supplied_product
22+
)

purchase_allowed_product/readme/CONTRIBUTORS.rst

+4
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55

66
* Manuel Calero
77
* Pedro M. Baeza
8+
9+
* `Via laurea <https://www.vialaurea.com>`__:
10+
11+
* Darius Žižys

0 commit comments

Comments
 (0)