Skip to content

Commit a6a9cf4

Browse files
HviorForgeFlowmanuelregidor
authored andcommitted
[13.0][ADD] purchase_warn_message
1 parent 2ad93a8 commit a6a9cf4

12 files changed

+610
-0
lines changed

purchase_warn_message/README.rst

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
=====================
2+
Purchase Warn Message
3+
=====================
4+
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%2Fpurchase--workflow-lightgray.png?logo=github
17+
:target: https://github.com/OCA/purchase-workflow/tree/13.0/purchase_warn_message
18+
:alt: OCA/purchase-workflow
19+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20+
:target: https://translation.odoo-community.org/projects/purchase-workflow-13-0/purchase-workflow-13-0-purchase_warn_message
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/142/13.0
24+
:alt: Try me on Runbot
25+
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
27+
28+
This module add a warning popup on purchase orders to ensure warning is
29+
populated no only when partner is changed.
30+
31+
**Table of contents**
32+
33+
.. contents::
34+
:local:
35+
36+
Bug Tracker
37+
===========
38+
39+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/issues>`_.
40+
In case of trouble, please check there if your issue has already been reported.
41+
If you spotted it first, help us smashing it by providing a detailed and welcomed
42+
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_warn_message%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
43+
44+
Do not contact contributors directly about support or help with technical issues.
45+
46+
Credits
47+
=======
48+
49+
Authors
50+
~~~~~~~
51+
52+
* ForgeFlow
53+
54+
Contributors
55+
~~~~~~~~~~~~
56+
57+
* Héctor Villarreal <hector.villarreal@forgeflow.com>
58+
59+
Maintainers
60+
~~~~~~~~~~~
61+
62+
This module is maintained by the OCA.
63+
64+
.. image:: https://odoo-community.org/logo.png
65+
:alt: Odoo Community Association
66+
:target: https://odoo-community.org
67+
68+
OCA, or the Odoo Community Association, is a nonprofit organization whose
69+
mission is to support the collaborative development of Odoo features and
70+
promote its widespread use.
71+
72+
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/13.0/purchase_warn_message>`_ project on GitHub.
73+
74+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

purchase_warn_message/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models

purchase_warn_message/__manifest__.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2020 ForgeFlow S.L.
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Purchase Warn Message",
6+
"summary": """
7+
Add a popup warning on purchase to ensure warning is populated""",
8+
"version": "13.0.1.0.0",
9+
"license": "AGPL-3",
10+
"author": "ForgeFlow, Odoo Community Association (OCA)",
11+
"website": "www.github.com/OCA/stock-logistics-workflow.git",
12+
"depends": ["purchase"],
13+
"data": ["views/purchase_order_views.xml"],
14+
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import purchase_order
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2020 ForgeFlow S.L.
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, fields, models
5+
6+
7+
class PurchaseOrder(models.Model):
8+
9+
_inherit = "purchase.order"
10+
11+
purchase_warn_msg = fields.Text(compute="_compute_purchase_warn_msg")
12+
13+
@api.depends(
14+
"state",
15+
"partner_id.purchase_warn",
16+
"partner_id.commercial_partner_id.purchase_warn",
17+
)
18+
def _compute_purchase_warn_msg(self):
19+
for rec in self:
20+
if rec.partner_id:
21+
if rec.state in ["done", "cancel"]:
22+
rec.sale_warn_msg = ""
23+
continue
24+
p = rec.partner_id.commercial_partner_id
25+
purchase_warn_msg = ""
26+
separator = ""
27+
if p.purchase_warn == "warning":
28+
separator = "\n"
29+
purchase_warn_msg += p.purchase_warn_msg
30+
if p != rec.partner_id and rec.partner_id.purchase_warn == "warning":
31+
purchase_warn_msg += separator + rec.partner_id.purchase_warn_msg
32+
rec.purchase_warn_msg = purchase_warn_msg
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Héctor Villarreal <hector.villarreal@forgeflow.com>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This module add a warning popup on purchase orders to ensure warning is
2+
populated no only when partner is changed.
Loading

0 commit comments

Comments
 (0)