Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
52 changes: 52 additions & 0 deletions account_invoice_line_salesperson/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
================================
Account Invoice Line Salesperson
================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-qrtl%2Fhls--custom-lightgray.png?logo=github
:target: https://github.com/qrtl/hls-custom/tree/12.0/account_invoice_line_salesperson
:alt: qrtl/hls-custom

|badge1| |badge2| |badge3|

This module adds the salesperson to the account invoice line based on the salesperson of the related sale order line or the salesperson of the invoice.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/qrtl/hls-custom/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/qrtl/hls-custom/issues/new?body=module:%20account_invoice_line_salesperson%0Aversion:%2012.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
~~~~~~~

* Quartile

Maintainers
~~~~~~~~~~~

This module is part of the `qrtl/hls-custom <https://github.com/qrtl/hls-custom/tree/12.0/account_invoice_line_salesperson>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions account_invoice_line_salesperson/__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_invoice_line_salesperson/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Quartile
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Account Invoice Line Salesperson",
"version": "12.0.1.0.0",
"author": "Quartile",
"website": "https://www.quartile.co",
"category": "Invoice",
"license": "AGPL-3",
"depends": ["sale"],
"data": [
"views/account_invoice_views.xml",
],
"installable": True,
}
1 change: 1 addition & 0 deletions account_invoice_line_salesperson/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_invoice
23 changes: 23 additions & 0 deletions account_invoice_line_salesperson/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 Quartile
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class AccountInvoiceLine(models.Model):
_inherit = "account.invoice.line"

user_id = fields.Many2one(
"res.users", compute="_compute_salesperson", string="Salesperson", store=True
)

@api.multi
@api.depends("sale_line_ids.order_id.user_id", "invoice_id.user_id")
def _compute_salesperson(self):
for line in self:
if line.invoice_type not in ("out_invoice", "out_refund"):
continue
if line.sale_line_ids:
line.user_id = line.sale_line_ids[0].order_id.user_id
continue
line.user_id = line.invoice_id.user_id
1 change: 1 addition & 0 deletions account_invoice_line_salesperson/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds the salesperson to the account invoice line based on the salesperson of the related sale order line or the salesperson of the invoice.
Loading