콘텐츠로 건너뛰기
Odoo 메뉴
  • 로그인
  • 무료 체험하기
  • 앱
    재무 관리
    • 회계
    • 청구서 관리
    • 비용 관리
    • 스프레드시트 (BI)
    • 문서
    • 전자 서명
    판매
    • CRM
    • 판매
    • POS 스토어
    • POS 레스토랑
    • 구독
    • 렌탈
    웹사이트
    • 웹사이트 빌더
    • 이커머스
    • 블로그
    • 포럼
    • 실시간 채팅
    • 온라인 학습 관리
    공급망
    • 재고 관리
    • 제조 관리
    • 제품 수명주기 관리 (PLM)
    • 매입
    • 유지관리
    • 품질
    인적자원 관리
    • 직원
    • 채용
    • 휴가 관리
    • 인사 평가
    • 인재 추천
    • 차량 관리
    마케팅
    • 소셜 마케팅
    • 이메일 마케팅
    • SMS 마케팅
    • 행사
    • 마케팅 자동화
    • 설문 조사
    서비스
    • 프로젝트
    • 작업 기록
    • 현장 서비스
    • 헬프데스크
    • 일정 관리
    • 일정 예약
    생산성
    • 메일 및 채팅
    • 전자 결재
    • IoT
    • VoIP
    • 지식 센터
    • WhatsApp
    타사 앱 Odoo 스튜디오 Odoo 클라우드 플랫폼
  • 인더스트리
    리테일
    • 서점
    • 의류 매장
    • 가구점
    • 식료품점
    • 철물점
    • 장난감 가게
    식음료 & 숙박업
    • 바 & 펍
    • 레스토랑
    • 패스트푸드
    • 게스트 하우스
    • 음료 유통업체
    • 호텔
    부동산
    • 부동산 중개업체
    • 건축 회사
    • 건설
    • 부동산 관리
    • 가드닝
    • 부동산 소유자 협회
    컨설팅
    • 회계 법인
    • Odoo 파트너
    • 마케팅 대행사
    • 법률 사무소
    • 인재 영입
    • 감사 및 인증
    제조 관리
    • 텍스타일
    • 메탈
    • 가구
    • 푸드
    • 양조장
    • 기업용 선물
    건강 & 피트니스
    • 스포츠 클럽
    • 안경점
    • 피트니스 센터
    • 웰니스 전문가
    • 약국
    • 미용실
    사업
    • 핸디맨
    • IT 하드웨어 및 지원 서비스
    • 태양 에너지 시스템
    • 제화업체
    • 클리닝 서비스
    • HVAC 서비스
    기타
    • 비영리 단체
    • 환경 에이전시
    • 광고판 임대
    • 사진
    • 자전거 임대
    • 소프트웨어 리셀러
    전체 인더스트리 찾아보기
  • 커뮤니티
    학습
    • 튜토리얼
    • 문서
    • 인증
    • 훈련
    • 블로그
    • 팟캐스트
    교육 역량 강화
    • 교육 프로그램
    • Scale-Up! 경영관리 게임
    • Odoo에 방문해보세요
    소프트웨어 신청
    • 다운로드
    • 버전 살펴보기
    • 릴리즈 내역
    협업
    • Github
    • 포럼
    • 행사
    • 번역
    • 파트너 등록
    • 파트너 대상 서비스
    • 회계 법인 정보 등록
    서비스 신청
    • 파트너 검색
    • 회계사 검색
    • 전문 상담 예약
    • 구현 서비스
    • 고객 정보
    • 고객 지원
    • 업그레이드
    Github 유튜브 트위터 링크드인 인스타그램 페이스북 스포티파이
    +1 (650) 691-3277
    데모 예약하기
  • 요금제
  • 고객 지원

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

  • CRM
  • e-Commerce
  • 회계
  • 재고 관리
  • PoS
  • 프로젝트
  • MRP
All apps
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
모든 게시물 사용자 배지
태그 (모두 보기)
odoo accounting v14 pos v15
게시판 정보
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
모든 게시물 사용자 배지
태그 (모두 보기)
odoo accounting v14 pos v15
게시판 정보
도움말

POS module modify javascript function odoo 9

구독

이 게시물에 활동이 있으면 알림 받기

신고된 질문입니다
javascriptposv9odoo9
6 답글
16354 화면
아바타
Sam

Need to replace original function of odoo 9 pos module with my own one. Never did it before so studied manuals and samples first but still no success.

Original code in screens.js is the following:


