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

[18.0][ADD] sale_automatic_workflow_stock_job #3461

Open
wants to merge 1 commit into
base: 18.0
Choose a base branch
from
Open
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
83 changes: 83 additions & 0 deletions sale_automatic_workflow_stock_job/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
=================================
Sale Automatic Workflow Stock Job
=================================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_automatic_workflow_stock_job
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_automatic_workflow_stock_job
: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/sale-workflow&target_branch=18.0
:alt: Try me on Runboat

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

This module use Queue Jobs to process stock-related workflows in sales.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-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/sale-workflow/issues/new?body=module:%20sale_automatic_workflow_stock_job%0Aversion:%2018.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
-------

* Camptocamp

Contributors
------------

- Chau Le <chaulb@trobz.com>

Other credits
-------------

The development of this module has been financially supported by:

- Camptocamp

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.

This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_automatic_workflow_stock_job>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_automatic_workflow_stock_job/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions sale_automatic_workflow_stock_job/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2011 Akretion Sébastien BEAU <sebastien.beau@akretion.com>
# Copyright 2013 Camptocamp SA (author: Guewen Baconnier)
# Copyright 2016 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Sale Automatic Workflow Stock Job",
"version": "18.0.1.0.0",
"category": "Sales Management",
"license": "AGPL-3",
"author": "Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
"depends": ["sale_automatic_workflow_job", "sale_automatic_workflow_stock"],
"data": [
"data/queue_job_data.xml",
],
"auto_install": True,
}
18 changes: 18 additions & 0 deletions sale_automatic_workflow_stock_job/data/queue_job_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="job_function_do_validate_picking" model="queue.job.function">
<field
name="model_id"
ref="sale_automatic_workflow_stock.model_automatic_workflow_job"
/>
<field name="method">_do_validate_picking</field>
<field
name="channel_id"
ref="sale_automatic_workflow_job.channel_sale_automatic_workflow"
/>
<field
name="related_action"
eval='{"func_name": "_related_action_sale_automatic_workflow"}'
/>
</record>
</odoo>
1 change: 1 addition & 0 deletions sale_automatic_workflow_stock_job/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import automatic_workflow_job
32 changes: 32 additions & 0 deletions sale_automatic_workflow_stock_job/models/automatic_workflow_job.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2020 Camptocamp (https://www.camptocamp.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models

from odoo.addons.queue_job.job import identity_exact


class AutomaticWorkflowJob(models.Model):
_inherit = "automatic.workflow.job"

def _do_validate_picking_job_options(self, picking, domain_filter):
description = self.env._("Validate transfer %s", picking.display_name)
return {
"description": description,
"identity_key": identity_exact,
}

def _validate_pickings(self, picking_filter):
with_context = self.with_context(auto_delay_do_validation=True)
return super(AutomaticWorkflowJob, with_context)._validate_pickings(
picking_filter
)

def _register_hook(self):
self._patch_method(
"_do_validate_picking",
self._patch_job_auto_delay(
"_do_validate_picking", context_key="auto_delay_do_validation"
),
)
return super()._register_hook()
3 changes: 3 additions & 0 deletions sale_automatic_workflow_stock_job/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions sale_automatic_workflow_stock_job/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Chau Le \<<chaulb@trobz.com>\>
3 changes: 3 additions & 0 deletions sale_automatic_workflow_stock_job/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The development of this module has been financially supported by:

- Camptocamp
1 change: 1 addition & 0 deletions sale_automatic_workflow_stock_job/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module use Queue Jobs to process stock-related workflows in sales.
Loading