[tryton-dev] PATCH: account_invoice_history: Reset open_date when going back to draft (issue 764002)
Reviewers: , Please review this at http://codereview.tryton.org/764002/ Affected files: M invoice.py Index: invoice.py === --- a/invoice.py +++ b/invoice.py @@ -2,7 +2,7 @@ #this repository contains the full copyright notices and license terms. import datetime -from trytond.model import fields +from trytond.model import ModelView, Workflow, fields from trytond.pool import PoolMeta __all__ = ['Invoice'] @@ -35,6 +35,15 @@ }) @classmethod +@ModelView.button +@Workflow.transition('draft') +def draft(cls, invoices): +super(Invoice, cls).draft(invoices) +cls.write(invoices, { +'open_date': None, +}) + +@classmethod def copy(cls, invoices, default=None): if default is None: default = {}
[tryton-dev] PATCH: sale_supply: Ensure to process sale only once (issue 763002)
Reviewers: , Please review this at http://codereview.tryton.org/763002/ Affected files: M purchase.py Index: purchase.py === --- a/purchase.py +++ b/purchase.py @@ -30,8 +30,8 @@ SaleLine = pool.get('sale.line') cursor = Transaction().cursor -sale_ids = [r.origin.id for r in requests -if isinstance(r.origin, Sale)] +sale_ids = list(set(r.origin.id for r in requests +if isinstance(r.origin, Sale))) with Transaction().set_user(0, set_context=True): sale_lines = [] @@ -74,7 +74,7 @@ requests = list(chain(*requests)) if requests: -sale_ids = [req.origin.id for req in requests] +sale_ids = list(set(req.origin.id for req in requests)) with Transaction().set_user(0, set_context=True): Sale.process(Sale.browse(sale_ids))
Re: [tryton-dev] Financial analysis
* Cédric Krier [31.03 14:16]: > On 29/03/13 17:42 +0100, Marco Huymajer wrote: > > As it is easier to discuss the subject with some actual implementation in > > mind, I have created a blueprint with the models and some examples: > > > > http://code.google.com/p/tryton/wiki/FinancialAnalysis > > I have the feeling it goes to the wrong direction. > Here are the things that gives me this feeling: > > - having Python expression in the database, this should always avoid > as much as possible. > - thinking that users will fill such Models, it is far too much > complicate. > > I think most of the concept are already in Tryton or should just be > added to account. > I think it is better to just define the few function fields on a > Singleton that make the computation. > So for me, the blueprint should just collect those fields definition and > how they should be computed in Tryton. It seems that the proposed solution is to complex and agreeing upon a basic set of financial ratios and indicators and hard-coding them in Python seems the preferable way to go. I have changed the blueprint accordingly. The old version can still be found here: http://code.google.com/p/tryton/source/browse/FinancialAnalysis.wiki?spec=svn.wiki.6789f7a2da58f7e6c88ccebfa691f2025d5042f8&repo=wiki&r=02bc7b55adcdfe6af201e083e5eb67a69e82a1a1 Marco
Re: [tryton-dev] Questions about sale and purchase checks for account in get_invoice_line()
On 05/04/13 15:53 +0200, Udo Spallek wrote: > Fri, 5 Apr 2013 14:40:42 +0200 > Cédric Krier : > > >On 05/04/13 13:58 +0200, Udo Spallek wrote: > >> It is hard to extend the > >> get_invoice_line() method when you want to introduce an alternative > >> conception, like account_product_rule[3] does. > >Don't really understand the module but I don't see any modular > >difficulties in this code. It uses function fields that can be > >extended. > > So, when I want to deactivate the check, the way to go > would be to overwrite the function fields e.g. supplier_taxes_used[1] > getter[2] to always return true, like this: > > class Template: > __name__ = 'product.template' > > def get_account(self, name): > return True > > With this getter I can short-cut the check in [3]. > > Is it the proposed way to deactivate this kind function > field and the checks you meant with? No, just returns the right account. -- 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/ pgp4mJTTlQgDj.pgp Description: PGP signature
Re: [tryton-dev] Questions about sale and purchase checks for account in get_invoice_line()
Fri, 5 Apr 2013 14:40:42 +0200 Cédric Krier : >On 05/04/13 13:58 +0200, Udo Spallek wrote: >> It is hard to extend the >> get_invoice_line() method when you want to introduce an alternative >> conception, like account_product_rule[3] does. >Don't really understand the module but I don't see any modular >difficulties in this code. It uses function fields that can be >extended. So, when I want to deactivate the check, the way to go would be to overwrite the function fields e.g. supplier_taxes_used[1] getter[2] to always return true, like this: class Template: __name__ = 'product.template' def get_account(self, name): return True With this getter I can short-cut the check in [3]. Is it the proposed way to deactivate this kind function field and the checks you meant with? > It uses function fields that can be extended. TIA and regards Udo [1]http://hg.tryton.org/modules/account_product/file/95b9737d01dc/product.py#l185 [2]http://hg.tryton.org/modules/account_product/file/95b9737d01dc/product.py#l232 [3]http://hg.tryton.org/modules/purchase/file/38bca07037aa/purchase.py#l1156 -- _ virtual things Preisler & Spallek GbR München - Aachen Windeckstr. 77 81375 München Tel: +49 (89) 710 481 55 Fax: +49 (89) 710 481 56 i...@virtual-things.biz http://www.virtual-things.biz signature.asc Description: PGP signature
Re: [tryton-dev] Sale, Purchase and Invoice: do we mix-up domains and responsibilities?
On 05/04/13 15:02 +0200, Udo Spallek wrote: > Fri, 5 Apr 2013 14:44:12 +0200 > Cédric Krier : > >On 05/04/13 14:18 +0200, Udo Spallek wrote: > >> The revenue/expense accounts should become required on invoices which > >> are checked to 'open'. These accounts are IMHO not required on draft > >> invoices. > >> * Is there a technical or functional reason for the constraint? > >Data Integrity. > >User experience, it is always bad to have a popup that says "one of > >your many lines miss an account". > > Yes understand. But is'nt it for now a worse usability? Having on > sale and purchase 'a popup that says "one of your many lines miss an > account".'. It is a complete different business domain than accounting. > On sale/purchase you can not even set an account (not that I would like > to have this possibility...). This is a configuration mistake. Normally it is not possible to create a product for sale or purchase that doesn't have the right accounts defined (except when it is on category but it could also be checked). So in some way, it is good that the system prevents starting to sale a product that is not correctly defined. Imaging that you start to sale a product not configured (I mean that accountant did not defined the taxes, accounts etc.), and during the all month salemen sale it and generate a lot of invoices without any account. So at the end of the month when the invoices are validated by the accountant, they only discover the missing configuration and they must go through all the invoices to set the account on all the lines. > >> * Is it an idea to allow draft invoices with lines without > >> revenue/expense accounts? > >> (move the constraint to state != draft, cancel) > >I don't understand what could be a invoice line without an account. > > It is a draft invoice line, of course. > > A salesman usually does not know which taxes and accounts are used. Agree that in some way taxes on sale line could be just readonly but it is important that they are shown to allow the salemen to talk about it to the buyer. For example, if the buyer consider that he must have a different taxes at least there are information to talk about and the salemen could ask to accountant to fix it before the sale. For account, it is less important so it is not shown. > Sometimes he can not know. On purchase the same. A buyer can not > determine correctly taxes and accounts before he has the supplier > invoice in his hands. I don't agree. The buyer will know from the supplier which taxes will be applied and then he can correct it if he can. And as for sale, by having the information he could fix it earlier with the supplier. > Finally it is always the accountant who is responsible to check > draft invoices for the correct accounts before opening the invoice. > And an accountant should know what to do, when the exception > "one of your many lines miss an account" pops up. But accountant will expect that the system will generate invoices with correct accounts for all major cases and not to have to manually on each invoice lines set the account. -- 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/ pgpRrcHYENUYx.pgp Description: PGP signature
Re: [tryton-dev] Sale, Purchase and Invoice: do we mix-up domains and responsibilities?
Hi, thanks for your answer. Fri, 5 Apr 2013 14:44:12 +0200 Cédric Krier : >On 05/04/13 14:18 +0200, Udo Spallek wrote: >> The revenue/expense accounts should become required on invoices which >> are checked to 'open'. These accounts are IMHO not required on draft >> invoices. >> * Is there a technical or functional reason for the constraint? >Data Integrity. >User experience, it is always bad to have a popup that says "one of >your many lines miss an account". Yes understand. But is'nt it for now a worse usability? Having on sale and purchase 'a popup that says "one of your many lines miss an account".'. It is a complete different business domain than accounting. On sale/purchase you can not even set an account (not that I would like to have this possibility...). >> * Is it an idea to allow draft invoices with lines without >> revenue/expense accounts? >> (move the constraint to state != draft, cancel) >I don't understand what could be a invoice line without an account. It is a draft invoice line, of course. A salesman usually does not know which taxes and accounts are used. Sometimes he can not know. On purchase the same. A buyer can not determine correctly taxes and accounts before he has the supplier invoice in his hands. Finally it is always the accountant who is responsible to check draft invoices for the correct accounts before opening the invoice. And an accountant should know what to do, when the exception "one of your many lines miss an account" pops up. Regards Udo -- _ virtual things Preisler & Spallek GbR München - Aachen Windeckstr. 77 81375 München Tel: +49 (89) 710 481 55 Fax: +49 (89) 710 481 56 i...@virtual-things.biz http://www.virtual-things.biz signature.asc Description: PGP signature
[tryton-dev] tryton: Hide search box on focus-out (issue 762002)
Reviewers: , Description: tryton: Hide search box on focus-out Please review this at http://codereview.tryton.org/762002/ Affected files: M tryton/gui/window/view_form/view/screen_container.py Index: tryton/gui/window/view_form/view/screen_container.py === --- a/tryton/gui/window/view_form/view/screen_container.py +++ b/tryton/gui/window/view_form/view/screen_container.py @@ -398,6 +398,10 @@ button.set_active(False) window.hide() +def focus_out(window, event): +button.set_active(False) +window.hide() + def search(): button.set_active(False) self.search_window.hide() @@ -431,6 +435,7 @@ if hasattr(self.search_window, 'set_deletable'): self.search_window.set_deletable(False) self.search_window.connect('key-press-event', key_press) +self.search_window.connect('focus-out-event', focus_out) vbox = gtk.VBox() fields = [f for f in self.screen.domain_parser.fields.itervalues() if f.get('searchable', True)]
Re: [tryton-dev] Sale, Purchase and Invoice: do we mix-up domains and responsibilities?
On 05/04/13 14:18 +0200, Udo Spallek wrote: > The revenue/expense accounts should become required on invoices which > are checked to 'open'. These accounts are IMHO not required on draft > invoices. > > * Is there a technical or functional reason for the constraint? Data Integrity. User experience, it is always bad to have a popup that says "one of your many lines miss an account". > * Is it an idea to allow draft invoices with lines without > revenue/expense accounts? > (move the constraint to state != draft, cancel) I don't understand what could be a invoice line without an account. -- 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/ pgppJElTJ8yT1.pgp Description: PGP signature
Re: [tryton-dev] Questions about sale and purchase checks for account in get_invoice_line()
On 05/04/13 13:58 +0200, Udo Spallek wrote: > on sale[1] and purchase[2] there are checks in get_invoice_line() > for account_revenue and account_expense. I don't really see check except that it gives a better error message than the account required on invoice line. > It is hard to extend the > get_invoice_line() method when you want to introduce an alternative > conception, like account_product_rule[3] does. Don't really understand the module but I don't see any modular difficulties in this code. It uses function fields that can be extended. -- 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/ pgpo9AQDv59Ob.pgp Description: PGP signature
[tryton-dev] Sale, Purchase and Invoice: do we mix-up domains and responsibilities?
Hello, on invoice we have a constraint[1] which restricts the creation of draft invoices with lines of type product without a given revenue/expense account. When the sales men and the accountant are the same person, and there are only some sales/purchases to handle, I understand some usefulness of the constraint. But this constraint moves problems from the accounting domain into the sale or purchase domain. Blocking sale or purchase orders because of missing information for the accounting domain is IMHO an issue. The revenue/expense account has neither a function nor a meaning on sales or purchase. The revenue/expense accounts should become required on invoices which are checked to 'open'. These accounts are IMHO not required on draft invoices. * Is there a technical or functional reason for the constraint? * Is it an idea to allow draft invoices with lines without revenue/expense accounts? (move the constraint to state != draft, cancel) [1] http://hg.tryton.org/modules/account_invoice/file/4d3e00bb65ca/invoice.py#l1534 Regards Udo Spallek -- _ virtual things Preisler & Spallek GbR München - Aachen Windeckstr. 77 81375 München Tel: +49 (89) 710 481 55 Fax: +49 (89) 710 481 56 i...@virtual-things.biz http://www.virtual-things.biz
[tryton-dev] Questions about sale and purchase checks for account in get_invoice_line()
Hi, on sale[1] and purchase[2] there are checks in get_invoice_line() for account_revenue and account_expense. It is hard to extend the get_invoice_line() method when you want to introduce an alternative conception, like account_product_rule[3] does. Is a patch welcome which factors out these checks? Regards Udo [1] http://hg.tryton.org/modules/sale/file/8a0414095b30/sale.py#l1250 [2] http://hg.tryton.org/modules/purchase/file/38bca07037aa/purchase.py#l1156 [3] https://bitbucket.org/ukoma/account_product_rule/ -- _ virtual things Preisler & Spallek GbR München - Aachen Windeckstr. 77 81375 München Tel: +49 (89) 710 481 55 Fax: +49 (89) 710 481 56 i...@virtual-things.biz http://www.virtual-things.biz
Re: [tryton-dev] Default focus in a form view
2013/4/5 Cédric Krier : > On 05/04/13 12:45 +0200, Raimon Esteve wrote: >> Hello, >> >> In XML, default focus is available? (in OpenERP is default_focus="1": >> cursor in specific field when open a form view) > > See cursor on > http://doc.tryton.org/2.6/trytond/doc/topics/views/index.html#form I searched by "focus" :( Thanks -- Si us plau, NO adjunti arxius a les seves respostes. Li preguem que integri el text al cos del missatge. Pot respondre usant NetEtiquete que li ajudarà a seguir la conversa. http://es.wikipedia.org/wiki/Netiquette Por favor, NO adjunte archivos a sus respuestas. Le rogamos que integre el texto en el cuerpo del mensaje. Puede responder usando NetEtiquete que le ayudará a seguir la conversación.http://es.wikipedia.org/wiki/Netiquette Please, DO NOT send attachment files with your answers, just copy and paste only the text you need to send into the body of your mails. Repply using NetEtiquete. http://en.wikipedia.org/wiki/Netiquette Raimon Esteve // Tryton - OpenERP - Django // Doc OpenERP: http://openerp.zikzakmedia.com // Doc Tryton: http://tryton.zikzakmedia.com www.zikzakmedia.com
Re: [tryton-dev] Default focus in a form view
On 05/04/13 12:45 +0200, Raimon Esteve wrote: > Hello, > > In XML, default focus is available? (in OpenERP is default_focus="1": > cursor in specific field when open a form view) See cursor on http://doc.tryton.org/2.6/trytond/doc/topics/views/index.html#form > -- > Si us plau, NO adjunti arxius a les seves respostes. Li preguem que > integri el text al cos del missatge. Pot respondre usant NetEtiquete > que li ajudarà a seguir la conversa. > http://es.wikipedia.org/wiki/Netiquette > > Por favor, NO adjunte archivos a sus respuestas. Le rogamos que > integre el texto en el cuerpo del mensaje. Puede responder usando > NetEtiquete que le ayudará a seguir la > conversación.http://es.wikipedia.org/wiki/Netiquette > > Please, DO NOT send attachment files with your answers, just copy and > paste only the text you need to send into the body of your mails. > Repply using NetEtiquete. http://en.wikipedia.org/wiki/Netiquette > > Raimon Esteve > // Tryton - OpenERP - Django > // Doc OpenERP: http://openerp.zikzakmedia.com > // Doc Tryton: http://tryton.zikzakmedia.com > www.zikzakmedia.com FYI netiquette suggest signature size about 4 or 5, 6 lines: http://linux.sgms-centre.com/misc/netiquette.php#sigs -- 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/ pgpcJovz3WN7W.pgp Description: PGP signature
[tryton-dev] Default focus in a form view
Hello, In XML, default focus is available? (in OpenERP is default_focus="1": cursor in specific field when open a form view) Thanks -- Si us plau, NO adjunti arxius a les seves respostes. Li preguem que integri el text al cos del missatge. Pot respondre usant NetEtiquete que li ajudarà a seguir la conversa. http://es.wikipedia.org/wiki/Netiquette Por favor, NO adjunte archivos a sus respuestas. Le rogamos que integre el texto en el cuerpo del mensaje. Puede responder usando NetEtiquete que le ayudará a seguir la conversación.http://es.wikipedia.org/wiki/Netiquette Please, DO NOT send attachment files with your answers, just copy and paste only the text you need to send into the body of your mails. Repply using NetEtiquete. http://en.wikipedia.org/wiki/Netiquette Raimon Esteve // Tryton - OpenERP - Django // Doc OpenERP: http://openerp.zikzakmedia.com // Doc Tryton: http://tryton.zikzakmedia.com www.zikzakmedia.com