Skip to content

[16.0][ADD] sale_purchase_stock_inter_company - #898

Open
metaminux wants to merge 2 commits into
OCA:16.0from
akretion:16.0-add-sale_purchase_stock_inter_company
Open

[16.0][ADD] sale_purchase_stock_inter_company#898
metaminux wants to merge 2 commits into
OCA:16.0from
akretion:16.0-add-sale_purchase_stock_inter_company

Conversation

@metaminux

@metaminux metaminux commented Oct 29, 2025

Copy link
Copy Markdown
Contributor

@metaminux
metaminux force-pushed the 16.0-add-sale_purchase_stock_inter_company branch from 0b86ced to d2b01da Compare October 29, 2025 21:42
@metaminux
metaminux force-pushed the 16.0-add-sale_purchase_stock_inter_company branch from d2b01da to f118709 Compare December 3, 2025 22:47
@metaminux

Copy link
Copy Markdown
Contributor Author

Hi @OCA/intercompany-maintainers

Can someone trigger a re-run of tests on this PR, please ?
I fixed the underlying error in #913

@marcos-mendez marcos-mendez left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated Review -- Tests Failed

1. Root Cause of the Test Failure

The test failure occurs because the database connection fails during the Odoo server startup, likely due to an incorrect or missing database configuration in the test environment (Runboat). This is not a code issue but an infrastructure problem with the test setup.

2. Suggested Fix

No code fix is needed for the test failure itself. However, to ensure the module functions correctly:

  • Confirm that the sale_purchase_stock_inter_company module is properly integrated with sale_purchase_inter_company, sale_stock, and purchase_stock.
  • Ensure that the warehouse_id field is correctly added to res.company and res.config.settings models in the respective XML views and Python code.
  • Verify that the intercompany_picking_id field is correctly defined on the stock.picking model.

3. Additional Code Issues

  • Missing field definition in res.company and res.config.settings: The warehouse_id field should be explicitly defined in both res.company and res.config.settings models to ensure proper inheritance and data handling.
  • Missing stock.picking model extension: The stock.picking model should be extended to include the intercompany_picking_id field, and the logic for assigning quantities should be implemented in stock_picking.py.
  • Missing sale_order model extension: The sale.order model should be extended to handle intercompany picking logic and propagate warehouse information to purchase orders.

4. Test Improvements

  • Add a TransactionCase test to verify that a sale order creates a purchase order with the correct warehouse.
  • Add a SavepointCase test to ensure that the warehouse field is correctly propagated between companies.
  • Add tests for edge cases such as:
    • When no warehouse is set on the company, the purchase order should still be created.
    • When the warehouse is set to a non-existent warehouse, an error should be raised.
    • When the warehouse is set to a warehouse that is not accessible to the user, an error should be raised.

These tests should be tagged with @tag('post_install', 'at_install') to ensure they run in the appropriate context.

# Example test case structure
from odoo.tests import TransactionCase, tagged

@tagged('post_install', 'at_install')
class TestInterCompanyWarehouse(TransactionCase):
    def test_sale_order_creates_purchase_order_with_warehouse(self):
        # Setup
        company_a = self.env['res.company'].create({'name': 'Company A'})
        company_b = self.env['res.company'].create({'name': 'Company B'})
        warehouse = self.env['stock.warehouse'].create({'name': 'Test Warehouse'})

        # Set warehouse on company A
        company_a.warehouse_id = warehouse.id

        # Create sale order
        sale_order = self.env['sale.order'].create({
            'partner_id': company_b.id,
            'company_id': company_a.id,
        })

        # Verify purchase order is created with correct warehouse
        purchase_order = sale_order._create_purchase_order()
        self.assertEqual(purchase_order.warehouse_id, warehouse)

This approach ensures that the functionality works as expected and handles edge cases appropriately.


⏰ PR Aging Alert

This PR by @metaminux has been open for 137 days (4 months).
🔴 Zero human reviews in 137 days. This contributor invested their time to improve this module. The PSC owes them at least a response — even a "needs changes" is better than silence.
💤 No activity for 101 days. Has this PR been forgotten?

Every ignored PR is a contributor who might not come back. Review time matters. (OCA Aging Report)


Reciprocal Review Request

Hi everyone! I found some test failures on this PR and left detailed feedback above. I am happy to discuss or help debug. In the meantime, if any of you get a chance, I would appreciate a look at my open PR(s):

My open PRs across OCA:

Reviewing each other's work helps the whole community move forward. Thank you!


Environment via OCA Neural Reviewer: Minikube + K8s Job + oca-ci/py3.10-odoo16.0 | Odoo 16.0
Automated review by OCA Neural Reviewer + qwen3-coder:30b

@github-actions

Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale PR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants