跳至内容
菜单
此问题已终结
1 回复
2845 查看

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.​


 

形象
丢弃
编写者


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)

最佳答案

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.

形象
丢弃
相关帖文 回复 查看 活动
2
8月 23
4752
0
8月 23
1289
1
3月 24
3384
1
12月 23
2125
0
11月 23
38