Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions purchase_ux/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"views/purchase_line_views.xml",
"views/product_template_views.xml",
"views/product_supplierinfo_views.xml",
"views/res_company_views.xml",
],
"demo": [
"demo/purchase_order_demo.xml",
Expand Down
11 changes: 7 additions & 4 deletions purchase_ux/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from . import account_move
from . import purchase_order
from . import purchase_order_line
from . import product_template
from . import (
account_move,
product_template,
purchase_order,
purchase_order_line,
res_company,
)
1 change: 1 addition & 0 deletions purchase_ux/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class PurchaseOrder(models.Model):
_inherit = "purchase.order"

internal_notes = fields.Html()
skip_upload = fields.Boolean(related="company_id.skip_upload", string="Skip File Upload", readonly=True)

force_invoiced_status = fields.Selection(
[
Expand Down
14 changes: 14 additions & 0 deletions purchase_ux/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

skip_upload = fields.Boolean(
string="Skip Bill File Upload",
help="When enabled, bills will be created directly without requiring file upload in purchase orders.",
)
14 changes: 14 additions & 0 deletions purchase_ux/views/purchase_order_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
<field name="internal_notes" colspan="2" placeholder="Internal Notes..." nolabel="1" />
</field>

<!-- Add skip_upload field for visibility conditions -->
<field name="internal_notes" position="before">
<field name="skip_upload" invisible="1"/>
</field>

<button name="button_confirm" position="after">
<button name="button_set_invoiced" type="object" string="Set Invoiced" invisible="state != 'done' or invoice_status != 'to invoice'" confirm="This order will be setted as invoiced. This operation can't be undone. Are you sure do you want to continue?" groups="base.group_no_one"/>
</button>
Expand All @@ -35,6 +40,15 @@
<button name="%(action_purchase_change_currency)d" type="action" class="oe_inline oe_link" string="(change)" invisible="state not in ['draft', 'sent']"/>
</div>
</field>

<!-- Hide file uploader widget when skip_upload is enabled -->
<widget name="purchase_file_uploader" position="replace">
<widget name="purchase_file_uploader" invisible="state != 'purchase' or skip_upload"/>
<button name="action_create_invoice" type="object" string="Create Bill"
invisible="state != 'purchase' or not skip_upload"
class="oe_highlight"
data-hotkey="i"/>
</widget>
</field>
</record>

Expand Down
17 changes: 17 additions & 0 deletions purchase_ux/views/res_company_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<record id="view_company_form" model="ir.ui.view">
<field name="name">res.company.form.inherit.purchase.ux</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<field name="color" position="after">
<group string="Purchase">
<field name="skip_upload"/>
</group>
</field>
</field>
</record>

</odoo>