forked from OCA/sale-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] sale_order_type: add sale order type to sales and invoice analy…
…sis reports
- Loading branch information
Showing
7 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models | ||
from . import reports | ||
from . import wizards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import account_invoice_report | ||
from . import sale_report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class AccountInvoiceReport(models.Model): | ||
_inherit = "account.invoice.report" | ||
|
||
sale_type_id = fields.Many2one( | ||
comodel_name='sale.order.type', | ||
string='Sale Order Type', | ||
) | ||
|
||
def _select(self): | ||
select_str = super()._select() | ||
select_str += """ | ||
, move.sale_type_id as sale_type_id | ||
""" | ||
return select_str | ||
|
||
def _sub_select(self): | ||
select_str = super()._sub_select() | ||
select_str += """ | ||
, ai.sale_type_id | ||
""" | ||
return select_str | ||
|
||
def _group_by(self): | ||
group_by_str = super()._group_by() | ||
group_by_str += ", ai.sale_type_id" | ||
return group_by_str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="view_account_invoice_report_search" model="ir.ui.view"> | ||
<field name="inherit_id" ref="account.view_account_invoice_report_search"/> | ||
<field name="model">account.invoice.report</field> | ||
<field name="arch" type="xml"> | ||
<filter name="user" position="before"> | ||
<filter string="Sale Order Type" name="sale_order_type" | ||
context="{'group_by':'sale_type_id'}"/> | ||
</filter> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class SaleReport(models.Model): | ||
_inherit = "sale.report" | ||
|
||
type_id = fields.Many2one( | ||
comodel_name='sale.order.type', | ||
string='Type', | ||
) | ||
|
||
# pylint:disable=dangerous-default-value | ||
def _query(self, with_clause='', fields={}, groupby='', from_clause=''): | ||
fields['type_id'] = ", s.type_id as type_id" | ||
groupby += ', s.type_id' | ||
return super(SaleReport, self)._query( | ||
with_clause, fields, groupby, from_clause | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="view_order_product_search" model="ir.ui.view"> | ||
<field name="inherit_id" ref="sale.view_order_product_search"/> | ||
<field name="model">sale.report</field> | ||
<field name="arch" type="xml"> | ||
<filter name="User" position="before"> | ||
<filter string="Sale Order Type" name="sale_order_type" | ||
context="{'group_by':'type_id'}"/> | ||
</filter> | ||
</field> | ||
</record> | ||
|
||
</odoo> |