Skip to content

Commit

Permalink
[MIG] purchase_order_line_stock_available: Migration to 16.0
Browse files Browse the repository at this point in the history
TT49812
  • Loading branch information
victoralmau committed Jul 2, 2024
1 parent 1f00e34 commit f6f57f8
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 44 deletions.
10 changes: 5 additions & 5 deletions purchase_order_line_stock_available/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Purchase order line stock available
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/purchase-workflow/tree/15.0/purchase_order_line_stock_available
:target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_line_stock_available
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_order_line_stock_available
:target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_order_line_stock_available
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -48,7 +48,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_order_line_stock_available%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_order_line_stock_available%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -88,6 +88,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/15.0/purchase_order_line_stock_available>`_ project on GitHub.
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_line_stock_available>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion purchase_order_line_stock_available/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Purchase order line stock available",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "AvanzOSC," "Tecnativa," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/purchase-workflow",
Expand Down
3 changes: 0 additions & 3 deletions purchase_order_line_stock_available/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,3 @@ msgstr "Cantidad Prevista"
#: model:ir.model,name:purchase_order_line_stock_available.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Línea pedido de compra"

#~ msgid "Forecast Quantity"
#~ msgstr "Cantidad Prevista"
3 changes: 0 additions & 3 deletions purchase_order_line_stock_available/i18n/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,3 @@ msgstr ""
#: model:ir.model,name:purchase_order_line_stock_available.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "采购订单明细"

#~ msgid "Forecast Quantity"
#~ msgstr "预测库存"
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?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 @@ -369,7 +368,7 @@ <h1 class="title">Purchase order line stock available</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e7b843ac5ffb0540581972a7009977fe5c42f59c91538f7fc6002b6c2f94536b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/purchase-workflow/tree/15.0/purchase_order_line_stock_available"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_order_line_stock_available"><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/purchase-workflow&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<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/purchase-workflow/tree/16.0/purchase_order_line_stock_available"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_order_line_stock_available"><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/purchase-workflow&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to view the virtual stock quantity of a product in the
purchase order line.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -397,7 +396,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/purchase-workflow/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_order_line_stock_available%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_order_line_stock_available%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -433,7 +432,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/15.0/purchase_order_line_stock_available">OCA/purchase-workflow</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_line_stock_available">OCA/purchase-workflow</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
52 changes: 27 additions & 25 deletions purchase_order_line_stock_available/tests/test_purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,51 @@

from datetime import date

from odoo.tests import common
from odoo.addons.base.tests.common import BaseCommon


class TestPurchase(common.TransactionCase):
def setUp(self):
super().setUp()
self.company = self.env.ref("base.main_company")
self.partner = self.env["res.partner"].create({"name": "Test partner"})
self.product = self.env["product.product"].create(
{"name": "Test product", "detailed_type": "product"}
class TestPurchase(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.company = cls.env.ref("base.main_company")
cls.partner = cls.env["res.partner"].create({"name": "Test partner"})
cls.product = cls.env["product.product"].create(
{"name": "Test product", "type": "product", "detailed_type": "product"}
)
self.location_stock = self.env.ref("stock.stock_location_stock")
self.location_suppliers = self.env.ref("stock.stock_location_suppliers")
self.purchase = self.env["purchase.order"].create(
cls.location_stock = cls.env.ref("stock.stock_location_stock")
cls.location_suppliers = cls.env.ref("stock.stock_location_suppliers")
cls.purchase = cls.env["purchase.order"].create(
{
"partner_id": self.partner.id,
"partner_id": cls.partner.id,
"order_line": [
(
0,
0,
{
"product_id": self.product.id,
"product_uom": self.product.uom_id.id,
"name": self.product.name,
"price_unit": self.product.standard_price,
"product_id": cls.product.id,
"product_uom": cls.product.uom_id.id,
"name": cls.product.name,
"price_unit": cls.product.standard_price,
"date_planned": date.today(),
"product_qty": 1,
},
)
],
}
)
self.purchase_line = self.purchase.order_line[0]
self._create_stock_move(10.0)
cls.purchase_line = cls.purchase.order_line[0]
cls._create_stock_move(10.0)

def _create_stock_move(self, qty):
stock_move = self.env["stock.move"].create(
@classmethod
def _create_stock_move(cls, qty):
stock_move = cls.env["stock.move"].create(
{
"name": self.product.display_name,
"location_id": self.location_suppliers.id,
"location_dest_id": self.location_stock.id,
"product_id": self.product.id,
"product_uom": self.product.uom_id.id,
"name": cls.product.display_name,
"location_id": cls.location_suppliers.id,
"location_dest_id": cls.location_stock.id,
"product_id": cls.product.id,
"product_uom": cls.product.uom_id.id,
"product_uom_qty": qty,
}
)
Expand Down
6 changes: 3 additions & 3 deletions purchase_order_line_stock_available/views/purchase_view.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.ui.view" id="purchase_order_form_view_stock">
<record id="purchase_order_form_view_stock" model="ir.ui.view">
<field name="name">purchase.order.form.view.stock</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form" />
<field name="arch" type="xml">
<xpath
expr="//field[@name='order_line']/tree//field[@name='product_uom']"
expr="//field[@name='order_line']/tree//field[@name='qty_invoiced']"
position="after"
>
<field name="virtual_available" />
<field name="virtual_available" optional="show" />
</xpath>
</field>
</record>
Expand Down

0 comments on commit f6f57f8

Please sign in to comment.