From b7b7fe0c9bfb2aba37169aa83adbef1128daa7a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 24 Apr 2012 12:19:30 +0200 Subject: [PATCH 01/26] Increase version number --- __tryton__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tryton__.py b/__tryton__.py index f922deab4f..728601675b 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -10,7 +10,7 @@ 'name_es_ES': 'Ventas', 'name_fr_FR': 'Vente', 'name_nl_NL': 'Verkoop', - 'version': '2.4.0', + 'version': '2.4.1', 'author': 'B2CK', 'email': 'info@b2ck.com', 'website': 'http://www.tryton.org/', From 4f3251a04a61ac9562ea7042de66790f355bdd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 5 May 2012 09:24:44 +0200 Subject: [PATCH 02/26] Manage invoice line creation the same way as stock move As the invoice and shipment are both managed in the process method. So it sum all the quantity invoiced (even the canceled) with the exception of the one already recreated. review351001 (transplanted from 586ccb55c12bc012552f1d59fd1af8e015b44142) --- sale.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sale.py b/sale.py index 91aa373504..8a2adcb87f 100644 --- a/sale.py +++ b/sale.py @@ -1374,14 +1374,12 @@ class SaleLine(ModelSQL, ModelView): quantity += uom_obj.compute_qty(move.uom, move.quantity, line.unit) - ignored_ids = set( - l.id for i in line.sale.invoices_ignored for l in i.lines) + skip_ids = set(l.id for i in line.sale.invoices_recreated + for l in i.lines) for invoice_line in line.invoice_lines: if invoice_line.type != 'line': continue - if ((invoice_line.invoice and - invoice_line.invoice.state != 'cancel') or - invoice_line.id in ignored_ids): + if invoice_line.id not in skip_ids: quantity -= uom_obj.compute_qty(invoice_line.unit, invoice_line.quantity, line.unit) res['quantity'] = quantity From 4906eff8d18cfc4820c363586ac0a8042356aaee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 12 May 2012 16:40:17 +0200 Subject: [PATCH 03/26] Fx manual method, on_invoice_paid invoice method and states of cancel button review360001 (transplanted from ed8b2536f9feecdd78e364427146611d600eadf4) --- sale.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/sale.py b/sale.py index 8a2adcb87f..a441ada856 100644 --- a/sale.py +++ b/sale.py @@ -184,10 +184,7 @@ class Sale(Workflow, ModelSQL, ModelView): )) self._buttons.update({ 'cancel': { - 'invisible': ((Eval('state') == 'cancel') - | (~Eval('state').in_(['draft', 'quotation']) - & (Eval('invoice_state') != 'exception') - & (Eval('shipment_state') != 'exception'))), + 'invisible': ~Eval('state').in_(['draft', 'quotation']), }, 'draft': { 'invisible': Eval('state') != 'quotation', @@ -738,6 +735,9 @@ class Sale(Workflow, ModelSQL, ModelView): invoice_line_obj = pool.get('account.invoice.line') sale_line_obj = pool.get('sale.line') + if sale.invoice_method == 'manual': + return + if not sale.party.account_receivable: self.raise_user_error('missing_account_receivable', error_args=(sale.party.rec_name,)) @@ -812,6 +812,9 @@ class Sale(Workflow, ModelSQL, ModelView): move_obj = pool.get('stock.move') sale_line_obj = pool.get('sale.line') + if sale.shipment_method == 'manual': + return + moves = self._get_move_sale_line(sale, shipment_type) if not moves: return @@ -849,7 +852,10 @@ class Sale(Workflow, ModelSQL, ModelView): return shipments def is_done(self, sale): - return sale.invoice_state == 'paid' and sale.shipment_state == 'sent' + return ((sale.invoice_state == 'paid' + or sale.invoice_method == 'manual') + and (sale.shipment_state == 'sent' + or sale.shipment_method == 'manual')) def delete(self, ids): if isinstance(ids, (int, long)): @@ -1429,8 +1435,17 @@ class SaleLine(ModelSQL, ModelView): return if (shipment_type == 'out') != (line.quantity >= 0): return + + if line.sale.shipment_method == 'order': + quantity = abs(line.quantity) + else: + quantity = 0.0 + for invoice_line in line.invoice_lines: + if invoice_line.invoice.state in ('open', 'paid'): + quantity += uom_obj.compute_qty(invoice_line.unit, + invoice_line.quantity, line.unit) + skip_ids = set(x.id for x in line.moves_recreated) - quantity = abs(line.quantity) for move in line.moves: if move.id not in skip_ids: quantity -= uom_obj.compute_qty(move.uom, move.quantity, From 4080ab7f929f054426419c76ae2c5158e604356e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 19 May 2012 15:34:10 +0200 Subject: [PATCH 04/26] Use SQL query for migration review359001 (transplanted from 922f8f9e1075c860990ddd2fb95a038caec70a74) --- sale.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/sale.py b/sale.py index a441ada856..f22ea24bea 100644 --- a/sale.py +++ b/sale.py @@ -204,6 +204,10 @@ class Sale(Workflow, ModelSQL, ModelView): self._states_cached = ['confirmed', 'processing', 'done', 'cancel'] def init(self, module_name): + pool = Pool() + sale_line_obj = pool.get('sale.line') + sale_line_invoice_line_obj = pool.get('sale.line-account.invoice.line') + move_obj = pool.get('stock.move') cursor = Transaction().cursor # Migration from 1.2: packing renamed into shipment cursor.execute("UPDATE ir_model_data " @@ -233,14 +237,19 @@ class Sale(Workflow, ModelSQL, ModelView): table.not_null_action('sale_date', 'remove') # state confirmed splitted into confirmed and processing - confirmed2processing = [] - for sale in self.browse(self.search([ - ('state', '=', 'confirmed'), - ])): - if sale.invoices or sale.moves: - confirmed2processing.append(sale.id) - if confirmed2processing: - self.write(confirmed2processing, {'state': 'processing'}) + if (TableHandler.table_exist(cursor, sale_line_obj._table) + and TableHandler.table_exist(cursor, + sale_line_invoice_line_obj._table) + and TableHandler.table_exist(cursor, move_obj._table)): + cursor.execute('UPDATE "' + self._table + '" AS s ' + "SET state = 'processing' " + 'FROM "' + sale_line_obj._table + '" AS l, ' + '"' + sale_line_invoice_line_obj._table + '" AS li, ' + '"' + move_obj._table + '" AS m ' + "WHERE s.state = 'confirmed' " + "AND l.sale = s.id " + "AND (li.sale_line = l.id " + "OR m.sale_line = l.id)") # Add index on create_date table = TableHandler(cursor, self, module_name) From 558ec2d9b040e38df11f64f0392dbd34b8344f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 21 May 2012 12:36:59 +0200 Subject: [PATCH 05/26] Replace SQL query "UPDATE FROM" not supported by sqlite nor MySQL issue2608 review358002 (transplanted from 9bbf8d4505c2c0d296e1c9347a4a5d7d40f01090) --- sale.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sale.py b/sale.py index f22ea24bea..55d1f5b8b2 100644 --- a/sale.py +++ b/sale.py @@ -241,15 +241,19 @@ class Sale(Workflow, ModelSQL, ModelView): and TableHandler.table_exist(cursor, sale_line_invoice_line_obj._table) and TableHandler.table_exist(cursor, move_obj._table)): - cursor.execute('UPDATE "' + self._table + '" AS s ' + cursor.execute('UPDATE "%s" ' "SET state = 'processing' " - 'FROM "' + sale_line_obj._table + '" AS l, ' - '"' + sale_line_invoice_line_obj._table + '" AS li, ' - '"' + move_obj._table + '" AS m ' - "WHERE s.state = 'confirmed' " - "AND l.sale = s.id " - "AND (li.sale_line = l.id " - "OR m.sale_line = l.id)") + 'WHERE id IN (' + 'SELECT s.id ' + 'FROM "%s" AS s ' + 'INNER JOIN "%s" AS l ON l.sale = s.id ' + 'LEFT JOIN "%s" AS li ON li.sale_line = l.id ' + 'LEFT JOIN "%s" AS m ON m.sale_line = l.id ' + "WHERE s.state = 'confirmed' " + 'AND (li.id IS NOT NULL ' + 'OR m.id IS NOT NULL))' + % (self._table, self._table, sale_line_obj._table, + sale_line_invoice_line_obj._table, move_obj._table)) # Add index on create_date table = TableHandler(cursor, self, module_name) From 24ff48802552ef3d1b92a42815494d0766a99e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 22 May 2012 11:55:30 +0200 Subject: [PATCH 06/26] Wrap subquery inside an other inner subquery for MySQL MySQL syntax doesn't allow update a table and select from the same table in a subquery. (transplanted from b327f5a0bff1d0fcb2af28863344a6cb6e81b271) --- sale.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/sale.py b/sale.py index 55d1f5b8b2..b37aa0ca38 100644 --- a/sale.py +++ b/sale.py @@ -241,17 +241,22 @@ class Sale(Workflow, ModelSQL, ModelView): and TableHandler.table_exist(cursor, sale_line_invoice_line_obj._table) and TableHandler.table_exist(cursor, move_obj._table)): + # Wrap subquery inside an other inner subquery because MySQL syntax + # doesn't allow update a table and select from the same table in a + # subquery. cursor.execute('UPDATE "%s" ' "SET state = 'processing' " 'WHERE id IN (' - 'SELECT s.id ' - 'FROM "%s" AS s ' - 'INNER JOIN "%s" AS l ON l.sale = s.id ' - 'LEFT JOIN "%s" AS li ON li.sale_line = l.id ' - 'LEFT JOIN "%s" AS m ON m.sale_line = l.id ' - "WHERE s.state = 'confirmed' " - 'AND (li.id IS NOT NULL ' - 'OR m.id IS NOT NULL))' + 'SELECT id ' + 'FROM (' + 'SELECT s.id ' + 'FROM "%s" AS s ' + 'INNER JOIN "%s" AS l ON l.sale = s.id ' + 'LEFT JOIN "%s" AS li ON li.sale_line = l.id ' + 'LEFT JOIN "%s" AS m ON m.sale_line = l.id ' + "WHERE s.state = 'confirmed' " + 'AND (li.id IS NOT NULL ' + 'OR m.id IS NOT NULL)) AS foo)' % (self._table, self._table, sale_line_obj._table, sale_line_invoice_line_obj._table, move_obj._table)) From d3a97e7e671bd1d502ac8aee1f9b81174ca5295d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 30 May 2012 12:08:26 +0200 Subject: [PATCH 07/26] Fix invoice line generation for non-line review377002 (transplanted from 9d961d5a210111139b98ad3ee03fa9bddf51b071) --- sale.py | 10 +++--- tests/scenario_sale.rst | 69 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 72 insertions(+), 7 deletions(-) diff --git a/sale.py b/sale.py index b37aa0ca38..813d5d5e92 100644 --- a/sale.py +++ b/sale.py @@ -1376,10 +1376,12 @@ class SaleLine(ModelSQL, ModelView): res['note'] = line.note if line.type != 'line': if (line.sale.invoice_method == 'order' - and (all(l.quantity >= 0 for l in line.sale.lines - if l.type == 'line') - or all(l.quantity <= 0 for l in line.sale.lines - if l.type == 'line'))): + and ((all(l.quantity >= 0 for l in line.sale.lines + if l.type == 'line') + and invoice_type == 'out_invoice') + or (all(l.quantity <= 0 for l in line.sale.lines + if l.type == 'line') + and invoice_type == 'out_credit_note'))): return [res] else: return [] diff --git a/tests/scenario_sale.rst b/tests/scenario_sale.rst index c67487e6db..ad5a0a6093 100644 --- a/tests/scenario_sale.rst +++ b/tests/scenario_sale.rst @@ -174,13 +174,17 @@ Sale 5 products:: >>> sale = Sale() >>> sale.party = customer >>> sale.payment_term = payment_term - >>> sale.invoice_method = 'shipment' + >>> sale.invoice_method = 'order' >>> sale_line = SaleLine() >>> sale.lines.append(sale_line) >>> sale_line.product = product >>> sale_line.quantity = 2.0 >>> sale_line = SaleLine() >>> sale.lines.append(sale_line) + >>> sale_line.type = 'comment' + >>> sale_line.description = 'Comment' + >>> sale_line = SaleLine() + >>> sale.lines.append(sale_line) >>> sale_line.product = product >>> sale_line.quantity = 3.0 >>> sale.save() @@ -189,6 +193,39 @@ Sale 5 products:: >>> Sale.process([sale.id], config.context) >>> sale.state u'processing' + >>> sale.reload() + >>> len(sale.shipments), len(sale.shipment_returns), len(sale.invoices) + (1, 0, 1) + +Sale 5 products with an invoice method 'on shipment':: + + >>> Sale = Model.get('sale.sale') + >>> SaleLine = Model.get('sale.line') + >>> sale = Sale() + >>> sale.party = customer + >>> sale.payment_term = payment_term + >>> sale.invoice_method = 'shipment' + >>> sale_line = SaleLine() + >>> sale.lines.append(sale_line) + >>> sale_line.product = product + >>> sale_line.quantity = 2.0 + >>> sale_line = SaleLine() + >>> sale.lines.append(sale_line) + >>> sale_line.type = 'comment' + >>> sale_line.description = 'Comment' + >>> sale_line = SaleLine() + >>> sale.lines.append(sale_line) + >>> sale_line.product = product + >>> sale_line.quantity = 3.0 + >>> sale.save() + >>> Sale.quote([sale.id], config.context) + >>> Sale.confirm([sale.id], config.context) + >>> Sale.process([sale.id], config.context) + >>> sale.state + u'processing' + >>> sale.reload() + >>> len(sale.shipments), len(sale.shipment_returns), len(sale.invoices) + (1, 0, 0) Validate Shipments:: @@ -207,6 +244,8 @@ Open customer invoice:: >>> invoice, = sale.invoices >>> invoice.type u'out_invoice' + >>> len(invoice.lines) + 2 >>> Invoice.open([invoice.id], config.context) >>> invoice.reload() >>> invoice.state @@ -230,20 +269,26 @@ Create a Return:: >>> return_.lines.append(return_line) >>> return_line.product = product >>> return_line.quantity = -4. + >>> return_line = SaleLine() + >>> return_.lines.append(return_line) + >>> return_line.type = 'comment' + >>> return_line.description = 'Comment' >>> return_.save() >>> Sale.quote([return_.id], config.context) >>> Sale.confirm([return_.id], config.context) >>> Sale.process([return_.id], config.context) >>> return_.state u'processing' + >>> return_.reload() + >>> (len(return_.shipments), len(return_.shipment_returns), + ... len(return_.invoices)) + (0, 1, 0) Check Return Shipments:: >>> return_.reload() >>> ShipmentReturn = Model.get('stock.shipment.out.return') >>> ship_return, = return_.shipment_returns - >>> len(return_.shipments) - 0 >>> ShipmentReturn.receive([ship_return.id], config.context) >>> move_return, = ship_return.incoming_moves >>> move_return.product.name @@ -257,6 +302,8 @@ Open customer credit note:: >>> credit_note, = return_.invoices >>> credit_note.type u'out_credit_note' + >>> len(credit_note.lines) + 1 >>> Invoice.open([credit_note.id], config.context) >>> credit_note.reload() >>> credit_note.state @@ -278,6 +325,10 @@ Mixing return and sale:: >>> mix.lines.append(mixline) >>> mixline.product = product >>> mixline.quantity = 7. + >>> mixline_comment = SaleLine() + >>> mix.lines.append(mixline_comment) + >>> mixline_comment.type = 'comment' + >>> mixline_comment.description = 'Comment' >>> mixline2 = SaleLine() >>> mix.lines.append(mixline2) >>> mixline2.product = product @@ -288,6 +339,9 @@ Mixing return and sale:: >>> Sale.process([mix.id], config.context) >>> mix.state u'processing' + >>> mix.reload() + >>> len(mix.shipments), len(mix.shipment_returns), len(mix.invoices) + (1, 1, 2) Checking Shipments:: @@ -317,6 +371,8 @@ Checking the invoice:: ... key=attrgetter('type'), reverse=True) >>> mix_invoice.type, mix_credit_note.type (u'out_invoice', u'out_credit_note') + >>> len(mix_invoice.lines), len(mix_credit_note.lines) + (1, 1) >>> Invoice.open([mix_invoice.id], config.context) >>> mix_invoice.reload() >>> mix_invoice.state @@ -342,6 +398,10 @@ Mixing stuff with an invoice method 'on shipment':: >>> mix.lines.append(mixline) >>> mixline.product = product >>> mixline.quantity = 6. + >>> mixline_comment = SaleLine() + >>> mix.lines.append(mixline_comment) + >>> mixline_comment.type = 'comment' + >>> mixline_comment.description = 'Comment' >>> mixline2 = SaleLine() >>> mix.lines.append(mixline2) >>> mixline2.product = product @@ -352,6 +412,9 @@ Mixing stuff with an invoice method 'on shipment':: >>> Sale.process([mix.id], config.context) >>> mix.state u'processing' + >>> mix.reload() + >>> len(mix.shipments), len(mix.shipment_returns), len(mix.invoices) + (1, 1, 0) Checking Shipments:: From 1ac1a530399b98dfe3e7805823ab051ee6a0c0a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 13 Jun 2012 23:23:29 +0200 Subject: [PATCH 08/26] Improve warehouse requirement test and fix get_from_location issue2644 review386003 (transplanted from e88922f14ffc6f2d81c935910d498eb8671e24d8) --- sale.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sale.py b/sale.py index 813d5d5e92..126031d669 100644 --- a/sale.py +++ b/sale.py @@ -668,7 +668,7 @@ class Sale(Workflow, ModelSQL, ModelView): location = line.from_location else: location = line.to_location - if (not location + if ((not location or not line.warehouse) and line.product and line.product.type in ('goods', 'assets')): self.raise_user_error('warehouse_required') @@ -1321,8 +1321,11 @@ class SaleLine(ModelSQL, ModelView): def get_from_location(self, ids, name): result = {} for line in self.browse(ids): - if line.quantity >= 0 and line.warehouse: - result[line.id] = line.warehouse.output_location.id + if line.quantity >= 0: + if line.warehouse: + result[line.id] = line.warehouse.output_location.id + else: + result[line.id] = None else: result[line.id] = line.sale.party.customer_location.id return result From b1d93b003b2c6df3a3fbcc549b4a616a6e304737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 7 Aug 2012 12:53:09 +0200 Subject: [PATCH 09/26] unit_price and quantity could be None during on_change calls issue2740 (transplanted from e51f8556416e21590b6bf534fb43691934ccafd0) --- sale.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sale.py b/sale.py index 126031d669..2f59e78560 100644 --- a/sale.py +++ b/sale.py @@ -425,8 +425,8 @@ class Sale(Workflow, ModelSQL, ModelView): tax_list = () with Transaction().set_context(self.get_tax_context(vals)): tax_list = tax_obj.compute(line.get('taxes', []), - line.get('unit_price', Decimal('0.0')), - line.get('quantity', 0.0)) + line.get('unit_price') or Decimal('0.0'), + line.get('quantity') or 0.0) for tax in tax_list: key, val = invoice_obj._compute_tax(tax, 'out_invoice') if not key in taxes: @@ -1203,7 +1203,7 @@ class SaleLine(ModelSQL, ModelView): with Transaction().set_context( self._get_context_sale_price(product, vals)): res['unit_price'] = product_obj.get_sale_price([product.id], - vals.get('quantity', 0))[product.id] + vals.get('quantity') or 0)[product.id] if res['unit_price']: res['unit_price'] = res['unit_price'].quantize( Decimal(1) / 10 ** self.unit_price.digits[1]) @@ -1268,7 +1268,7 @@ class SaleLine(ModelSQL, ModelView): with Transaction().set_context( self._get_context_sale_price(product, vals)): res['unit_price'] = product_obj.get_sale_price([vals['product']], - vals.get('quantity', 0))[vals['product']] + vals.get('quantity') or 0)[vals['product']] if res['unit_price']: res['unit_price'] = res['unit_price'].quantize( Decimal(1) / 10 ** self.unit_price.digits[1]) From 33f2dd74c7c91465ffd3f6db3d6a2456eb735d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 2 Sep 2012 16:46:33 +0200 Subject: [PATCH 10/26] Prepare release 2.4.1 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index a637465992..e4a20c2986 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.4.1 - 2012-09-02 +* Bug fixes (see mercurial logs for details) + Version 2.4.0 - 2012-04-24 * Bug fixes (see mercurial logs for details) * Manage negative amounts in sale From 11881c2634f7455a175274fda6c6cdae9414df16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 2 Sep 2012 16:46:34 +0200 Subject: [PATCH 11/26] Added tag 2.4.1 for changeset 99a34bfed20a --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 08987ea90e..82f22ec2d5 100644 --- a/.hgtags +++ b/.hgtags @@ -6,3 +6,4 @@ dd5101ebaec9f7d1d13071e0e1ffcf3958a6b0f1 1.6.0 4a6f7eb2afa6f6aa315fac3148397a01b0d6ed8e 2.0.0 746ade947a1b66841722d5bfb4e50a3f87c18c9f 2.2.0 5cc785354c99154c3656c94aa399a9e1d708db9f 2.4.0 +99a34bfed20ad5a09d881561eb44e01893de19e5 2.4.1 From 90ed126beb41bd3dea7998b02206b95136e18f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 2 Sep 2012 16:46:43 +0200 Subject: [PATCH 12/26] Increase version number --- __tryton__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tryton__.py b/__tryton__.py index 728601675b..52f51ade39 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -10,7 +10,7 @@ 'name_es_ES': 'Ventas', 'name_fr_FR': 'Vente', 'name_nl_NL': 'Verkoop', - 'version': '2.4.1', + 'version': '2.4.2', 'author': 'B2CK', 'email': 'info@b2ck.com', 'website': 'http://www.tryton.org/', From 3b719e5c9cfc66af65b660ea708539dc5dec0ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 26 Aug 2012 15:56:53 +0200 Subject: [PATCH 13/26] Add missing sale_date on some on_change (transplanted from bbca949a7e284d74ea3578936539d3893f4a8a21) --- sale.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sale.py b/sale.py index 2f59e78560..4994159c10 100644 --- a/sale.py +++ b/sale.py @@ -991,7 +991,8 @@ class SaleLine(ModelSQL, ModelView): 'required': Eval('type') == 'line', 'readonly': ~Eval('_parent_sale', {}), }, on_change=['product', 'quantity', 'unit', - '_parent_sale.currency', '_parent_sale.party'], + '_parent_sale.currency', '_parent_sale.party', + '_parent_sale.sale_date'], depends=['type', 'unit_digits']) unit = fields.Many2One('product.uom', 'Unit', states={ @@ -1016,7 +1017,8 @@ class SaleLine(ModelSQL, ModelView): 'readonly': ~Eval('_parent_sale', {}), }, on_change=['product', 'unit', 'quantity', 'description', - '_parent_sale.party', '_parent_sale.currency'], + '_parent_sale.party', '_parent_sale.currency', + '_parent_sale.sale_date'], context={ 'locations': If(Bool(Eval('_parent_sale', {}).get('warehouse')), [Eval('_parent_sale', {}).get('warehouse', 0)], []), From 0111cc9c1f763eeb95061c3c6a41e4fe92c9c6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 2 Sep 2012 16:48:14 +0200 Subject: [PATCH 14/26] Fix typo in tests_require (transplanted from 73ce95a4c5acf619191264613b1afb2b91cd921f) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4466f62b95..6cc14f0422 100644 --- a/setup.py +++ b/setup.py @@ -71,5 +71,5 @@ setup(name='trytond_sale', """, test_suite='tests', test_loader='trytond.test_loader:Loader', - test_require=tests_require, + tests_require=tests_require, ) From f68b5195c6bebca469f9aeed12efc86aee705299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 4 Sep 2012 22:53:48 +0200 Subject: [PATCH 15/26] Fix typo in HandleInvoiceException (transplanted from 307d034d77b690b2ff4b2fe0e9e0066de32ddfe9) --- sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale.py b/sale.py index 4994159c10..f5e83f8e64 100644 --- a/sale.py +++ b/sale.py @@ -2083,7 +2083,7 @@ class HandleInvoiceException(Wizard): if invoice.state == 'cancel' and invoice.id not in skip_ids: invoices.append(invoice.id) return { - 'to_recreate': invoices, + 'recreate_invoices': invoices, 'domain_invoices': invoices, } From a602caa82f8dc8ee1514fd62b9fb9bde243af31b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 Nov 2012 18:06:57 +0100 Subject: [PATCH 16/26] Prepare release 2.4.2 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index e4a20c2986..b559404d33 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.4.2 - 2012-11-05 +* Bug fixes (see mercurial logs for details) + Version 2.4.1 - 2012-09-02 * Bug fixes (see mercurial logs for details) From b6525835b3275fbb97d76da26aca5a331f480ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 Nov 2012 18:06:58 +0100 Subject: [PATCH 17/26] Added tag 2.4.2 for changeset 1aeb5cba2667 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 82f22ec2d5..e4898d3f9a 100644 --- a/.hgtags +++ b/.hgtags @@ -7,3 +7,4 @@ dd5101ebaec9f7d1d13071e0e1ffcf3958a6b0f1 1.6.0 746ade947a1b66841722d5bfb4e50a3f87c18c9f 2.2.0 5cc785354c99154c3656c94aa399a9e1d708db9f 2.4.0 99a34bfed20ad5a09d881561eb44e01893de19e5 2.4.1 +1aeb5cba2667db7f87b2ab6ff0a0e5e4bdbf632f 2.4.2 From 6555aef71c1daa53b08eb5cae523d93d395538b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 Nov 2012 18:07:11 +0100 Subject: [PATCH 18/26] Increase version number --- __tryton__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tryton__.py b/__tryton__.py index 52f51ade39..1224dec762 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -10,7 +10,7 @@ 'name_es_ES': 'Ventas', 'name_fr_FR': 'Vente', 'name_nl_NL': 'Verkoop', - 'version': '2.4.2', + 'version': '2.4.3', 'author': 'B2CK', 'email': 'info@b2ck.com', 'website': 'http://www.tryton.org/', From bbd78731829ec9cdae0b1d2500c157bd0e75ad19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 16 Apr 2013 15:34:13 +0200 Subject: [PATCH 19/26] Fix process for cache management of browse record When related records are created, the local cache of the browse record is not clear so at the second loop in process the local cache is already filled with empty one2many (like moves). issue3111 review755002 --- sale.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sale.py b/sale.py index f5e83f8e64..3d1700aa08 100644 --- a/sale.py +++ b/sale.py @@ -911,7 +911,8 @@ class Sale(Workflow, ModelSQL, ModelView): @Workflow.transition('processing') def process(self, ids): done = [] - for sale in self.browse(ids): + for sale_id in ids: + sale = self.browse(sale_id) if sale.state in ('done', 'cancel'): continue self.create_invoice(sale, 'out_invoice') From 9d2b30181ca65943e826cf51464720e817c90789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 2 May 2013 10:11:00 +0200 Subject: [PATCH 20/26] Prepare release 2.4.3 --- CHANGELOG | 3 +++ COPYRIGHT | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b559404d33..000dd90656 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.4.3 - 2013-05-02 +* Bug fixes (see mercurial logs for details) + Version 2.4.2 - 2012-11-05 * Bug fixes (see mercurial logs for details) diff --git a/COPYRIGHT b/COPYRIGHT index ede3facd44..6e948f6faf 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,6 +1,6 @@ -Copyright (C) 2008-2012 Cédric Krier. +Copyright (C) 2008-2013 Cédric Krier. Copyright (C) 2008-2012 Bertrand Chenal. -Copyright (C) 2008-2012 B2CK SPRL. +Copyright (C) 2008-2013 B2CK SPRL. Copyright (C) 2004-2008 Tiny SPRL. This program is free software: you can redistribute it and/or modify From c195536b4ca3f1f83c145db37098c9ff6952a923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 2 May 2013 10:11:01 +0200 Subject: [PATCH 21/26] Added tag 2.4.3 for changeset 5099d47cd63e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e4898d3f9a..0f133af6ce 100644 --- a/.hgtags +++ b/.hgtags @@ -8,3 +8,4 @@ dd5101ebaec9f7d1d13071e0e1ffcf3958a6b0f1 1.6.0 5cc785354c99154c3656c94aa399a9e1d708db9f 2.4.0 99a34bfed20ad5a09d881561eb44e01893de19e5 2.4.1 1aeb5cba2667db7f87b2ab6ff0a0e5e4bdbf632f 2.4.2 +5099d47cd63e41722923773c0380fd8a351ef3fd 2.4.3 From ea1e85f26b656ceedc52715c9afe1dd4df671cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 2 May 2013 10:11:11 +0200 Subject: [PATCH 22/26] Increase version number --- __tryton__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tryton__.py b/__tryton__.py index 1224dec762..713c48dc70 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -10,7 +10,7 @@ 'name_es_ES': 'Ventas', 'name_fr_FR': 'Vente', 'name_nl_NL': 'Verkoop', - 'version': '2.4.3', + 'version': '2.4.4', 'author': 'B2CK', 'email': 'info@b2ck.com', 'website': 'http://www.tryton.org/', From eadb7f3f059057287d628703e962cc456c967c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 2 Sep 2013 11:19:37 +0200 Subject: [PATCH 23/26] Create invoice line for non-line only once issue3292 review1043002 (transplanted from 71fd4a013396386aaee4479c27c05178721b38d5) --- sale.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sale.py b/sale.py index 3d1700aa08..45ed6a8e11 100644 --- a/sale.py +++ b/sale.py @@ -1382,6 +1382,7 @@ class SaleLine(ModelSQL, ModelView): res['note'] = line.note if line.type != 'line': if (line.sale.invoice_method == 'order' + and not line.invoice_lines and ((all(l.quantity >= 0 for l in line.sale.lines if l.type == 'line') and invoice_type == 'out_invoice') From de9bc1fa957e289ed899931ae347f4c5636010a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 1 Oct 2013 21:43:03 +0200 Subject: [PATCH 24/26] Prepare release 2.4.4 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 000dd90656..8aa5a71f6f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 2.4.4 - 2013-10-01 +* Bug fixes (see mercurial logs for details) + Version 2.4.3 - 2013-05-02 * Bug fixes (see mercurial logs for details) From e65c442536b072325faa0ba7ec7f7f04f50561ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 1 Oct 2013 21:43:04 +0200 Subject: [PATCH 25/26] Added tag 2.4.4 for changeset 282915176b11 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 0f133af6ce..5c18e0e022 100644 --- a/.hgtags +++ b/.hgtags @@ -9,3 +9,4 @@ dd5101ebaec9f7d1d13071e0e1ffcf3958a6b0f1 1.6.0 99a34bfed20ad5a09d881561eb44e01893de19e5 2.4.1 1aeb5cba2667db7f87b2ab6ff0a0e5e4bdbf632f 2.4.2 5099d47cd63e41722923773c0380fd8a351ef3fd 2.4.3 +282915176b11e5a7766bd9e97f4d0877b418de97 2.4.4 From b10e760b8f21f130afe0fc54e6d18b3a4dfbb79a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 1 Oct 2013 21:43:17 +0200 Subject: [PATCH 26/26] Increase version number --- __tryton__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tryton__.py b/__tryton__.py index 713c48dc70..3a8e9d81b1 100644 --- a/__tryton__.py +++ b/__tryton__.py @@ -10,7 +10,7 @@ 'name_es_ES': 'Ventas', 'name_fr_FR': 'Vente', 'name_nl_NL': 'Verkoop', - 'version': '2.4.4', + 'version': '2.4.5', 'author': 'B2CK', 'email': 'info@b2ck.com', 'website': 'http://www.tryton.org/',