[FIX] stock_account: coherent field type

In case `move_line_ids.location_id.company_id` or
`move_line_ids.location_dest_id.company_id` is not set, the fallback
value is `False`. Indeed:

```
>>> True and False or True
True
```

This makes `company_from.id` or `company_to.id` crash.

We keep the logic but change the condition:

```
>>> False if True else True
False
```

opw-2045628

closes odoo/odoo#35695

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-08-13 13:05:01 +00:00
parent 2f361bec36
commit 07da48216f
+2 -2
View File
@@ -680,8 +680,8 @@ class StockMove(models.Model):
location_from = self.location_id
location_to = self.location_dest_id
company_from = self._is_out() and self.mapped('move_line_ids.location_id.company_id') or False
company_to = self._is_in() and self.mapped('move_line_ids.location_dest_id.company_id') or False
company_from = self.mapped('move_line_ids.location_id.company_id') if self._is_out() else False
company_to = self.mapped('move_line_ids.location_dest_id.company_id') if self._is_in() else False
# Create Journal Entry for products arriving in the company; in case of routes making the link between several
# warehouse of the same company, the transit location belongs to this company, so we don't need to create accounting entries