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] auto_printing_stock_picking #354

Open
wants to merge 4 commits into
base: 14.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
94 changes: 94 additions & 0 deletions printing_auto_stock_picking/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
===========================
Printing Auto Stock Picking
===========================

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

.. |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%2Fstock--logistics--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-reporting/tree/14.0/printing_auto_stock_picking
:alt: OCA/stock-logistics-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-reporting-14-0/stock-logistics-reporting-14-0-printing_auto_stock_picking
: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-reporting&target_branch=14.0
:alt: Try me on Runboat

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

When a picking is done, automatically trigger the printing of some documents.
This can be used to print a delivery slip (report) or labels received from the carrier (attachment).

**Table of contents**

.. contents::
:local:

Configuration
=============

Go to the Operation Type and configure which report or attachment to print.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-reporting/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-reporting/issues/new?body=module:%20printing_auto_stock_picking%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
~~~~~~~

* BCIM
* MT Software

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

* Jacques-Etienne Baudoux (BCIM) <[email protected]>
* Michael Tietz (MT Software) <[email protected]>
* Camptocamp
* Christopher Hansen <[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-jbaudoux| image:: https://github.com/jbaudoux.png?size=40px
:target: https://github.com/jbaudoux
:alt: jbaudoux

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

|maintainer-jbaudoux|

This module is part of the `OCA/stock-logistics-reporting <https://github.com/OCA/stock-logistics-reporting/tree/14.0/printing_auto_stock_picking>`_ 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 printing_auto_stock_picking/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions printing_auto_stock_picking/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2022 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Printing Auto Stock Picking",
"author": "BCIM, MT Software, Odoo Community Association (OCA)",
"maintainers": ["jbaudoux"],
"category": "Warehouse Management",
"data": [
"security/ir.model.access.csv",
"security/ir_rule.xml",
"views/stock_picking.xml",
"views/stock_picking_type.xml",
],
"depends": [
"stock",
"printing_auto_base",
],
"license": "AGPL-3",
"version": "14.0.1.0.0",
"website": "https://github.com/OCA/stock-logistics-reporting",
}
2 changes: 2 additions & 0 deletions printing_auto_stock_picking/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_picking
from . import stock_picking_type
19 changes: 19 additions & 0 deletions printing_auto_stock_picking/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2022 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# Copyright 2022 Michael Tietz (MT Software) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class StockPicking(models.Model):
_name = "stock.picking"
_inherit = ["stock.picking", "printing.auto.mixin"]

auto_printing_ids = fields.Many2many(
"printing.auto", related="picking_type_id.auto_printing_ids"
)

def _action_done(self):
result = super()._action_done()
self.handle_print_auto()
return result
15 changes: 15 additions & 0 deletions printing_auto_stock_picking/models/stock_picking_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2022 Jacques-Etienne Baudoux (BCIM) <[email protected]>
# Copyright 2022 Michael Tietz (MT Software) <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class StockPickingType(models.Model):
_inherit = "stock.picking.type"

auto_printing_ids = fields.Many2many(
"printing.auto",
string="Auto Printing Configuration",
domain=[("model", "=", "stock.picking.type")],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mt-software-de I wonder if this is not a mistake and if we should not put the model of what is printed instead of where it is configured? And in _get_printing_auto filter on that model. https://github.com/OCA/report-print-send/pull/310/files#diff-1360f4baf5029947c074c2576244e65952f4043906416d240f5026996ac26f68R37

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I don't quite understand what you mean.
We need to configure the printing.auto on the picking.type.
I also think we should change the model in the domain to stock.picking. This then aligned with the model which is printing.
But a filter is not needed, because the auto_printing_ids are on the model with the mixin.

)
1 change: 1 addition & 0 deletions printing_auto_stock_picking/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Go to the Operation Type and configure which report or attachment to print.
4 changes: 4 additions & 0 deletions printing_auto_stock_picking/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Jacques-Etienne Baudoux (BCIM) <[email protected]>
* Michael Tietz (MT Software) <[email protected]>
* Camptocamp
* Christopher Hansen <[email protected]>
2 changes: 2 additions & 0 deletions printing_auto_stock_picking/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
When a picking is done, automatically trigger the printing of some documents.
This can be used to print a delivery slip (report) or labels received from the carrier (attachment).
3 changes: 3 additions & 0 deletions printing_auto_stock_picking/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_manager,stock_picking_auto_print - manager,printing_auto_base.model_printing_auto,stock.group_stock_manager,1,1,1,1
access_user,stock_picking_auto_print - user,printing_auto_base.model_printing_auto,stock.group_stock_user,1,0,0,0
13 changes: 13 additions & 0 deletions printing_auto_stock_picking/security/ir_rule.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="ir_rule_user" model="ir.rule">
<field name="name">stock picking auto print</field>
<field name="model_id" ref="printing_auto_base.model_printing_auto" />
<field name="domain_force">[("model", "=", "stock.picking.type")]</field>
<field name="groups" eval="[(4, ref('stock.group_stock_user'))]" />
<field name="perm_create" eval="0" />
<field name="perm_write" eval="0" />
<field name="perm_unlink" eval="0" />
<field name="perm_read" eval="1" />
</record>
</odoo>
Loading
Loading