[16.0][ADD] sale_purchase_stock_inter_company - #898
Conversation
0b86ced to
d2b01da
Compare
d2b01da to
f118709
Compare
|
Hi @OCA/intercompany-maintainers Can someone trigger a re-run of tests on this PR, please ? |
marcos-mendez
left a comment
There was a problem hiding this comment.
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_companymodule is properly integrated withsale_purchase_inter_company,sale_stock, andpurchase_stock. - Ensure that the
warehouse_idfield is correctly added tores.companyandres.config.settingsmodels in the respective XML views and Python code. - Verify that the
intercompany_picking_idfield is correctly defined on thestock.pickingmodel.
3. Additional Code Issues
- Missing field definition in
res.companyandres.config.settings: Thewarehouse_idfield should be explicitly defined in bothres.companyandres.config.settingsmodels to ensure proper inheritance and data handling. - Missing
stock.pickingmodel extension: Thestock.pickingmodel should be extended to include theintercompany_picking_idfield, and the logic for assigning quantities should be implemented instock_picking.py. - Missing
sale_ordermodel extension: Thesale.ordermodel 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:
- server-tools#3554 [MIG] datetime_formatter: Migration to 18.0
- server-tools#3548 [18.0][MIG] base_kanban_stage: Migration to 18.0
- hr-attendance#262 [16.0][ADD] Hr_attendance_idsecure: iDSecure (ControliD) attendance integration
- stock-logistics-workflow#2276 [16.0][ADD] stock_move_line_devaluation
- stock-logistics-workflow#2275 [16.0][ADD] Stock move line analytic account
- stock-logistics-workflow#2268 [16.0][ADD] stock_move_line_picking_partner
- purchase-workflow#2694 [16.0][IMP]Purchase workflow added to review state & exception fix
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
|
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. |
Supersedes #517
Depends on:
[16.0][ADD] sale_purchase_inter_company #897CC @chafique-delli @Kev-Roche @emiliesoutiras