Skip to Content
Odoo Menu
  • Prihlásiť sa
  • Vyskúšajte zadarmo
  • Aplikácie
    Financie
    • Účtovníctvo
    • Fakturácia
    • Výdavky
    • Tabuľka (BI)
    • Dokumenty
    • Podpis
    Predaj
    • CRM
    • Predaj
    • POS Shop
    • POS Restaurant
    • Manažment odberu
    • Požičovňa
    Webstránky
    • Tvorca webstránok
    • eShop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Supply Chain
    • Sklad
    • Výroba
    • Správa životného cyklu produktu
    • Nákup
    • Údržba
    • Manažment kvality
    Ľudské zdroje
    • Zamestnanci
    • Nábor zamestnancov
    • Voľné dni
    • Hodnotenia
    • Odporúčania
    • Vozový park
    Marketing
    • Marketing sociálnych sietí
    • Email marketing
    • SMS marketing
    • Eventy
    • Marketingová automatizácia
    • Prieskumy
    Služby
    • Projektové riadenie
    • Pracovné výkazy
    • Práca v teréne
    • Helpdesk
    • Plánovanie
    • Schôdzky
    Produktivita
    • Tímová komunikácia
    • Schvalovania
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Priemyselné odvetvia
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Reštaurácia
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Reality
    • Real Estate Agency
    • Architecture Firm
    • Konštrukcia
    • Estate Managament
    • Gardening
    • Property Owner Association
    Poradenstvo
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Jedlo
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Iní
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Komunita
    Vzdelávanie
    • Tutoriály
    • Dokumentácia
    • Certifikácie
    • Školenie
    • Blog
    • Podcast
    Empower Education
    • Vzdelávací program
    • Scale Up! Business Game
    • Visit Odoo
    Softvér
    • Stiahnuť
    • Porovnanie Community a Enterprise vierzie
    • Releases
    Spolupráca
    • Github
    • Fórum
    • Eventy
    • Preklady
    • Staň sa partnerom
    • Services for Partners
    • Register your Accounting Firm
    Služby
    • Nájdite partnera
    • Nájdite účtovníka
    • Meet an advisor
    • Implementation Services
    • Zákaznícke referencie
    • Podpora
    • Upgrades
    ​Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Získajte demo
  • Cenník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účtovníctvo
  • Sklady
  • PoS
  • Projektové riadenie
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tagy (View all)
odoo accounting v14 pos v15
About this forum
Pomoc

[8.0] Generating INVOICE from REPAIR ORDER - FLEET ID doesnt appear

Odoberať

Get notified when there's activity on this post

This question has been flagged
fleetinvoicemrp_repairodooV8
2 Replies
4933 Zobrazenia
Avatar
Mohammed Kamar-eddine

Using ODOO v8, Creating INVOICE from REPAIR ORDER - the vehicle (fleet_id) doesnt get transferred to the final INVOICE. What lines could i include to the .py file under 'action_nvoice_create' to allow the vehicule in the repair order to be transferred to the INVOICE

				
					
				


0
Avatar
Zrušiť
Mohammed Kamar-eddine
Autor

Odoo Server Error

Traceback (most recent call last):

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 539, in _handle_exception

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 576, in dispatch

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 312, in _call_function

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 118, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 309, in checked_call

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 805, in __call__

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 405, in response_wrap

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\web\controllers\main.py", line 955, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 1113, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 881, in proxy_method

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 115, in dispatch_rpc

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 37, in dispatch

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 118, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 188, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 182, in exec_workflow_cr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 164, in execute_cr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 3571, in signal_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\__init__.py", line 85, in trg_validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\service.py", line 91, in validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\instance.py", line 80, in validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 120, in process

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 248, in _split_test

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 257, in _join_test

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 95, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 116, in process

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 162, in _execute

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 313, in wkf_expr_execute

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 291, in wkf_expr_eval_expr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\tools\safe_eval.py", line 314, in safe_eval

File "", line 1, in <module>

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 266, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 564, in new_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mrp_repair\mrp_repair.py", line 306, in wkf_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\garage\objects\mrp_repair.py", line 558, in action_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mrp_repair\mrp_repair.py", line 351, in action_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\garage\objects\invoice.py", line 50, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mail\mail_thread.py", line 381, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 372, in old_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 4093, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 266, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 508, in new_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 4231, in _create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\sql_db.py", line 158, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\sql_db.py", line 234, in execute

