diff --git a/tko_coexiste_br_account/models/account_invoice.py b/tko_coexiste_br_account/models/account_invoice.py index 5863fc7..f6f8970 100644 --- a/tko_coexiste_br_account/models/account_invoice.py +++ b/tko_coexiste_br_account/models/account_invoice.py @@ -261,8 +261,9 @@ def write(self, vals): due_date = datetime.datetime.strptime(due_date, OE_DFORMAT).date() for move_line in record.move_id.line_ids: move_line.date_maturity = due_date + super(AccountInvoice, record).write(vals) record.draft_invoice_validate() - return super(AccountInvoice, self).write(vals) + return True class AccountInvoiceLine(models.Model): diff --git a/tko_purchase_requisition/__init__.py b/tko_purchase_requisition/__init__.py new file mode 100644 index 0000000..bd8f392 --- /dev/null +++ b/tko_purchase_requisition/__init__.py @@ -0,0 +1,26 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# ThinkOpen Solutions Brasil +# Copyright (C) Thinkopen Solutions . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import purchase_requisition +import wizard diff --git a/tko_purchase_requisition/__manifest__.py b/tko_purchase_requisition/__manifest__.py new file mode 100644 index 0000000..b50d78c --- /dev/null +++ b/tko_purchase_requisition/__manifest__.py @@ -0,0 +1,50 @@ + # -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# ThinkOpen Solutions Brasil +# Copyright (C) Thinkopen Solutions . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +{ + 'name': 'Merge Purchase Requisition Orders', + 'version': '10.0.0.0.0', + 'category': 'Customizations', + 'sequence': 14, + 'complexity': 'medium', + 'description': ''' == This module allows to merge Requisition Orders in Draft Stage ==\n +''', + 'author': 'ThinkOpen Solutions Brasil', + 'website': 'http://www.tkobr.com', + 'depends': [ + 'purchase_requisition', + ], + 'data': [ + 'purchase_requisition_view.xml', + 'wizard/purchase_requisition_wizard_view.xml', + ], + 'init': [], + 'demo': [], + 'update': [], + 'test': [], # YAML files with tests + 'installable': True, + 'application': False, + 'auto_install': False, + 'certificate': '', +} diff --git a/tko_purchase_requisition/purchase_requisition.py b/tko_purchase_requisition/purchase_requisition.py new file mode 100644 index 0000000..a93bd61 --- /dev/null +++ b/tko_purchase_requisition/purchase_requisition.py @@ -0,0 +1,62 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# ThinkOpen Solutions Brasil +# Copyright (C) Thinkopen Solutions . +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from odoo import models, fields, api + + +class PurchaseRequisition(models.Model): + _inherit = 'purchase.requisition' + + parent_id = fields.Many2one('purchase.requisition', string='Merged Into', readonly=True) + child_ids = fields.One2many('purchase.requisition','parent_id','Children') + + + @api.multi + def send_mail_to_all_quotations(self): + template_id = self.env.ref('purchase.email_template_edi_purchase') + if template_id: + for rfq in self.purchase_ids: + if rfq.partner_id.email: + values = template_id.generate_email(rfq.id) + values['email_to'] = rfq.partner_id.email + values['email_from'] = self.env.user.email + mail = self.env['mail.mail'].create(values) + attachment_ids = [] + # create attachments + for attachment in values['attachments']: + attachment_data = { + 'name': attachment[0], + 'datas_fname': attachment[0], + 'datas': attachment[1], + 'res_model': 'mail.message', + 'res_id': mail.mail_message_id.id, + } + attachment_ids.append(self.env['ir.attachment'].create(attachment_data).id) + if attachment_ids: + mail.write({'attachment_ids': [(6, 0, attachment_ids)]}) + # send mail + mail.send() + # change status of RFQ + rfq.state = 'sent' + return True diff --git a/tko_purchase_requisition/purchase_requisition_view.xml b/tko_purchase_requisition/purchase_requisition_view.xml new file mode 100644 index 0000000..c769fb1 --- /dev/null +++ b/tko_purchase_requisition/purchase_requisition_view.xml @@ -0,0 +1,33 @@ + + + + purchase.requisition + purchase.requisition + + + + + + +