Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    อสังหาริมทรัพย์
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    ปรึกษา
    • สำนักงานบัญชี
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • เหล็ก
    • เฟอร์นิเจอร์
    • อาหาร
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • ระบบพลังงานแสงอาทิตย์
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    อื่น ๆ
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม Odoo
    รับซอฟต์แวร์
    • ดาวน์โหลด
    • เปรียบเทียบรุ่น
    • เผยแพร่
    ทำงานร่วมกัน
    • Github
    • ฟอรั่ม
    • ระบบการจัดงานอีเวนต์
    • การแปล
    • ร่วมเป็นพาร์ทเนอร์
    • Services for Partners
    • ลงทะเบียนเพื่อสร้างบัญชีบริษัทของคุณ
    รับบริการ
    • ค้นหาพาร์ทเนอร์
    • ค้นหานักบัญชี
    • พบกับที่ปรึกษา
    • บริการติดตั้งระบบเพื่อใช้งาน
    • ข้อมูลอ้างอิงลูกค้า
    • การสนับสนุน
    • อัปเกรด
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    รับการสาธิต
  • ราคา
  • ช่วยเหลือ

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • ลูกค้าสัมพันธ์
  • e-Commerce
  • ระบบบัญชี
  • สินค้าคงคลัง
  • PoS
  • โปรเจกต์
  • MRP
All apps
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

How to Implement Maximum Purchase Quantity Limit Per Product in POS Order - Odoo 17

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
productposrestrictionodoo17
1 ตอบกลับ
3074 มุมมอง
อวตาร
Tenth Planet

Environment: Odoo Version: 17.0 (Enterprise/Community)- Module: Point of Sale

Business Requirement:

We need to implement a maximum quantity limit per product in POS orders to prevent bulk purchases during promotional periods. 

Specific Requirements:

1. Configure maximum allowed quantity per product

2. Display warning/restriction in POS when quantity exceeds the limit

3. Prevent order completion OR show alert message when limit is exceeded

Use Case:

During promotional offers, we need to ensure fair distribution of discounted products to end consumers by preventing bulk purchases. For example:- Product A has a max limit of 5 units per order- If customer tries to purchase 7 units, system should either:  - Show warning message  - OR prevent adding more than 5 units  - OR require manager approval for exceeding limit

Questions:

1. Is there any existing functionality in Odoo 17 to achieve this?

2. If not, what would be the recommended approach to implement this?   

​2a. Custom field for max quantity limit on product form?   

​2b. POS order line validation?   

​2c. Alert/restriction mechanism?

What we've Investigated: Checked standard POS configuration options- Reviewed product form fields- Searched for similar implementations

Any guidance on implementing this feature would be greatly appreciated. Technical implementation details or pointers to similar solutions would be helpful.


Regards
odoo@tenthplanet

0
อวตาร
ละทิ้ง
อวตาร
Jainesh Shah(Aktiv Software)
คำตอบที่ดีที่สุด

Hello, Tenth Planet,


To implement a maximum purchase quantity limit per product in a POS order, follow the steps outlined below:


1. Add a New Field in the Product Model


File: `models/product_product.py`

Objective: Add a new field to the `product.product` model to store the quantity limit for each product.


//Code 1 in comment//


2. Inherit the POS Data Loader in POS Session Model


File: `models/pos_session.py`

Objective: Ensure the `pos_product_qty_limit` field is loaded into the POS session for use in the frontend.


//Code 2 in comment//


3. Patch the POS Order Model


File: `static/src/js/models/order.js`

Objective: Add a validation step in the `pay` method to enforce the product quantity limit during payment.


Add this file path in the manifest under `"point_of_sale.assets_prod"`.


//Code 3 in Comment//


Ensure the `point_of_sale` dependency is added to the `__manifest__.py` file. Additionally, include the new JavaScript file path in `"point_of_sale.assets_prod"`.


5. Payment Button Behavior


When a user clicks the "Payment" button in the POS screen: 

- If a product's quantity exceeds the limit, an error popup is displayed. 

- Payment is blocked until the product quantities are corrected.


