How to insert specific invoice items in sales_invoice_item Table?How to add custom attribute in Collection?Subtotal is doubled in the second attempt to invoiceHow can I display non-invoiced items in the invoice?PDF Invoice - content forcing new pageHow to queue “New Order” email before “New Invoice” email?Add custom field in onepage check out,order,invoice,salesHow to get shipping address by invoice number?Magento 1.9.2 coupon( discount) not appearing while creating invoiceMagento Edit Order Invoice PDF - Options on Single LineOrder items showing as invoiced even though invoice failedInvoice Items Collection

How would a solely written language work mechanically

Can a Knock spell open the door to Mordenkainen's Magnificent Mansion?

How do you justify more code being written by following clean code practices?

Started in 1987 vs. Starting in 1987

How can I, as DM, avoid the Conga Line of Death occurring when implementing some form of flanking rule?

Put the phone down / Put down the phone

Why is participating in the European Parliamentary elections used as a threat?

Is there a distance limit for minecart tracks?

What is it called when someone votes for an option that's not their first choice?

Weird lines in Microsoft Word

How do you say "Trust your struggle." in French?

Air travel with refrigerated insulin

Reasons for having MCU pin-states default to pull-up/down out of reset

How to get directions in deep space?

python displays `n` instead of breaking a line

Do people actually use the word "kaputt" in conversation?

Why didn’t Eve recognize the little cockroach as a living organism?

Asserting that Atheism and Theism are both faith based positions

In the event of Brexit being postponed beyond the EU elections, will UK voters in EU countries be eligible to participate?

Pre-Employment Background Check With Consent For Future Checks

Friend wants my recommendation but I don't want to give it to him

How do I lift the insulation blower into the attic?

Do I have to take mana from my deck or hand when tapping this card?

Did I make a mistake by ccing email to boss to others?



How to insert specific invoice items in sales_invoice_item Table?


How to add custom attribute in Collection?Subtotal is doubled in the second attempt to invoiceHow can I display non-invoiced items in the invoice?PDF Invoice - content forcing new pageHow to queue “New Order” email before “New Invoice” email?Add custom field in onepage check out,order,invoice,salesHow to get shipping address by invoice number?Magento 1.9.2 coupon( discount) not appearing while creating invoiceMagento Edit Order Invoice PDF - Options on Single LineOrder items showing as invoiced even though invoice failedInvoice Items Collection













2















Actually, I created a multi-vendor site. I did most of the things but now am stuck in invoice creation.

I filter the invoice items in the New Invoice page shown in the screenshot
enter image description here



In this order, there are 4 Items but I already filter each vendor can see own items.

In this screenshort, you can see 2 items because the current login vendor has 2 items in this order.



My Problem is when I click on "submit invoice" button in this page it creates 4 records mean insert 4 items in sales_invoice_item table. I want to insert just those records that shown in New Invoice Page which I filtered .
Others invoice item will be excluded.



How can I make restriction? please guide me. Thanks










share|improve this question
























  • are you looking for to create multiple invoices for the same order for each vendor with their items?

    – Rakesh Kumar Jakhar
    17 hours ago












  • first i want to insert just filtered items in sales_invoice_item then i will discuss after .

    – HaFiz Umer
    17 hours ago











  • In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.

    – HelgeB
    17 hours ago












  • Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you

    – HaFiz Umer
    16 hours ago















2















Actually, I created a multi-vendor site. I did most of the things but now am stuck in invoice creation.

I filter the invoice items in the New Invoice page shown in the screenshot
enter image description here



In this order, there are 4 Items but I already filter each vendor can see own items.

In this screenshort, you can see 2 items because the current login vendor has 2 items in this order.



My Problem is when I click on "submit invoice" button in this page it creates 4 records mean insert 4 items in sales_invoice_item table. I want to insert just those records that shown in New Invoice Page which I filtered .
Others invoice item will be excluded.



How can I make restriction? please guide me. Thanks










share|improve this question
























  • are you looking for to create multiple invoices for the same order for each vendor with their items?

    – Rakesh Kumar Jakhar
    17 hours ago












  • first i want to insert just filtered items in sales_invoice_item then i will discuss after .

    – HaFiz Umer
    17 hours ago











  • In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.

    – HelgeB
    17 hours ago












  • Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you

    – HaFiz Umer
    16 hours ago













2












2








2








Actually, I created a multi-vendor site. I did most of the things but now am stuck in invoice creation.

I filter the invoice items in the New Invoice page shown in the screenshot
enter image description here



In this order, there are 4 Items but I already filter each vendor can see own items.

In this screenshort, you can see 2 items because the current login vendor has 2 items in this order.



My Problem is when I click on "submit invoice" button in this page it creates 4 records mean insert 4 items in sales_invoice_item table. I want to insert just those records that shown in New Invoice Page which I filtered .
Others invoice item will be excluded.



How can I make restriction? please guide me. Thanks










share|improve this question
















Actually, I created a multi-vendor site. I did most of the things but now am stuck in invoice creation.

I filter the invoice items in the New Invoice page shown in the screenshot
enter image description here



In this order, there are 4 Items but I already filter each vendor can see own items.

In this screenshort, you can see 2 items because the current login vendor has 2 items in this order.



