Skip to content

Commit

Permalink
Merge PR #1243 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Apr 18, 2023
2 parents e3b07ee + 7e64d17 commit d083a99
Show file tree
Hide file tree
Showing 17 changed files with 718 additions and 0 deletions.
103 changes: 103 additions & 0 deletions partner_invoicing_mode/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
===================================
Account Invoice Base Invoicing Mode
===================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/14.0/account_invoice_base_invoicing_mode
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-14-0/account-invoicing-14-0-account_invoice_base_invoicing_mode
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/95/14.0
:alt: Try me on Runbot

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

This is a base module for implementing different invoicing mode for customers.
It adds a selection field `invoicing_mode` in the Accounting tab of the partner
with a default value (Odoo standard invoicing mode).
But it serves no purpose installed on its own.

The following modules use it to install specific invoicing mode :

* `account_invoice_mode_at_shipping`
* `account_invoice_mode_monthly`

**Table of contents**

.. contents::
:local:

Known issues / Roadmap
======================

On the version 13.0 PR it has been discussed to rename the modules like this:

* account_invoice_base_invoicing_mode -> partner_invoicing_mode
* account_invoice_mode_monthly -> partner_invoicing_mode_monthly
* account_invoice_mode_at_shipping -> partner_invoicing_mode_at_shipping

It would be great to do it, during the version 15.0 migration.

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

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

* Camptocamp

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

* `Camptocamp <https://www.camptocamp.com>`_:

* Thierry Ducrest <[email protected]>

* Phuc (Tran Thanh) <[email protected]>

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/account-invoicing <https://github.com/OCA/account-invoicing/tree/14.0/account_invoice_base_invoicing_mode>`_ 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 partner_invoicing_mode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions partner_invoicing_mode/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2020 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Partner Invoicing Mode",
"version": "15.0.1.0.0",
"summary": "Base module for handling multiple partner invoicing mode",
"author": "Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
"license": "AGPL-3",
"category": "Accounting & Finance",
"depends": ["account", "queue_job", "sale"],
"data": [
"data/queue_job_data.xml",
"views/res_partner.xml",
],
}
19 changes: 19 additions & 0 deletions partner_invoicing_mode/data/queue_job_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Queue Job Channel -->
<record id="invoice_validation" model="queue.job.channel">
<field name="name">invoice_validation</field>
<field name="parent_id" ref="queue_job.channel_root" />
</record>

<!-- Queue Job Function -->
<record id="job_function_validate_invoice" model="queue.job.function">
<field name="model_id" ref="account.model_account_move" />
<field name="method">_validate_invoice</field>
<field name="channel_id" ref="invoice_validation" />
<field
name="related_action"
eval='{"func_name": "related_action_open_invoice"}'
/>
</record>
</odoo>
4 changes: 4 additions & 0 deletions partner_invoicing_mode/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import account_invoice
from . import queue_job
from . import res_partner
from . import sale_order
11 changes: 11 additions & 0 deletions partner_invoicing_mode/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo import models


class AccountMove(models.Model):
_inherit = "account.move"

def _validate_invoice(self):
return self.sudo().action_post()
35 changes: 35 additions & 0 deletions partner_invoicing_mode/models/queue_job.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo import _, models


class QueueJob(models.Model):
_inherit = "queue.job"

def related_action_open_invoice(self):
"""Open a form view with the invoice related to the job."""
self.ensure_one()
model_name = self.model_name
records = self.env[model_name].browse(self.record_ids).exists()
if not records:
return None
action = {
"name": _("Related Record"),
"type": "ir.actions.act_window",
"view_type": "form",
"view_mode": "form",
"res_model": records._name,
}
if len(records) == 1:
action["res_id"] = records.id
else:
action.update(
{
"name": _("Related Records"),
"view_mode": "tree,form",
"view_id": "account.view_invoice_tree",
"domain": [("id", "in", records.ids)],
}
)
return action
21 changes: 21 additions & 0 deletions partner_invoicing_mode/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo import api, fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

invoicing_mode = fields.Selection([("standard", "Standard")], default="standard")
one_invoice_per_order = fields.Boolean(
default=False,
help="Do not group sale order into one invoice.",
)

@api.model
def _commercial_fields(self):
return super()._commercial_fields() + [
"invoicing_mode",
"one_invoice_per_order",
]
10 changes: 10 additions & 0 deletions partner_invoicing_mode/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo import fields, models


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

invoicing_mode = fields.Selection(related="partner_invoice_id.invoicing_mode")
5 changes: 5 additions & 0 deletions partner_invoicing_mode/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* `Camptocamp <https://www.camptocamp.com>`_:

* Thierry Ducrest <[email protected]>

* Phuc (Tran Thanh) <[email protected]>
3 changes: 3 additions & 0 deletions partner_invoicing_mode/readme/CREDITS.rst
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
9 changes: 9 additions & 0 deletions partner_invoicing_mode/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This is a base module for implementing different invoicing mode for customers.
It adds a selection field `invoicing_mode` in the Accounting tab of the partner
with a default value (Odoo standard invoicing mode).
But it serves no purpose installed on its own.

The following modules use it to install specific invoicing mode :

* `partner_invoicing_mode_at_shipping`
* `partner_invoicing_mode_monthly`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d083a99

Please sign in to comment.