Skip to content

Commit

Permalink
[MIG] sale_force_invoiced to v16
Browse files Browse the repository at this point in the history
The force_invoiced field is now tracked in the chatter and hidden on quotations
  • Loading branch information
alexis-via committed Dec 14, 2022
1 parent af76485 commit b1dc575
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sale_force_invoiced/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
{
"name": "Sale Force Invoiced",
"summary": "Allows to force the invoice status of the sales order to Invoiced",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"category": "sale",
"license": "AGPL-3",
"website": "https://github.com/OCA/sale-workflow",
"depends": ["sale"],
"data": ["view/sale_view.xml"],
"data": ["view/sale_order.xml"],
"installable": True,
}
5 changes: 3 additions & 2 deletions sale_force_invoiced/model/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ class SaleOrder(models.Model):
"quantities pending to invoice.",
readonly=True,
states={"done": [("readonly", False)], "sale": [("readonly", False)]},
tracking=20,
copy=False,
)

@api.depends("force_invoiced")
def _get_invoice_status(self):
res = super(SaleOrder, self)._get_invoice_status()
def _compute_invoice_status(self):
res = super()._compute_invoice_status()
for order in self.filtered(
lambda so: so.force_invoiced and so.state in ("sale", "done")
):
Expand Down
2 changes: 1 addition & 1 deletion sale_force_invoiced/tests/test_sale_force_invoiced.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_sales_order(self):
so.invoice_status, "to invoice", "The invoice status should be To Invoice"
)

self._create_invoice_from_sale(so)
so._create_invoices()
self.assertEqual(
so.invoice_status, "invoiced", "The invoice status should be Invoiced"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<group name="sale_info" position="inside">
<field name="force_invoiced" groups="sales_team.group_sale_manager" />
<field
name="force_invoiced"
groups="sales_team.group_sale_manager"
widget="boolean_toggle"
attrs="{'invisible': [('state', 'not in', ('sale', 'done'))]}"
/>
</group>
</field>
</record>
Expand Down
1 change: 1 addition & 0 deletions setup/sale_force_invoiced/odoo/addons/sale_force_invoiced
6 changes: 6 additions & 0 deletions setup/sale_force_invoiced/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit b1dc575

Please sign in to comment.