Skip to content

Commit

Permalink
[ADD] l10n_uy_demo: data demo para Uruguay y [REF] l10n_uy_edi: renam…
Browse files Browse the repository at this point in the history
…e journal to avoid problem with alias

X-original-commit: 0a166db
X-original-commit: 06b25f3
  • Loading branch information
fw-bot-adhoc authored and zaoral committed May 15, 2023
1 parent 4cb8569 commit 2ad414d
Show file tree
Hide file tree
Showing 11 changed files with 639 additions and 36 deletions.
6 changes: 6 additions & 0 deletions l10n_uy_account/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@
],
'demo': [
'demo/res_company_demo.xml',
'demo/account_journal_demo.xml',
'demo/res_currency_rate_demo.xml',
'demo/account_chart_template_demo.xml',
'demo/res_partner_demo.xml',
'demo/account_customer_invoice_demo.xml',
'demo/account_customer_refund_demo.xml',
'demo/account_supplier_invoice_demo.xml',
'demo/account_supplier_refund_demo.xml',
'demo/l10n_uy_adenda_demo.xml',
# restore
'demo/res_users_demo.xml',
Expand Down
187 changes: 187 additions & 0 deletions l10n_uy_account/demo/account_customer_invoice_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">

<!-- TODO This demo data is for functional testing and demo but also was used for tests. Test cases should be moved to proper tests -->
<!-- Invoice to gritti support service, vat 21 -->
<record id="demo_invoice_1" model="account.move" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="company_id" ref="company_uy"/>
<field name="partner_id" ref="demo_partner_5"/>
<field name="invoice_user_id" ref="base.user_demo"/>
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
<field name="move_type">out_invoice</field>
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-01'"/>
<field name="journal_id" model="account.journal" eval="obj().search([('type', '=', 'sale'), ('l10n_uy_type', '=', 'preprinted')])"/>
<field name="invoice_line_ids" eval="[
(0, 0, {'product_id': ref('product.product_product_2'), 'price_unit': 642.0, 'quantity': 1}),
(0, 0, {'product_id': ref('product.product_product_12'), 'price_unit': 120.0, 'quantity': 4}),
(0, 0, {'product_id': ref('product.product_product_16'), 'price_unit': 25.0, 'quantity': 20}),
(0, 0, {'product_id': ref('product.product_product_20'), 'price_unit': 1950.0, 'quantity': 4}),
]"/>
</record>

<record id="demo_invoice_2" model="account.move" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="company_id" ref="company_uy"/>
<field name="partner_id" ref="demo_partner_5"/>
<field name="invoice_user_id" ref="base.user_demo"/>
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
<field name="move_type">out_invoice</field>
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-05'"/>
<field name="journal_id" model="account.journal" eval="obj().search([('type', '=', 'sale'), ('l10n_uy_type', '=', 'preprinted')])"/>
<field name="l10n_latam_document_type_id" model="l10n_latam.document.type" eval="obj().env.ref('l10n_uy_account.dc_e_inv')"/>
<field name="invoice_line_ids" eval="[
(0, 0, {'product_id': ref('product.product_product_27'), 'price_unit': 642.0, 'quantity': 5}),
(0, 0, {'product_id': ref('product.product_product_25'), 'price_unit': 3245.0, 'quantity': 2}),
(0, 0, {'product_id': ref('product.consu_delivery_01'), 'price_unit': 4000.0, 'quantity': 5}),
]"/>
</record>

<!-- Invoice to consumidor final -->
<record id="demo_invoice_3" model="account.move" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="company_id" ref="company_uy"/>
<field name="partner_id" ref="partner_cfu"/>
<field name="invoice_user_id" ref="base.user_demo"/>
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
<field name="move_type">out_invoice</field>
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-10'"/>
<field name="journal_id" model="account.journal" eval="obj().search([('type', '=', 'sale'), ('l10n_uy_type', '=', 'preprinted')])"/>
<field name="l10n_latam_document_type_id" model="l10n_latam.document.type" eval="obj().env.ref('l10n_uy_account.dc_e_ticket')"/>
<field name="invoice_line_ids" eval="[
(0, 0, {'product_id': ref('product.product_product_27'), 'price_unit': 642.0, 'quantity': 5}),
(0, 0, {'product_id': ref('product.product_product_2'), 'price_unit': 642.0, 'quantity': 1}),
(0, 0, {'product_id': ref('product.product_delivery_02'), 'price_unit': 40.0, 'quantity': 5}),
(0, 0, {'product_id': ref('product.product_order_01'), 'price_unit': 280.0, 'quantity': 3}),
(0, 0, {'product_id': ref('product.product_product_3'), 'price_unit': 450.0, 'quantity': 2}),
]"/>
</record>

