[REF][REM]GOLEM Resource Account : remove useless methods on wizard for adding on invoice

This commit is contained in:
Fabien BOURGEOIS 2018-04-16 18:14:02 +02:00
parent 28a3e84105
commit d19e650158
2 changed files with 14 additions and 38 deletions

View File

@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
""" GOLEM Reservation's Adding to invoice wizard""" """ GOLEM Reservation's Adding to invoice wizard"""
from odoo import models, fields, api, _ from odoo import models, fields
class GolemReservationAddToInvoiceWizard(models.TransientModel): class GolemReservationAddToInvoiceWizard(models.TransientModel):
"""GOLEM Reservation Add to Invoice Wizard """ """GOLEM Reservation Add to Invoice Wizard """
@ -25,30 +25,3 @@ class GolemReservationAddToInvoiceWizard(models.TransientModel):
invoice_ids = fields.Many2many('account.invoice', string="Partner invoice list") invoice_ids = fields.Many2many('account.invoice', string="Partner invoice list")
reservation_id = fields.Many2one('golem.resource.reservation') reservation_id = fields.Many2one('golem.resource.reservation')
keyword = fields.Char(required=True)
member_ids = fields.Many2many('golem.member', string='Members')
contact_ids = fields.Many2many('res.partner', string='Contacts')
@api.multi
def action(self):
""" Returns action window with current model and instance """
self.ensure_one()
return {'name' : _('Search results'),
'type' : 'ir.actions.act_window',
'res_model' : self._name,
'res_id': self[0].id,
'view_mode': 'form',
'target': 'new'}
@api.multi
def search_partners(self):
""" Searches partners in name, email """
self.ensure_one()
domain = ['|',
('name', 'ilike', self[0].keyword),
('email', 'ilike', self[0].keyword)]
partner_ids = self.env['res.partner'].search(domain)
self[0].write({'contact_ids': [(6, False, partner_ids.ids)],
'member_ids': [(6, False, partner_ids.mapped('member_id').ids)]})
return self[0].action()

View File

@ -24,16 +24,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="model">golem.reservation.add.to.invoice.wizard</field> <field name="model">golem.reservation.add.to.invoice.wizard</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form> <form>
<sheet>
<group>
<field name="reservation_id" readonly="1" /> <field name="reservation_id" readonly="1" />
<field name="invoice_ids" widget="many2many" <field name="invoice_ids" widget="many2many" readonly="1">
context="{'reservation_id': reservation_id}"
readonly="1">
<tree> <tree>
<field name="partner_id" /> <field name="partner_id" />
<field name="amount_total" /> <field name="amount_total" />
<field name="state" />
<button name="add_to_invoice" type="object" icon="fa fa-plus-square" /> <button name="add_to_invoice" type="object" icon="fa fa-plus-square" />
</tree> </tree>
</field> </field>
</group>
</sheet>
<footer> <footer>
<button string="Close" special="cancel" /> <button string="Close" special="cancel" />
</footer> </footer>