From 5587fae0a9b0735dbb48413c82e7d4edfd08a6da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 17 Oct 2011 18:43:28 +0200 Subject: [PATCH 01/20] Increase version number --- __tryton__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tryton__.py b/__tryton__.py index 842d9e7dc6..41179bfec7 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -6,7 +6,7 @@ 'name_de_DE': 'Verkauf Lieferposten Kosten', 'name_es_ES': 'Costo del método de envio', 'name_fr_FR': "Coût d'expédition de vente", - 'version' : '2.0.0', + 'version' : '2.0.1', 'author' : 'B2CK', 'email': 'info@b2ck.com', 'website': 'http://www.tryton.org/', From 20e1d0c78043678e80134d6cd07e29d26ab11e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 18 Oct 2011 10:53:50 +0200 Subject: [PATCH 02/20] Fix digits of cost field (transplanted from 057bf2d5d3e692c6c9cb0aebad7850b2931841c1) --- stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stock.py b/stock.py index 8a45de0b62..0f815bedb7 100644 --- a/stock.py +++ b/stock.py @@ -24,7 +24,7 @@ class ShipmentOut(ModelWorkflow, ModelSQL, ModelView): 'Cost Currency Digits', on_change_with=['currency']), 'get_cost_currency_digits') cost = fields.Numeric('Cost', - digits=(16, Eval('currency_digits', 2)), states={ + digits=(16, Eval('cost_currency_digits', 2)), states={ 'invisible': Not(Bool(Eval('carrier'))), 'readonly': Not(In(Eval('state'), ['draft', 'assigned', 'packed'])), From 0f1ffc2794657ad882c0fb7a4698528131319b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Fri, 28 Oct 2011 11:05:25 +0200 Subject: [PATCH 03/20] Use correct variable name (transplanted from a575944d73fabd08bc4243ad3e29d7be3c165c7c) --- stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stock.py b/stock.py index 0f815bedb7..6885be5f7f 100644 --- a/stock.py +++ b/stock.py @@ -90,7 +90,7 @@ class ShipmentOut(ModelWorkflow, ModelSQL, ModelView): currency_obj = self.pool.get('currency.currency') try: - result = super(ShipmentOut, self).on_change_lines(value) + result = super(ShipmentOut, self).on_change_lines(values) except AttributeError: result = {} carrier = carrier_obj.browse(values['carrier']) From e3e2233752a0763c1731713d542d193722bc91d1 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 26 Dec 2011 10:38:38 +0100 Subject: [PATCH 04/20] Prepare release 2.0.1 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 56d00297c6..661eb5a5e2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,2 +1,5 @@ +Version 2.0.1 - 2011-12-26 +* Bug fixes (see mercurial logs for details) + Version 2.0.0 - 2011-10-17 * Initial release From df92a97d7edf604b292a50790a6796d566cb3e1e Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 26 Dec 2011 10:38:38 +0100 Subject: [PATCH 05/20] Added tag 2.0.1 for changeset 0f6bb468c54f --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e7f4121982..cd5fb45e32 100644 --- a/.hgtags +++ b/.hgtags @@ -1 +1,2 @@ 71a276c5d18a81476b1545a4d958cda80c4450ab 2.0.0 +0f6bb468c54f66a8e7d77984443f8e7230e946b3 2.0.1 From f54c982fcdf67e2c89b2f26cce25a0ee3696cc85 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 26 Dec 2011 10:38:42 +0100 Subject: [PATCH 06/20] Increase version number --- __tryton__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tryton__.py b/__tryton__.py index 41179bfec7..156a9e6f1c 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -6,7 +6,7 @@ 'name_de_DE': 'Verkauf Lieferposten Kosten', 'name_es_ES': 'Costo del método de envio', 'name_fr_FR': "Coût d'expédition de vente", - 'version' : '2.0.1', + 'version': '2.0.2', 'author' : 'B2CK', 'email': 'info@b2ck.com', 'website': 'http://www.tryton.org/', From 98c468ab7807ae3b3a082552370da988ca17db71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 2 Dec 2011 10:17:05 +0100 Subject: [PATCH 07/20] Don't force database name in scenario (transplanted from 984787c071046058733e9fa1d108709d6d698c12) --- tests/scenario_sale_shipment_cost.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/scenario_sale_shipment_cost.rst b/tests/scenario_sale_shipment_cost.rst index f0dff378b5..b5ec8546f3 100644 --- a/tests/scenario_sale_shipment_cost.rst +++ b/tests/scenario_sale_shipment_cost.rst @@ -16,7 +16,8 @@ Imports:: Create database:: - >>> config = config.set_trytond(':memory:') + >>> config = config.set_trytond() + >>> config.pool.test = True Install sale_shipment_cost, sale and account_invoice:: From e3b75786fc3a95cac7b39262c7677dd796059630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 6 Dec 2011 19:45:53 +0100 Subject: [PATCH 08/20] cost_line could be empty dictionary if there is no cost (transplanted from ebb11dd2659394e1fca65c231a3647c1a4647d76) --- sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale.py b/sale.py index dd1dba6a94..77fae8e0d3 100644 --- a/sale.py +++ b/sale.py @@ -150,7 +150,7 @@ class Sale(Model): values['lines'] = [] for line in values['lines']: if line.get('shipment_cost'): - if line['shipment_cost'] != cost_line['shipment_cost']: + if line['shipment_cost'] != cost_line.get('shipment_cost'): to_remove = line['id'] values['lines'].remove(line) if cost_line: From ecf3b611913edf8dffee860fc29500ace7b0c3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 9 Dec 2011 16:01:47 +0100 Subject: [PATCH 09/20] Add missing stock dependency (transplanted from e955fb62728320f973d2f3ebda28b38f6563ab2a) --- INSTALL | 1 + __tryton__.py | 1 + 2 files changed, 2 insertions(+) diff --git a/INSTALL b/INSTALL index 6afabc18df..308527dfa3 100644 --- a/INSTALL +++ b/INSTALL @@ -10,6 +10,7 @@ Prerequisites * trytond_sale (http://www.tryton.org/) * trytond_currency (http://www.tryton.org/) * trytond_account_invoice (http://www.tryton.org/) + * trytond_stock (http://www.tryton.org/) Installation ------------ diff --git a/__tryton__.py b/__tryton__.py index 156a9e6f1c..75c317ccac 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -23,6 +23,7 @@ 'sale', 'currency', 'account_invoice', + 'stock', ], 'xml' : [ 'sale.xml', From bd56c0617c3e3611e143a79b5c56052323917c22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 17 Dec 2011 12:08:03 +0100 Subject: [PATCH 10/20] Add missing REPORT_ONLY_FIRST_FAILURE on doctest (transplanted from 166ba6757e4706759d9091f64df64ea7b84d3028) --- tests/test_sale_shipment_cost.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_sale_shipment_cost.py b/tests/test_sale_shipment_cost.py index a0305db4e7..d74c970860 100644 --- a/tests/test_sale_shipment_cost.py +++ b/tests/test_sale_shipment_cost.py @@ -46,7 +46,8 @@ def suite(): suite.addTests(unittest.TestLoader().loadTestsFromTestCase( SaleShipmentCostTestCase)) suite.addTests(doctest.DocFileSuite('scenario_sale_shipment_cost.rst', - setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8')) + setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8', + optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)) return suite if __name__ == '__main__': From 1de274c992b07c150868c9136c9580e3f53c4a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 17 Dec 2011 12:10:45 +0100 Subject: [PATCH 11/20] Fix typo in the super call to on_change_inventory_moves (transplanted from c750ed17661195b9c7600773ef6b3a6e86ee0609) --- stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stock.py b/stock.py index 6885be5f7f..5de8f220c1 100644 --- a/stock.py +++ b/stock.py @@ -90,7 +90,7 @@ class ShipmentOut(ModelWorkflow, ModelSQL, ModelView): currency_obj = self.pool.get('currency.currency') try: - result = super(ShipmentOut, self).on_change_lines(values) + result = super(ShipmentOut, self).on_change_inventory_moves(values) except AttributeError: result = {} carrier = carrier_obj.browse(values['carrier']) From 868b17d5250a289efcb49518609c2a3457729857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 17 Dec 2011 12:11:51 +0100 Subject: [PATCH 12/20] Fix on_change_inventory_moves when carrier is not filled (transplanted from f7c5f714b76771840721a6fa601162fca33eff64) --- stock.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stock.py b/stock.py index 5de8f220c1..93a0f1bfb1 100644 --- a/stock.py +++ b/stock.py @@ -93,6 +93,8 @@ class ShipmentOut(ModelWorkflow, ModelSQL, ModelView): result = super(ShipmentOut, self).on_change_inventory_moves(values) except AttributeError: result = {} + if not values.get('carrier'): + return result carrier = carrier_obj.browse(values['carrier']) with Transaction().set_context( self._get_carrier_context(values)): From c55e85bd9b67a8e9277b428b1a2e93b9ef9e03fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 17 Dec 2011 22:30:00 +0100 Subject: [PATCH 13/20] Use comparison in doctest doctest fails if we got an integer instead of float (transplanted from 8a0914a419aa0f8dd3cf706e5d9fb41146655df0) --- tests/scenario_sale_shipment_cost.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/scenario_sale_shipment_cost.rst b/tests/scenario_sale_shipment_cost.rst index b5ec8546f3..72de62d3fa 100644 --- a/tests/scenario_sale_shipment_cost.rst +++ b/tests/scenario_sale_shipment_cost.rst @@ -185,8 +185,8 @@ Sale products with cost on shipment:: >>> cost_line = sale.lines[-1] >>> cost_line.product == carrier_product True - >>> cost_line.quantity - 1.0 + >>> cost_line.quantity == 1 + True >>> cost_line.amount == Decimal('3') True >>> sale.save() @@ -254,8 +254,8 @@ Sale products with cost on order:: >>> cost_line = sale.lines[-1] >>> cost_line.product == carrier_product True - >>> cost_line.quantity - 1.0 + >>> cost_line.quantity == 1 + True >>> cost_line.amount == Decimal('3') True >>> sale.save() From 7f48fe39b5ef0f798293e18a107de6f13b08681b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 23 Dec 2011 17:16:29 +0100 Subject: [PATCH 14/20] Add missing currency_obj in get_cost_invoice_line (transplanted from 313047031d7c12e910bd0c8541c780582d34263b) --- stock.py | 1 + 1 file changed, 1 insertion(+) diff --git a/stock.py b/stock.py index 93a0f1bfb1..ffef43dd6d 100644 --- a/stock.py +++ b/stock.py @@ -112,6 +112,7 @@ class ShipmentOut(ModelWorkflow, ModelSQL, ModelView): def get_cost_invoice_line(self, shipment, invoice): product_obj = self.pool.get('product.product') tax_rule_obj = self.pool.get('account.tax.rule') + currency_obj = self.pool.get('currency.currency') if not shipment.cost: return {} From b21db11f71d59a5d6b25ebfc9b93ff84300ae60f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 23 Dec 2011 17:48:10 +0100 Subject: [PATCH 15/20] Allow to update cost also in waiting state (transplanted from 929e81dc3752a69f0e3e0e671cf822093c84bf53) --- stock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stock.py b/stock.py index ffef43dd6d..4d5222eade 100644 --- a/stock.py +++ b/stock.py @@ -18,7 +18,7 @@ class ShipmentOut(ModelWorkflow, ModelSQL, ModelView): 'invisible': Not(Bool(Eval('carrier'))), 'required': Bool(Eval('carrier')), 'readonly': Not(In(Eval('state'), - ['draft', 'assigned', 'packed'])), + ['draft', 'waiting', 'assigned', 'packed'])), }, depends=['carrier', 'state']) cost_currency_digits = fields.Function(fields.Integer( 'Cost Currency Digits', on_change_with=['currency']), @@ -27,7 +27,7 @@ class ShipmentOut(ModelWorkflow, ModelSQL, ModelView): digits=(16, Eval('cost_currency_digits', 2)), states={ 'invisible': Not(Bool(Eval('carrier'))), 'readonly': Not(In(Eval('state'), - ['draft', 'assigned', 'packed'])), + ['draft', 'waiting', 'assigned', 'packed'])), }, depends=['carrier', 'state', 'cost_currency_digits']) cost_invoice_line = fields.Many2One('account.invoice.line', 'Cost Invoice Line', readonly=True) From d252a53f68e9e10b9593ae9eb35e8d87b547b554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 6 Feb 2012 19:42:59 +0100 Subject: [PATCH 16/20] Fix computation of stockable review230005 (transplanted from 6c3cd5e4e4908d1c98468e8b1b33ca85d3ed6dfc) --- sale.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sale.py b/sale.py index 77fae8e0d3..b5e07df796 100644 --- a/sale.py +++ b/sale.py @@ -103,7 +103,8 @@ class Sale(Model): cost_line = {} product_ids = [line['product'] for line in values.get('lines') or [] if line.get('product')] - stockable = any(product.salable for product in product_obj.browse(product_ids)) + stockable = any(product.type in ('stockable', 'consumable') + for product in product_obj.browse(product_ids)) if cost and currency_id and stockable: if (values.get('currency') and currency_id != values['currency']): From a30ec3e6d3a9c976f48316cd48b351a258cdbeec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 13 Apr 2012 13:22:22 +0200 Subject: [PATCH 17/20] Use default values when adding a record via on_change review325001 (transplanted from 9851c07f50504f047d8dbc0bdb440be4256aa9a2) --- sale.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/sale.py b/sale.py index b5e07df796..edf2aee13c 100644 --- a/sale.py +++ b/sale.py @@ -116,18 +116,20 @@ class Sale(Model): with Transaction().set_context(party_context): description = product_obj.browse(product.id).rec_name taxes = [] - cost_line = { - 'type': 'line', - 'product': product.id, - 'description': description, - 'quantity': 1, #XXX - 'unit': product.sale_uom.id, - 'unit_price': cost, - 'shipment_cost': cost, - 'amount': cost, - 'taxes': taxes, - 'sequence': 9999, #XXX - } + cost_line = sale_line_obj.default_get( + sale_line_obj._columns.keys()) + cost_line.update({ + 'type': 'line', + 'product': product.id, + 'description': description, + 'quantity': 1, # XXX + 'unit': product.sale_uom.id, + 'unit_price': cost, + 'shipment_cost': cost, + 'amount': cost, + 'taxes': taxes, + 'sequence': 9999, # XXX + }) pattern = sale_line_obj._get_tax_rule_pattern(party, cost_line) for tax in product.customer_taxes_used: From da17cd720a13349aa2c979032802506769282c24 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 7 May 2012 11:08:00 +0200 Subject: [PATCH 18/20] Prepare release 2.0.2 --- CHANGELOG | 3 +++ COPYRIGHT | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 661eb5a5e2..f7912af16c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.0.2 - 2012-05-07 +* Bug fixes (see mercurial logs for details) + Version 2.0.1 - 2011-12-26 * Bug fixes (see mercurial logs for details) diff --git a/COPYRIGHT b/COPYRIGHT index 2e03509ddd..c6901ede17 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,7 +1,7 @@ -Copyright (C) 2011 Cédric Krier. +Copyright (C) 2011-2012 Cédric Krier. Copyright (C) 2011 Bertrand Chenal. Copyright (C) 2011 Nicolas Évrard. -Copyright (C) 2011 B2CK SPRL. +Copyright (C) 2011-2012 B2CK SPRL. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From 5a2b32abd513ccd7a765f816f57589fa65aefbd4 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 7 May 2012 11:08:01 +0200 Subject: [PATCH 19/20] Added tag 2.0.2 for changeset ccdfe8fcd0e5 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index cd5fb45e32..286d8c0d66 100644 --- a/.hgtags +++ b/.hgtags @@ -1,2 +1,3 @@ 71a276c5d18a81476b1545a4d958cda80c4450ab 2.0.0 0f6bb468c54f66a8e7d77984443f8e7230e946b3 2.0.1 +ccdfe8fcd0e50f7e3918d424fffa1ec5db1990a3 2.0.2 From 96f15ebb9998189e87cda49962587f231674516c Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 7 May 2012 11:08:05 +0200 Subject: [PATCH 20/20] Increase version number --- __tryton__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tryton__.py b/__tryton__.py index 75c317ccac..e5798c8819 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -6,7 +6,7 @@ 'name_de_DE': 'Verkauf Lieferposten Kosten', 'name_es_ES': 'Costo del método de envio', 'name_fr_FR': "Coût d'expédition de vente", - 'version': '2.0.2', + 'version': '2.0.3', 'author' : 'B2CK', 'email': 'info@b2ck.com', 'website': 'http://www.tryton.org/',