<!-- Invoice to ADHOC in USD and vat 21 -->
<record id="base.USD" model="res.currency">
<field name="active" eval="True"/>
</record>

<record id="demo_invoice_4" model="account.move" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="partner_id" ref="demo_partner_5"/>
<field name="invoice_user_id" ref="base.user_demo"/>
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
<field name="move_type">out_invoice</field>
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-13'"/>
<field name="l10n_latam_document_type_id" model="l10n_latam.document.type" eval="obj().env.ref('l10n_uy_account.dc_e_inv')"/>
<field name="invoice_line_ids" eval="[
(0, 0, {'product_id': ref('product.product_product_27'), 'price_unit': 1000.0, 'quantity': 5}),
(0, 0, {'product_id': ref('product.product_product_3'), 'price_unit': 450.0, 'quantity': 2}),
(0, 0, {'product_id': ref('product.product_product_12'), 'price_unit': 120.0, 'quantity': 4}),
(0, 0, {'product_id': ref('product.product_product_13'), 'price_unit': 85.0, 'quantity': 3}),
]"/>
<field name="currency_id" ref="base.USD"/>
</record>

<record id="demo_invoice_5" model="account.move" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="partner_id" ref="demo_partner_5"/>
<field name="invoice_user_id" ref="base.user_demo"/>
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
<field name="move_type">out_invoice</field>
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-11'"/>
<field name="l10n_latam_document_type_id" model="l10n_latam.document.type" eval="obj().env.ref('l10n_uy_account.dc_e_inv_exp')"/>
<field name="invoice_line_ids" eval="[
(0, 0, {'product_id': ref('product.consu_delivery_02'), 'price_unit': 4000.0, 'quantity': 5}),
(0, 0, {'product_id': ref('product.product_product_3'), 'price_unit': 450.0, 'quantity': 2}),
(0, 0, {'product_id': ref('product.product_product_12'), 'price_unit': 120.0, 'quantity': 4}),
(0, 0, {'product_id': ref('product.product_product_13'), 'price_unit': 85.0, 'quantity': 3}),
(0, 0, {'product_id': ref('product.consu_delivery_03'), 'price_unit': 2350.0, 'quantity': 1}),
]"/>
<field name="currency_id" ref="base.USD"/>
</record>

<record id="demo_invoice_6" model="account.move" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="company_id" ref="company_uy"/>
<field name="partner_id" ref="partner_cfu"/>
<field name="invoice_user_id" ref="base.user_demo"/>
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
<field name="move_type">out_invoice</field>
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-14'"/>
<field name="l10n_latam_document_type_id" model="l10n_latam.document.type" eval="obj().env.ref('l10n_uy_account.dc_e_ticket')"/>
<field name="invoice_line_ids" eval="[
(0, 0, {'product_id': ref('product.product_product_1'), 'price_unit': 216.0, 'quantity': 9}),
(0, 0, {'product_id': ref('product.product_delivery_01'), 'price_unit': 70.0, 'quantity': 11}),
(0, 0, {'product_id': ref('product.product_delivery_02'), 'price_unit': 40.0, 'quantity': 5}),
(0, 0, {'product_id': ref('product.product_order_01'), 'price_unit': 280.0, 'quantity': 3}),
(0, 0, {'product_id': ref('product.consu_delivery_02'), 'price_unit': 4000.0, 'quantity': 5}),
(0, 0, {'product_id': ref('product.product_product_3'), 'price_unit': 450.0, 'quantity': 2}),
(0, 0, {'product_id': ref('product.product_product_12'), 'price_unit': 120.0, 'quantity': 4}),
(0, 0, {'product_id': ref('product.product_product_13'), 'price_unit': 85.0, 'quantity': 3}),
(0, 0, {'product_id': ref('product.product_product_16'), 'price_unit': 25.0, 'quantity': 20}),
(0, 0, {'product_id': ref('product.product_product_20'), 'price_unit': 1950.0, 'quantity': 4}),
]"/>
</record>

