-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #971 from ursais/cb-quote-downpayments
[ADD] osi_quote_downpayment: allows downpayments on quotes
- Loading branch information
Showing
6 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (C) 2024, Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "OSI Quote Downpayment", | ||
"version": "17.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Open Source Integrators", | ||
"category": "Sales", | ||
"maintainer": "Open Source Integrators", | ||
"summary": "Allow downpayments on Quote", | ||
"website": "https://github.com/ursais/osi-addons", | ||
"depends": [ | ||
"sale", | ||
"account", | ||
], | ||
"data": [ | ||
"views/sale_order_views.xml", | ||
"wizards/sale_make_invoice_advance_views.xml", | ||
], | ||
"installable": True, | ||
"maintainers": ["bodedra"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import account_move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (C) 2019 - 2021, Open Source Integrators | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class AccountMove(models.Model): | ||
_inherit = "account.move" | ||
|
||
#Prevents price of downpayment from being reset on draft sale orders | ||
def action_post(self): | ||
downpayment_lines = {} | ||
for rec in records: | ||
downpayment_lines[rec.id] = {} | ||
for line in rec.invoice_line_ids: | ||
if "Down payment" in line.name: | ||
downpayment_lines[rec.id][line.id] = line.price_unit | ||
res = super().action_post() | ||
for rec in records: | ||
for line in rec.invoice_line_ids: | ||
if "Down payment" in line.name: | ||
downpayment_lines[rec.id][line.id] = line.price_unit | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<odoo> | ||
|
||
<record id="sale_order_form_view_inherit" model="ir.ui.view"> | ||
<field name="name">sale.order.form.view.inherit</field> | ||
<field name="model">sale.order</field> | ||
<field name="type">form</field> | ||
<field name="inherit_id" ref="sale.view_order_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//button[@id='create_invoice']" position="attributes"> | ||
<attribute name="invisible">invoice_status != 'to invoice' or state in ['draft', 'sent']</attibute> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
16 changes: 16 additions & 0 deletions
16
osi_quote_downpayment/wizards/sale_make_invoice_advance_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="sale_make_invoice_advance_view_inherit" model="ir.ui.view"> | ||
<field name="name">sale.make.invoice.advance.view.inherit</field> | ||
<field name="model">sale.advance.payment.inv</field> | ||
<field name="type">form</field> | ||
<field name="inherit_id" ref="sale.view_sale_advance_payment_inv" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='advance_payment_method']" position="after"> | ||
<field name="deduct_down_payments" invisible="advance_payment_method != 'delivered'"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |