Skip to Content
Odoo Меню
  • Увійти
  • Спробуйте це безкоштовно
  • Додатки
    Фінанси
    • Бухоблік
    • Виставлення рахунку
    • Витрати
    • Електронні таблиці (BI)
    • Документи
    • Підпис
    Продажі
    • CRM
    • Продажі
    • POS Магазин
    • POS Ресторан
    • Підписки
    • Оренда
    Веб-сайти
    • Конструктор веб-сайту
    • Електронна комерція
    • Блог
    • Форум
    • Живий чат
    • Електронне навчання
    Ланцюг поставок
    • Склад
    • Виробництво
    • PLM
    • Купівлі
    • Технічне обслуговування
    • Якість
    Кадри
    • Співробітники
    • Рекрутинг
    • Відпустки
    • Оцінювання
    • Рекомендації
    • Автотранспорт
    Маркетинг
    • Маркетинг соцмереж
    • Email-маркетинг
    • SMS-маркетинг
    • Події
    • Автом. маркетингу
    • Опитування
    Послуги
    • Проект
    • Табелі
    • Виїзне обслуговування
    • Служба підтримки
    • Планування
    • Призначення
    Продуктивність
    • Обговорення
    • Схвалення
    • IoT
    • IP-телефонія
    • База знань
    • WhatsApp
    Сторонні модулі Odoo Studio Платформа Odoo Cloud
  • Сфери
    Роздрібна торгівля
    • Книжковий магазин
    • Магазин одягу
    • Магазин меблів
    • Продуктовий магазин
    • Магазин будівельних матеріалів
    • Магазин іграшок
    Food & Hospitality
    • Бар та паб
    • Ресторан
    • Фастфуд
    • Guest House
    • Дистриб'ютор напоїв
    • Hotel
    Нерухомість
    • Real Estate Agency
    • Архітектурна фірма
    • Будівництво
    • Управління нерухомістю
    • Садівництво
    • Асоціація власників нерухомості
    Консалтинг
    • Бухгалтерська компанія
    • Партнер Odoo
    • Агенція маркетингу
    • Юридична фірма
    • Придбання Талантів
    • Аудит та сертифікація
    Виробництво
    • Textile
    • Metal
    • Меблі
    • Їжа
    • Brewery
    • Корпоративні подарунки
    Здоров'я & Фітнес
    • Спортивний клуб
    • Оптика
    • Фітнес-центр
    • Практики здоров'я
    • Аптека
    • Салон краси
    Trades
    • Ремонтник
    • IT-обладнання та Підтримка
    • Системи сонячної енергії
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Інші
    • Nonprofit Organization
    • Екологічна агенція
    • Оренда білбордів
    • Фотографія
    • Лізинг велосипедів
    • Реселлер програмного забезпечення
    Browse all Industries
  • Спільнота
    Навчання
    • Навчальний посібник
    • Документація
    • Сертифікації
    • Тренування
    • Блог
    • Подкаст
    Сприяйте Освіті
    • Програма навчання
    • Бізнес гра Scale Up!
    • Відвідайте 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:

  • CRM
  • 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 edit Total value from order form

Підписатися

Отримуйте сповіщення про активність щодо цієї публікації

Це запитання позначене
ordertotal
15 Відповіді
7944 Переглядів
Аватар
Matthieu

Hello,


I tried differents things but my problem is that I don't know how to edit one field in the order form of point of sale. I'm currently using Odoo 9.

You can see the field, in the red circle, here :

http://i.imgur.com/DjEYJiS.png

Maybe, the changes to do are in a python or javascript file.


Please, help me.


Thanks.

0
Аватар
Відмінити
Juan Vicente Pascual

search for the text 'def _amount_all_wrapper' in sale module so you can see what this method do, then you need to override it creating a custom module. What kind of change do you want to make to the amount_total field?

Matthieu
Автор

Hi Juan, Thank you for your help ! I searched in the sale module and I also did a "cat * | grep -R -e "_amount_all_wrapper" > /home/matthieu/result.txt but I didn't found it, it's why I'm asking for the file to find it. To answer your question, I did a custom module and I need to add to this value the value of the attribute "coupon_nb" from an inherit of pos_order from Point Of Sale. Thanks so much for your help !

Аватар
Matthieu
Автор Найкраща відповідь

Finally, it works.

My code is here :

class pos_order(osv.osv):

_name = 'pos.order'

_inherit = 'pos.order'

def _amount_all(self, cr, uid, ids, name, args, context=None):

res = super(pos_order, self)._amount_all(cr, uid, ids, name, args, context)

for order in self.browse(cr, uid, ids, context=context):

res[order.id]['amount_total'] += 42

return res

_columns = {

'amount_tax': fields.function(_amount_all, string='Taxes', digits=0, multi='all'),

'amount_total': fields.function(_amount_all, string='Total', digits=0, multi='all'),

'amount_paid': fields.function(_amount_all, string='Paid', states={'draft': [('readonly', False)]}, readonly=True, digits=0, multi='all'),

'amount_return': fields.function(_amount_all, string='Returned', digits=0, multi='all'),

}





0
Аватар
Відмінити
Аватар
Prakash
Найкраща відповідь

