Skip to content

Commit fb63be9

Browse files
[ADD] account_invoice_line_salesperson
1 parent 212658a commit fb63be9

10 files changed

Lines changed: 521 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
================================
2+
Account Invoice Line Salesperson
3+
================================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Beta
13+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15+
:alt: License: AGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-qrtl%2Fhls--custom-lightgray.png?logo=github
17+
:target: https://github.com/qrtl/hls-custom/tree/12.0/account_invoice_line_salesperson
18+
:alt: qrtl/hls-custom
19+
20+
|badge1| |badge2| |badge3|
21+
22+
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.
23+
24+
**Table of contents**
25+
26+
.. contents::
27+
:local:
28+
29+
Bug Tracker
30+
===========
31+
32+
Bugs are tracked on `GitHub Issues <https://github.com/qrtl/hls-custom/issues>`_.
33+
In case of trouble, please check there if your issue has already been reported.
34+
If you spotted it first, help us smashing it by providing a detailed and welcomed
35+
`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**>`_.
36+
37+
Do not contact contributors directly about support or help with technical issues.
38+
39+
Credits
40+
=======
41+
42+
Authors
43+
~~~~~~~
44+
45+
* Quartile
46+
47+
Maintainers
48+
~~~~~~~~~~~
49+
50+
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.
51+
52+
You are welcome to contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2024 Quartile
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Account Invoice Line Salesperson",
5+
"version": "12.0.1.0.0",
6+
"author": "Quartile",
7+
"website": "https://www.quartile.co",
8+
"category": "Invoice",
9+
"license": "AGPL-3",
10+
"depends": ["sale"],
11+
"data": [
12+
"views/account_invoice_views.xml",
13+
],
14+
"installable": True,
15+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import account_invoice
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2024 Quartile
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, fields, models
5+
6+
7+
class AccountInvoiceLine(models.Model):
8+
_inherit = "account.invoice.line"
9+
10+
user_id = fields.Many2one(
11+
"res.users", compute="_compute_salesperson", string="Salesperson", store=True
12+
)
13+
14+
@api.multi
15+
@api.depends("sale_line_ids.order_id.user_id", "invoice_id.user_id")
16+
def _compute_salesperson(self):
17+
for line in self:
18+
if line.invoice_type not in ("out_invoice", "out_refund"):
19+
continue
20+
if line.sale_line_ids:
21+
line.user_id = line.sale_line_ids[0].order_id.user_id
22+
continue
23+
line.user_id = line.invoice_id.user_id
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

0 commit comments

Comments
 (0)