[FIX] stock_account: location default account_id
Behaviour before commit: If the location is a production or inventory location, you can set an account_id for the valuation. Once this account_id is set, it will still be there if you change the type of location to a view location for example. This may not be the right account_id given the new type of location. Behaviour after commit: Check if the location is of a specific type, if it's not inventory or production, it will take the default valuation account id from the product category. Otherwise it will take the one set on the location. OPW-3269584 closes odoo/odoo#119344 X-original-commit: 3f0ea5d0fa5a96eb78e4637781698121434ee069 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
@@ -379,7 +379,10 @@ class StockMove(models.Model):
|
||||
return self.location_id.valuation_out_account_id.id or accounts_data['stock_input'].id
|
||||
|
||||
def _get_dest_account(self, accounts_data):
|
||||
return self.location_dest_id.valuation_in_account_id.id or accounts_data['stock_output'].id
|
||||
if not self.location_dest_id.usage in ('production', 'inventory'):
|
||||
return accounts_data['stock_output'].id
|
||||
else:
|
||||
return self.location_dest_id.valuation_in_account_id.id or accounts_data['stock_output'].id
|
||||
|
||||
def _prepare_account_move_line(self, qty, cost, credit_account_id, debit_account_id, svl_id, description):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user