the field you are considering is the function/compute fields ,you can't change it value from front end , you can change it value only by overriding the _amount_all    method only.


@api.depends('order_line.price_total')
def _amount_all(self):
for order in self:
    amount_untaxed = amount_tax = 0.0
for line in order.order_line:
    amount_untaxed += line.price_subtotal
    amount_tax += line.price_tax
 order.update({
'amount_untaxed': order.pricelist_id.currency_id.round(amount_untaxed),
'amount_tax': order.pricelist_id.currency_id.round(amount_tax),
'amount_total': amount_untaxed + amount_tax,
 })

in odoo9 https://github.com/odoo/odoo/blob/9.0/addons/sale/sale.py#L24 


amount_total = fields.Monetary(string='Total', store=True, readonly=True, compute='_amount_all', track_visibility='always')
1
Аватар
Відмінити
Matthieu
Автор

Thank you, but where is this method ? I've only found in point_of_sale.py : 'amount_total': fields.function(_amount_all, string='Total', digits=0, multi='all')

Prakash

Hi Matthieu , i have update my answer above ,just open this link https://github.com/odoo/odoo/blob/9.0/addons/sale/sale.py#L24

Matthieu
Автор

Ok, but my value is from an inherit of pos.order (https://github.com/odoo/odoo/blob/9.0/addons/point_of_sale/point_of_sale.py). So if I want to add it to amount_total of sale.py, how can I do ? Manythanks for your help !

OdooBot
open this https://github.com/odoo/odoo/blob/9.0/addons/point_of_sale/point_of_sale.py#L842

On Wed, May 11, 2016 at 11:01 PM, Matthieu <matthieu.artaud@gmail.com> wrote:

Ok, but my value is from an inherit of pos.order (https://github.com/odoo/odoo/blob/9.0/addons/point_of_sale/point_of_sale.py). So if I want to add it to amount_total of sale.py, how can I do ? Manythanks for your help !

--
Matthieu

Sent by Odoo S.A. using Odoo

Matthieu
Автор

Well, if this can really modify the field "Total" of orders, I think I didn't inherit it correctly. Here is my code : http://pastebin.com/1xF83Nt1 But the value is not changed at all :( Thanks a lot for all the answers !

Matthieu
Автор

I tried differents things : -> I tried to directly edit the point_of_sale.py and I edited the line as it : res[order.id]['amount_total'] = res[order.id]['amount_tax'] + amount_untaxed + 42. The result was changed, so it was a sucess. -> I added a log in my function to see if it is executed. The log message was not written so I think the problem is that my function is not overriting the original one at all. I gonna try to see why, but if you find the problem, help me please !

Juan Vicente Pascual

Have you added the module name in the __openerp__.py file in depends tag?

Matthieu
Автор

I have found the reason : the function name is _amount_all But the functions wich start with underscore (_) are private. So I can't inherit it.

Matthieu
Автор

Yes, Juan, I did it

Аватар
Juan Vicente Pascual
Найкраща відповідь

The function you need is in the sale module in file sale.py,

this is the code,

def _amount_all_wrapper(self, cr, uid, ids, field_name, arg, context=None):

""" Wrapper because of direct method passing as parameter for function fields """

return self._amount_all(cr, uid, ids, field_name, arg, context=context)

def _amount_all(self, cr, uid, ids, field_name, arg, context=None):

cur_obj = self.pool.get('res.currency')

res = {}

for order in self.browse(cr, uid, ids, context=context):

res[order.id] = {

'amount_untaxed': 0.0,

'amount_tax': 0.0,

'amount_total': 0.0,

}

val = val1 = 0.0

cur = order.pricelist_id.currency_id

for line in order.order_line:

val1 += line.price_subtotal

val += self._amount_line_tax(cr, uid, line, context=context)

res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val)

res[order.id]['amount_untaxed'] = cur_obj.round(cr, uid, cur, val1)

res[order.id]['amount_total'] = res[order.id]['amount_untaxed'] + res[order.id]['amount_tax']

return res

just override the function  _amount_all  to change the price based on your coupon.

This functions are from v8.

Kind regards.

0
Аватар
Відмінити
Matthieu
Автор

Thank you, this function doesn't exist anymore in Odoo 9 but I think _amount_all is the same, up to date. I'll try !

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Реєстрація
Related Posts Відповіді Переглядів Дія
How to modify amount_total from pos_order
order total amount
Аватар
Аватар
Аватар
4
трав. 16
5530
How can I change the address of my Warehouse (Purchase Order)? Вирішено
order
Аватар
Аватар
1
січ. 24
3111
OrderReceipt.xml
order
Аватар
Аватар
1
груд. 22
4074
How to display 'total' under a column containing numeric values in tree view Вирішено
total
Аватар
Аватар
1
жовт. 24
26775
Discount on Purchase order
order
Аватар
Аватар
Аватар
2
серп. 21
3821
Спільнота
  • Навчальний посібник
  • Документація
  • Форум
Open Source
  • Завантаження
  • 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, електронна комерція, бухгалтерський облік, склад, точка продажу, управління проектами тощо.

Унікальна пропозиція 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