Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][ADD] stock_request_sequence_option #1853

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions setup/stock_request_sequence_option/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
92 changes: 92 additions & 0 deletions stock_request_sequence_option/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
=============================
Stock Request Sequence Option
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7703e3a9e7129a260c40f5b72b03abc08f95708d90bf974bef2543b0abaa4fcb
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-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/14.0/stock_request_sequence_option
: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-14-0/stock-logistics-warehouse-14-0-stock_request_sequence_option
: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/stock-logistics-warehouse&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends module ir_sequence_option and allow you to
provide optional sequences for stock request documents.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_request_sequence_option%0Aversion:%2014.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.

Credits
=======

Authors
~~~~~~~

* Ecosoft

Contributors
~~~~~~~~~~~~

* `Ecosoft <http://ecosoft.co.th>`__:

* Pimolnat Suntian <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

.. |maintainer-ps-tubtim| image:: https://github.com/ps-tubtim.png?size=40px
:target: https://github.com/ps-tubtim
:alt: ps-tubtim

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ps-tubtim|

This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_request_sequence_option>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions stock_request_sequence_option/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
18 changes: 18 additions & 0 deletions stock_request_sequence_option/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 Ecosoft Co., Ltd. (https://ecosoft.co.th)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Stock Request Sequence Option",
"summary": "Manage sequence options for stock request",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Ecosoft, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"depends": ["base_sequence_option", "stock_request"],
"data": ["data/stock_request_sequence_option.xml"],
"demo": ["demo/stock_request_demo_options.xml"],
"development_status": "Alpha",
"maintainers": ["ps-tubtim"],
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">

<record id="stock_request_sequence_option" model="ir.sequence.option">
<field name="name">Stock Request</field>
<field name="model">stock.request</field>
<field name="use_sequence_option" eval="False" />
</record>

<record id="stock_request_order_sequence_option" model="ir.sequence.option">
<field name="name">Stock Request Order</field>
<field name="model">stock.request.order</field>
<field name="use_sequence_option" eval="False" />
</record>

</odoo>
43 changes: 43 additions & 0 deletions stock_request_sequence_option/demo/stock_request_demo_options.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="seq_stock_request_option_1" model="ir.sequence">
<field name="name">Stock Request: Option 1</field>
<field name="padding" eval="5" />
<field name="prefix">SR-1/</field>
</record>
<record id="seq_stock_request_order_option_1" model="ir.sequence">
<field name="name">Stock Request Order: Option 1</field>
<field name="padding" eval="5" />
<field name="prefix">SRO-1/</field>
</record>

<record id="stock_request_sequence_option_line_1" model="ir.sequence.option.line">
<field
name="base_id"
ref="stock_request_sequence_option.stock_request_sequence_option"
/>
<field name="name">SR Option 1</field>
<field name="filter_domain">[]</field>
<field
name="sequence_id"
ref="stock_request_sequence_option.seq_stock_request_option_1"
/>
</record>
<record
id="stock_request_order_sequence_option_line_1"
model="ir.sequence.option.line"
>
<field
name="base_id"
ref="stock_request_sequence_option.stock_request_order_sequence_option"
/>
<field name="name">SRO Option 1</field>
<field name="filter_domain">[]</field>
<field
name="sequence_id"
ref="stock_request_sequence_option.seq_stock_request_order_option_1"
/>
</record>

</odoo>
5 changes: 5 additions & 0 deletions stock_request_sequence_option/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import stock_request_order
from . import stock_request
from . import sequence_option
19 changes: 19 additions & 0 deletions stock_request_sequence_option/models/sequence_option.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2023 Ecosoft Co., Ltd. (https://ecosoft.co.th)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class IrSequenceOption(models.Model):
_inherit = "ir.sequence.option"

model = fields.Selection(
selection_add=[
("stock.request", "stock.request"),
("stock.request.order", "stock.request.order"),
],
ondelete={
"stock.request": "cascade",
"stock.request.order": "cascade",
},
)
14 changes: 14 additions & 0 deletions stock_request_sequence_option/models/stock_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023 Ecosoft Co., Ltd. (https://ecosoft.co.th)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models


class StockRequest(models.Model):
_inherit = "stock.request"

@api.model
def create(self, vals):
seq = self.env["ir.sequence.option.line"].get_sequence(self.new(vals))
self = self.with_context(sequence_option_id=seq.id)
return super().create(vals)
14 changes: 14 additions & 0 deletions stock_request_sequence_option/models/stock_request_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2023 Ecosoft Co., Ltd. (https://ecosoft.co.th)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models


class StockRequestOrder(models.Model):
_inherit = "stock.request.order"

@api.model
def create(self, vals):
seq = self.env["ir.sequence.option.line"].get_sequence(self.new(vals))
self = self.with_context(sequence_option_id=seq.id)
return super().create(vals)
3 changes: 3 additions & 0 deletions stock_request_sequence_option/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Ecosoft <http://ecosoft.co.th>`__:

* Pimolnat Suntian <[email protected]>
2 changes: 2 additions & 0 deletions stock_request_sequence_option/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module extends module ir_sequence_option and allow you to
provide optional sequences for stock request documents.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading