first commit

This commit is contained in:
Suherdy Yacob 2026-06-19 10:02:31 +07:00
commit 00334b38c8
5 changed files with 67 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
__pycache__/
*.pyc
*.pyo
*.pyd
.DS_Store

19
README.md Normal file
View File

@ -0,0 +1,19 @@
Purchase Create Bill Button
===========================
This module restores the Odoo 17 behavior on the Purchase Order form view:
* Adds "Create Bill" buttons in the header of the Purchase Order form view.
* Ensures the "Vendor Bills" smart button is visible even when there are no associated bills yet.
Features
--------
* Adds a primary "Create Bill" button (highlighted) when there are items ready to be billed.
* Adds a secondary "Create Bill" button when there are no items to bill yet (allowing manual billing).
* Shows the "Vendor Bills" smart button as soon as the purchase order is confirmed.
Usage
-----
Install the module. Navigate to Purchase -> Orders -> Purchase Orders. Confirmed purchase orders will now feature the "Create Bill" buttons, and the smart button for "Vendor Bills" will be visible.

1
__init__.py Normal file
View File

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

22
__manifest__.py Normal file
View File

@ -0,0 +1,22 @@
{
'name': 'Purchase Create Bill Button',
'version': '19.0.1.0.0',
'category': 'Inventory/Purchase',
'summary': 'Add Create Bill buttons and restore smart button visibility on Purchase Order form view like Odoo 17',
'description': """
Purchase Create Bill Button
===========================
This module restores the Odoo 17 behaviors:
1. Adds "Create Bill" buttons in the header of the Purchase Order form view.
2. Ensures the "Vendor Bills" smart button is visible even when there are no associated bills yet.
""",
'author': 'Suherdy Yacob',
'depends': ['purchase'],
'data': [
'views/purchase_order_views.xml',
],
'installable': True,
'application': False,
'auto_install': False,
'license': 'LGPL-3',
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="purchase_order_form_inherit" model="ir.ui.view">
<field name="name">purchase.order.form.inherit.create.bill</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<!-- Add Create Bill buttons in header after the file uploader widget -->
<xpath expr="//widget[@name='purchase_file_uploader']" position="after">
<button name="action_create_invoice" string="Create Bill" type="object" class="oe_highlight" context="{'create_bill':True}" invisible="state != 'purchase' or invoice_status != 'to invoice'" data-hotkey="w"/>
<button name="action_create_invoice" string="Create Bill" type="object" context="{'create_bill':True}" invisible="state != 'purchase' or invoice_status != 'no'" data-hotkey="w"/>
</xpath>
<!-- Modify the Vendor Bills smart button to be visible even if invoice_count is 0 -->
<xpath expr="//button[@name='action_view_invoice']" position="attributes">
<attribute name="invisible">state in ('draft', 'sent', 'to approve')</attribute>
</xpath>
</field>
</record>
</odoo>