Source

trytond-stock_valued_report / shipment.py

Diff from to

shipment.py

 from trytond.pool import Pool
 from trytond.modules.company import CompanyReport
 
+__all__ = ['DeliveryValued']
+
 class DeliveryValued(CompanyReport):
-    _name = 'stock.shipment.out.delivery_valued'
+    'Stock Delivery Report Valued'
+    __name__ = 'stock.shipment.out.delivery_valued'
 
-    def parse(self, report, objects, datas, localcontext):
+    @classmethod
+    def parse(cls, report, objects, data, localcontext):
         localcontext['product_name'] = lambda product_id, language: \
-                self.product_name(product_id, language)
-        return super(DeliveryValued, self).parse(report, objects, datas,
+                cls.product_name(product_id, language)
+        return super(DeliveryValued, cls).parse(report, objects, data,
                 localcontext)
 
-    def product_name(self, product_id, language):
-        product_obj = Pool().get('product.product')
+    @classmethod
+    def product_name(cls, product_id, language):
+        Product = Pool().get('product.product')
         with Transaction().set_context(language=language):
-            return product_obj.browse(product_id).rec_name
-
-DeliveryValued()
+            return Product(product_id).rec_name
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.