Skip to content

Commit be928bf

Browse files
chienandalusergio-teruel
authored andcommitted
[MIG] account_reporting_weight: Migration to 11.0
1 parent eb86de2 commit be928bf

10 files changed

+76
-68
lines changed

account_reporting_weight/README.rst

+58-25
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,42 @@
1-
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2-
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
3-
:alt: License: AGPL-3
4-
51
=====================================
62
Weights in the invoices analysis view
73
=====================================
84

9-
This module adds the measure "Weight" in the invoices analysis view. This is
10-
caught from 2 possible sources:
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-OCA%2Faccount--invoicing-lightgray.png?logo=github
17+
:target: https://github.com/OCA/account-invoicing/tree/11.0/account_reporting_weight
18+
:alt: OCA/account-invoicing
19+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20+
:target: https://translation.odoo-community.org/projects/account-invoicing-11-0/account-invoicing-11-0-account_reporting_weight
21+
:alt: Translate me on Weblate
22+
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23+
:target: https://runbot.odoo-community.org/runbot/95/11.0
24+
:alt: Try me on Runbot
25+
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
27+
28+
This module adds the measure "Weight" in the invoices analysis view.
1129

12-
* If the UoM of the product is one of the category "Weight", the value is taken
13-
from the ordered quantity.
14-
* If the UoM of the product is another, then the weight is taken from the
15-
weight field of the product multiply by the ordered quantity.
30+
**Table of contents**
31+
32+
.. contents::
33+
:local:
34+
35+
Installation
36+
============
37+
38+
* `product_weight_through_uom` is recommended in case you have products with
39+
a UoM in the Weight category so the weight is correctly computed.
1640

1741
Configuration
1842
=============
@@ -26,36 +50,45 @@ Usage
2650
#. Go to *Invoicing > Reporting > Businness Intelligence > Invoices*.
2751
#. Add the "Weight" measure from your "Measures" dropdown in your analysis.
2852

29-
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
30-
:alt: Try me on Runbot
31-
:target: https://runbot.odoo-community.org/runbot/94/9.0
53+
Bug Tracker
54+
===========
3255

33-
Known issues / Roadmap
34-
======================
56+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/issues>`_.
57+
In case of trouble, please check there if your issue has already been reported.
58+
If you spotted it first, help us smashing it by providing a detailed and welcomed
59+
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_reporting_weight%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
3560

36-
* The weight quantity is expressed in the unit of measure of the product,
37-
so if you have several weight UoMs across your products, the global sum won't
38-
make sense.
61+
Do not contact contributors directly about support or help with technical issues.
3962

4063
Credits
4164
=======
4265

66+
Authors
67+
~~~~~~~
68+
69+
* Tecnativa
70+
4371
Contributors
44-
------------
72+
~~~~~~~~~~~~
73+
74+
* `Tecnativa <https://www.tecnativa.com>`_:
4575

46-
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
76+
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
77+
* David Vidal <david.vidal@tecnativa.com>
4778

48-
Maintainer
49-
----------
79+
Maintainers
80+
~~~~~~~~~~~
81+
82+
This module is maintained by the OCA.
5083

5184
.. image:: https://odoo-community.org/logo.png
5285
:alt: Odoo Community Association
5386
:target: https://odoo-community.org
5487

55-
This module is maintained by the OCA.
56-
5788
OCA, or the Odoo Community Association, is a nonprofit organization whose
5889
mission is to support the collaborative development of Odoo features and
5990
promote its widespread use.
6091

61-
To contribute to this module, please visit https://odoo-community.org.
92+
This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/11.0/account_reporting_weight>`_ project on GitHub.
93+
94+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

account_reporting_weight/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
32

43
from . import reports

account_reporting_weight/__openerp__.py account_reporting_weight/__manifest__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright 2017 Pedro M. Baeza <pedro.baeza@tecnativa.com>
32
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
43

54
{
65
'name': 'Weights in the invoices analysis view',
7-
'version': '9.0.1.0.0',
6+
'version': '11.0.1.0.0',
87
'author': 'Tecnativa,'
98
'Odoo Community Association (OCA)',
109
'category': 'Inventory, Logistics, Warehousing',
1110
'license': 'AGPL-3',
12-
'website': 'https://www.tecnativa.com',
11+
'website': 'https://www.github.com/account_reporting_weight',
1312
'depends': [
1413
'sale',
1514
],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
You need to be at least "Accountant" on "Accounting & Finance" role for
2+
seeing the report.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
* `Tecnativa <https://www.tecnativa.com>`_:
2+
3+
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
4+
* David Vidal <david.vidal@tecnativa.com>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module adds the measure "Weight" in the invoices analysis view.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* `product_weight_through_uom` is recommended in case you have products with
2+
a UoM in the Weight category so the weight is correctly computed.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#. Go to *Invoicing > Reporting > Businness Intelligence > Invoices*.
2+
#. Add the "Weight" measure from your "Measures" dropdown in your analysis.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
32

43
from . import account_invoice_report
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# -*- coding: utf-8 -*-
21
# Copyright 2017 Pedro M. Baeza <pedro.baeza@tecnativa.com>
32
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
43

5-
from openerp import fields, models
6-
import openerp.addons.decimal_precision as dp
4+
from odoo import fields, models
5+
import odoo.addons.decimal_precision as dp
76

87

98
class AccountInvoiceReport(models.Model):
@@ -21,44 +20,12 @@ def _select(self):
2120
def _sub_select(self):
2221
select_str = super(AccountInvoiceReport, self)._sub_select()
2322
select_str += """
24-
, CASE
25-
WHEN u.category_id = imd.res_id
26-
THEN (
27-
CASE
28-
WHEN ai.type::text = ANY (
29-
ARRAY['out_refund'::character varying::text,
30-
'in_invoice'::character varying::text])
31-
THEN
32-
SUM(-ail.quantity / u.factor * u2.factor)
33-
ELSE
34-
SUM(ail.quantity / u.factor * u2.factor)
35-
END
36-
)
37-
ELSE (
38-
CASE
39-
WHEN ai.type::text = ANY (
40-
ARRAY['out_refund'::character varying::text,
41-
'in_invoice'::character varying::text])
42-
THEN
43-
SUM(pr.weight * -ail.quantity / u.factor * u2.factor)
44-
ELSE
45-
SUM(pr.weight * ail.quantity / u.factor * u2.factor)
46-
END
47-
)
48-
END AS weight
23+
, SUM(pr.weight * ail.quantity / u.factor * u2.factor)
24+
AS weight
4925
"""
5026
return select_str
5127

52-
def _from(self):
53-
from_str = super(AccountInvoiceReport, self)._from()
54-
from_str += """
55-
JOIN ir_model_data imd
56-
ON (imd.module = 'product' AND
57-
imd.name = 'product_uom_categ_kgm')
58-
"""
59-
return from_str
60-
6128
def _group_by(self):
6229
group_by_str = super(AccountInvoiceReport, self)._group_by()
63-
group_by_str += ", pr.weight, u.category_id, imd.res_id"
30+
group_by_str += ", pr.weight, u.category_id"
6431
return group_by_str

0 commit comments

Comments
 (0)