Skip to content

Commit

Permalink
Merge PR #24 into 13.0
Browse files Browse the repository at this point in the history
Signed-off-by dreispt
  • Loading branch information
OCA-git-bot committed Nov 27, 2021
2 parents a9cc60a + cdff6ea commit 060699f
Show file tree
Hide file tree
Showing 18 changed files with 664 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ env:
- VERSION="13.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"

install:
# FIXME:
- git clone --branch 13.0-add_account_fiscal_position_allowed_journal_tbi
https://github.com/acsone/account-financial-tools.git PR937
- rm -rf account_fiscal_position_allowed_journal && cp -ar
PR937/account_fiscal_position_allowed_journal .
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git
${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
Expand Down
86 changes: 86 additions & 0 deletions account_fiscal_position_allowed_journal_sale/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
============================================
Account Fiscal Position Allowed Journal Sale
============================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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--financial-lightgray.png?logo=github
:target: https://github.com/OCA/sale-financial/tree/13.0/account_fiscal_position_allowed_journal_sale
:alt: OCA/sale-financial
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-financial-13-0/sale-financial-13-0-account_fiscal_position_allowed_journal_sale
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/147/13.0
:alt: Try me on Runbot

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

When creating an invoice from a sale order, take the allowed sale journal on the fiscal position, if there is exactly one on it.

**Table of contents**

.. contents::
:local:

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

See configuration of Account Fiscal Position Allowed Journal.

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

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

Credits
=======

Authors
~~~~~~~

* ACSONE SA/NV

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

* Thomas Binsfeld <thomas.binsfeld@acsone.eu> (https://www.acsone.eu/)

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

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

|maintainer-ThomasBinsfeld|

This module is part of the `OCA/sale-financial <https://github.com/OCA/sale-financial/tree/13.0/account_fiscal_position_allowed_journal_sale>`_ 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 account_fiscal_position_allowed_journal_sale/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions account_fiscal_position_allowed_journal_sale/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2020 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Account Fiscal Position Allowed Journal Sale",
"summary": """
Use an allowed journal when creating an invoice from a sale order.""",
"version": "13.0.1.0.0",
"development_status": "Beta",
"license": "AGPL-3",
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"maintainers": ["ThomasBinsfeld"],
"website": "https://github.com/OCA/sale-financial",
"depends": ["sale", "account_fiscal_position_allowed_journal"],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
23 changes: 23 additions & 0 deletions account_fiscal_position_allowed_journal_sale/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2020 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class SaleOrder(models.Model):
_inherit = "sale.order"

def _prepare_invoice(self):
"""
If there is a fiscal position in vals and exactly one sale journal
allowed on it, set this journal in vals.
"""
res = super()._prepare_invoice()
fiscal_position_id = res.get("fiscal_position_id")
if fiscal_position_id:
fiscal_position_model = self.env["account.fiscal.position"]
fiscal_position = fiscal_position_model.browse(fiscal_position_id)
sale_journal = fiscal_position._get_allowed_journal("sale")
if sale_journal:
res["journal_id"] = sale_journal.id
return res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See configuration of Account Fiscal Position Allowed Journal.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Thomas Binsfeld <thomas.binsfeld@acsone.eu> (https://www.acsone.eu/)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When creating an invoice from a sale order, take the allowed sale journal on the fiscal position, if there is exactly one on it.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 060699f

Please sign in to comment.