diff --git a/tecnitower_custom/__manifest__.py b/tecnitower_custom/__manifest__.py index b55e11291f4bb24c73f9fa16c8e76e7bcc386c94..0f831b77be842df7ee69ee7a0cefcde795d29c3e 100644 --- a/tecnitower_custom/__manifest__.py +++ b/tecnitower_custom/__manifest__.py @@ -28,11 +28,13 @@ 'stock', 'l10n_ar_eynes', 'delivery', + 'account', ], 'data': [ 'views/stock_picking_views.xml', 'views/res_config_settigs_views.xml', 'views/res_company_views.xml', + 'views/account_move_views.xml', 'report/stock_picking_qweb.xml', 'report/account_move_qweb.xml', 'report/sale_report_templates.xml', diff --git a/tecnitower_custom/models/__init__.py b/tecnitower_custom/models/__init__.py index 23c27882349e1f3ab8324afd2b41502fd9c569ad..40b3ef159c06b8872114af402cc8a483cdbaa20b 100644 --- a/tecnitower_custom/models/__init__.py +++ b/tecnitower_custom/models/__init__.py @@ -1,3 +1,5 @@ from . import stock_picking from . import res_company from . import res_config_settings +from . import account_move +from . import sale_order diff --git a/tecnitower_custom/models/account_move.py b/tecnitower_custom/models/account_move.py new file mode 100644 index 0000000000000000000000000000000000000000..1aa43c8e5327ce07676224e400246d4d9e8d9cc8 --- /dev/null +++ b/tecnitower_custom/models/account_move.py @@ -0,0 +1,25 @@ +from odoo import models, fields, api + +class AccountMove(models.Model): + _inherit = 'account.move' + _description = 'Account Move Tecnitower' + + stock_picking_id = fields.Many2one('stock.picking', string='Stock Picking') + stock_picking_name = fields.Char(string='Stock Picking Name', compute='_compute_stock_picking_name', store=True, readonly=True) + stock_picking_origin = fields.Char(string='Stock Picking Origin', compute='_compute_stock_picking_origin', store=True, readonly=True) + stock_picking_name_and_origin = fields.Char(compute='_compute_stock_picking_name_and_origin', string='N° Pedido', store=True, readonly=True) + + @api.depends('stock_picking_name', 'stock_picking_origin') + def _compute_stock_picking_name_and_origin(self): + for record in self: + record.stock_picking_name_and_origin = f"{record.stock_picking_id.name}:{record.stock_picking_id.origin}" + + @api.depends('stock_picking_id', 'stock_picking_id.name') + def _compute_stock_picking_name(self): + for record in self: + record.stock_picking_name = record.stock_picking_id.name + + @api.depends('stock_picking_id', 'stock_picking_id.origin') + def _compute_stock_picking_origin(self): + for record in self: + record.stock_picking_origin = record.stock_picking_id.origin diff --git a/tecnitower_custom/models/sale_order.py b/tecnitower_custom/models/sale_order.py new file mode 100644 index 0000000000000000000000000000000000000000..3913ed9c86500e577ca06912eccaa559e27d7fb6 --- /dev/null +++ b/tecnitower_custom/models/sale_order.py @@ -0,0 +1,15 @@ +from odoo import models, fields + +class SaleOrder(models.Model): + _inherit = 'sale.order' + _description = 'Sale Order Tecnitower' + + def _create_invoices(self, grouped=False, final=False, date=None): + invoices = super()._create_invoices(grouped, final, date) + + picking = self.picking_ids.filtered(lambda p: p.state not in ['cancel']) + + for invoice in invoices: + invoice.write({ + 'stock_picking_id': picking.id + }) diff --git a/tecnitower_custom/report/account_move_qweb.xml b/tecnitower_custom/report/account_move_qweb.xml index 5e26449dc207521c74d447062531c23cd788055a..52004b89238ec29610c53c77ef98e42c1b45a521 100644 --- a/tecnitower_custom/report/account_move_qweb.xml +++ b/tecnitower_custom/report/account_move_qweb.xml @@ -66,4 +66,12 @@ </template> + <template id="account_move_report_qweb_tecnitower" inherit_id="l10n_ar_eynes.account_move_report_qweb"> + <xpath expr="//span[@t-esc='o.invoice_payment_term_id.name']" position="after"> + <br/> + <span class="partner-info">N° Pedido: </span> + <span t-esc="o.stock_picking_id.name"/>:<span t-esc="o.stock_picking_id.origin"/> + </xpath> + </template> + </odoo> diff --git a/tecnitower_custom/report/stock_picking_qweb.xml b/tecnitower_custom/report/stock_picking_qweb.xml index b9c077de998e1bc562a47f41a3f1d6dda4f91eb8..6bfdacab69daf4971ebe32040c62688fffa2ef32 100644 --- a/tecnitower_custom/report/stock_picking_qweb.xml +++ b/tecnitower_custom/report/stock_picking_qweb.xml @@ -120,7 +120,9 @@ /> </td> <td width="50%"> - Código: + Código: <span + t-esc="o.partner_id.ref" + /> <br /> CUIT: <span t-esc="o.partner_id.vat" diff --git a/tecnitower_custom/views/account_move_views.xml b/tecnitower_custom/views/account_move_views.xml new file mode 100644 index 0000000000000000000000000000000000000000..603d4e0c8c53ce3428a69baa1790e903656f823d --- /dev/null +++ b/tecnitower_custom/views/account_move_views.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + + <record id="view_move_form_tecnitower" model="ir.ui.view"> + <field name="name">view.move.form.tecnitower</field> + <field name="model">account.move</field> + <field name="inherit_id" ref="account.view_move_form"/> + <field name="arch" type="xml"> + <xpath expr="//group[@name='sale_info_group']//field[@name='partner_bank_id']" position="after"> + <field name="stock_picking_id" readonly="1"/> + <field name="stock_picking_name_and_origin" readonly="1"/> + </xpath> + </field> + </record> + +</odoo>