mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 17:47:00 -05:00
Fix condition mapping for payee rule creation from payee modal (#414)
This commit is contained in:
@@ -588,20 +588,29 @@ export default function ManageRules({
|
||||
}, []);
|
||||
|
||||
function onCreateRule() {
|
||||
let rule = {
|
||||
stage: null,
|
||||
conditions: [
|
||||
{
|
||||
field: 'payee',
|
||||
op: 'is',
|
||||
value: payeeId || null,
|
||||
type: 'id'
|
||||
}
|
||||
],
|
||||
actions: [
|
||||
{
|
||||
op: 'set',
|
||||
field: 'category',
|
||||
value: null,
|
||||
type: 'id'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
dispatch(
|
||||
pushModal('edit-rule', {
|
||||
rule: {
|
||||
stage: null,
|
||||
conditions: [{ op: 'is', field: 'payee', value: null, type: 'id' }],
|
||||
actions: [
|
||||
{
|
||||
op: 'set',
|
||||
field: 'category',
|
||||
value: null,
|
||||
type: 'id'
|
||||
}
|
||||
]
|
||||
},
|
||||
rule,
|
||||
onSave: async newRule => {
|
||||
let newRules = await loadRules();
|
||||
|
||||
|
||||
@@ -90,19 +90,24 @@ function ManagePayeesWithData({
|
||||
}
|
||||
|
||||
function onCreateRule(id) {
|
||||
let payee = payees.find(p => p.id === id);
|
||||
let rule = {
|
||||
id: null,
|
||||
stage: null,
|
||||
conditions: [
|
||||
{
|
||||
field: 'description',
|
||||
field: 'payee',
|
||||
op: 'is',
|
||||
value: payee.id,
|
||||
value: id,
|
||||
type: 'id'
|
||||
}
|
||||
],
|
||||
actions: []
|
||||
actions: [
|
||||
{
|
||||
op: 'set',
|
||||
field: 'category',
|
||||
value: null,
|
||||
type: 'id'
|
||||
}
|
||||
]
|
||||
};
|
||||
pushModal('edit-rule', { rule });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user