Skip to content

Commit

Permalink
[IMP]purchase_sale_inter_company: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
toita86 committed Mar 26, 2024
1 parent 9e40f55 commit 2f9e655
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
3 changes: 2 additions & 1 deletion purchase_sale_inter_company/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Inter Company Module for Purchase to Sale Order
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3899bc2db53f1d1d16a8c0d9b0f75002813b2e3095815b55949efad59958f1a3
!! source digest: sha256:b6e4052551bb016a07cf8a1f8be3349ca96f744962c8e1f7b388cd4d7d952a38
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -111,6 +111,7 @@ Contributors
* Ooops404 <[email protected]>

* Francesco Foresti <[email protected]>
* Eduard Brahas <[email protected]>

Maintainers
~~~~~~~~~~~
Expand Down
3 changes: 2 additions & 1 deletion purchase_sale_inter_company/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ def button_validate(self):
dest_company = record.partner_id.commercial_partner_id.ref_company_ids
if (
dest_company
and record.state == "assigned"
and record.picking_type_code == "incoming"
and record.state == "assigned"
or record.state == "waiting"
):
raise UserError(
_(
Expand Down
4 changes: 3 additions & 1 deletion purchase_sale_inter_company/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down Expand Up @@ -366,7 +367,7 @@ <h1 class="title">Inter Company Module for Purchase to Sale Order</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3899bc2db53f1d1d16a8c0d9b0f75002813b2e3095815b55949efad59958f1a3
!! source digest: sha256:b6e4052551bb016a07cf8a1f8be3349ca96f744962c8e1f7b388cd4d7d952a38
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/multi-company/tree/14.0/purchase_sale_inter_company"><img alt="OCA/multi-company" src="https://img.shields.io/badge/github-OCA%2Fmulti--company-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/multi-company-14-0/multi-company-14-0-purchase_sale_inter_company"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/multi-company&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module is useful if there are multiple companies in the same Odoo database and those companies sell goods or services among themselves.</p>
Expand Down Expand Up @@ -448,6 +449,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
</li>
<li>Ooops404 &lt;<a class="reference external" href="mailto:info&#64;ooops404.com">info&#64;ooops404.com</a>&gt;<ul>
<li>Francesco Foresti &lt;<a class="reference external" href="mailto:francesco.foresti&#64;ooops404.com">francesco.foresti&#64;ooops404.com</a>&gt;</li>
<li>Eduard Brahas &lt;<a class="reference external" href="mailto:eduardbrhas&#64;outlook.it">eduardbrhas&#64;outlook.it</a>&gt;</li>
</ul>
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,3 +597,22 @@ def test_update_open_sale_order(self):
"3.0 Units of Consumable Product 2.+instead of 8.0 Units", re.DOTALL
),
)

def test_block_manual_validation(self):
"""
Test that the manual validation of the picking is blocked
when the flag is set in the destination company
"""
self.company_a.sync_picking = True
self.company_b.sync_picking = True
self.company_b.block_po_manual_picking_validation = True
purchase = self._create_purchase_order(
self.partner_company_b, self.consumable_product
)
sale = self._approve_po(purchase)
so_picking_id = sale.picking_ids
# The picking should be in waiting state
self.assertEqual(so_picking_id.state, "waiting")
# The manual validation should be blocked
with self.assertRaises(UserError):
so_picking_id.button_validate()

0 comments on commit 2f9e655

Please sign in to comment.