[tryton-dev] account_invoice: Add default database language code (issue198002)
Reviewers: , Please review this at http://codereview.tryton.org/198002/ Affected files: M invoice.py Index: invoice.py === --- a/invoice.py +++ b/invoice.py @@ -11,6 +11,7 @@ from trytond.tools import reduce_ids from trytond.transaction import Transaction from trytond.pool import Pool +from trytond.config import CONFIG _STATES = { 'readonly': Eval('state') != 'draft', @@ -337,7 +338,7 @@ party = party_obj.browse(vals['party']) if party.lang: return party.lang.code -return 'en_US' +return CONFIG['language'] def get_party_language(self, ids, name): ''' @@ -353,7 +354,7 @@ if invoice.party.lang: res[invoice.id] = invoice.party.lang.code else: -res[invoice.id] = 'en_US' +res[invoice.id] = CONFIG['language'] return res def get_type_name(self, ids, name): @@ -1461,7 +1462,7 @@ party = party_obj.browse(vals['party']) if party.lang: return party.lang.code -return 'en_US' +return CONFIG['language'] def get_party_language(self, ids, name): ''' @@ -1477,7 +1478,7 @@ if line.party and line.party.lang: res[line.id] = line.party.lang.code else: -res[line.id] = 'en_US' +res[line.id] = CONFIG['language'] return res def on_change_with_amount(self, vals): -- tryton-dev@googlegroups.com mailing list
[tryton-dev] account_statement: Add default database language code (issue201001)
Reviewers: , Please review this at http://codereview.tryton.org/201001/ Affected files: M statement.py Index: statement.py === --- a/statement.py +++ b/statement.py @@ -148,13 +148,10 @@ if not ids: return {} -for code in [Transaction().language, 'en_US']: -lang_ids = lang_obj.search([ -('code', '=', code), +lang_id, = lang_obj.search([ +('code', '=', Transaction().language), ]) -if lang_ids: -break -lang = lang_obj.browse(lang_ids[0]) +lang = lang_obj.browse(lang_id) res = {} for statement in self.browse(ids): @@ -266,13 +263,10 @@ for line in statement.lines: computed_end_balance += line.amount if computed_end_balance != statement.end_balance: -for code in [Transaction().language, 'en_US']: -lang_ids = lang_obj.search([ -('code', '=', code), +lang_id, = lang_obj.search([ +('code', '=', Transaction().language), ]) -if lang_ids: -break -lang = lang_obj.browse(lang_ids[0]) +lang = lang_obj.browse(lang_id) amount = lang_obj.format(lang, '%.' + str(statement.journal.currency.digits) + 'f', @@ -462,13 +456,10 @@ line.invoice.amount_to_pay, line.statement.journal.currency.id) if amount_to_pay abs(line.amount): -for code in [Transaction().language, 'en_US']: -lang_ids = lang_obj.search([ -('code', '=', code), +lang_id, = lang_obj.search([ +('code', '=', Transaction().language), ]) -if lang_ids: -break -lang = lang_obj.browse(lang_ids[0]) +lang = lang_obj.browse(lang_id) amount = lang_obj.format(lang, '%.' + str(line.statement.journal.currency.digits) + 'f', -- tryton-dev@googlegroups.com mailing list
[tryton-dev] currency: Add default database language code (issue199002)
Reviewers: , Please review this at http://codereview.tryton.org/199002/ Affected files: M currency.py Index: currency.py === --- a/currency.py +++ b/currency.py @@ -204,13 +204,10 @@ else: name = to_currency.name -for code in [Transaction().language, 'en_US']: -lang_ids = lang_obj.search([ -('code', '=', code), +lang_id, = lang_obj.search([ +('code', '=', Transaction().language), ]) -if lang_ids: -break -lang = lang_obj.browse(lang_ids[0]) +lang = lang_obj.browse(lang_id) self.raise_user_error('no_rate', (name, datetime_strftime(date, str(lang.date -- tryton-dev@googlegroups.com mailing list
[tryton-dev] sale: Add default database language code (issue198003)
Reviewers: , Please review this at http://codereview.tryton.org/198003/ Affected files: M sale.py Index: sale.py === --- a/sale.py +++ b/sale.py @@ -12,6 +12,7 @@ from trytond.pyson import If, Eval, Bool, PYSONEncoder from trytond.transaction import Transaction from trytond.pool import Pool +from trytond.config import CONFIG class Sale(ModelWorkflow, ModelSQL, ModelView): @@ -316,7 +317,7 @@ party = party_obj.browse(vals['party']) if party.lang: return party.lang.code -return 'en_US' +return CONFIG['language'] def get_party_lang(self, sales): ''' @@ -331,7 +332,7 @@ if sale.party.lang: res[sale.id] = sale.party.lang.code else: -res[sale.id] = 'en_US' +res[sale.id] = CONFIG['language'] return res -- tryton-dev@googlegroups.com mailing list
[tryton-dev] trytond: Fix str convertion of buffer if False for issue2335 (issue198005)
Reviewers: , Please review this at http://codereview.tryton.org/198005/ Affected files: M trytond/report/report.py Index: trytond/report/report.py === --- a/trytond/report/report.py +++ b/trytond/report/report.py @@ -166,8 +166,10 @@ localcontext['setLang'] = lambda language: translate.set_language(language) # Convert to str as buffer from DB is not supported by StringIO -report_content = str(report.report_content) -style_content = str(report.style_content) +report_content = (str(report.report_content) if report.report_content +else False) +style_content = (str(report.style_content) if report.style_content +else False) if not report_content: raise Exception('Error', 'Missing report file!') -- tryton-dev@googlegroups.com mailing list
[tryton-dev] trytond: Add missing converter to get_style_content of ir.action.report (issue203001)
Reviewers: , Please review this at http://codereview.tryton.org/203001/ Affected files: M trytond/ir/action.py Index: trytond/ir/action.py === --- a/trytond/ir/action.py +++ b/trytond/ir/action.py @@ -425,6 +425,12 @@ def get_style_content(self, ids, name): res = {} +converter = buffer +default = False +format_ = Transaction().context.pop('%s.%s' % (self._name, name), '') +if format_ == 'size': +converter = len +default = 0 for report in self.browse(ids): try: with file_open( report.style.replace('/', os.sep), @@ -432,7 +438,7 @@ data = fp.read() except Exception: data = False -res[report.id] = data +res[report.id] = converter(data) if data else default return res def get_pyson(self, ids, name): -- tryton-dev@googlegroups.com mailing list
[tryton] proteus import
I'm trying to import a list of products, and I having trouble saving product cost_price I see it's stored in ir_property table but I cannot save it as product.cost_price, how it most be done? My saving fuction... def append_product(name, code, st_cat,cost_price): Product = Model.get('product.product') product = Product() #using unit as default uom uom = Model.get('product.uom') (um,) = uom.find([('name', '=', 'Unit')]) product.default_uom = um product.active = True product.account_category = True product.taxes_category = True product.purchasable = True product.salable = True product.code = '%s' %code product.name = '%s' %name #searching category cat = Model.get('product.category') (ca,) = cat.find([('name', '=', st_cat)]) product.category = ca product.save() -- tryton@googlegroups.com mailing list
[tryton] Can't start tryton server - novice
New to Tryton and ubuntu. I have installed tryton server and client and on running trytond it gives the following error Traceback (most recent call last): File /usr/bin/trytond, line 30, in module trytond.server.TrytonServer().run() TypeError: __init__() takes exactly 2 arguments (1 given) When i used the following command tryton -c bin/trytond the error received was IOError: [Errno 13] Permission denied: '/home/gnuhealth/.config/tryton/ 2.2/known_hosts' Can please someone help Thanks PJ -- tryton@googlegroups.com mailing list
Re: [tryton] confius about my_module.my_report
Am 07.12.2011 17:05, schrieb pjalrimba rimbabara: Can anybody explain to me what is my_module.my_report . record model=ir.action.report id=report_invoice_new field name=nameInvoice/field field name=report_nameaccount.invoice/field field name=modelaccount.invoice/field field name=reportmy_module/my_report/field field name=stylemodule_name/header_A4.odt/field /record report_name: The name of the report model, for example my_module.my_report. This is the name you would use with pool.get This means: class Report(Report): _name='*reportname*' so you can do a self.pool.get('*reportname*') Jan -- tryton@googlegroups.com mailing list
Re: [tryton] proteus import
* Mariano DAngelo [2011-12-08 04:56 +0100]: Hello, I'm trying to import a list of products, and I having trouble saving product cost_price I see it's stored in ir_property table but I cannot save it as product.cost_price, how it most be done? You must assign to product.cost_price a decimal value (not a float). def append_product(name, code, st_cat,cost_price): Product = Model.get('product.product') product = Product() #using unit as default uom uom = Model.get('product.uom') (um,) = uom.find([('name', '=', 'Unit')]) product.default_uom = um product.active = True product.account_category = True product.taxes_category = True product.purchasable = True product.salable = True product.code = '%s' %code product.name = '%s' %name #searching category cat = Model.get('product.category') (ca,) = cat.find([('name', '=', st_cat)]) product.category = ca product.save() There is no assignation to product.cost_price is it normal ? -- Nicolas Évrard B2CK SPRL rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 E-mail/Jabber: nicolas.evr...@b2ck.com Website: http://www.b2ck.com/ -- tryton@googlegroups.com mailing list
Re: [tryton] Can't start tryton server - novice
On 08/12/11 00:36 -0800, PJ wrote: New to Tryton and ubuntu. I have installed tryton server and client and on running trytond it gives the following error Traceback (most recent call last): File /usr/bin/trytond, line 30, in module trytond.server.TrytonServer().run() TypeError: __init__() takes exactly 2 arguments (1 given) I think you mixed installation of different versions of the server. Perhaps one from Ubuntu package installer and one from PyPI? -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: cedric.kr...@b2ck.com Website: http://www.b2ck.com/ pgpUuRRcvizVH.pgp Description: PGP signature
Re: [tryton] Can't start tryton server - novice
I appreciate your response. I had uninstalled two installations of the server as you mentioned and reinstalled it using pip install --user tryton_health_profile pip install --user tryton that installed the server and client in ./local/ folder so now when i run the command tryton -c trytond gnuhealth@ubuntu:~$ tryton -c trytond (tryton:4308): Gtk-WARNING **: Unable to locate theme engine in module_path: pixmap, (tryton:4308): Gtk-WARNING **: Unable to locate theme engine in module_path: pixmap, (tryton:4308): Gtk-WARNING **: Unable to locate theme engine in module_path: pixmap, (tryton:4308): Gtk-WARNING **: Unable to locate theme engine in module_path: pixmap, Traceback (most recent call last): File /usr/bin/tryton, line 37, in module import tryton File /home/gnuhealth/.local/lib/python2.7/site-packages/tryton/__init__.py, line 3, in module import client File /home/gnuhealth/.local/lib/python2.7/site-packages/tryton/client.py, line 19, in module import tryton.common as common File /home/gnuhealth/.local/lib/python2.7/site-packages/tryton/common/__init__.py, line 3, in module from common import * File /home/gnuhealth/.local/lib/python2.7/site-packages/tryton/common/common.py, line 25, in module import tryton.rpc as rpc File /home/gnuhealth/.local/lib/python2.7/site-packages/tryton/rpc.py, line 31, in module _FINGERPRINTS = Fingerprints() File /home/gnuhealth/.local/lib/python2.7/site-packages/tryton/fingerprints.py, line 13, in __init__ self.load() File /home/gnuhealth/.local/lib/python2.7/site-packages/tryton/fingerprints.py, line 25, in load self[host] = sha1 File /home/gnuhealth/.local/lib/python2.7/site-packages/tryton/fingerprints.py, line 40, in __setitem__ self.save() File /home/gnuhealth/.local/lib/python2.7/site-packages/tryton/fingerprints.py, line 29, in save with open(KNOWN_HOSTS_PATH, 'w') as known_hosts: IOError: [Errno 13] Permission denied: '/home/gnuhealth/.config/tryton/2.2/known_hosts' Should i uninstall everything again and reinstall in a particular way. I have not changed anything in known_hosts and tryton.conf file. On Thu, Dec 8, 2011 at 4:04 AM, Cédric Krier cedric.kr...@b2ck.com wrote: On 08/12/11 00:36 -0800, PJ wrote: New to Tryton and ubuntu. I have installed tryton server and client and on running trytond it gives the following error Traceback (most recent call last): File /usr/bin/trytond, line 30, in module trytond.server.TrytonServer().run() TypeError: __init__() takes exactly 2 arguments (1 given) I think you mixed installation of different versions of the server. Perhaps one from Ubuntu package installer and one from PyPI? -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: cedric.kr...@b2ck.com Website: http://www.b2ck.com/ -- tryton@googlegroups.com mailing list
[tryton] remove module
How to remove module -- tryton@googlegroups.com mailing list
Re: [tryton] remove module
On 08/12/11 07:48 -0800, pjalrimba rimbabara wrote: How to remove module Not possible for now see https://bugs.tryton.org/issue322 -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: cedric.kr...@b2ck.com Website: http://www.b2ck.com/ pgp2eRvQMLPHh.pgp Description: PGP signature
[tryton] Update Tryton in Ubuntu Repository to 1.4.2 - Novice
Colleagues Ubuntu's software repository contains Tryton version 2.0. How can I update the repository to reflect the current version 1.4.2 Grateful for your support. Regards, Pierre -- tryton@googlegroups.com mailing list