<record id="demo_invoice_7" model="account.move" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="company_id" ref="company_uy"/>
<field name="partner_id" ref="partner_cfu"/>
<field name="invoice_user_id" ref="base.user_demo"/>
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
<field name="move_type">out_invoice</field>
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-14'"/>
<field name="l10n_latam_document_type_id" model="l10n_latam.document.type" eval="obj().env.ref('l10n_uy_account.dc_e_ticket')"/>
<field name="invoice_line_ids" eval="[
(0, 0, {'product_id': ref('product.product_product_1'), 'price_unit': 216.0, 'quantity': 3}),
(0, 0, {'product_id': ref('product.product_delivery_01'), 'price_unit': 70.0, 'quantity': 1}),
(0, 0, {'product_id': ref('product.product_delivery_02'), 'price_unit': 40.0, 'quantity': 5}),
(0, 0, {'product_id': ref('product.product_product_3'), 'price_unit': 450.0, 'quantity': 7}),
(0, 0, {'product_id': ref('product.product_product_12'), 'price_unit': 120.0, 'quantity': 4}),
(0, 0, {'product_id': ref('product.product_product_16'), 'price_unit': 25.0, 'quantity': 16}),
(0, 0, {'product_id': ref('product.product_product_20'), 'price_unit': 1950.0, 'quantity': 2}),
]"/>
</record>

<record id="demo_invoice_8" model="account.move" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="company_id" ref="company_uy"/>
<field name="partner_id" ref="demo_partner_5"/>
<field name="invoice_user_id" ref="base.user_demo"/>
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
<field name="move_type">out_invoice</field>
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-01'"/>
<field name="l10n_latam_document_type_id" model="l10n_latam.document.type" eval="obj().env.ref('l10n_uy_account.dc_dn_e_inv')"/>
<field name="invoice_line_ids" eval="[
(0, 0, {'product_id': ref('product.product_product_27'), 'price_unit': 642.0, 'quantity': 4}),
(0, 0, {'product_id': ref('product.product_product_25'), 'price_unit': 3245.0, 'quantity': 2}),
(0, 0, {'product_id': ref('product.consu_delivery_01'), 'price_unit': 4000.0, 'quantity': 1}),
(0, 0, {'product_id': ref('product.product_product_12'), 'price_unit': 120.0, 'quantity': 3}),
]"/>
</record>

<record id="demo_invoice_9" model="account.move" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="company_id" ref="company_uy"/>
<field name="partner_id" ref="demo_partner_5"/>
<field name="invoice_user_id" ref="base.user_demo"/>
<field name="invoice_payment_term_id" ref="account.account_payment_term_end_following_month"/>
<field name="move_type">out_invoice</field>
<field name="l10n_latam_document_type_id" model="l10n_latam.document.type" eval="obj().env.ref('l10n_uy_account.dc_e_ticket')"/>
<field name="invoice_date" eval="time.strftime('%Y-%m')+'-05'"/>
<field name="invoice_line_ids" eval="[
(0, 0, {'product_id': ref('product.product_product_27'), 'price_unit': 642.0, 'quantity': 5}),
(0, 0, {'product_id': ref('product.product_product_25'), 'price_unit': 3245.0, 'quantity': 2}),
(0, 0, {'product_id': ref('product.consu_delivery_01'), 'price_unit': 4000.0, 'quantity': 5}),
(0, 0, {'product_id': ref('product.product_delivery_02'), 'price_unit': 4000.0, 'quantity': 1}),
]"/>
</record>

<function model="account.move.line" name="write" context="{'check_move_validity': False, 'active_test': False}">
<value model="account.move.line" search="[('move_id', '=', ref('demo_invoice_1')), ('product_id', '=', ref('product.product_product_20'))]"/>
<value model="account.tax" eval="{'tax_ids': [(4, obj().search([('company_id', '=', ref('company_uy')), ('type_tax_use', '=', 'sale'), ('tax_group_id.l10n_uy_vat_code', '=', 'vat_10')], limit=1).id)]}"/>
</function>

<function model="account.move.line" name="write" context="{'check_move_validity': False, 'active_test': False}">
<value model="account.move.line" search="[('move_id', '=', ref('demo_invoice_4')), ('product_id', '=', ref('product.product_product_27'))]"/>
<value model="account.tax" eval="{'tax_ids': [(4, obj().search([('company_id', '=', ref('company_uy')), ('type_tax_use', '=', 'sale'), ('tax_group_id.l10n_uy_vat_code', '=', 'vat_10')], limit=1).id)]}"/>
</function>

