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

[17.0][ADD] Module pos_order_split_invoice_attachment_sync #1198

Open
wants to merge 1 commit into
base: 17.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
96 changes: 96 additions & 0 deletions pos_order_split_invoice_attachment_sync/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
=======================================
Pos Order Split Invoice Attachment Sync
=======================================

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

.. |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%2Fpos-lightgray.png?logo=github
:target: https://github.com/OCA/pos/tree/17.0/pos_order_split_invoice_attachment_sync
:alt: OCA/pos
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pos-17-0/pos-17-0-pos_order_split_invoice_attachment_sync
: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/pos&target_branch=17.0
:alt: Try me on Runboat

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

This module synchronizes attachments between pos orders and splitted
invoices.

**Table of contents**

.. contents::
:local:

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

This has no configuration required.

Usage
=====

You have nothing to do, all the attachments in a pos order linked to a
splitted invoice are syncronized with in the splitted invoice.

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

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

* INVITU

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

- INVITU <[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-Coco Invitu| image:: https://github.com/Coco Invitu.png?size=40px
:target: https://github.com/Coco Invitu
:alt: Coco Invitu

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

|maintainer-Coco Invitu|

This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/17.0/pos_order_split_invoice_attachment_sync>`_ 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 pos_order_split_invoice_attachment_sync/__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.html).

from . import models
14 changes: 14 additions & 0 deletions pos_order_split_invoice_attachment_sync/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Pos Order Split Invoice Attachment Sync",
"version": "17.0.1.0.0",
"category": "Point Of Sale",
"summary": "Synchronizes attachments between Pos Orders and Splitted Invoices",
"author": "INVITU,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/pos",
"license": "AGPL-3",
"depends": ["base", "pos_order_split_invoice", "pos_order_attachment"],
"data": [],
"installable": True,
}
3 changes: 3 additions & 0 deletions pos_order_split_invoice_attachment_sync/models/__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.html).

from . import ir_attachment
41 changes: 41 additions & 0 deletions pos_order_split_invoice_attachment_sync/models/ir_attachment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models


class IrAttachment(models.Model):
_name = "ir.attachment"
_inherit = ["ir.attachment"]

@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)
for attachment in res:
if attachment.res_model == "pos.order":
pos_order = self.env["pos.order"].search(
[("id", "=", attachment.res_id)]
)
if pos_order.splitting_move_id:
linked_account_move = pos_order.splitting_move_id
res.copy(
{"res_model": "account.move", "res_id": linked_account_move.id}
)
return res

def unlink(self):
for attachment in self:
if attachment.res_model == "pos.order":
pos_order = self.env["pos.order"].search(
[("id", "=", attachment.res_id)]
)
linked_account_move = pos_order.splitting_move_id
link_attachment = self.env["ir.attachment"].search(
[
("res_id", "=", linked_account_move.id),
("res_model", "=", "account.move"),
("checksum", "=", attachment.checksum),
]
)
link_attachment.unlink()
res = super().unlink()
return res
3 changes: 3 additions & 0 deletions pos_order_split_invoice_attachment_sync/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This has no configuration required.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- INVITU \<<[email protected]>\>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module synchronizes attachments between pos orders and splitted invoices.
1 change: 1 addition & 0 deletions pos_order_split_invoice_attachment_sync/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
You have nothing to do, all the attachments in a pos order linked to a splitted invoice are syncronized with in the splitted invoice.
Loading
Loading