My Problem is when I click on "submit invoice" button in this page it creates 4 records mean insert 4 items in sales_invoice_item table. I want to insert just those records that shown in New Invoice Page which I filtered .
Others invoice item will be excluded.



How can I make restriction? please guide me. Thanks







magento2 invoice create restriction






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 17 hours ago









magefms

1,8321425




1,8321425










asked 17 hours ago









HaFiz UmerHaFiz Umer

3439




3439












  • are you looking for to create multiple invoices for the same order for each vendor with their items?

    – Rakesh Kumar Jakhar
    17 hours ago












  • first i want to insert just filtered items in sales_invoice_item then i will discuss after .

    – HaFiz Umer
    17 hours ago











  • In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.

    – HelgeB
    17 hours ago












  • Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you

    – HaFiz Umer
    16 hours ago

















  • are you looking for to create multiple invoices for the same order for each vendor with their items?

    – Rakesh Kumar Jakhar
    17 hours ago












  • first i want to insert just filtered items in sales_invoice_item then i will discuss after .

    – HaFiz Umer
    17 hours ago











  • In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.

    – HelgeB
    17 hours ago












  • Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you

    – HaFiz Umer
    16 hours ago
















are you looking for to create multiple invoices for the same order for each vendor with their items?

– Rakesh Kumar Jakhar
17 hours ago






are you looking for to create multiple invoices for the same order for each vendor with their items?

– Rakesh Kumar Jakhar
17 hours ago














first i want to insert just filtered items in sales_invoice_item then i will discuss after .

– HaFiz Umer
17 hours ago





first i want to insert just filtered items in sales_invoice_item then i will discuss after .

– HaFiz Umer
17 hours ago













In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.

– HelgeB
17 hours ago






In my opinion it still would be better not to make changes that way but to use quantities as proposed in my answer to a former question magento.stackexchange.com/a/265960/76597 In that way you will not have any impact on order totals and everything would work as you need. If you dont't want to show some items in the form you should rather think about changing the form (i.e. hide rows with qty = 0) than changing the totals calculation.

– HelgeB
17 hours ago














Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you

– HaFiz Umer
16 hours ago





Dear HelgeB ! i will try your this answer beforePrepareInvoice for filtering invoice item. I will give you feed back soon. Thank you

– HaFiz Umer
16 hours ago










1 Answer
1






active

oldest

votes


















0














You have to override the controller which is generating the invoice for the order.
Following file is doing this



MagentoSalesControllerAdminhtmlOrderInvoiceSave.php


You have to modify the invoiceItems array according to the vendor items



$invoiceItems = isset($invoiceData['items']) ? $invoiceData['items'] : [];


Following line is processing the invoice



$invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems);


How to override controller



https://www.dckap.com/blog/how-to-override-a-controller-in-magento-2/






share|improve this answer






















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266469%2fhow-to-insert-specific-invoice-items-in-sales-invoice-item-table%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You have to override the controller which is generating the invoice for the order.
    Following file is doing this



    MagentoSalesControllerAdminhtmlOrderInvoiceSave.php


    You have to modify the invoiceItems array according to the vendor items



    $invoiceItems = isset($invoiceData['items']) ? $invoiceData['items'] : [];


    Following line is processing the invoice



    $invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems);


    How to override controller



    https://www.dckap.com/blog/how-to-override-a-controller-in-magento-2/






    share|improve this answer



























      0














      You have to override the controller which is generating the invoice for the order.
      Following file is doing this



      MagentoSalesControllerAdminhtmlOrderInvoiceSave.php


      You have to modify the invoiceItems array according to the vendor items



      $invoiceItems = isset($invoiceData['items']) ? $invoiceData['items'] : [];


      Following line is processing the invoice



      $invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems);


      How to override controller



      https://www.dckap.com/blog/how-to-override-a-controller-in-magento-2/






      share|improve this answer

























        0












        0








        0







        You have to override the controller which is generating the invoice for the order.
        Following file is doing this



        MagentoSalesControllerAdminhtmlOrderInvoiceSave.php


        You have to modify the invoiceItems array according to the vendor items



        $invoiceItems = isset($invoiceData['items']) ? $invoiceData['items'] : [];


        Following line is processing the invoice



        $invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems);


        How to override controller



        https://www.dckap.com/blog/how-to-override-a-controller-in-magento-2/






        share|improve this answer













        You have to override the controller which is generating the invoice for the order.
        Following file is doing this



        MagentoSalesControllerAdminhtmlOrderInvoiceSave.php


        You have to modify the invoiceItems array according to the vendor items



        $invoiceItems = isset($invoiceData['items']) ? $invoiceData['items'] : [];


        Following line is processing the invoice



        $invoice = $this->invoiceService->prepareInvoice($order, $invoiceItems);


        How to override controller



        https://www.dckap.com/blog/how-to-override-a-controller-in-magento-2/







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 17 hours ago









        Rakesh Kumar JakharRakesh Kumar Jakhar

        1664




        1664



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266469%2fhow-to-insert-specific-invoice-items-in-sales-invoice-item-table%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Sum ergo cogito? 1 nng

            419 nièngy_Soadمي 19bal1.5o_g

            Queiggey Chernihivv 9NnOo i Zw X QqKk LpB