[MIG] stock_request_picking_type: Migration to 13.0

This commit is contained in:
ps-tubtim
2020-11-17 13:33:16 +07:00
parent 3e17f9a22e
commit 4e5e6c604c
9 changed files with 49 additions and 66 deletions

View File

@@ -14,13 +14,13 @@ Stock Request Picking Type
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_request_picking_type
:target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_request_picking_type
:alt: OCA/stock-logistics-warehouse
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_request_picking_type
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_request_picking_type
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/153/12.0
:target: https://runbot.odoo-community.org/runbot/153/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -45,7 +45,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_request_picking_type%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_request_picking_type%0Aversion:%2013.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.
@@ -61,6 +61,8 @@ Contributors
~~~~~~~~~~~~
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
* Raphael Lee <rlee@opensourceintegrators.com>
Maintainers
~~~~~~~~~~~
@@ -83,6 +85,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-max3903|
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_request_picking_type>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_request_picking_type>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -7,9 +7,9 @@
"version": "13.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/stock-logistics-warehouse",
"author": "Open Source Integrators, " "Odoo Community Association (OCA)",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"category": "Warehouse",
"depends": ["stock_request_submit"],
"depends": ["stock_request"],
"data": [
"data/stock_picking_type.xml",
"views/stock_request_order_views.xml",

View File

@@ -3,6 +3,6 @@
<field name="name">Stock Requests</field>
<field name="sequence_id" ref="stock_request.seq_stock_request_order" />
<field name="code">stock_request_order</field>
<field name="sequence">0</field>
<field name="sequence_code">SRO</field>
</record>
</odoo>

View File

@@ -15,9 +15,6 @@ class StockPickingType(models.Model):
count_sr_late = fields.Integer(string="Late", compute="_compute_sr_count")
def _compute_sr_count(self):
types = self.filtered(lambda picking: picking.code == "stock_request_order")
if not types:
return
domains = {
"count_sr_todo": [("state", "=", "submitted")],
"count_sr_open": [("state", "=", "open")],
@@ -41,7 +38,7 @@ class StockPickingType(models.Model):
and x["picking_type_id"][0]: x["picking_type_id_count"]
for x in data
}
for record in types:
for record in self:
record[field] = count.get(record.id, 0)
def get_stock_request_order_picking_type_action(self):

View File

@@ -9,21 +9,16 @@ class StockRequestOrder(models.Model):
@api.model
def _get_default_picking_type(self):
companies = self._context.get("allowed_company_ids", []).copy()
companies.append(False)
return (
self.env["stock.picking.type"]
.search(
[
("code", "=", "stock_request_order"),
(
"warehouse_id.company_id",
"in",
[
self.env.context.get(
"company_id", self.env.user.company_id.id
),
False,
],
),
"|",
("warehouse_id.company_id", "in", companies),
("warehouse_id", "=", False),
],
limit=1,
)
@@ -31,8 +26,8 @@ class StockRequestOrder(models.Model):
)
picking_type_id = fields.Many2one(
"stock.picking.type",
"Operation Type",
comodel_name="stock.picking.type",
string="Operation Type",
default=_get_default_picking_type,
required=True,
)

View File

@@ -1 +1,3 @@
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
* Raphael Lee <rlee@opensourceintegrators.com>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_request_picking_type"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_request_picking_type"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_request_picking_type"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_request_picking_type"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module adds stock request orders within the Inventory app with a new operation type.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
@@ -395,7 +395,7 @@ ul.auto-toc {
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/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 smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_request_picking_type%0Aversion:%2012.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/stock-logistics-warehouse/issues/new?body=module:%20stock_request_picking_type%0Aversion:%2013.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">
@@ -410,6 +410,8 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<ul class="simple">
<li>Maxime Chambreuil &lt;<a class="reference external" href="mailto:mchambreuil&#64;opensourceintegrators.com">mchambreuil&#64;opensourceintegrators.com</a>&gt;</li>
<li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li>
<li>Raphael Lee &lt;<a class="reference external" href="mailto:rlee&#64;opensourceintegrators.com">rlee&#64;opensourceintegrators.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
@@ -421,7 +423,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/max3903"><img alt="max3903" src="https://github.com/max3903.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_request_picking_type">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_request_picking_type">OCA/stock-logistics-warehouse</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>

View File

@@ -1,55 +1,41 @@
<odoo>
<record id="view_stock_request_order_filter" model="ir.ui.view">
<field name="name">stock.request.order.select</field>
<record model="ir.ui.view" id="stock_request_order_search">
<field name="name">stock.request.order.search</field>
<field name="model">stock.request.order</field>
<field name="inherit_id" ref="stock_request.stock_request_order_search" />
<field name="arch" type="xml">
<search string="Search Stock Request Orders">
<field name="name" />
<xpath expr='//filter[@name="location"]' position="after">
<filter
string="To Do"
name="todo"
domain="[('state','=', 'submitted')]"
help="Stock Requests To Do."
string="Operation Type"
name="picking_type_id"
domain="[]"
context="{'group_by': 'picking_type_id'}"
/>
<filter
string="In Progress"
name="inprogress"
domain="[('state', '=', 'open')]"
help="Stock Requests in Progress."
</xpath>
</field>
</record>
<record id="stock_request_order_form_picking_type" model="ir.ui.view">
<field name="name">stock.request.order.form.picking.type</field>
<field name="model">stock.request.order</field>
<field name="inherit_id" ref="stock_request.stock_request_order_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='warehouse_id']" position="after">
<field
name="picking_type_id"
domain="[('code', '=', 'stock_request_order')]"
context="{'default_code': 'stock_request_order'}"
attrs="{'readonly': [('state', '!=', 'draft')]}"
/>
<filter
string="Late"
domain="['&amp;', ('expected_date', '&lt;', current_date), ('state', 'in', ('submitted', 'open'))]"
name="late"
help="Late Stock Requests"
/>
<filter string="Done" name="done" domain="[('state', '=', 'done')]" />
<group expand="0" string="Group By...">
<filter
string="Expected Date"
name="expected_date"
domain="[]"
context="{'group_by': 'expected_date'}"
help="Expected Date by Month"
/>
<filter
string="State"
name="state"
domain="[]"
context="{'group_by': 'state'}"
/>
</group>
</search>
</xpath>
</field>
</record>
<record id="action_picking_dashboard" model="ir.actions.act_window">
<field name="name">Stock Request Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.request.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="False" />
<field name="search_view_id" ref="view_stock_request_order_filter" />
<field name="search_view_id" ref="stock_request_order_search" />
<field name="domain">[('picking_type_id', '=', active_id)]</field>
<field name="context">{'default_picking_type_id': active_id}</field>
</record>
@@ -57,7 +43,6 @@
<field name="name">Stock Request Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.request.order</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
</record>
<menuitem