Announcement

Collapse
No announcement yet.

Quote Item Link Multiple Field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quote Item Link Multiple Field

    Hello,

    I have a link mutiple field Test in Quote Item.

    Relation of quote item with Test is many to many.

    Click image for larger version  Name:	link multiple.png Views:	1 Size:	4.5 KB ID:	35519

    After saving quote, this field shows empty. quote_item_test table is also empty.

    Click image for larger version  Name:	after save.png Views:	1 Size:	987 Bytes ID:	35520

    Please help.

    Thanks in advance.
    Last edited by krishnapriya; 03-12-2018, 09:06 AM.

  • #2
    Hello,
    I don't know, how does Test relate to Quote, but in any case the main saving functionality is in application/Espo/Modules/Advanced/Repositories/Quote.php
    Last edited by tanya; 03-12-2018, 10:17 AM.

    Comment


    • #3
      Actually in quote item, I am linking each product to multiple supplierfees, because same product might need multiple suppliers.

      So quoteItem is in a many to many relationship with supplier fees.


      In item.js->fetch

      fetch: function () {
      var data = {
      supplierFeessIds: this.model.get('supplierFeessIds'),
      supplierFeessNames: this.model.get('supplierFeessNames'),
      };
      return data;
      },


      And in hooks->quoteItem

      protected function setItemWithData(Entity $item, \StdClass $o) {
      $data = array(

      'supplierFeessIds' => $this->getAttributeFromItemObject($o, 'supplierFeessIds'),
      'supplierFeessNames' => $this->getAttributeFromItemObject($o, 'supplierFeessNames'),
      );
      }


      after save, quote_item_supplier_fees table is now saved with data. But in quote detail view supplierFees is empty.



      Comment


      • #4
        In services->Quote->loadAdditionalFields

        foreach ($itemList as $item) {
        $item->loadLinkMultipleField('supplierFeess');
        }

        solved the issue.

        Comment

        Working...
        X