Coder Social home page Coder Social logo

Comments (8)

cesarsc79 avatar cesarsc79 commented on August 24, 2024 1

contract_days_before.zip

Sorry:

I am development a new module (not finished yet... NO TIME )
it create 2 field

1º Days before
2º Virtual date

Virtual date is the today.date + Days before

So, you can custom every contract separately

antelacion = fields.Integer(
string='Dias de antelacion',
default=5,
help="Mete los dias de antelacion con los que quieres ejecutar el cron",
)

virtual_date = fields.Date(
string='Fecha Virtual',
compute='_compute_date'
)

def _compute_date(self):
    self.virtual_date = date.today() + timedelta(days=self.antelacion)

@api.model
def cron_recurring_create_invoice(self):

    contracts = self.with_context(cron=True).search([
        ('recurring_invoices', '=', True),
        ('recurring_next_date', '<=', **virtual_date**),
        '|',
        ('date_end', '=', False),
        ('date_end', '>=', today),
    ])
    return contracts.recurring_create_invoice()

well .... dont work... i am not an an expert in odoo orm

someone wants finish it??

p.d.
other option is add an action in contract form list, for select all contract you want and execute the cron manually without need to go into form view...

from contract.

babatoko avatar babatoko commented on August 24, 2024 1

This feature will be highly appreciate.

from contract.

NL66278 avatar NL66278 commented on August 24, 2024 1

@angelmoya @babatoko If you could test/review my PR it would be appreciated. If PR is accepted, i will also forward port it to 11.0 and 12.0.

from contract.

pedrobaeza avatar pedrobaeza commented on August 24, 2024

Well, it can be good if it's set as a parameter. Can be done at journal level, company level or system parameter. The second one can be the best balanced maybe.

from contract.

angelmoya avatar angelmoya commented on August 24, 2024

Yes, I was thinking about create X as a system parameter.

from contract.

angelmoya avatar angelmoya commented on August 24, 2024

from contract.

pedrobaeza avatar pedrobaeza commented on August 24, 2024

Better by company...

from contract.

rafaelbn avatar rafaelbn commented on August 24, 2024

I close this issue as it has been done in #282

from contract.

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.