-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[17.0][MIG] agreement_sale: Migration to 17.0
- Loading branch information
ilo
committed
Sep 10, 2024
1 parent
c1f431e
commit 986509e
Showing
13 changed files
with
95 additions
and
54 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
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import agreement | ||
from . import sale | ||
from . import res_config_settings |
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,33 @@ | ||
# Copyright 2024 - TODAY, Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class Agreement(models.Model): | ||
_inherit = "agreement" | ||
|
||
sale_order_count = fields.Integer( | ||
compute="_compute_sale_order_count", string="# Sale Orders" | ||
) | ||
|
||
def _compute_sale_order_count(self): | ||
for agreement in self: | ||
agreement.sale_order_count = self.env["sale.order"].search_count( | ||
[("agreement_id", "=", agreement.id)] | ||
) | ||
|
||
def action_view_sale_order(self): | ||
for agreement in self: | ||
sale_order_ids = self.env["sale.order"].search( | ||
[("agreement_id", "=", agreement.id)] | ||
) | ||
action = self.env["ir.actions.act_window"]._for_xml_id( | ||
"sale.action_quotations" | ||
) | ||
if len(sale_order_ids) == 1: | ||
action["views"] = [(self.env.ref("sale.view_order_form").id, "form")] | ||
action["res_id"] = sale_order_ids.ids[0] | ||
else: | ||
action["domain"] = [("id", "in", sale_order_ids.ids)] | ||
return action | ||
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
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,2 @@ | ||
- Alexis de Lattre \<<[email protected]>\> | ||
- Italo LOPES \<<[email protected]>\> |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
Features to evaluate before implementation | ||
|
||
- add smart button on agreement to access implied sales | ||
- add module agreement_account: agreement_sale'll depends on it |
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
File renamed without changes.
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,26 @@ | ||
<odoo> | ||
|
||
<!-- Agreement Form View --> | ||
<record id="agreement_sale_order_form_view" model="ir.ui.view"> | ||
<field name="name">agreement.form.fsm.order.view</field> | ||
<field name="model">agreement</field> | ||
<field name="inherit_id" ref="agreement.agreement_form" /> | ||
<field name="arch" type="xml"> | ||
<div class="oe_button_box" position="inside"> | ||
<button | ||
name="action_view_sale_order" | ||
type="object" | ||
class="oe_stat_button" | ||
icon="fa-shopping-cart" | ||
> | ||
<field | ||
name="sale_order_count" | ||
widget="statinfo" | ||
string="Sale Orders" | ||
/> | ||
</button> | ||
</div> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
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
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