Giter Club home page Giter Club logo

Comments (3)

petrus-v avatar petrus-v commented on July 17, 2024

as today before generating payload I'm calling a method such

    def _wait_related_exchange_to_be_sent_and_processed(self):
        if not all(
            self.exchange_record.dependent_exchange_ids.mapped(
                lambda rel_exch: rel_exch.edi_exchange_state
                == "output_sent_and_processed"
            )
        ):
            raise RetryableJobError(
                "Waiting related exchanges to be done before generate...",
            )

from edi.

simahawk avatar simahawk commented on July 17, 2024

Hi @petrus-v ,

Regarding job dependencies between actions (eg: generate/send) I've recently drafted this #796

As for dependencies between exchanges, we could have a method that accepts a list of records and chains its jobs.
By default this could come from a field as you mentioned. The issue is: the fact that a job is done does not represent the fact that exchange is done. And what if you set the job as done manually? This will likely trigger the next job in the chain.
Hence, I think you cannot avoid checking the state of the former record in the chain in any case.

As of today, I think it's better to leverage events. You can already use them now.
When a record is successfully transitioned to another state you generate the next one. Easy and clear.

Another approach that I drafted is to automate exchange generation based on some rules.
It depends on #797 and OCA/edi-framework#4.
In my case, for instance, I'm able to generate an order response as an ack to the original exchange record that created a SO when the order gets confirmed.
In your case, you can handle what happens on the invoice and on its related record.

Another point is - and this is something I wanted to do since a long time - we should reflect the state of last related job on the exchange record.

from edi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.