1. zikzakmedia
  2. trytond-stock_valued_report

Commits

Raimon Esteve (Zikzakmedia)  committed 45cfcb1

Add Delivery Note Valued ODT + DeliveryValued Shipment class

  • Participants
  • Parent commits f6973c8
  • Branches default

Comments (0)

Files changed (5)

File __init__.py

View file
 #This file is part of Tryton. The COPYRIGHT file at the top level of
 #this repository contains the full copyright notices and license terms.
+
+from .shipment import *

File delivery_note.odt

Binary file removed.

File delivery_note_valued.odt

Binary file added.

File shipment.py

View file
+#This file is part of Tryton.  The COPYRIGHT file at the top level of
+#this repository contains the full copyright notices and license terms.
+
+from trytond.transaction import Transaction
+from trytond.pool import Pool
+from trytond.modules.company import CompanyReport
+
+class DeliveryValued(CompanyReport):
+    _name = 'stock.shipment.out.delivery_valued'
+
+    def parse(self, report, objects, datas, localcontext):
+        localcontext['product_name'] = lambda product_id, language: \
+                self.product_name(product_id, language)
+        return super(DeliveryValued, self).parse(report, objects, datas,
+                localcontext)
+
+    def product_name(self, product_id, language):
+        product_obj = Pool().get('product.product')
+        with Transaction().set_context(language=language):
+            return product_obj.browse(product_id).rec_name
+
+DeliveryValued()

File shipment.xml

View file
 this repository contains the full copyright notices and license terms. -->
 <tryton>
     <data>
-        <record model="ir.action.report" id="report_shipment_out_delivery_note_valued">
+        <record model="ir.action.report" id="report_shipment_out_delivery_valued">
             <field name="name">Delivery Note Valued</field>
             <field name="model">stock.shipment.out</field>
-            <field name="report_name">stock.shipment.out.delivery_note_valued</field>
-            <field name="report">stock_valued_report/delivery_note.odt</field>
+            <field name="report_name">stock.shipment.out.delivery_valued</field>
+            <field name="report">stock_valued_report/delivery_note_valued.odt</field>
             <field name="style">company/header_A4.odt</field>
         </record>
-        <record model="ir.action.keyword" id="report_shipment_out_delivery_note_valued_keyword">
+        <record model="ir.action.keyword" id="report_shipment_out_delivery_valued_keyword">
             <field name="keyword">form_print</field>
             <field name="model">stock.shipment.out,-1</field>
-            <field name="action" ref="report_shipment_out_delivery_note_valued"/>
+            <field name="action" ref="report_shipment_out_delivery_valued"/>
         </record>
     </data>
 </tryton>