Skip to content

[NEW] module pos_order_validation_rule #1386

@cvinh

Description

@cvinh

The idea of this module is to allow a non-developper user to add validation rules that can be checked in the canPay function of pos orders.
The canPay function allows easy inheritance thanks to this commit
Here's an example of how canPay can be inherited : https://github.com/OCA/pos/blob/68f3d69c13940c1520a45a053743f53894afc550/pos_order_split_invoice/static/src/models/order.esm.js

Now we need a way to manage logical rules to be added in the canPay function.
The logical rules must be very flexible :

  • applied globally to the company
  • applied only to some pos config
  • applied only to some res_user (or res_groups)
  • applied only to some pricelist
  • applied only to some customers (via tags, boolean field or age...)
  • applied only to date interval (ie between 2025-01-01 to 2025-03-31)
  • applied only to time interval in the day (ie between 8:00AM to 6:00PM)
  • applied only to some week days (ie saturdays and sundays)
  • they can be based on conditions depending on related models with several levels (ie like in python record.model_id.booleanfield)

I was thinking of something like setting up the rules in ir.actions.server that can already execute some python code and then return True or False with an error message to the canPay function...

Can you advice on how to implement such a powerful feature ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions