Active Record

This commit is contained in:
resteve 2012-10-18 15:16:30 +02:00
parent 874736c3a2
commit eaaaa494b3
7 changed files with 49 additions and 62 deletions

View File

@ -1,3 +1,7 @@
Version 2.6.0 - 2012-10-16
* Active Record
* Simplify module information with python configuration
Version 2.4.0 - 2012-07-17
* Initial release

1
README
View File

@ -2,7 +2,6 @@ trytond_stock_valued_report
===========================
Add delivery note report valued on shipment out of Tryton.
See __tryton__.py
Installing
----------

View File

@ -1,5 +1,11 @@
#This file is part stock_valued_report module for Tryton.
#The COPYRIGHT file at the top level of this repository contains
#the full copyright notices and license terms.
from trytond.pool import Pool
from .shipment import *
def register():
Pool.register(
DeliveryValued,
module='stock_valued_report', type_='report')

View File

@ -1,43 +0,0 @@
#This file is part stock_valued_report module for Tryton.
#The COPYRIGHT file at the top level of this repository contains
#the full copyright notices and license terms.
{
'name': 'Stock Valued Report',
'name_ca_ES': 'Informe alabarans valorats',
'name_es_ES': 'Informe albaranes valorados',
'version': '2.4.0',
'author': 'Zikzakmedia',
'email': 'zikzak@zikzakmedia.com',
'website': 'http://www.zikzakmedia.com/',
'description': '''Report Stock Valued.
In Delivery Note Report, you can add group permisions:
- Stock
- Stock Price
''',
'description_ca_ES': '''Informe albarans valorats.
A la configuració del informe Albarà d'entrega', pot afegir els grups:
- Estoc
- Preus estoc
''',
'description_es_ES': '''Informe albaranes valorados.
A la configuración del informe Albarán de entrega, puede añadir los grupos:
- Stock
- Precios stock
''',
'depends': [
'company',
'stock',
'stock_valued',
'res',
'ir',
'currency',
'product',
],
'xml': [
'shipment.xml',
],
'translation': [
'locale/ca_ES.po',
'locale/es_ES.po',
],
}

View File

@ -5,8 +5,15 @@
from setuptools import setup
import re
import os
import ConfigParser
info = eval(open('__tryton__.py').read())
config = ConfigParser.ConfigParser()
config.readfp(open('tryton.cfg'))
info = dict(config.items('tryton'))
for key in ('depends', 'extras_depend', 'xml'):
if key in info:
info[key] = info[key].strip().splitlines()
major_version, minor_version, _ = info.get('version', '0.0.1').split('.', 2)
major_version = int(major_version)
minor_version = int(minor_version)
@ -22,10 +29,10 @@ requires.append('trytond >= %s.%s, < %s.%s' %
setup(name='trytond_stock_valued_report',
version=info.get('version', '0.0.1'),
description=info.get('description', ''),
author=info.get('author', ''),
author_email=info.get('email', ''),
url=info.get('website', ''),
description='Tryton module for stock valued discount report',
author='Zikzakmedia SL',
author_email='zikzak@zikzakmedia.com',
url='http://www.zikzakmedia.com',
download_url="https://bitbucket.org/zikzakmedia/trytond-stock_valued_report",
package_dir={'trytond.modules.stock_valued_report': '.'},
packages=[
@ -34,8 +41,7 @@ setup(name='trytond_stock_valued_report',
],
package_data={
'trytond.modules.stock_valued_report': info.get('xml', []) \
+ info.get('translation', []) \
+ ['delivery_note.odt',],
+ ['tryton.cfg', 'locale/*.po', '*.odt'],
},
classifiers=[
'Development Status :: 5 - Production/Stable',

View File

@ -6,18 +6,21 @@ 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'
__all__ = ['DeliveryValued']
def parse(self, report, objects, datas, localcontext):
class DeliveryValued(CompanyReport):
'Stock Delivery Report Valued'
__name__ = 'stock.shipment.out.delivery_valued'
@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

12
tryton.cfg Normal file
View File

@ -0,0 +1,12 @@
[tryton]
version=2.6.0
depends:
company
stock
stock_valued
res
ir
currency
product
xml:
shipment.xml