forked from odoo/odoo-extra
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request odoo#34 from ingadhoc/fix_produc_catalog
IMP report by price_template and category Public
- Loading branch information
Showing
9 changed files
with
147 additions
and
29 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
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
1 change: 1 addition & 0 deletions
1
product_catalog_aeroo_report/report/.~lock.product_catalog_simple.odt#
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 @@ | ||
,nico,nico,07.04.2015 13:08,file:///home/nico/.config/libreoffice/4; |
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
Binary file modified
BIN
+3.23 KB
(120%)
product_catalog_aeroo_report/report/product_catalog_simple.odt
Binary file not shown.
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,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import product_catalog |
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,30 @@ | ||
# -*- coding: utf-8 -*- | ||
{ | ||
'name': 'Report Category Public', | ||
'version': '1.0', | ||
'category': 'Aeroo Reporting', | ||
'sequence': 14, | ||
'summary': '', | ||
'description': """ | ||
Report Category Public | ||
============================ | ||
""", | ||
'author': 'ADHOC', | ||
'website': 'www.adhoc.com.ar', | ||
'images': [ | ||
], | ||
'depends': [ | ||
'website_sale', | ||
'product_catalog_aeroo_report', | ||
], | ||
'data': ['product_catalog.xml' | ||
], | ||
'demo': [ | ||
], | ||
'test': [ | ||
], | ||
'installable': True, | ||
'auto_install': True, | ||
'application': False, | ||
} | ||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
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,49 @@ | ||
# -*- coding: utf-8 -*- | ||
from openerp import fields, models, api | ||
|
||
|
||
class product_catalog_report(models.Model): | ||
_inherit = 'product.product_catalog_report' | ||
|
||
category_type = fields.Selection( | ||
[('public_category', 'Public Category'), | ||
('accounting_category', 'Accounting Category')], 'Category Type', | ||
required=True | ||
) | ||
public_category_ids = fields.Many2many( | ||
'product.public.category', | ||
'product_catalog_report_categories_public', | ||
'product_catalog_report_id', | ||
'category_id', | ||
'Product Categories Public', | ||
required=True | ||
) | ||
|
||
@api.multi | ||
def generate_report(self): | ||
""" Print the catalog | ||
""" | ||
self.ensure_one() | ||
|
||
context = self._context.copy() | ||
if self.category_type == 'public_category': | ||
category_ids = self.public_category_ids.ids | ||
if self.include_sub_categories: | ||
category_ids = self.env['product.public.category'].search( | ||
[('id', 'child_of', category_ids)]).ids | ||
else: | ||
category_ids = self.category_ids.ids | ||
if self.include_sub_categories: | ||
category_ids = self.env['product.category'].search( | ||
[('id', 'child_of', category_ids)]).ids | ||
|
||
context['category_ids'] = category_ids | ||
context['category_type'] = self.category_type | ||
context['product_type'] = self.product_type | ||
context['pricelist_ids'] = self.pricelist_ids.ids | ||
context['products_order'] = self.products_order | ||
context['categories_order'] = self.categories_order | ||
context['only_with_stock'] = self.only_with_stock | ||
|
||
return self.env['report'].with_context(context).get_action( | ||
self, self.report_xml_id.report_name) |
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,19 @@ | ||
<?xml version="1.0"?> | ||
<openerp> | ||
<data> | ||
<record id="view_product_catalog_public_report_form" model="ir.ui.view"> | ||
<field name="name">Product Catalog Public Reports</field> | ||
<field name="model">product.product_catalog_report</field> | ||
<field name="inherit_id" ref="product_catalog_aeroo_report.view_product_catalog_report_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="product_type" position="after"> | ||
<field name="category_type"/> | ||
</field> | ||
<field name="category_ids" position="replace"> | ||
<field name="category_ids" attrs="{'invisible':[('category_type','=','public_category')]}"/> | ||
<field name="public_category_ids" attrs="{'invisible':[('category_type','=','accounting_category')]}"/> | ||
</field> | ||
</field> | ||
</record> | ||
</data> | ||
</openerp> |