avanzosc team mailing list archive
-
avanzosc team
-
Mailing list archive
-
Message #00461
[Merge] lp:~dani-ds/avanzosc/dos_product_additional_info into lp:~avanzosc-security-team/avanzosc/72horas
Daniel Campos (Avanzosc) has proposed merging lp:~dani-ds/avanzosc/dos_product_additional_info into lp:~avanzosc-security-team/avanzosc/72horas.
Requested reviews:
Avanzosc_security (avanzosc-security-team)
For more details, see:
https://code.launchpad.net/~dani-ds/avanzosc/dos_product_additional_info/+merge/223384
--
https://code.launchpad.net/~dani-ds/avanzosc/dos_product_additional_info/+merge/223384
Your team Avanzosc_security is requested to review the proposed merge of lp:~dani-ds/avanzosc/dos_product_additional_info into lp:~avanzosc-security-team/avanzosc/72horas.
=== modified file 'dos_product_additional_info/__openerp__.py'
--- dos_product_additional_info/__openerp__.py 2014-06-11 10:23:47 +0000
+++ dos_product_additional_info/__openerp__.py 2014-06-17 11:07:40 +0000
@@ -21,17 +21,14 @@
{
- "name" : "DOS Product Additional Info",
- "version" : "1.0",
- "author" : "DOS",
- "category" : "Product",
- "website" : "www.dos-sl.es",
+ "name": "DOS Product Additional Info",
+ "version": "1.0",
+ "author": "DOS",
+ "category": "Product",
+ "website": "www.dos-sl.es",
"description": "This module adds extra information to products",
- "depends" : ['product'],
- "init_xml" : [],
- "update_xml" : ['product_view.xml'],
+ "depends": ['product'],
+ "data": ['view/product_view.xml'],
"active": False,
"installable": True
}
-
-
=== added directory 'dos_product_additional_info/models'
=== renamed file 'dos_product_additional_info/product.py' => 'dos_product_additional_info/models/product.py'
--- dos_product_additional_info/product.py 2014-06-11 10:23:47 +0000
+++ dos_product_additional_info/models/product.py 2014-06-17 11:07:40 +0000
@@ -19,79 +19,71 @@
#
##############################################################################
-from osv import osv, fields
-import re
-from tools.translate import _
-
-class product_product(osv.osv):
-
- _name = 'product.product'
- _inherit = 'product.product'
-
- _columns = {
- 'commissionable': fields.boolean('Commissionable', help="If the commissionable field is set to True, it will allow you to pay commission on the sale of the product."),
- }
-
-
- def pack_components(self, product):
-
- product_sim_id = product_link_id = None
-
- if self._is_pack(product.categ_id):
- for mrp_bom in product.bom_ids:
- for line in mrp_bom.bom_lines:
- if line.product_id and self._is_sim(line.product_id.categ_id):
- product_sim_id = line.product_id.id
- elif line.product_id and self._is_link(line.product_id.categ_id):
- product_link_id = line.product_id.id
- break
-
- return product_sim_id, product_link_id
-
- def _is_sim(self, category):
- if not category:
- return False
-
- if category.name == 'Tarjetas SIM':
- return True
- else:
- return self._is_sim(category.parent_id)
-
-
- def _is_link(self, category):
- if not category:
- return False
-
- if category.name == 'Enlaces':
- return True
- else:
- return self._is_link(category.parent_id)
-
-
- def _is_pack(self, category):
- if not category:
- return False
-
- if category.name == 'Packs':
- return True
- else:
- return self._is_pack(category.parent_id)
-
- def _is_shipping_cost(self, category):
- if not category:
- return False
-
- if category.name == 'Gastos de Envío' or category.id == 4:
- return True
- else:
- return self._is_shipping_cost(category.parent_id)
-
-product_product()
-
-class product_template(osv.osv):
-
- _name = 'product.template'
+from openerp.osv import orm, fields
+from openerp.tools.translate import _
+import openerp.addons.re
+
+
+class ProductProduct(orm.Model):
+ _inherit = 'product.product'
+
+ _columns = {
+ 'commissionable': fields.boolean('Commissionable',
+ help="If the commissionable field is "
+ "set to True, it will allow you to "
+ "pay commission on the sale of the "
+ "product."),
+ }
+
+ def pack_components(self, product):
+ product_sim_id = product_link_id = None
+ if self._is_pack(product.categ_id):
+ for mrp_bom in product.bom_ids:
+ for line in mrp_bom.bom_lines:
+ categ_id = line.product_id.categ_id
+ if line.product_id and self._is_sim(categ_id):
+ product_sim_id = line.product_id.id
+ elif line.product_id and self._is_link(categ_id):
+ product_link_id = line.product_id.id
+ break
+ return product_sim_id, product_link_id
+
+ def _is_sim(self, category):
+ if not category:
+ return False
+ if category.name == 'Tarjetas SIM':
+ return True
+ else:
+ return self._is_sim(category.parent_id)
+
+ def _is_link(self, category):
+ if not category:
+ return False
+ if category.name == 'Enlaces':
+ return True
+ else:
+ return self._is_link(category.parent_id)
+
+ def _is_pack(self, category):
+ if not category:
+ return False
+ if category.name == 'Packs':
+ return True
+ else:
+ return self._is_pack(category.parent_id)
+
+ def _is_shipping_cost(self, category):
+ if not category:
+ return False
+ if category.name == 'Gastos de Envío' or category.id == 4:
+ return True
+ else:
+ return self._is_shipping_cost(category.parent_id)
+
+
+class ProductTemplate(orm.Model):
_inherit = 'product.template'
+
_columns = {
'property_stock_finished_product': fields.property(
'stock.location',
@@ -100,9 +92,10 @@
string="Finished Product Location",
method=True,
view_load=True,
- domain=[('usage','like','internal')],
- help="For the current product, this stock location will be used, instead of the default one, as the location of origin of products whose manufacture has been completed"),
-
+ domain=[('usage', 'like', 'internal')],
+ help="For the current product, this stock location will be used, "
+ "instead of the default one, as the location of origin of products"
+ " whose manufacture has been completed"),
'property_stock_consumer_product': fields.property(
'stock.location',
type='many2one',
@@ -110,21 +103,20 @@
string="Consumer Product Location",
method=True,
view_load=True,
- domain=[('usage','like','internal')],
- help="For the current product, this stock location will be used, instead of the default one, as the source location for consumption of the product"),
-
- 'unitary_prod_order': fields.boolean('Unitary production order', help="If the unitary production order field is set to True, it will generate production orders from unit to unit."),
- 'discount': fields.float('Discount', digits=(2,2), help="Discount applies if the product is rented."),
- }
-
- _defaults = {
- 'unitary_prod_order': False,
- 'discount': 0,
- }
-
-product_template()
-
-
-
-
-
+ domain=[('usage', 'like', 'internal')],
+ help="For the current product, this stock location will be used, "
+ "instead of the default one, as the source location for "
+ "consumption of the product"),
+ 'unitary_prod_order': fields.boolean('Unitary production order',
+ help="If the unitary production "
+ "order field is set to True, it "
+ "will generate production orders "
+ "from unit to unit."),
+ 'discount': fields.float('Discount', digits=(2, 2),
+ help="Discount applies if the product is "
+ "rented."),
+ }
+ _defaults = {
+ 'unitary_prod_order': False,
+ 'discount': 0,
+ }
=== added directory 'dos_product_additional_info/views'
=== renamed file 'dos_product_additional_info/product_view.xml' => 'dos_product_additional_info/views/product_view.xml'
Follow ups