Skip to content

[18.0] [REF] quotation api - #1663

Open
paradoxxxzero wants to merge 9 commits into
shopinvader:18.0from
akretion:18.0-refactor-quotations-rest-api
Open

[18.0] [REF] quotation api#1663
paradoxxxzero wants to merge 9 commits into
shopinvader:18.0from
akretion:18.0-refactor-quotations-rest-api

Conversation

@paradoxxxzero

Copy link
Copy Markdown
Contributor

This is a forward port of #1597 with some changes to the helper to try a better integration with the new router helper.

@paradoxxxzero
paradoxxxzero force-pushed the 18.0-refactor-quotations-rest-api branch from a0d0798 to 4674e65 Compare June 29, 2026 14:07
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.18321% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.06%. Comparing base (75d50d9) to head (4674e65).

Files with missing lines Patch % Lines
sale_quotation/models/sale_order.py 78.75% 13 Missing and 4 partials ⚠️
shopinvader_api_quotation/routers/quotation.py 96.47% 5 Missing and 1 partial ⚠️
...vader_product_order_mode/models/product_product.py 82.35% 1 Missing and 2 partials ⚠️
sale_cart_quotation/models/sale_order.py 80.00% 1 Missing and 1 partial ⚠️
shopinvader_api_quotation/schemas/quotation.py 95.83% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             18.0    #1663      +/-   ##
==========================================
+ Coverage   96.99%   97.06%   +0.06%     
==========================================
  Files         244      271      +27     
  Lines        5125     5817     +692     
  Branches      198      226      +28     
==========================================
+ Hits         4971     5646     +675     
- Misses         92      107      +15     
- Partials       62       64       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@paradoxxxzero
paradoxxxzero marked this pull request as ready for review June 29, 2026 14:25

@metaminux metaminux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hello @paradoxxxzero

Theoretically, the second commit should only modify files from the sale_cart module, but it adds pyproject.toml, CONTRIBUTORS.md and DESCRIPTION.md from other modules.
The ".rst" countepart files are removed from those modules later...

<field name="inherit_id" ref="sale.view_quotation_tree"/>
<field name="arch" type="xml">
<field name="state" position="attributes">
<attribute name="invisible">1</attribute>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
<attribute name="invisible">1</attribute>
<attribute name="column_invisible">1</attribute>

Comment on lines +5 to +14
from odoo import Command
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase


class TestShopOrderMode(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
from odoo import Command
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase
class TestShopOrderMode(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
from odoo import Command
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase
class TestShopOrderMode(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))

Comment on lines +4 to +12
from odoo import Command
from odoo.tests.common import TransactionCase


class TestQuotation(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
from odoo import Command
from odoo.tests.common import TransactionCase
class TestQuotation(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
from odoo import Command
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
from odoo.tests.common import TransactionCase
class TestQuotation(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))

Comment on lines +201 to +202
customer_quotations.write({"quotation_state": "accepted", "typology": "sale"})
return super().action_confirm()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
customer_quotations.write({"quotation_state": "accepted", "typology": "sale"})
return super().action_confirm()
customer_quotations.write({"typology": "sale"})
return super().action_confirm()

quotation_state will be recomputed when state is updated by calling super(), right ?

Comment on lines +206 to +210
customer_quotations.quotation_state = "draft"
customer_quotations.filtered(
lambda so: so.typology != "quote"
).typology = "quote"
return super().action_draft()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
customer_quotations.quotation_state = "draft"
customer_quotations.filtered(
lambda so: so.typology != "quote"
).typology = "quote"
return super().action_draft()
customer_quotations.filtered(
lambda so: so.typology != "quote"
).write({"typology": "quote"})
return super().action_draft()

Same question as before, is it useful, quotation_state will be recomputed when state is updated, right ?

Also, without ensure_one(), I think we should use a write here to avoid "Expected singleton" errors

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants