Skip to content

Conversation

@bizzappdev
Copy link
Contributor

No description provided.

@bizzappdev bizzappdev force-pushed the 18.0-mig-sale_invoice_plan-BAD branch from 635f10a to 6c46833 Compare May 14, 2025 10:44
@rousseldenis
Copy link
Contributor

@bizzappdev Still draft ?

@bizzappdev
Copy link
Contributor Author

@rousseldenis Yes, some manual test cases failed, we are working on the Fixes. next week it might be ready.

@bizzappdev bizzappdev force-pushed the 18.0-mig-sale_invoice_plan-BAD branch from 6c46833 to e063dd0 Compare May 26, 2025 06:17
@bizzappdev bizzappdev marked this pull request as ready for review May 26, 2025 07:37
@bizzappdev
Copy link
Contributor Author

@rousseldenis MR is ready for the review.

@rousseldenis
Copy link
Contributor

/ocabot migration sale_invoice_plan

@OCA-git-bot OCA-git-bot added this to the 18.0 milestone May 27, 2025
if rec.state != "draft":
if rec.invoice_plan_ids.filtered(lambda plan: not plan.percent):
raise ValidationError(
_("Please fill percentage for all invoice plan lines")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_("Please fill percentage for all invoice plan lines")
self.env._("Please fill percentage for all invoice plan lines")

Please replace all _ with self.env._ to improve performance in some cases.

According to the migration list to 18.0 at https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-18.0

Copy link

@Pani-k-folk Pani-k-folk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remark : Renaming the view ID from 'tree' to 'list' is optional.

@@ -0,0 +1,233 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.ui.view" id="view_sale_invoice_plan_tree">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<record model="ir.ui.view" id="view_sale_invoice_plan_tree">
<record model="ir.ui.view" id="view_sale_invoice_plan_list">

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.ui.view" id="view_sale_invoice_plan_tree">
<field name="name">view.sale.invoice.plan.tree</field>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<field name="name">view.sale.invoice.plan.tree</field>
<field name="name">view.sale.invoice.plan.list</field>

/>
<field
name="invoice_plan_ids"
context="{'tree_view_ref': 'sale_invoice_plan.view_sale_invoice_plan_tree'}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
context="{'tree_view_ref': 'sale_invoice_plan.view_sale_invoice_plan_tree'}"
context="{'list_view_ref': 'sale_invoice_plan.view_sale_invoice_plan_list'}"

</field>
</record>
<record id="view_sale_invoice_plan_tree_readonly" model="ir.ui.view">
<field name="name">view.sale.invoice.plan.tree</field>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<field name="name">view.sale.invoice.plan.tree</field>
<field name="name">view.sale.invoice.plan.list</field>

</search>
</field>
</record>
<record id="view_sale_invoice_plan_tree_readonly" model="ir.ui.view">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<record id="view_sale_invoice_plan_tree_readonly" model="ir.ui.view">
<record id="view_sale_invoice_plan_list_readonly" model="ir.ui.view">

<field name="name">Sales Invoice Plan</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.invoice.plan</field>
<field name="view_mode">tree</field>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<field name="view_mode">tree</field>
<field name="view_mode">list</field>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please change the tree view mode to list, as the tree view is no longer in use and it's currently preventing the Sale Invoice Plan window from opening

<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.invoice.plan</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_sale_invoice_plan_tree_readonly" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<field name="view_id" ref="view_sale_invoice_plan_tree_readonly" />
<field name="view_id" ref="view_sale_invoice_plan_list_readonly" />

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pani-k-folk Changes are done.

@bizzappdev bizzappdev force-pushed the 18.0-mig-sale_invoice_plan-BAD branch from e063dd0 to d91139e Compare May 30, 2025 07:54
<field name="arch" type="xml">
<list editable="bottom">
<field name="no_edit" column_invisible="1" />
<field name="analytic_account_id" widget="many2many_tags" />
Copy link

@Pani-k-folk Pani-k-folk May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bizzappdev
Why are you show distribution_analytic_account_ids (analytic_account_id) in the Invoice Plan? Shouldn't it be analytic_distribution instead? Also, is this part still necessary to show?"

)
analytic_account_id = fields.Many2one(related="sale_id.analytic_account_id")
analytic_account_id = fields.Many2many(
related="sale_id.order_line.distribution_analytic_account_ids"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmhh, I'm not sure of that. Naming a field with an id' and Ḿany2many` is not correct.

This should be changed.

@niboo-ave
Copy link

niboo-ave commented Jun 23, 2025

Odoo.sh raise an error while doing test:
`
2025-06-23 08:37:34,264 4 ERROR ****-feature--9-21418645 odoo.addons.base.tests.test_views: Please indicate why the always invisible fields are present in the view, or remove the field tag.

Addon: 'sale_invoice_plan'

View: view_order_form_invoice_plan

Fields:

    <field name="invoice_plan_process" invisible="1"/>

View: view_sale_invoice_plan_list
Fields:

     <field name="no_edit" column_invisible="1"/>
     <field name="last" column_invisible="1"/>

`
I assume it's due to the 1 that should be rename to "True" ?

Other than that, i did some functional testing and seems to be great.

Copy link
Contributor

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Saran440
Copy link
Member

Saran440 commented Dec 8, 2025

@bizzappdev Hi, Did you still do this PR?
I test and found 2 bug (may be other version is bug too)

  1. Error when change QTY = 0.0 after create invoice plan 1 line:
    Step to error:
    1. Create Quotation with invoice plan
    2. Confirm > Create Invoice by Plan > Create Next Invoice
    3. It still worked, until you change quantity in quotation to 0.0 > Save
    selection_021
    selection_022
    4. It will show error, and you can't click to this document
    selection_020

I solved by check condition amount_untaxed

@api.depends("percent")
    def _compute_amount(self):
        for rec in self:
            amount_untaxed = rec.sale_id._origin.amount_untaxed
            if not amount_untaxed:
                continue

  1. amount_invoiced field support only 1 invoice. For my case, we can created invoice > 1 (split by vat and no vat) but amount_invoiced compute by first invoiced only. Is it possible to change method to support more than 1 invoice?

path: sale_invoice_plan/models/sale_invoice_plan.py

    def _get_amount_invoice(self, invoices):
        """Get amoutn invoice from same order"""
        amount_invoiced = sum(invoices.mapped("amount_untaxed"))
        lines = invoices.mapped("invoice_line_ids").filtered(
            lambda ml: ml.product_id.id and self.sale_id in ml.sale_line_ids.mapped("order_id")
        )
        amount_invoiced = sum(lines.mapped("price_subtotal"))
        return amount_invoiced

    @api.depends("invoice_move_ids.state")
    def _compute_invoiced(self):
        for rec in self:
            invoiced = rec.invoice_move_ids.filtered(
                lambda move_line: move_line.state in ("draft", "posted")
            )
            rec.invoiced = True if invoiced else False
            rec.amount_invoiced = (
                sum(invoiced.mapped("amount_untaxed"))
                if rec.invoice_type == "advance"
                else rec._get_amount_invoice(invoiced)
            )

@bizzappdev bizzappdev marked this pull request as draft December 11, 2025 05:41
@TheerayutEncoder
Copy link
Member

Hi @bizzappdev, is it possible to mark a draft as ready for review?

Ernesto Tejeda and others added 22 commits December 19, 2025 16:49
The implementation has changed in 14.0
remove the dependency on sale_stock which does not seem to be required.
this allows to use the module in service companies which don't need
the stock application
Currently translated at 100.0% (75 of 75 strings)

Translation: sale-workflow-15.0/sale-workflow-15.0-sale_invoice_plan
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-15-0/sale-workflow-15-0-sale_invoice_plan/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-workflow-15.0/sale-workflow-15.0-sale_invoice_plan
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-15-0/sale-workflow-15-0-sale_invoice_plan/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: sale-workflow-16.0/sale-workflow-16.0-sale_invoice_plan
Translate-URL: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_invoice_plan/
@bizzappdev bizzappdev force-pushed the 18.0-mig-sale_invoice_plan-BAD branch from 9247027 to 51a3d63 Compare December 19, 2025 11:21
@bizzappdev bizzappdev marked this pull request as ready for review December 19, 2025 12:16
@bizzappdev
Copy link
Contributor Author

@Saran440 Changes are done.
@TheerayutEncoder It is now ready for review.

Copy link
Member

@Saran440 Saran440 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review 👍

comodel_name="sale.invoice.plan",
inverse_name="sale_id",
string="Inovice Plan",
string="Invoice Plan",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a little comment.
no need to add because odoo will auto use string Invoice Plan

@bizzappdev bizzappdev force-pushed the 18.0-mig-sale_invoice_plan-BAD branch from 51a3d63 to fc02c98 Compare December 24, 2025 11:08
@Saran440
Copy link
Member

@bizzappdev Thanks for your work.
@Pani-k-folk @TheerayutEncoder Please check this PR.

If it's okay, let's we merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.