<function model="account.move.line" name="write" context="{'check_move_validity': False, 'active_test': False}">
<value model="account.move.line" search="[('move_id', '=', ref('demo_invoice_9')), ('product_id', '=', ref('product.product_product_25'))]"/>
<value model="account.tax" eval="{'tax_ids': [(4, obj().search([('company_id', '=', ref('company_uy')), ('type_tax_use', '=', 'sale'), ('tax_group_id.l10n_uy_vat_code', '=', 'vat_10')], limit=1).id)]}"/>
</function>

<function model="account.move" name="action_post">
<value eval="[ref('demo_invoice_1'), ref('demo_invoice_2'), ref('demo_invoice_3'), ref('demo_invoice_4'), ref('demo_invoice_5'), ref('demo_invoice_6'), ref('demo_invoice_8'), ref('demo_invoice_9')]"/>
</function>

</odoo>
46 changes: 46 additions & 0 deletions l10n_uy_account/demo/account_customer_refund_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="True">

<!-- Create draft refund for invoice 3 -->
<record id="demo_refund_invoice_1" model="account.move.reversal" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="reason">Mercadería defectuosa</field>
<field name="refund_method">cancel</field>
<field name="move_ids" eval="[(4, ref('demo_invoice_1'), 0)]"/>
<field name="journal_id" model="account.journal" eval="obj().env.ref('l10n_uy_account.demo_invoice_1').journal_id"/>
<field name="date" eval="time.strftime('%Y-%m')+'-01'"/>
</record>

<!-- Create draft refund for invoice 4 -->
<record id="demo_refund_invoice_2" model="account.move.reversal" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="reason">Venta cancelada</field>
<field name="refund_method">cancel</field>
<field name="move_ids" eval="[(4, ref('demo_invoice_4'), 0)]"/>
<field name="l10n_latam_document_type_id" model="l10n_latam.document.type" eval="obj().env.ref('l10n_uy_account.dc_cn_e_inv')"/>
<field name="journal_id" model="account.journal" eval="obj().env.ref('l10n_uy_account.demo_invoice_4').journal_id"/>
<field name="date" eval="time.strftime('%Y-%m')+'-01'"/>
</record>

<record id="demo_refund_invoice_3" model="account.move.reversal" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="reason">Venta cancelada</field>
<field name="refund_method">refund</field>
<field name="move_ids" eval="[(4, ref('demo_invoice_5'), 0)]"/>
<field name="journal_id" model="account.journal" eval="obj().env.ref('l10n_uy_account.demo_invoice_5').journal_id"/>
<field name="l10n_latam_document_type_id" model="l10n_latam.document.type" eval="obj().env.ref('l10n_uy_account.dc_cn_e_inv_exp')"/>
<field name="date" eval="time.strftime('%Y-%m')+'-01'"/>
</record>

<record id="demo_refund_invoice_4" model="account.move.reversal" context="{'allowed_company_ids': [ref('company_uy')]}">
<field name="reason">Venta cancelada</field>
<field name="refund_method">cancel</field>
<field name="move_ids" eval="[(4, ref('demo_invoice_6'), 0)]"/>
<field name="journal_id" model="account.journal" eval="obj().env.ref('l10n_uy_account.demo_invoice_6').journal_id"/>
<field name="l10n_latam_document_type_id" model="l10n_latam.document.type" eval="obj().env.ref('l10n_uy_account.dc_cn_e_ticket')"/>
<field name="date" eval="time.strftime('%Y-%m')+'-01'"/>
</record>

<function model="account.move.reversal" name="reverse_moves" eval="[ref('demo_refund_invoice_1')]"/>
<function model="account.move.reversal" name="reverse_moves" eval="[ref('demo_refund_invoice_2')]"/>
<function model="account.move.reversal" name="reverse_moves" eval="[ref('demo_refund_invoice_3')]"/>
<function model="account.move.reversal" name="reverse_moves" eval="[ref('demo_refund_invoice_4')]"/>

</odoo>
14 changes: 14 additions & 0 deletions l10n_uy_account/demo/account_journal_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo noupdate="1">

<record id="manual_journal" model="account.journal">
<field name='name'>Testing CFE UY</field>
<field name='company_id' ref="l10n_uy_account.company_uy"/>
<field name='type'>sale</field>
<field name='code'>MAN</field>
<field name='l10n_latam_use_documents' eval="True"/>
<field name='l10n_uy_type'>manual</field>
<field name='sequence'>1</field>
</record>

</odoo>
Loading

0 comments on commit 2ad414d

Please sign in to comment.