Skip to content

Commit

Permalink
[IMP] account_reconcile_oca: Improve JS for reusing code
Browse files Browse the repository at this point in the history
  • Loading branch information
etobella committed Oct 1, 2024
1 parent e11c081 commit 8450574
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ ReconcileMoveLineController.props = {
...ListController.props,
parentRecord: {type: Object, optional: true},
parentField: {type: String, optional: true},
counterpartField: {type: String, optional: true},
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export class ReconcileMoveLineRenderer extends ListRenderer {
getRowClass(record) {
var classes = super.getRowClass(record);
if (
this.props.parentRecord.data.reconcile_data_info.counterparts.includes(
record.resId
)
this.props.parentRecord.data.reconcile_data_info[
this.props.counterpartField
].includes(record.resId)
) {
classes += " o_field_account_reconcile_oca_move_line_selected";
}
Expand All @@ -19,4 +19,5 @@ ReconcileMoveLineRenderer.props = [
...ListRenderer.props,
"parentRecord",
"parentField",
"counterpartField",
];
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class AccountReconcileMatchWidget extends Component {
searchViewId: false,
parentRecord: this.props.record,
parentField: this.props.name,
counterpartField: this.props.counterpartField,
};
}
}
Expand All @@ -45,6 +46,9 @@ AccountReconcileMatchWidget.components = {
...AccountReconcileMatchWidget.components,
View,
};
AccountReconcileMatchWidget.extractProps = ({attrs}) => ({
counterpartField: attrs.options.counterpart_field || "counterparts",
});

registry
.category("fields")
Expand Down
1 change: 1 addition & 0 deletions account_reconcile_oca/static/src/xml/reconcile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
<xpath expr="//t[@list='model.root']" position="attributes">
<attribute name="parentRecord">props.parentRecord</attribute>
<attribute name="parentField">props.parentField</attribute>
<attribute name="counterpartField">props.counterpartField</attribute>
</xpath>
</t>
</templates>

0 comments on commit 8450574

Please sign in to comment.