Invoice PO Required
by Odoo Apps by Mithahara https://apps.odoo.com/apps/modules/browse?author=Mithahara$ 29.00
Invoice PO Required
Invoice PO Required is an Odoo 20 app that refuses to post a customer invoice that has no customer PO number, for the customers you flag, and lets one override group post anyway for Odoo teams whose customers send invoices back when the purchase order number is missing.
Refuse to post a customer invoice that has no customer PO number, for the customers you flag
Some customers send an invoice back when it does not quote their purchase order number. Odoo posts such an invoice without a word, and an invoice made from a sales order is worse: when the order has no customer reference, Odoo puts the order number in the Customer Reference field, so the field looks filled in. Invoice PO Required adds one checkbox to the customer. For a flagged customer, its customer invoices cannot be posted until the Customer Reference holds something other than the invoice's own order numbers. This page shows each step with screenshots of an Odoo 20 Community database that holds a made-up Spokane packaging distributor, Cedar Ridge Packaging Supply, Inc.; the tables are real readings from the same run, and each picture says which it is.
It is a single rule. It refuses to post; it does not fill in the reference, does not check that the number is the right one, and does not look at credit notes or vendor bills. A member of one group can post anyway, and the chatter records who. Building this page found no fault in the app.
Install it, open a customer, tick Customer PO Required on the Invoicing tab. It needs the Invoicing app; Sales is not required.
Requires Odoo.sh or On-Premise. Third-party apps cannot be installed on Odoo Online (SaaS).
What does Invoice PO Required do?
Invoice PO Required refuses to post a customer invoice that has no customer PO number, for the customers you flag, and lets one override group post anyway.
- Tick Customer PO Required on a customer; its customer invoices cannot be posted until the Customer Reference holds something other than the invoice's own order numbers.
- It never writes the reference or any other field of an invoice.
Why is an invoice made from a sales order not counted as having a PO number?
When the order has no customer reference, Odoo copies the order's own number into the invoice's Customer Reference, so the field looks filled in. Invoice PO Required treats a reference made only of the invoice's own order numbers as missing.
- Order S00001 without a PO gave an invoice with Customer Reference S00001, which was refused; order S00002 with PO NG-PO-45020 gave an invoice that posted.
Who is Invoice PO Required for?
It is for Odoo teams whose customers send invoices back when the purchase order number is missing.
- It checks that a reference is present; it cannot know whether the number is the right one.
Invoice PO Required: key facts
| App name | Invoice PO Required |
|---|---|
| Technical name | mh_invoice_po_required |
| Odoo versions | 20.0 |
| Version | 20.0.1.0.2 |
| Licence | OPL-1 |
| Depends on | account, mail |
| Stores data | Stores: one checkbox on the customer, and a chatter note on an invoice when the override is used. Does not store: no table of its own, no script, no mail, no network call. |
| Not included / limits |
|
What does Odoo do without Invoice PO Required?
In Odoo 20 Community without Invoice PO Required, Odoo posts a customer invoice with an empty reference, or with the order number in it, without any message.
- Odoo copies the order's Customer Reference to the invoice, and when the order has none it puts the order name there.
Before you install
Each line was tested or read in the code.
- Changes: adds a checkbox to the customer form, one security group and a check when a customer invoice is posted. Nothing is checked until a customer is flagged.
- Keeps: every invoice, customer and chatter note, also after uninstall. It never writes the Customer Reference or any other field of an invoice. It adds no menu, no setting, no script, no e-mail and no network call. It depends on Invoicing and Discuss (mail); Sales is optional.
- Limits tested: the flag is read from the company, not from a contact; any reference counts, not only the right one (also '-', a lower-case order number, a semicolon list); an invoice of several orders posts when one has a PO; a reference equal to the order number counts as missing; only customer invoices are checked; the system user is checked too; ticking the flag needs the right to edit customers.
- Not an accounting, tax or compliance control: no such claim is made or verified.
- Not tested: Odoo Enterprise, Odoo.sh, other charts of accounts, several companies, subscription and point-of-sale invoices, the scheduled-posting job itself, other languages. There is no demo video.
1 Flag the customer
The problem
Odoo has no way to say which customers must quote a PO number, so nothing can stop the invoice that leaves without one.
What you see
On the customer form, Invoicing tab, General group, tick Customer PO Required and save. Its contacts and invoice addresses are covered by the company's flag, so an invoice addressed to a contact of the company is checked too. The flag is read from the company, not from the contact: ticking it on a contact whose company is not flagged does nothing, and the invoice posts with no reference. A customer you do not flag is never checked. Ticking the box is a write on the customer: a user with Invoicing rights only is refused by Odoo, so it is ticked by a user who can edit customers.
What it does not do
It does not add the flag to a list or a filter, and it has no company-wide switch.
The flag. Real Odoo screen, Odoo 20.
2 Posting is refused
The problem
Without the app, Odoo posts a customer invoice with an empty reference and says nothing.
What you see
Press Post on a draft invoice of a flagged customer whose Customer Reference is empty and Odoo shows a message instead: the customer PO number is missing, nothing was posted, the invoice is named, and how to fix it. The invoice stays a draft. The same refusal comes from the list action and the API; a blank reference, spaces only, or commas only count as missing. The table reads what posts and what is refused for ten cases.
What it does not do
It does not change the invoice, and it does not check credit notes, vendor bills, receipts or journal entries.
The refusal on one invoice. Real Odoo screen, Odoo 20.
What posts and what is refused. Evidence table.
3 The order number is not a PO number
The problem
A check that only asks whether the reference is empty would never fire on an invoice made from an order.
What you see
When an order has no customer reference, Odoo copies the order's own number into the invoice's Customer Reference (the picture shows S00001). The app compares the reference name by name with the invoice's source documents and treats a reference made only of those as missing, so that invoice is refused. An order with a customer reference, here NG-PO-45020, gives an invoice that posts. A reference typed identical to the order number counts as missing too.
What it does not do
It does not copy the PO from the order; Odoo does that.
What Odoo wrote. Real Odoo screen, Odoo 20.
4 A selection is refused as a whole
The problem
Posting a selection should not leave half of it posted and half of it forgotten.
What you see
Select four draft invoices of a flagged customer, three of which lack a PO number, and choose the post action: the message names the refused invoices and none of the four is posted, the one with a PO included. A message lists ten invoices and then counts the rest ("and 2 more invoices"). The second table also shows who may post anyway.
What it does not do
It does not post the invoices that are fine.
A selection of four, three named. Real Odoo screen, Odoo 20.
Batches and who may use the override. Evidence table.
5 Override and the record of it
The problem
Without an exit, the rule would refuse every invoice of a flagged customer that has no PO number.
What you see
Members of the group Invoice PO Override post the invoice. Each override is written to the invoice's chatter as "Customer PO check overridden by" and the user's name; an invoice that was fine gets no note. The group is implied by no other group and given to nobody, Administrators included, and code run as the system user is not an override user.
What it does not do
It does not ask for a reason, and it does not notify anyone.
The record of an override. Real Odoo screen, Odoo 20.
Known limits
Each of these was reproduced in a run on Odoo 20.
- The flag is read from the company, not the contact. Ticking Customer PO Required on a contact whose company is not flagged does nothing: an invoice to that contact with no reference posts. Flag the company and the same invoice is refused. (Read on a running Odoo, both versions.)
- Some references pass: a reference of '-', an order number in lower case (s00001 for order S00001) and order numbers separated by a semicolon (S00001;S00002) all pass the check; the exact order number and a comma-separated list are refused. (Read on a running Odoo, both versions.)
- Any reference counts, not only the right one.
- An invoice of several orders posts when at least one reference is not an order number.
- A reference equal to the order number counts as missing.
- Only customer invoices are checked.
- The system user is checked like everyone else; a scheduled posting run can be refused.
- The flag is ticked by a user who can edit customers.
- Not verified: Odoo Enterprise, Odoo.sh, other charts of accounts, several companies, subscription and point-of-sale invoices, the scheduled-posting job itself.
Limits and what was not tested. Evidence table.
Tests
32 automated tests ran on this version with no failure, two of them browser tours in Chromium. The same tests fail on a stub that never refuses (17 of 32), and 29 of 29 deliberate breaks of the code were caught, with the no-break control passing. Documents in the tests are created and posted through a real web session. Version 20.0.1.0.2 corrects this page (two more limits, a retaken refusal screenshot, the tables) and changes no behaviour; version 20.0.1.0.1 added the listing images.
Tests and checks. Evidence table.
Odoo 20 and Odoo 19
This page is for the Odoo 20 build. The Odoo Apps store lists each Odoo version separately; the Odoo 19 build has its own page. The behaviour is the same; the screens and tests on this page ran on Odoo 20 Community.
Requirements and install
Frequently asked questions about Invoice PO Required
How do I stop Odoo posting a customer invoice that has no customer PO number?
Invoice PO Required is an Odoo 20 app that refuses to post a customer invoice that has no customer PO number, for the customers you flag, and lets one override group post anyway, for Odoo teams whose customers send invoices back when the purchase order number is missing.
How do I set up Invoice PO Required?
Install it with Invoicing present, open a customer, tick Customer PO Required on the Invoicing tab, and add the people who may post anyway to the group Invoice PO Override. Customers you do not flag are never checked.
Who can post an invoice that has no PO number, and who can tick the flag?
Only members of the group Invoice PO Override, which is given to nobody by default, Administrators included; each override is written to the invoice's chatter. The flag is ticked by a user who can edit customers.
What does Invoice PO Required store?
One checkbox on the customer and a chatter note when the override is used; it never writes the reference or any other field of an invoice, and it has no table, script, mail or network call.
What can Invoice PO Required not do?
It does not check that the PO number is the right one or has a format, does not copy the PO from the order, does not check credit notes, vendor bills or receipts, and does not stop a sales order or a delivery.
Which known limits are recorded for Invoice PO Required?
The flag is read from the company, not from a contact; any reference counts (also '-', a lower-case order number and a semicolon list); an invoice of several orders posts when one has a PO; a reference equal to the order number counts as missing; only customer invoices are checked; and the system user is checked too.
What happens when several invoices are posted at once?
The selection is refused as a whole: the message names up to ten refused invoices and counts the rest, and none of the selection is posted, the ones with a PO included.
Does Invoice PO Required work on Odoo.sh, Odoo Online, Community or Enterprise?
Third-party apps cannot be installed on Odoo Online. Behaviour on Odoo.sh and on Enterprise is not verified; the tests and screenshots ran on Odoo 20 Community.
Support
Questions before or after purchase: support@mithahara.com.
Need this tailored to your business?
This app covers the common case out of the box. If you need it adapted to a specific workflow, integrated with another system, or extended with a feature you don't see here, we do custom Odoo development too - reach out at support@mithahara.com and we'll scope it.
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Discuss (mail)
• Invoicing (account) |
| Lines of code | 69 |
| Technical Name |
mh_invoice_po_required |
| License | OPL-1 |
| Website | https://apps.odoo.com/apps/modules/browse?author=Mithahara |
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module