Announcement

Collapse
No announcement yet.

Shipping cost not carried over from quote into sales order and invoice

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

  • Shipping cost not carried over from quote into sales order and invoice

    Bug title: Shipping cost not carried over

    EspoCRM version: 7.0.9
    Sales extension: 1.1.6
    Outlook Integration: 1.2.6
    PHP version: 7.4.18

    Bug details:
    When adding shipping cost to a quote and creating either a sales order or an invoice based on that quote, the shipping cost are not carried over. Furthermore, the same behavior applies to an invoice created based on a sales order with shipping cost.

    This behavior is reproducible both common ways: Either by creating a new sales order / invoice and selecting the corresponding quote / sales order in the drop down list (detail view) or by clicking the small plus icon in the list of associated docs an the bottom end of the page.
    Last edited by hybit; 01-25-2022, 09:19 AM. Reason: Bug persists in version 7.0.9

  • #2
    Confirmed - it's not working also on official demo. yuri could you add this to list of bugs for SalesPack?

    Comment


    • #3
      I'm trying to dig into hooks and maybe find a hotfix for this issue (and learn hooks, it's a fantastic way to mod things). However, as I am rather new maybe you can help me out a bit.

      To start with, I'm trying to automatically set the ShippingCost from Quote to SalesOrder upon linking. My approach is to use afterRelate with a file in Espo\Custom\Hooks\SalesOrder:
      PHP Code:
      <?php
      namespace Espo\Custom\Hooks\SalesOrder;

      use 
      Espo\ORM\Entity;
      use 
      Espo\Tools\Stream\HookProcessor;

      class 
      ShippingCost
      {

        private 
      $processor;

        public function 
      __construct(HookProcessor $processor)
        {
          
      $this->processor $processor;
        }

        public function 
      afterRelate(Entity $entity, array $options, array $data): void
        
      {

          
      $link $data['relationName'] ?? null;
          
      $foreignEntity $data['foreignEntity'] ?? null;

          if (!
      $link || !$foreignEntity instanceof Entity) {
            return;
          }

          if (
      $foreignEntity->get('shippingCost')) {
            
      $entity->set('shippingCost'$foreignEntity->get('shippingCost'));
          }

          
      $this->processor->afterRelate($entity$foreignEntity$link$options);

        }
      }
      So far, however, I was unsuccessful in making it work. Where is my (probably most basic) misunderstanding?

      Thanks and Regards
      Last edited by hybit; 01-25-2022, 04:41 PM.

      Comment


      • #4
        Fixed in 1.1.7.

        Comment

        Working...
        X