6. Output


Below is an example of the error popup displayed when a product's quantity exceeds its limit. 


 


Hope this helps! If you need any assistance with customization, feel free to contact us.


Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari


0
อวตาร
ละทิ้ง
Jainesh Shah(Aktiv Software)

//Code 1//

# -*- coding: utf-8 -*-
from odoo import api, fields, models, _

class ProductProduct(models.Model):
_inherit = "product.product"

# New field to define the maximum quantity limit for a product in POS.
pos_product_qty_limit = fields.Integer("POS Product Quantity Limit")

//Code 2//

# -*- coding: utf-8 -*-
from odoo import models

class PosSession(models.Model):
_inherit = "pos.session"

def _loader_params_product_product(self):
"""
This method customizes the loader parameters for loading product data in a POS session.
Specifically, it ensures that the `pos_product_qty_limit` field is included
when product data is loaded into the POS interface.
"""
result = super()._loader_params_product_product()

# Add the `pos_product_qty_limit` field to the list of fields to be loaded.
result["search_params"]["fields"].extend(["pos_product_qty_limit"])

return result

//Code 3//

/* @odoo-module */

import { patch } from "@web/core/utils/patch";
import { Order } from "@point_of_sale/app/store/models";
import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup";
import { _t } from "@web/core/l10n/translation";

// Patch the Order model to include quantity validation during payment.
patch(Order.prototype, {
/**
* Override the `pay` method to include custom validation logic for product quantity limits.
* This ensures that users cannot pay for an order if any product's quantity exceeds its defined limit.
*/
async pay() {
const orderLines = this.get_orderlines();

for (const line of orderLines) {
const posProductQtyLimit = line.product.pos_product_qty_limit;
// Check if the quantity exceeds the limit.
if (posProductQtyLimit > 0 && line.quantity > posProductQtyLimit) {
// Display a warning popup if the limit is exceeded.
this.env.services.popup.add(ErrorPopup, {
title: _t("Product Quantity Exceeded"),
body: _t(`The quantity for the product "${line.product.display_name}" exceeds the limit. You cannot add a quantity greater than "${posProductQtyLimit}".`),
});
return;
}
}
return super.pay(...arguments);
},
});

สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
Error replacing header text in pos แก้ไขแล้ว
pos odoo17
อวตาร
อวตาร
1
ก.ย. 25
2240
Can Odoo create combo products with inventory deduction, variants, and add-ons?
product pos
อวตาร
อวตาร
1
ม.ค. 25
2070
POS bill output v17
pos odoo17
อวตาร
อวตาร
1
ส.ค. 24
2328
POS Proudct attribute popup, show attributes dynamically
pos odoo17
อวตาร
0
มิ.ย. 24
1841
How can I sell configurable products (Pizza - REMOVE Onions or ADD Extra Cheese) in Odoo v9 POS?
product pos
อวตาร
อวตาร
2
ส.ค. 16
4778
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • Github
  • Runbot
  • การแปล
บริการ
  • โฮสติ้ง odoo.sh เซิร์ฟเวอร์
  • การสนับสนุน
  • อัปเกรด
  • การพัฒนาที่กำหนดเอง
  • การศึกษา
  • ค้นหานักบัญชี
  • ค้นหาพาร์ทเนอร์
  • ร่วมเป็นพาร์ทเนอร์
เกี่ยวกับเรา
  • บริษัทของเรา
  • ทรัพย์สินในรูปของเครื่องหมายการค้า
  • ติดต่อเรา
  • งาน
  • ระบบการจัดงานอีเวนต์
  • พอดแคสต์
  • บล็อก
  • ลูกค้า
  • กฎหมาย • ความเป็นส่วนตัว
  • ความปลอดภัย
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo เป็นชุดแอปธุรกิจแบบเปิดที่ครอบคลุมทุกความต้องการของบริษัทของคุณ อาธิ CRM eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ Odoo คือการใช้งานที่ง่ายดายและผสานการทำงานอย่างสมบูรณ์แบบในเวลาเดียวกัน

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now