This question has been flagged
4 Replies
8890 Views

Hi, I need to mark SO as fully invoiced (because no more invoicing is expected) despite the invoice amount is not 100% of the SO.

We service our customers in many locations and charge them per travelled distance. In the quotation stage we estimate the distance and when the client accepts the conditions, we have SO with estimated distance (km). Nevertheless, once the service takes place, real distance shall be invoiced, but the SO is not editable any more as the sale is confirmed. We invoice a bit more or less than stated in SO and consider such SO as fulfilled.

Any idea how to mark SO as invoiced without going into the database ?

Avatar
Discard
Author

Odoo 11 CE

Best Answer

Please post the Version (eg: 9, 10, 11) and Edition (Community, Enterprise, Online) as the answer might be different depending on which Version and/or Edition you use.

A great way to setup Odoo v11 (CE, EE, OE) to handle this case:

Create a product as a SERVICE with an INVOICING POLICY of "Delivered Quantities":



After the Sales Order is confirmed, you can now update the DELIVERED QUANTITY of the Service:


You can enter ANY quantity - either less than or more than the quoted amount - it can be HOURS, UNITS, KM, etc.


To mark EXISTING Orders as FULLY INVOICES, force the readonly attribute of the invoice_status field in the view to "0" so you can edit it.  You will have to do this AFTER the order has been LOCKED - if you change it before this Odoo will change it back.



You should do this in your own view, with code like this:

<data>
<field name="invoice_status" position="replace">
<field name="invoice_status" states="sale,done" readonly="0"/>
</field>
</data
Avatar
Discard
Author

Hi Ray, many thanks for the comprehensive advice. It works perfectly !

Wondering if you have any thoughts on accomplishing this with Studio on Odoo 16? As a manufacturer we often with ship less than the ordered amount due to production variances. "Invoiced Complete" is a common term. Is there a way to make a smart button or such to log an SO as complete?

@Tim - since this was posted we now have the ability to LOCK orders. You can also create your own Custom field and set the value with a Server Action if you need to, it depends on what you are trying to achieve

Best Answer

Thank you for the reply Ray. I ended up creating a server action to change invoice status to invoiced and set it as contextual so that it appears in the action menu. Seems to work well for our needs. Thank you for all in the insights you provide on the forum!

Avatar
Discard

Hi Tim! Can you tell me how did you created this server action to manage to turn a sales order "fully invoiced"?
Thank you!

I am not the best at this but I will try to lay out the steps. I suggest trying it first in a stagging environment or on runbot.
Turn developer mode on or install the app : https://youtu.be/wGWHAX68Rt8?si=-fQPDFS9uM0gu_zU
From the home screen simple start typing 'server action' and the option will appear.
Click new.
Model is sales order
Action is update record
Field is invoiced status
Evaluation type is value
Value is invoiced
Save
Click create contextual action
Goto sales application and refresh
Action should appear in the action drop down

If you are new to server actions I suggest watching some of this Odooer's videos. Some great tips:
https://www.youtube.com/@odoo-it-yourself/search?query=server

Best Answer

Look in the following area:


   
   

   

   











Avatar
Discard
Best Answer

Hello!
How exactly do I implement this in v15 / EE? Where do I put the code?

Avatar
Discard

Likely in the view_order_form, notebook. Currently identified as invisible.

<group name="sale_info" string="Invoicing">
<field name="fiscal_position_id" options="{'no_create': True}"/>
<field name="analytic_account_id" context="{'default_partner_id':partner_invoice_id, 'default_name':name}" attrs="{'readonly': [('invoice_count','!=',0),('state','=','sale')]}" groups="analytic.group_analytic_accounting" force_save="1"/>
<!-- <field name="invoice_status" states="sale,done" groups="base.group_no_one"/> -->
<field name="invoice_status" states="sale,done" readonly="0"/>
</group>