[FIX] stock_account, stock_dropshipping: do not change accounts
- Change the one of the following default account on a product category:
Stock Input Account
Stock Output Account
Stock Valuation Account
- Upgrade stock_account
The account is changed back to the default value.
This was due to commit 1bf25fc018 which attempted to solve an error
in a test.
We fix the test by making sure we check the right accounts. We also make
sure to avoid creating 2 identical `ir.properties` (one `False`, the
other with a value). We only update the property if it is `False`.
opw-1859706
This commit is contained in:
committed by
Nicolas Martinelli
parent
d65043c3c2
commit
fc14ed6642
@@ -55,10 +55,10 @@
|
||||
'fields_id': field_id,
|
||||
'value': value,
|
||||
}
|
||||
properties = PropertyObj.search([('name', '=', record), ('company_id', '=', company.id)])
|
||||
if properties:
|
||||
# the property exist: modify it
|
||||
properties.write(vals)
|
||||
else:
|
||||
properties = PropertyObj.search([('name', '=', record), ('company_id', '=', company.id)], limit=1)
|
||||
if not properties:
|
||||
# create the property
|
||||
PropertyObj.create(vals)
|
||||
elif not properties.value_reference:
|
||||
# update the property if False
|
||||
properties.write(vals)
|
||||
|
||||
@@ -11,13 +11,14 @@ class TestStockValuation(AccountingTestCase):
|
||||
self.stock_location = self.env.ref('stock.stock_location_stock')
|
||||
self.partner_id = self.env.ref('base.res_partner_1')
|
||||
self.product1 = self.env.ref('product.product_product_8')
|
||||
self.categ_id = self.product1.categ_id
|
||||
|
||||
self.acc_payable = self.env['account.account'].search([('name', '=', 'Account Payable')]).id
|
||||
self.acc_expense = self.env['account.account'].search([('name', '=', 'Expenses')]).id
|
||||
self.acc_receivable = self.env['account.account'].search([('name', '=', 'Account Receivable')]).id
|
||||
self.acc_sale = self.env['account.account'].search([('name', '=', 'Product Sales')]).id
|
||||
self.acc_stock_in = self.env['account.account'].search([('name', '=', 'Stock Interim Account (Received)')]).id
|
||||
self.acc_stock_out = self.env['account.account'].search([('name', '=', 'Stock Interim Account (Delivered)')]).id
|
||||
self.acc_payable = self.partner_id.property_account_payable_id.id
|
||||
self.acc_expense = self.categ_id.property_account_expense_categ_id.id
|
||||
self.acc_receivable = self.partner_id.property_account_receivable_id.id
|
||||
self.acc_sale = self.categ_id.property_account_income_categ_id.id
|
||||
self.acc_stock_in = self.categ_id.property_stock_account_input_categ_id.id
|
||||
self.acc_stock_out = self.categ_id.property_stock_account_output_categ_id.id
|
||||
|
||||
def _dropship_product1(self):
|
||||
# enable the dropship and MTO route on the product
|
||||
|
||||
Reference in New Issue
Block a user