Skip to content

Draft: Create Coupon modules and API

David P requested to merge feature/225-create-coupons-modules into master

Created coupon models:

  • Base in new module sm_coupons
  • Company in sm_partago_user
  • Reward in sm_rewards

Company and Reward inherit from base but with different model names. Views can't be inherited and have been duplicated and completed using the base coupon views instead. Base coupon views have no use other than an example for inheriting models.

registration_group_ba_behaviour needed to also be duplicated on each module.

Base Coupon menu item should be hidden, base coupons are not meant to be used by users. Currently visible for testing.

REST APIs have been created for each coupon type. Base and Company only have GETs, passing the coupon code as parameter. Reward coupons also have a POST method, passing the coupon ID* (Change this) and an used variable to mark a coupon as used.

API Calls examples: GET:

http://odoo-sm.local:8069/api/cs-coupon-reward/?code=ABC123 http://odoo-sm.local:8069/api/cs-coupon-company/?code=ABC123 POST:

Edited by David P

Merge request reports