[FIX] stock: move name length

- Create a stockable product with a long description (> 3000
  characters)
- Validate the SO

An error is raised because the stock move name is too long.

The stock move name is taken from the procurement name, which is itself
taken from the SO line description. However, the stock move name is an
indexed field and therefore its length is limited (to 2712 characters by
default).

We truncate the move name to 2000 characters. Actually, there is no real
point to so many characters, nor its indexing.

opw-767040
This commit is contained in:
Nicolas Martinelli
2017-08-22 17:34:12 +02:00
parent 92ec666f8d
commit 5f7030fc44
+1 -1
View File
@@ -151,7 +151,7 @@ class ProcurementOrder(models.Model):
qty_done = sum(self.move_ids.filtered(lambda move: move.state == 'done').mapped('product_uom_qty'))
qty_left = max(self.product_qty - qty_done, 0)
return {
'name': self.name,
'name': self.name[:2000],
'company_id': self.rule_id.company_id.id or self.rule_id.location_src_id.company_id.id or self.rule_id.location_id.company_id.id or self.company_id.id,
'product_id': self.product_id.id,
'product_uom': self.product_uom.id,