Skip to content

Commit 5e3d118

Browse files
committed
Merge PR #2494 into 14.0
Signed-off-by rousseldenis
2 parents e8aa912 + be16b5a commit 5e3d118

16 files changed

Lines changed: 735 additions & 0 deletions

File tree

sale_require_po_doc/README.rst

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
=============================================
2+
Sale Orders Require PO or Sales Documentation
3+
=============================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:e5ff855d8b30eade264afc1431b3bd64546f6d0ae74d160c449bc89d4d81d5aa
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
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-OCA%2Fsale--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/sale-workflow/tree/14.0/sale_require_po_doc
21+
:alt: OCA/sale-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/sale-workflow-14-0/sale-workflow-14-0-sale_require_po_doc
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=14.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
The goal of this development is to create a field for validation to notate which customers require a purchase order in order to create an invoice.
32+
33+
**Table of contents**
34+
35+
.. contents::
36+
:local:
37+
38+
Bug Tracker
39+
===========
40+
41+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
42+
In case of trouble, please check there if your issue has already been reported.
43+
If you spotted it first, help us to smash it by providing a detailed and welcomed
44+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_require_po_doc%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
45+
46+
Do not contact contributors directly about support or help with technical issues.
47+
48+
Credits
49+
=======
50+
51+
Authors
52+
~~~~~~~
53+
54+
* Open Source Integrators
55+
56+
Contributors
57+
~~~~~~~~~~~~
58+
59+
* Daniel Reis <[email protected]>
60+
* Chandresh Thakkar <[email protected]>
61+
62+
Other credits
63+
~~~~~~~~~~~~~
64+
65+
* Open Source Integrators <[email protected]>
66+
67+
Maintainers
68+
~~~~~~~~~~~
69+
70+
This module is maintained by the OCA.
71+
72+
.. image:: https://odoo-community.org/logo.png
73+
:alt: Odoo Community Association
74+
:target: https://odoo-community.org
75+
76+
OCA, or the Odoo Community Association, is a nonprofit organization whose
77+
mission is to support the collaborative development of Odoo features and
78+
promote its widespread use.
79+
80+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/14.0/sale_require_po_doc>`_ project on GitHub.
81+
82+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

sale_require_po_doc/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (C) 2021 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from . import models
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (C) 2021 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Sale Orders Require PO or Sales Documentation",
6+
"version": "14.0.1.0.0",
7+
"license": "AGPL-3",
8+
"author": "Open Source Integrators, Odoo Community Association (OCA)",
9+
"website": "https://github.com/OCA/sale-workflow",
10+
"category": "Sales",
11+
"depends": ["sale_management"],
12+
"data": ["views/res_partner_view.xml", "views/sale_order_view.xml"],
13+
"auto_install": False,
14+
"application": False,
15+
"installable": True,
16+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_require_po_doc
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 14.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: <>\n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: sale_require_po_doc
17+
#: model:ir.model.fields,help:sale_require_po_doc.field_res_partner__customer_need_po
18+
#: model:ir.model.fields,help:sale_require_po_doc.field_res_users__customer_need_po
19+
#: model:ir.model.fields,help:sale_require_po_doc.field_sale_order__customer_need_po
20+
msgid "A PO number will be required on the Sales Order field for Customer Reference"
21+
msgstr ""
22+
23+
#. module: sale_require_po_doc
24+
#: model:ir.model,name:sale_require_po_doc.model_res_partner
25+
msgid "Contact"
26+
msgstr ""
27+
28+
#. module: sale_require_po_doc
29+
#: model:ir.model.fields,field_description:sale_require_po_doc.field_res_partner__customer_need_po
30+
#: model:ir.model.fields,field_description:sale_require_po_doc.field_res_users__customer_need_po
31+
#: model:ir.model.fields,field_description:sale_require_po_doc.field_sale_order__customer_need_po
32+
msgid "Customer Requires PO"
33+
msgstr ""
34+
35+
#. module: sale_require_po_doc
36+
#: model:ir.model.fields,help:sale_require_po_doc.field_res_partner__sale_doc
37+
#: model:ir.model.fields,help:sale_require_po_doc.field_res_users__sale_doc
38+
#: model:ir.model.fields,help:sale_require_po_doc.field_sale_order__sale_doc
39+
msgid "Details of the sales documentation required for this customer. Sales documentation notes field will be required on Sales Orders This is complementary to requiring a PO number, and can be used with or without that setting."
40+
msgstr ""
41+
42+
#. module: sale_require_po_doc
43+
#: selection:sale.order,sale_document_option:0
44+
msgid "Documentation required obtained and archived"
45+
msgstr ""
46+
47+
#. module: sale_require_po_doc
48+
#: selection:sale.order,sale_document_option:0
49+
msgid "No documentation needed for this Sale"
50+
msgstr ""
51+
52+
#. module: sale_require_po_doc
53+
#: model:ir.model.fields,field_description:sale_require_po_doc.field_sale_order__sale_document_option
54+
msgid "Sale Documentation"
55+
msgstr ""
56+
57+
#. module: sale_require_po_doc
58+
#: model:ir.model.fields,field_description:sale_require_po_doc.field_sale_order__sale_document_note
59+
msgid "Sale Documentation Notes"
60+
msgstr ""
61+
62+
#. module: sale_require_po_doc
63+
#: model:ir.model,name:sale_require_po_doc.model_sale_order
64+
msgid "Sale Order"
65+
msgstr ""
66+
67+
#. module: sale_require_po_doc
68+
#: model:ir.model.fields,field_description:sale_require_po_doc.field_res_partner__sale_doc
69+
#: model:ir.model.fields,field_description:sale_require_po_doc.field_res_users__sale_doc
70+
#: model:ir.model.fields,field_description:sale_require_po_doc.field_sale_order__sale_doc
71+
msgid "Sales Require Documentation"
72+
msgstr ""
73+
74+
#. module: sale_require_po_doc
75+
#: code:addons/sale_require_po_doc/models/sale_order.py:32
76+
#, python-format
77+
msgid "You can not confirm sale order without Customer reference."
78+
msgstr ""
79+
80+
#. module: sale_require_po_doc
81+
#: code:addons/sale_require_po_doc/models/sale_order.py:36
82+
#, python-format
83+
msgid "You can not confirm sale order without Sale Documentation."
84+
msgstr ""
85+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (C) 2021 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from . import res_partner
5+
from . import sale_order
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (C) 2021 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ResPartner(models.Model):
8+
_inherit = "res.partner"
9+
10+
customer_need_po = fields.Boolean(
11+
string="Customer Requires PO",
12+
tracking=True,
13+
help="A PO number will be required on the"
14+
" Sales Order field for Customer Reference",
15+
)
16+
sale_doc = fields.Text(
17+
string="Sales Require Documentation",
18+
tracking=True,
19+
help="Details of the sales documentation required for this customer."
20+
" Sales documentation notes field will be required on Sales Orders"
21+
" This is complementary to requiring a PO number, and can be used"
22+
" with or without that setting.",
23+
)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright (C) 2021 Open Source Integrators
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import _, fields, models
5+
from odoo.exceptions import ValidationError
6+
7+
8+
class SaleOrder(models.Model):
9+
_inherit = "sale.order"
10+
11+
customer_need_po = fields.Boolean(
12+
related="partner_id.customer_need_po",
13+
string="Customer Requires PO",
14+
readonly=True,
15+
)
16+
sale_doc = fields.Text(
17+
related="partner_id.sale_doc",
18+
string="Sales Require Documentation",
19+
readonly=True,
20+
)
21+
sale_document_option = fields.Selection(
22+
[
23+
("no_need", "No documentation needed for this Sale"),
24+
("done", "Documentation required obtained and archived"),
25+
],
26+
string="Sale Documentation",
27+
)
28+
sale_document_note = fields.Text(string="Sale Documentation Notes")
29+
30+
def action_confirm(self):
31+
for order in self:
32+
if order.customer_need_po and not order.client_order_ref:
33+
raise ValidationError(
34+
_(
35+
"You can not confirm sale order without \
36+
Customer reference."
37+
)
38+
)
39+
if order.sale_doc and not order.sale_document_option:
40+
raise ValidationError(
41+
_(
42+
"You can not confirm sale order without \
43+
Sale Documentation."
44+
)
45+
)
46+
return super(SaleOrder, self).action_confirm()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* Daniel Reis <[email protected]>
2+
* Chandresh Thakkar <[email protected]>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Open Source Integrators <[email protected]>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The goal of this development is to create a field for validation to notate which customers require a purchase order in order to create an invoice.

0 commit comments

Comments
 (0)