diff --git a/i18n/es_AR.mo b/i18n/es_AR.mo index 2f1ee0fe4ef5665f06a3983ea1c54ac2a35a316b..18384f1e3fde62476c4e737f7dbb49022ed810b2 100644 Binary files a/i18n/es_AR.mo and b/i18n/es_AR.mo differ diff --git a/i18n/es_AR.po b/i18n/es_AR.po index a3990d7845fb404d15a7f25d39f81f5802581b43..325aab8e2108798578bfa64bca7398bff872b89f 100644 --- a/i18n/es_AR.po +++ b/i18n/es_AR.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-07 20:08+0000\n" -"PO-Revision-Date: 2022-01-07 17:13-0300\n" +"POT-Creation-Date: 2022-01-13 15:00+0000\n" +"PO-Revision-Date: 2022-01-13 12:02-0300\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -184,21 +184,34 @@ msgid "Add Lines" msgstr "Agregar lÃneas" #. module: medical_invoicing -#: code:addons/medical_invoicing/models/account_invoice.py:62 +#: code:addons/medical_invoicing/models/account_invoice.py:66 #, python-format msgid "All the benefits in the invoice must be in state 'For Invoicing' or 'For Reinvoicing'" msgstr "Todas las prestaciones de la factura deben estar en estado 'Para Facturar' o 'Para Refacturar'" #. module: medical_invoicing #: model:ir.model.fields,field_description:medical_invoicing.field_apportionment_pami_line__amount +#: model:ir.model.fields,field_description:medical_invoicing.field_refund_professional_line__amount msgid "Amount" msgstr "Importe" +#. module: medical_invoicing +#: code:addons/medical_invoicing/wizard/account_invoice_refund.py:31 +#, python-format +msgid "Amount must be greater than 0 in all lines" +msgstr "El monto debe ser mayor a 0 en todas las lÃneas" + #. module: medical_invoicing #: model_terms:ir.ui.view,arch_db:medical_invoicing.report_pre_invoice_template msgid "Amount of benefits" msgstr "Cantidad de prestaciones" +#. module: medical_invoicing +#: model:ir.model.fields,field_description:medical_invoicing.field_account_invoice_refund__professional_line_ids +#: model_terms:ir.ui.view,arch_db:medical_invoicing.view_account_invoice_refund_medical_invoicing_inherit +msgid "Amounts per professional" +msgstr "Montos por profesional" + #. module: medical_invoicing #: code:addons/medical_invoicing/report/apportionment_pami_report.py:143 #: code:addons/medical_invoicing/report/apportionment_pami_report.py:148 @@ -229,6 +242,8 @@ msgid "Benefit Date" msgstr "Fecha de prestación" #. module: medical_invoicing +#: selection:account.invoice,credit_note_type:0 +#: selection:account.invoice.line,credit_note_type:0 #: selection:account.invoice.refund,refund_type:0 #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice__medical_benefit_ids_qty msgid "Benefits" @@ -355,6 +370,7 @@ msgstr "" #: model:ir.model.fields,field_description:medical_invoicing.field_insurance_capita_line__create_uid #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice__create_uid #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice_config__create_uid +#: model:ir.model.fields,field_description:medical_invoicing.field_refund_professional_line__create_uid #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_account_invoice_modify__create_uid #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_capitated_benefits__create_uid #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_professional_invoicing__create_uid @@ -370,6 +386,7 @@ msgstr "Creado por" #: model:ir.model.fields,field_description:medical_invoicing.field_insurance_capita_line__create_date #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice__create_date #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice_config__create_date +#: model:ir.model.fields,field_description:medical_invoicing.field_refund_professional_line__create_date #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_account_invoice_modify__create_date #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_capitated_benefits__create_date #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_professional_invoicing__create_date @@ -395,6 +412,12 @@ msgstr "Nota de Crédito" msgid "Credit Note Amount" msgstr "Monto de Nota de Crédito" +#. module: medical_invoicing +#: model:ir.model.fields,field_description:medical_invoicing.field_account_invoice__credit_note_type +#: model:ir.model.fields,field_description:medical_invoicing.field_account_invoice_line__credit_note_type +msgid "Credit Note Type" +msgstr "Tipo de nota de crédito" + #. module: medical_invoicing #: model_terms:ir.ui.view,arch_db:medical_invoicing.view_account_invoice_refund_medical_invoicing_inherit msgid "Credit note total (Untaxed)" @@ -544,6 +567,7 @@ msgstr "Aranceles de las prácticas" #: model:ir.model.fields,field_description:medical_invoicing.field_insurance_capita_line__display_name #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice__display_name #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice_config__display_name +#: model:ir.model.fields,field_description:medical_invoicing.field_refund_professional_line__display_name #: model:ir.model.fields,field_description:medical_invoicing.field_report_medical_invoicing_report_capitated_benefits_xls__display_name #: model:ir.model.fields,field_description:medical_invoicing.field_report_medical_invoicing_report_invoice_detail_template__display_name #: model:ir.model.fields,field_description:medical_invoicing.field_report_medical_invoicing_report_invoice_insurance__display_name @@ -728,6 +752,7 @@ msgstr "" #: model:ir.model.fields,field_description:medical_invoicing.field_insurance_capita_line__id #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice__id #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice_config__id +#: model:ir.model.fields,field_description:medical_invoicing.field_refund_professional_line__id #: model:ir.model.fields,field_description:medical_invoicing.field_report_medical_invoicing_report_capitated_benefits_xls__id #: model:ir.model.fields,field_description:medical_invoicing.field_report_medical_invoicing_report_invoice_detail_template__id #: model:ir.model.fields,field_description:medical_invoicing.field_report_medical_invoicing_report_invoice_insurance__id @@ -843,13 +868,13 @@ msgid "Invoice Configuration" msgstr "Configuración de facturación" #. module: medical_invoicing -#: code:addons/medical_invoicing/models/account_invoice.py:98 +#: code:addons/medical_invoicing/models/account_invoice.py:102 #, python-format msgid "Invoice Detail Report of %s" msgstr "Reporte de detalle de prestaciones de %s" #. module: medical_invoicing -#: code:addons/medical_invoicing/models/account_invoice.py:97 +#: code:addons/medical_invoicing/models/account_invoice.py:101 #, python-format msgid "Invoice Detail Report of %s%s" msgstr "Reporte de detalle de prestaciones de %s%s" @@ -860,13 +885,13 @@ msgid "Invoice Detail report (PDF)" msgstr "Reporte de detalle de prestaciones (PDF)" #. module: medical_invoicing -#: code:addons/medical_invoicing/models/account_invoice.py:96 +#: code:addons/medical_invoicing/models/account_invoice.py:100 #, python-format msgid "Invoice Insurance Report of %s" msgstr "Reporte de factura para Obra Social de %s" #. module: medical_invoicing -#: code:addons/medical_invoicing/models/account_invoice.py:95 +#: code:addons/medical_invoicing/models/account_invoice.py:99 #, python-format msgid "Invoice Insurance Report of %s%s" msgstr "Reporte de factura para Obra Social de %s%s" @@ -966,6 +991,7 @@ msgstr "Junio" #: model:ir.model.fields,field_description:medical_invoicing.field_insurance_capita_line____last_update #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice____last_update #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice_config____last_update +#: model:ir.model.fields,field_description:medical_invoicing.field_refund_professional_line____last_update #: model:ir.model.fields,field_description:medical_invoicing.field_report_medical_invoicing_report_capitated_benefits_xls____last_update #: model:ir.model.fields,field_description:medical_invoicing.field_report_medical_invoicing_report_invoice_detail_template____last_update #: model:ir.model.fields,field_description:medical_invoicing.field_report_medical_invoicing_report_invoice_insurance____last_update @@ -986,6 +1012,7 @@ msgstr "Última modificación en" #: model:ir.model.fields,field_description:medical_invoicing.field_insurance_capita_line__write_uid #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice__write_uid #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice_config__write_uid +#: model:ir.model.fields,field_description:medical_invoicing.field_refund_professional_line__write_uid #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_account_invoice_modify__write_uid #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_capitated_benefits__write_uid #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_professional_invoicing__write_uid @@ -1001,6 +1028,7 @@ msgstr "Última actualización por" #: model:ir.model.fields,field_description:medical_invoicing.field_insurance_capita_line__write_date #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice__write_date #: model:ir.model.fields,field_description:medical_invoicing.field_medical_invoice_config__write_date +#: model:ir.model.fields,field_description:medical_invoicing.field_refund_professional_line__write_date #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_account_invoice_modify__write_date #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_capitated_benefits__write_date #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_professional_invoicing__write_date @@ -1018,6 +1046,11 @@ msgstr "" msgid "Lines of refund wizard" msgstr "" +#. module: medical_invoicing +#: model:ir.model,name:medical_invoicing.model_refund_professional_line +msgid "Lines to create a credit note for other concept" +msgstr "" + #. module: medical_invoicing #: model_terms:ir.ui.view,arch_db:medical_invoicing.report_invoice_insurance_template msgid "Logo" @@ -1114,7 +1147,7 @@ msgid "Modify Invoice" msgstr "Modificar factura" #. module: medical_invoicing -#: code:addons/medical_invoicing/models/account_invoice.py:66 +#: code:addons/medical_invoicing/models/account_invoice.py:70 #: code:addons/medical_invoicing/models/medical_invoice.py:130 #: model:ir.model.fields,field_description:medical_invoicing.field_distribution_apportionment_pami__month #: model:ir.model.fields,field_description:medical_invoicing.field_insurance_capita__month @@ -1181,8 +1214,10 @@ msgid "Origin:" msgstr "Origen: " #. module: medical_invoicing +#: selection:account.invoice,credit_note_type:0 +#: selection:account.invoice.line,credit_note_type:0 #: selection:account.invoice.refund,refund_type:0 -#: code:addons/medical_invoicing/wizard/account_invoice_refund.py:168 +#: code:addons/medical_invoicing/wizard/account_invoice_refund.py:192 #, python-format msgid "Other concept" msgstr "Otro concepto" @@ -1232,13 +1267,13 @@ msgid "Please use the following communication for your payment :" msgstr "Por favor utilice la siguiente referencia al realizar su pago: " #. module: medical_invoicing -#: code:addons/medical_invoicing/models/account_invoice.py:100 +#: code:addons/medical_invoicing/models/account_invoice.py:104 #, python-format msgid "Pre Invoice Report of %s" msgstr "Reporte de pre-factura de %s" #. module: medical_invoicing -#: code:addons/medical_invoicing/models/account_invoice.py:99 +#: code:addons/medical_invoicing/models/account_invoice.py:103 #, python-format msgid "Pre Invoice Report of %s%s" msgstr "Reporte de pre-factura de %s%s" @@ -1283,6 +1318,7 @@ msgstr "Producto" #: model:ir.model.fields,field_description:medical_invoicing.field_account_invoice_line__professional_id #: model:ir.model.fields,field_description:medical_invoicing.field_account_invoice_refund__professional_id #: model:ir.model.fields,field_description:medical_invoicing.field_apportionment_pami_line__professional_id +#: model:ir.model.fields,field_description:medical_invoicing.field_refund_professional_line__professional_id #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_account_invoice_modify__professional_id #: model:ir.model.fields,field_description:medical_invoicing.field_wizard_professional_invoicing__professional_id #: model_terms:ir.ui.view,arch_db:medical_invoicing.report_pre_invoice_template @@ -1346,11 +1382,6 @@ msgstr "Referencia" msgid "Ref - Label" msgstr "Referencia" -#. module: medical_invoicing -#: model:ir.model.fields,field_description:medical_invoicing.field_account_invoice_refund__refund_amount -msgid "Refund Amount" -msgstr "Importe de la nota de crédito" - #. module: medical_invoicing #: model_terms:ir.ui.view,arch_db:medical_invoicing.view_invoice_form_medical_invoicing_inherit #: model_terms:ir.ui.view,arch_db:medical_invoicing.view_refund_reinvoice @@ -1362,12 +1393,6 @@ msgstr "Refacturar nota de crédito" msgid "Refund Type" msgstr "Tipo de nota de crédito" -#. module: medical_invoicing -#: code:addons/medical_invoicing/wizard/account_invoice_refund.py:50 -#, python-format -msgid "Refund amount must be greater than 0" -msgstr "El monto de la nota de crédito debe ser mayor a 0" - #. module: medical_invoicing #: model:ir.actions.act_window,name:medical_invoicing.wizard_refund_reinvoice_action msgid "Refund reinvoice" @@ -1506,7 +1531,7 @@ msgid "There is more than one tariff for the selected descriptor and date range" msgstr "Hay más de un arancel para la práctica y el rango de fecha seleccionados" #. module: medical_invoicing -#: code:addons/medical_invoicing/wizard/account_invoice_refund.py:140 +#: code:addons/medical_invoicing/wizard/account_invoice_refund.py:163 #, python-format msgid "There must be at least one invoice line selected" msgstr "Debe haber por lo menos una lÃnea de factura seleccionada" @@ -1533,6 +1558,12 @@ msgstr "Este asistente va a presentar un reporte de las prestaciones ya cobradas msgid "This assistant will show the charged benefits of capitated insurances in the period for all the professionals" msgstr "Este asistente va a presentar las prestaciones cobradas de obras sociales capitadas en el perÃodo indicado para todos los profesionales" +#. module: medical_invoicing +#: code:addons/medical_invoicing/wizard/account_invoice_refund.py:65 +#, python-format +msgid "This refund type can be used only with insurances of codes 141 and 250" +msgstr "Este tipo de nota de crédito solo puede ser utilizado con las obras sociales de códigos 141 y 250" + #. module: medical_invoicing #: model_terms:ir.ui.view,arch_db:medical_invoicing.medical_invoice_form msgid "To Progress" @@ -1591,6 +1622,11 @@ msgstr "Ver" msgid "Vitrectomies" msgstr "VitrectomÃas" +#. module: medical_invoicing +#: model:ir.model.fields,field_description:medical_invoicing.field_refund_professional_line__wizard_id +msgid "Wizard" +msgstr "Asistente" + #. module: medical_invoicing #: model:ir.model,name:medical_invoicing.model_wizard_account_invoice_tariff_change msgid "Wizard change tariff from all lines with the selected descriptor" diff --git a/models/account_invoice.py b/models/account_invoice.py index e4385288338cb3c9ae40dbe49b71accb5a0b7a30..a7742b7e22e9fb89b6ccc5ba3f2a4010c13358ea 100644 --- a/models/account_invoice.py +++ b/models/account_invoice.py @@ -10,6 +10,10 @@ class AccountInvoice(models.Model): _inherit = 'account.invoice' medical_invoice_id = fields.Many2one('medical.invoice', string='Medical invoice') + credit_note_type = fields.Selection([ + ('benefits', 'Benefits'), + ('other_concept', 'Other concept') + ], string='Credit Note Type', default='benefits') @api.model def _prepare_refund(self, invoice, date_invoice=None, date=None, description=None, journal_id=None): @@ -103,6 +107,11 @@ class AccountInvoice(models.Model): class AccountInvoiceLine(models.Model): _inherit = 'account.invoice.line' + credit_note_type = fields.Selection([ + ('benefits', 'Benefits'), + ('other_concept', 'Other concept') + ], string='Credit Note Type', default='benefits') + benefit_id = fields.Many2one('medical.benefit', 'Benefit') descriptor_id = fields.Many2one('medical.benefit.descriptor','Descriptor') professional_id = fields.Many2one('res.partner','Professional') diff --git a/views/account_invoice_view.xml b/views/account_invoice_view.xml index aa962d65ede2ddbd79a9cb456715db570aa50b21..eca9e8990510cfe2e020ac2d7e4350f5f638da9a 100644 --- a/views/account_invoice_view.xml +++ b/views/account_invoice_view.xml @@ -6,6 +6,9 @@ <field name="model">account.invoice</field> <field name="inherit_id" ref="account.invoice_form"/> <field name="arch" type="xml"> + <xpath expr="//field[@name='partner_id']" position="after"> + <field name="credit_note_type" invisible="1"/> + </xpath> <xpath expr="//form" position="attributes"> <attribute name="create">false</attribute> </xpath> @@ -26,9 +29,9 @@ </button> </xpath> <xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='product_id']" position="after"> - <field name="descriptor_id"/> + <field name="descriptor_id" attrs="{'column_invisible': [('parent.credit_note_type','!=','benefits')]}"/> <field name="professional_id"/> - <field name="patient_id"/> + <field name="patient_id" attrs="{'column_invisible': [('parent.credit_note_type','!=','benefits')]}"/> </xpath> <xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='price_subtotal']" position="after"> <field name="tax_amount"/> diff --git a/wizard/account_invoice_refund.py b/wizard/account_invoice_refund.py index 51192ebcc4078b823ee1965cd3b13a8edc12e37e..64992351e22398f9801b1baf36a68b3f47ca578b 100644 --- a/wizard/account_invoice_refund.py +++ b/wizard/account_invoice_refund.py @@ -16,14 +16,38 @@ from odoo.exceptions import ValidationError, UserError _logger = logging.getLogger(__name__) +class RefundProfessionalLine(models.TransientModel): + _name = 'refund.professional.line' + _description = 'Lines to create a credit note for other concept' + + professional_id = fields.Many2one('res.partner', string='Professional', domain=lambda x:x.get_domain_professional_id()) + amount = fields.Float('Amount') + wizard_id = fields.Many2one('account.invoice.refund') + + @api.constrains('amount') + def check_amount(self): + for line in self: + if line.amount <= 0: + raise ValidationError(_('Amount must be greater than 0 in all lines')) + + @api.multi + def get_domain_professional_id(self): + domain = [] + invoice = self.env['account.invoice'].browse(self._context.get('active_id',False)) + professionals = invoice.invoice_line_ids.mapped('professional_id') + domain.append(('id','in',professionals.ids if professionals else [])) + return domain + class AccountInvoiceRefund(models.TransientModel): _inherit = "account.invoice.refund" + professional_id = fields.Many2one('res.partner','Professional',domain=lambda x:x.get_domain_professional_id()) descriptor_id = fields.Many2one('medical.benefit.descriptor','Descriptor',domain=lambda x:x.get_domain_descriptor_id()) date_from = fields.Date('Date from') date_to = fields.Date('Date to') + professional_line_ids = fields.One2many('refund.professional.line','wizard_id',"Amounts per professional") refund_type = fields.Selection( [ ('benefits', 'Benefits'), @@ -32,23 +56,21 @@ class AccountInvoiceRefund(models.TransientModel): string='Refund Type', default='benefits', ) - refund_amount = fields.Float('Refund Amount', default="1") + + @api.constrains('refund_type') + def check_refund_type(self): + invoice = self.env['account.invoice'].browse(self._context.get('active_id',False)) + if self.refund_type == 'other_concept' and invoice.partner_id.ref not in ['141','250']: + raise ValidationError(_('This refund type can be used only with insurances of codes 141 and 250')) @api.onchange('refund_type') def onchange_refund_type(self): invoice = self.env['account.invoice'].browse(self._context.get('active_id',False)) - #if self.refund_type == 'other_concept' and invoice.partner_id.ref not in ['141','250']: - # raise ValidationError(_('This refund type can be used only with insurances of codes 141 and 250')) if self.refund_type == 'other_concept': self.filter_refund = 'refund' if self.refund_type == 'benefits': self.filter_refund = 'modify' - @api.onchange('refund_amount') - def onchange_refund_amount(self): - if self.refund_amount <= 0: - raise ValidationError(_('Refund amount must be greater than 0')) - @api.multi def get_domain_professional_id(self): domain = [] @@ -158,19 +180,23 @@ class AccountInvoiceRefund(models.TransientModel): return elif self.refund_type == 'other_concept': res = super(AccountInvoiceRefund, self).invoice_refund() + professional_amounts = self.professional_line_ids credit_note_id = res['domain'][1][2][0] credit_note = INV_obj.browse(credit_note_id) + credit_note.credit_note_type = 'other_concept' insurance_config = self.env['medical.invoice.config'].search([('insurance_id', '=', invoice.partner_id.insurance_plan_id.insurance_id.id)]) account_id = insurance_config.product_id.categ_id.property_account_income_categ_id.id product_id = insurance_config.product_id.id - invoice_line = { + invoice_lines = [{ 'name': _('Other concept'), - 'price_unit': self.refund_amount, + 'price_unit': rec.amount, 'quantity': 1, 'account_id': account_id, 'product_id': product_id, - } - credit_note.invoice_line_ids = [(0,0,invoice_line)] + 'professional_id': rec.professional_id.id, + } for rec in professional_amounts] + invoice_line_ids = self.env['account.invoice.line'].create(invoice_lines).ids + credit_note.invoice_line_ids = [(6,0,invoice_line_ids)] return res diff --git a/wizard/account_invoice_refund_view.xml b/wizard/account_invoice_refund_view.xml index b34d01055918bce7be78238f080174f686cc5240..2d60691454bb2dc43f909f3cd5b1f7465efa02c6 100644 --- a/wizard/account_invoice_refund_view.xml +++ b/wizard/account_invoice_refund_view.xml @@ -6,6 +6,16 @@ <field name="model">account.invoice.refund</field> <field name="inherit_id" ref="account.view_account_invoice_refund"/> <field name="arch" type="xml"> + <xpath expr="//group[1]" position="after"> + <group attrs="{'invisible': [('refund_type','!=','other_concept')]}"> + <field name="professional_line_ids"> + <tree string="Amounts per professional" editable="bottom"> + <field name="professional_id" required="1"/> + <field name="amount"/> + </tree> + </field> + </group> + </xpath> <xpath expr="//notebook[@name='refund_notebook']" position="attributes"> <attribute name="attrs">{'invisible': [('refund_type','!=','benefits')]}</attribute> </xpath> @@ -31,7 +41,6 @@ </xpath> <xpath expr="//field[@name='description']" position="after"> <field name="refund_type"/> - <field name="refund_amount" attrs="{'invisible': [('refund_type','!=','other_concept')]}"/> </xpath> <xpath expr="//field[@name='invoice_line_ids']" position="after"> <div style="text-align:right;">