Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
2841 Tampilan

Hi!

I need create a new type of invoice from POS, in Chile(like in other countries) we have many document types for sale products, two of de most common are electronic invoice (factura electrónica in spanish) and electronic ticket (boleta electrónica).

I have models and fields that i need to create the electronic ticket from the account module.

Actually by default in POS interface exist the invoice option to sale the products. To add the option i put the ticket option after the invoice option:

xml version="1.0" encoding="UTF-8"?>

    <templatesid="template"xml:space="preserve"> 

       <t-name="PaymentScreen"

            t-inherit="point_of_sale.PaymentScreen"t-inherit-mode="extension"owl="1">                                       <xpath expr="//div[hasclass('button js_invoice')]"position="after">                                        <div class="button js_boleta"               

                 t-att-class="{ highlight: currentOrder.is_to_ticket() }" 

                 t-on-click="toggleIsToTicket">                

            <iclass="fa fa-file-text-o"/> Boleta                            

        div>      

      xpath>    

    t>

templates>


After that i inherited some functions to make the ticket option works well, the last function i use is this:

async _finalizeValidation() {          

    if ((this.currentOrder.is_paid_with_cash() || this.currentOrder.get_change()) &&                                   this.env.pos.config.iface_cashdrawer) {                                                                                                  this.env.proxy.printer.open_cashbox();  }

    this.currentOrder.initialize_validation_date();

    this.currentOrder.finalized = true

    letsyncOrderResult, hasError

    try

         // 1. Save order to server. 

        syncOrderResult = awaitthis.env.pos.push_single_order(this.currentOrder);

        // 2. Invoice.

        if (this.currentOrder.is_to_invoice()) {   

            if (syncOrderResult.length) {

                await this.env.legacyActionManager.do_action('account.account_invoices', { 

                    additional_context: {  

                        active_ids: [syncOrderResult[0].account_move],

                     },   

                  }); 

             } else {

                throw { code:401, message:'Backend Invoice', data: { order:this.currentOrder } };                        }

        }

        if (this.currentOrder.is_to_ticket()) {   

            if (syncOrderResult.length) {

                await this.env.legacyActionManager.do_action('account.account_invoices', { 

                    additional_context: {  

                        active_ids: [syncOrderResult[0].account_move],

                     },   

                  }); 

             } else {

                throw { code:401message:'Backend Invoice'data: { order:this.currentOrder } };                        }

        }

        // 3. Post process. 

        if (syncOrderResult.length && this.currentOrder.wait_for_push_order()) {                                        constpostPushResult = awaitthis._postPushOrderResolve(

            this.currentOrder

            syncOrderResult.map((res) =>res.id)

          );

          if (!postPushResult) {

            this.showPopup('ErrorPopup', { 

                title:this.env._t('Error: no internet connection.'), 

                body:this.env._t('Some, if not all, post-processing after syncing order failed.'),

             });                       

         }

    } 

} catch....


But i don't know what to do next, how tell to account move what type is it.

The field that indicates to account_move what type of invoice is it, is l10n_latam_document_type_id


Thank you very much in advance.​


 

Avatar
Buang
Penulis


More than that i need to understand the complete POS billing process in v16 and for all the code that goes through (xml, javascript, python)

Jawaban Terbai

Pudiste implementar esto? En Perú tambien se requiere 2 tipos de invoice (Facturas y Boletas de Venta), pero estoy revisando varios tutoriales, pero ninguno me está funcionando.

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Agu 23
4732
0
Agu 23
1273
1
Mar 24
3365
1
Des 23
2116
0
Nov 23
38