var PosBaseWidget = require('point_of_sale.BaseWidget');
var gui = require('point_of_sale.gui');
var models = require('point_of_sale.models');
var core = require('web.core');
var Model = require('web.DataModel');
var utils = require('web.utils');
var formats = require('web.formats');
var QWeb = core.qweb;
var _t = core._t;
var round_pr = utils.round_precision;
/*--------------------------------------*\
| THE SCREEN WIDGET |
\*======================================*/
// The screen widget is the base class inherited
var ScreenWidget = PosBaseWidget.extend({
init: function(parent,options){
this._super(parent,options);
this.hidden = false;
},
barcode_product_screen: 'products', //if defined, this screen will be loaded when a product is scanned
// what happens when a product is scanned :
// it will add the product to the order and go to barcode_product_screen.
barcode_product_action: function(code){
var self = this;
if (self.pos.scan_product(code)) {
if (self.barcode_product_screen) {
self.gui.show_screen(self.barcode_product_screen);
}
} else {
this.barcode_error_action(code);
}
},
... etc ...

I'm doing the following thing:

openerp.my_pos = function (instance) {
module = instance.point_of_sale;
var QWeb = instance.web.qweb;
var _t = instance.web._t;
var gui = require('point_of_sale.gui');
var models = require('point_of_sale.models');
var core = require('web.core');
var Model = require('web.DataModel');
var utils = require('web.utils');
var formats = require('web.formats');
module.ScreenWidget.prototype.barcode_product_action = function (code) {
var show_code;
if (code.code.length > 32) {
show_code = code.code.substring(0, 29) + '...';
} else {
show_code = code.code;
}
this.gui.show_popup('error-barcode', show_code);
};
};

But it does not affect behavior.

Below is my xml file I'm inserting my code with:


<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="pos assets" inherit_id="point_of_sale.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/mopnex_erp/static/src/js/my_pos.js"></script>
</xpath>
</template>
</data>
</openerp>
0
아바타
취소
아바타
Sam
작성자 베스트 답변

Solved finally. Below is the code (v9)


odoo.define('my_pos.my_pos', function (require) {
"use strict";
var screens = require('point_of_sale.screens');

screens.ScreenWidget.include({
barcode_product_action: function (code) {
var show_code;
if (code.code.length > 32) {
show_code = code.code.substring(0, 29) + '...';
} else {
show_code = code.code;
}
this.gui.show_popup('error-barcode', show_code);
},
});
});

2
아바타
취소
Adnier Rosello

I have tried something like that but I got this error:

"Missing dependencies: ["account.account_payment_widget"] " at the line :

var payment = require('account.account_payment_widget');

아바타
Tuan
베스트 답변

Hello isio-odoo


Here is an example for you


```

module.PaymentScreenWidget.include({
    	
    	validate_order: function=||var=this(options) {
    		options  options  {}; 
           
            
            // Write your code here

          ._super(options);
}, });

```

Hope it help!

0
아바타
취소
아바타
Shahid M
베스트 답변


here is a complete example, i have orride set_discount method in orderline module 
openerp.yourprojectname = function(instance, module) {

var module = instance.point_of_sale;

var _t = instance.web._t,

_lt = instance.web._lt;

var QWeb = instance.web.qweb;

var round_di = instance.web.round_decimals;

var round_pr = instance.web.round_precision

var orderline_id = 1;

module.Orderline = Backbone.Model.extend({

initialize: function (attr, options) {

this.pos = options.pos;

this.order = options.order;

this.product = options.product;

this.price = options.product.price;

this.quantity = 1;

this.quantityStr = '1';

this.discount = 0;

this.discountStr = '0';

this.type = 'unit';

this.selected = false;

this.id = orderline_id++;},

set_discount: function (discount) {

//var disc = Math.min(Math.max(parseFloat(discount) || 0, 0), 100);

//this.discount = disc;

this.discount = discount;

this.discountStr = '' + discount;

this.trigger('change', this);

},
)}

0
아바타
취소
아바타
aymenisio
베스트 답변

Hello,

I want to change this function from screen on the point of sale

validate_order 

i need to add some other contrainte  on this function

how i can do it (Odoo V8 )

thank you

0
아바타
취소
Sam
작성자

You can overload this function just like it is done in the code above. Find the proper module and widget, find the function, use "include" or "extend" to add your own code, do not forget to call the original one with "_super" or "prototype".

aymenisio

Have you any exemple plz ?

토론이 재미있으신가요? 직접 참여해보세요!

지금 바로 가입하여 독점 서비스를 이용해보고 특별한 커뮤니티와 소통하세요!

가입
관련 게시물 답글 화면 활동
POS module Widget inheritance java script issue
javascript pos widget v9
아바타
0
10월 15
6090
does odoo 17 allow to add button to Navbar header in point of sale session inside it to get dynamic data
javascript pos
아바타
아바타
1
11월 24
2240
How to add product in POS programmatically 해결 완료
javascript pos
아바타
아바타
아바타
아바타
4
10월 24
5251
JavaScript: Calling _super() on the parent of the parent
javascript pos
아바타
0
10월 22
5989
Javascript in POS not loaded
javascript pos
아바타
0
9월 22
38
커뮤니티
  • 튜토리얼
  • 문서
  • 포럼
오픈 소스
  • 다운로드
  • 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, 이커머스, 회계, 재고, POS, 프로젝트 관리 등 기업의 모든 요구 사항을 충족하도록 설계된 오픈 소스 기반의 통합 비즈니스 앱 제품군입니다.

Odoo의 간편한 UI와 완벽하게 통합된 기능을 직접 확인해 보세요.

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