Skip to content

Commit

Permalink
Merge branch 'pu/cw/saleslegacy' into '2024.11'
Browse files Browse the repository at this point in the history
tweak(Sales): legacy handling for old invoicing module

See merge request tine20/tine20!4759
  • Loading branch information
corneliusweiss committed Jan 15, 2024
2 parents 690f2a7 + cca02b2 commit 3b173ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions tine20/Sales/js/AddressSearchCombo.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ Tine.Sales.AddressSearchCombo = Ext.extend(Tine.Tinebase.widgets.form.RecordPick
const customer = customerField?.selectedRecord;
const customer_id = customer?.json?.original_id || customer?.id;

const category = editDialog.getForm().findField('document_category').selectedRecord;
const category = editDialog.getForm().findField('document_category')?.selectedRecord;
const isLegacy = !!editDialog.getForm().findField('contract');
const division = category?.data?.division_id;

this.setDisabled(!customer_id);
Expand All @@ -89,7 +90,7 @@ Tine.Sales.AddressSearchCombo = Ext.extend(Tine.Tinebase.widgets.form.RecordPick
// is this case used somewhere???
typeRecord = customer.data?.postal;
} else {
const debitors = _.filter(customer.data.debitors, (deb) => { return _.get(deb, 'division_id.id', deb) === division?.id});
const debitors = _.filter(customer.data.debitors, (deb) => { return isLegacy || _.get(deb, 'division_id.id', deb) === division?.id});
const typeRecords = _.flatten(_.each(_.map(debitors, type), (addrs, idx) => {
// have postal addr in each debitor
addrs = addrs.concat(customer?.data?.postal ? customer.data.postal : []);
Expand Down
3 changes: 2 additions & 1 deletion tine20/Sales/js/InvoiceEditDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Tine.Sales.InvoiceEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
* @param {Tine.Sales.Model.Contract}
* record
*/
onAfterContractLoad: function(record, customer) {
onAfterContractLoad: async function(record, customer) {
var record = record ? record : this.record;
var relations = record.get('relations'), foundCostCenter = false;
var foundCustomer = customer ? customer : null;
Expand All @@ -306,6 +306,7 @@ Tine.Sales.InvoiceEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
}

if (foundCustomer) {
foundCustomer = await Tine.Sales.getCustomer(foundCustomer.id);
this.customerPicker.setValue(foundCustomer);
this.customerPicker.combo.fireEvent('select');

Expand Down

0 comments on commit 3b173ef

Please sign in to comment.