[FIX] analytic: traceback hr_expense invoicing analytic distribution
Steps to reproduce the issue: - Have the modules `hr_expense` and `account` installed (not `account_accountant`) - Create a new expense - Change the category - Click on analytic distribution field => Traceback The issue comes from the fact that the account field is present but empty (we don't have accounting). For the old and new account field, we have 2 undefined values. We then do a shallowEqual of these, where it will compare length attributes, so traceback. To solve it, we just give it a value false to the field instead of being undefined for the comparison. closes odoo/odoo#105593 X-original-commit: face5b8f9134fc052ea09742667a610b508a4886 Signed-off-by: John Laterre (jol) <jol@odoo.com>
This commit is contained in:
+4
-4
@@ -70,8 +70,8 @@ export class AnalyticDistribution extends Component {
|
||||
fieldString: this.env._t("Analytic Distribution Template"),
|
||||
});
|
||||
this.allPlans = [];
|
||||
this.lastAccount = this.props.account_field ? this.props.record.data[this.props.account_field] : false;
|
||||
this.lastProduct = this.props.product_field ? this.props.record.data[this.props.product_field] : false;
|
||||
this.lastAccount = this.props.account_field && this.props.record.data[this.props.account_field] || false;
|
||||
this.lastProduct = this.props.product_field && this.props.record.data[this.props.product_field] || false;
|
||||
}
|
||||
|
||||
// Lifecycle
|
||||
@@ -88,8 +88,8 @@ export class AnalyticDistribution extends Component {
|
||||
// or a model applies that contains unavailable plans
|
||||
// This should only execute when these fields have changed, therefore we use the `_field` props.
|
||||
const valueChanged = JSON.stringify(this.props.value) !== JSON.stringify(nextProps.value);
|
||||
const currentAccount = this.props.account_field ? this.props.record.data[this.props.account_field] : false;
|
||||
const currentProduct = this.props.product_field ? this.props.record.data[this.props.product_field] : false;
|
||||
const currentAccount = this.props.account_field && this.props.record.data[this.props.account_field] || false;
|
||||
const currentProduct = this.props.product_field && this.props.record.data[this.props.product_field] || false;
|
||||
const accountChanged = !shallowEqual(this.lastAccount, currentAccount);
|
||||
const productChanged = !shallowEqual(this.lastProduct, currentProduct);
|
||||
if (valueChanged || accountChanged || productChanged) {
|
||||
|
||||
Reference in New Issue
Block a user