ValueError: "null value in column "fleet_id" violates not-null constraint

DETAIL: Failing row contains (2, null, null, 0.00, null, null, null, null, 1, 113, 2016-06-25 14:54:53.655, 1, null, null, null, 296, null, none, 2, null, draft, null, out_invoice, null, 1179, f, null, null, null, null, 2016-06-25 14:54:53.655, 1, 1, OR-003, null, OR-003, f, null, null, 1, null, null, null).

" while evaluating

u'wkf_invoice_create()'

Avatar
Mohammed Kamar-eddine
Autor Best Answer

def action_invoice_create(self, cr, uid, ids, group=False, context=None):
    context = dict(context or {})
    repair = self.browse(cr, uid, ids[0], context)
    context['default_fleet_id'] = repair.fleet_id and repair.fleet_id.id or False
    res = super(mrp_repair, self).action_invoice_create(
        cr, uid, ids, group=group, context=context)

I've added the code listed above, which resulted in this code below:


def action_invoice_create(self, cr, uid, ids, group=False, context=None):
    print "action_invoice_create---------------",ids, group, context
    context = dict(context or {})
    repair = self.browse(cr, uid, ids[0], context)
    context['fleet_id'] = repair.fleet_id and repair.fleet_id.id or False
    res = super(mrp_repair, self).action_invoice_create(cr, uid, ids,
                                                        group=group,
                                                        context=context)
    inv_line_obj = self.pool.get('account.invoice.line')
    inv_obj = self.pool.get('account.invoice')
    for repair_id, invoice_id in res.iteritems():
        if not invoice_id:
            continue
        invoice  = inv_obj.browse(cr, uid, invoice_id) #activated by MSKE-25/06/2016
        inv_obj.write(cr, uid, [invoice_id],{'fleet_id': fleet_id}) # added by MSKE-25/06/2016
        for rsol in repair.order_line_ids:
            name = rsol.name or ''

            if rsol.product_id.property_account_income:
                account_id = rsol.product_id.property_account_income.id
            elif rsol.product_id.categ_id.property_account_income_categ:
                account_id = rsol.product_id.categ_id.property_account_income_categ.id
            else:
                raise osv.except_osv(_('Error!'), _('No account defined for product "%s".') % rsol.product_id.name)
            invoice_line_vals = {
                'invoice_id': invoice_id,
                'name': rsol.product_id.name,
                'origin': rsol.repair_sale_order_line_id.name,
                'account_id': account_id,
                #'quantity': rsol.product_uom_qty,
                'invoice_line_tax_id': [(6, 0, [x.id for x in rsol.tax_id])],
                'uos_id': rsol.product_id.uom_id.id,
                'price_unit': rsol.price_unit,
                'price_subtotal': rsol.product_uom_qty * rsol.price_unit,
                'product_id': rsol.product_id and rsol.product_id.id or False
            }

            print "invoice_line_vals----------",invoice_line_vals

            invoice_line_id = inv_line_obj.create(cr, uid, invoice_line_vals)
            print "after line create----------------------------",invoice_line_id
        self.pool.get('account.invoice').\
            button_reset_taxes(cr, uid, invoice_id, context=context)
    return res

But i'm receiving the error:

ValueError: "null value in column "fleet_id" violates not-null constraint

Any advice? Where did i go wrong

0
Avatar
Zrušiť
Mohammed Kamar-eddine
Autor

THE ERROR im receiving now:

Odoo Server Error

Traceback (most recent call last):

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 539, in _handle_exception

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 576, in dispatch

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 312, in _call_function

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 118, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 309, in checked_call

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 805, in __call__

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 405, in response_wrap

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\web\controllers\main.py", line 955, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 1113, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 881, in proxy_method

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\http.py", line 115, in dispatch_rpc

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 37, in dispatch

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 118, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 188, in exec_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 182, in exec_workflow_cr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\service\model.py", line 164, in execute_cr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 3571, in signal_workflow

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\__init__.py", line 85, in trg_validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\service.py", line 91, in validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\instance.py", line 80, in validate

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 120, in process

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 248, in _split_test

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 257, in _join_test

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 95, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 116, in process

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 162, in _execute

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 313, in wkf_expr_execute

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\workflow\workitem.py", line 291, in wkf_expr_eval_expr

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\tools\safe_eval.py", line 314, in safe_eval

