-
-
Notifications
You must be signed in to change notification settings - Fork 601
[18.0][FIX] contract_manually_invoiced: wizard invoice manually view #1408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| - Tobias Zehntner <tobias.zehntner@acsone.eu> (https://www.acsone.eu) | ||
| - Jacques-Etienne Baudoux (BCIM) <je@bcim.be> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,19 @@ | ||
| # Copyright 2026 ACSONE SA/NV | ||
| # Copyright 2026 Jacques-Etienne Baudoux (BCIM) <je@bcim.be> | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
|
||
|
|
||
| from odoo import api, fields, models | ||
| from odoo.osv import expression | ||
| from odoo.tools.safe_eval import safe_eval | ||
|
|
||
|
|
||
| class ContractManuallyCreateInvoice(models.TransientModel): | ||
| _inherit = "contract.manually.create.invoice" | ||
|
|
||
| manually_invoiced = fields.Boolean( | ||
| default=lambda self: self.env.company.enable_contract_invoice_manually | ||
| ) | ||
|
|
||
| filter_domain = fields.Char( | ||
| string="Domain", | ||
| compute="_compute_filter_domain", | ||
|
|
@@ -18,7 +22,7 @@ class ContractManuallyCreateInvoice(models.TransientModel): | |
| help="Filter/Domain to apply on contracts to invoice", | ||
| ) | ||
|
|
||
| @api.depends("invoice_date", "contract_type") | ||
| @api.depends("invoice_date", "contract_type", "manually_invoiced") | ||
| def _compute_filter_domain(self): | ||
| for wizard in self: | ||
| domain = [ | ||
|
|
@@ -28,9 +32,8 @@ def _compute_filter_domain(self): | |
| fields.Datetime.to_string(wizard.invoice_date), | ||
| ), | ||
| ("contract_type", "=", wizard.contract_type), | ||
| ("is_manually_invoiced", "=", wizard.manually_invoiced), | ||
| ] | ||
| if self.env.company.enable_contract_invoice_manually: | ||
| domain = expression.AND([domain, [("is_manually_invoiced", "=", True)]]) | ||
|
Comment on lines
+35
to
-33
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know what your use case is, but I think it's not clear from the boolean in the view that unticking it would exclude the manually invoiced contracts. Maybe only add the domain if it's ticked, and otherwise include both types of contracts? |
||
| wizard.filter_domain = str(domain) | ||
|
|
||
| @api.depends("invoice_date", "filter_domain") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,22 +9,21 @@ | |
| ref="contract.contract_manually_create_invoice_form_view" | ||
| /> | ||
| <field name="arch" type="xml"> | ||
| <xpath expr="//form/group[last()]" position="after"> | ||
| <notebook invisible="not invoice_date"> | ||
| <page name="contracts" string="Contracts"> | ||
| <button | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the button is fixed here: #1391 |
||
| name="action_show_contract_to_invoice" | ||
| position="move" | ||
| /> | ||
| </page> | ||
| <page name="domain" string="Contract Filter"> | ||
| <field | ||
| name="filter_domain" | ||
| widget="domain" | ||
| options="{'model': 'contract.contract'}" | ||
| /> | ||
| </page> | ||
| </notebook> | ||
| <field name="invoice_date" position="after"> | ||
| <field name="manually_invoiced" /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should only show when the config setting is active |
||
| </field> | ||
| <xpath expr="//form/group" position="after"> | ||
| <group | ||
| string="Contract Filter" | ||
| invisible="not invoice_date" | ||
| groups="base.group_no_one" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find it's too limiting to put the filter only for debug-mode. Our clients use filtering regularly but aren't necessarily familiar with debug mode. However, I agree it's a bit of an extra technical thing, hence my reasoning to put it away in a second tab: accessible but not confusing. |
||
| > | ||
| <field | ||
| name="filter_domain" | ||
| widget="domain" | ||
| options="{'model': 'contract.contract'}" | ||
| /> | ||
| </group> | ||
| </xpath> | ||
| </field> | ||
| </record> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that could add some flexibility (even though it's already there via the filter for the technically versed users)