Search code examples
odooodoo-15

How can I make an invoice from custom module ?? I know I need to make Create method for invoice but where to put that method ?? I am beginner in odoo


This is my Custom Module : enter image description here

When I Click on Create invoice button it shows wizard as shown below : enter image description here

But when I try to Create regular invoice it shows error :

enter image description here

I Changed the invoicing policy of product from "delivered quantities" to "ordered quantities" but still it throws same error.

xml code adding buttons :

          <header>
                <button name="action_draft" string="Draft" type="object" data-hotkey="r"/>
                <button name="action_in_progress" string="In Progress" type="object" data-hotkey="p"/>
                <button name="action_done" string="Done" type="object" states="in_progress"/>
                <button name="action_cancel" string="Cancel" type="object" data-hotkey="x"/>
                <field name="state" widget="statusbar" nolabel="1"/>
                <button name="331" string="Create Invoice" type="action" data-hotkey="x" states="done"/>
            </header>

Solution

  • You need to create a python function that does it and then to call that function by naming a button as your function.

    Odoo tutorial explaining how to proceed

    Code example about how to create an account.move

    Don't forget to add taxes if you need to.