File "", line 1, in <module>

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 266, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 564, in new_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mrp_repair\mrp_repair.py", line 306, in wkf_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\garage\objects\mrp_repair.py", line 558, in action_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mrp_repair\mrp_repair.py", line 351, in action_invoice_create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\garage\objects\invoice.py", line 50, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\openerp\addons\mail\mail_thread.py", line 381, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 268, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 372, in old_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 4093, in create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 266, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\api.py", line 508, in new_api

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\models.py", line 4231, in _create

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\sql_db.py", line 158, in wrapper

File "C:\Program Files (x86)\Odoo 8.0-20160420\server\.\openerp\sql_db.py", line 234, in execute

ValueError: "null value in column "fleet_id" violates not-null constraint

DETAIL: Failing row contains (2, null, null, 0.00, null, null, null, null, 1, 113, 2016-06-25 14:54:53.655, 1, null, null, null, 296, null, none, 2, null, draft, null, out_invoice, null, 1179, f, null, null, null, null, 2016-06-25 14:54:53.655, 1, 1, OR-003, null, OR-003, f, null, null, 1, null, null, null).

" while evaluating

u'wkf_invoice_create()'

Avatar
ayman mohammed adam
Best Answer

Dear all,

you must add 

fleet_id field  many2one on account.invoice Model and then update this field on created invoice  



def action_invoice_create(self, cr, uid, ids, group=False, context=None):
        print "action_invoice_create---------------",ids, group, context
        repair = self.browse(cr, uid, ids[0])
        res = super(mrp_repair, self).action_invoice_create(cr, uid, ids,
                                                            group=group,
                                                            context=context)
        inv_line_obj = self.pool.get('account.invoice.line')
        inv_obj = self.pool.get('account.invoice')
        for repair_id, invoice_id in res.iteritems():
            if not invoice_id:
                continue

                        invoice = inv_obj.browse(cr, uid, invoice_id)
                        inv_obj.write(cr, uid, [invoice_id],{'fleet_id':your fleet _id})
0
Avatar
Zrušiť
Enjoying the discussion? Don't just read, join in!

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

Registrácia
Related Posts Replies Zobrazenia Aktivita
Generate invoice automatic when confirm sale in sales order
invoice odooV8
Avatar
Avatar
1
nov 16
8447
Invoice duplicate function
invoice duplication odooV8
Avatar
Avatar
1
dec 22
6476
Advance on sale without created invoice
invoice advance odooV8
Avatar
Avatar
2
jún 20
4608
Translation not working for invoice report
invoice report odooV8
Avatar
Avatar
Avatar
5
jan 20
9083
Invoice number - validating an invoice will not re-use the internal_number if exists Solved
invoice invoice_number odooV8
Avatar
1
nov 17
4597
Komunita
  • Tutoriály
  • Dokumentácia
  • Fórum
Open Source
  • Stiahnuť
  • Github
  • Runbot
  • Preklady
Služby
  • Odoo.sh hosting
  • Podpora
  • Vyššia verzia
  • Custom Developments
  • Vzdelávanie
  • Nájdite účtovníka
  • Nájdite partnera
  • Staň sa partnerom
O nás
  • Naša spoločnosť
  • Majetok značky
  • Kontaktujte nás
  • Pracovné ponuky
  • Eventy
  • Podcast
  • Blog
  • Zákazníci
  • Právne dokumenty • Súkromie
  • Bezpečnosť
الْعَرَبيّة 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 je sada podnikových aplikácií s otvoreným zdrojovým kódom, ktoré pokrývajú všetky potreby vašej spoločnosti: CRM, e-shop, účtovníctvo, skladové hospodárstvo, miesto predaja, projektový manažment atď.

Odoo prináša vysokú pridanú hodnotu v jednoduchom použití a súčasne plne integrovanými biznis aplikáciami.

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