From 23cf8920c86e781296792d6e3d1f443c186f39d1 Mon Sep 17 00:00:00 2001 From: "matthieu.saison" Date: Tue, 28 Nov 2023 11:50:20 +0100 Subject: [PATCH] add shopinvader_state --- sale_quotation/README.rst | 2 +- sale_quotation/static/description/index.html | 2 +- shopinvader_api_quotation/models/__init__.py | 1 + .../models/sale_order.py | 33 +++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 shopinvader_api_quotation/models/__init__.py create mode 100644 shopinvader_api_quotation/models/sale_order.py diff --git a/sale_quotation/README.rst b/sale_quotation/README.rst index 85cbd2700f..9d6cd4bc34 100644 --- a/sale_quotation/README.rst +++ b/sale_quotation/README.rst @@ -7,7 +7,7 @@ Sale Quotation !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:0b385df82e12b7547593361d9083b791ef182af861cad60fa9425f2845de77ac + !! source digest: sha256:79ec393c9ca6d114b4479c21bc5b1ec617adbcd53a2e750a99977e56331ff908 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png diff --git a/sale_quotation/static/description/index.html b/sale_quotation/static/description/index.html index be65f8c3ad..c535c60b1c 100644 --- a/sale_quotation/static/description/index.html +++ b/sale_quotation/static/description/index.html @@ -367,7 +367,7 @@

Sale Quotation

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:0b385df82e12b7547593361d9083b791ef182af861cad60fa9425f2845de77ac +!! source digest: sha256:79ec393c9ca6d114b4479c21bc5b1ec617adbcd53a2e750a99977e56331ff908 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Production/Stable License: AGPL-3 shopinvader/odoo-shopinvader

This module handle the model and view for product and sale.order needs for shopinvader-api-quotation

diff --git a/shopinvader_api_quotation/models/__init__.py b/shopinvader_api_quotation/models/__init__.py new file mode 100644 index 0000000000..6aacb75313 --- /dev/null +++ b/shopinvader_api_quotation/models/__init__.py @@ -0,0 +1 @@ +from . import sale_order diff --git a/shopinvader_api_quotation/models/sale_order.py b/shopinvader_api_quotation/models/sale_order.py new file mode 100644 index 0000000000..97b1b8c984 --- /dev/null +++ b/shopinvader_api_quotation/models/sale_order.py @@ -0,0 +1,33 @@ +# Copyright 2017-2018 Akretion (http://www.akretion.com). +# Copyright 2021 Camptocamp (http://www.camptocamp.com) +# @author BenoƮt GUILLOT +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import fields, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + shopinvader_state = fields.Selection( + selection_add=[ + ("estimating", "Estimating Quotation"), + ("estimated", "Estimated Quotation"), + ], + ondelete={ + "estimating": "cascade", + "estimated": "cascade", + }, + ) + + def _compute_shopinvader_state_depends(self): + return super()._compute_shopinvader_state_depends() + ("typology",) + + def _get_shopinvader_state(self): + self.ensure_one() + if self.typology == "quotation" and self.state == "draft": + return "estimating" + if self.typology == "quotation" and self.state == "sent": + return "estimated" + return super()._get_shopinvader_state()