mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[9.0][IMP] rma: add button to rma's from customers
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
'views/stock_warehouse.xml',
|
'views/stock_warehouse.xml',
|
||||||
'views/product_view.xml',
|
'views/product_view.xml',
|
||||||
'views/procurement_view.xml',
|
'views/procurement_view.xml',
|
||||||
|
'views/res_partner_view.xml',
|
||||||
'wizards/rma_make_picking_view.xml',
|
'wizards/rma_make_picking_view.xml',
|
||||||
'wizards/rma_add_stock_move_view.xml',
|
'wizards/rma_add_stock_move_view.xml',
|
||||||
'wizards/stock_config_settings.xml',
|
'wizards/stock_config_settings.xml',
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# © 2017 Eficent Business and IT Consulting Services S.L.
|
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||||
|
|
||||||
from . import rma_order
|
from . import rma_order
|
||||||
@@ -10,3 +9,4 @@ from . import stock_warehouse
|
|||||||
from . import product
|
from . import product
|
||||||
from . import product_category
|
from . import product_category
|
||||||
from . import procurement
|
from . import procurement
|
||||||
|
from . import res_partner
|
||||||
|
|||||||
27
rma/models/res_partner.py
Normal file
27
rma/models/res_partner.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||||
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
|
from openerp import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class ResPartner(models.Model):
|
||||||
|
_inherit = "res.partner"
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def _compute_rma_line_count(self):
|
||||||
|
for rec in self:
|
||||||
|
rec.rma_line_count = len(rec.rma_line_ids)
|
||||||
|
|
||||||
|
rma_line_ids = fields.One2many(
|
||||||
|
comodel_name="rma.order.line", string="RMAs",
|
||||||
|
inverse_name="partner_id",
|
||||||
|
)
|
||||||
|
rma_line_count = fields.Integer(compute="_compute_rma_line_count")
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def action_open_partner_rma(self):
|
||||||
|
action = self.env.ref('rma.action_rma_customer_lines')
|
||||||
|
result = action.read()[0]
|
||||||
|
result['context'] = {'search_default_partner_id': self.id}
|
||||||
|
return result
|
||||||
23
rma/views/res_partner_view.xml
Normal file
23
rma/views/res_partner_view.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="view_partner_form" model="ir.ui.view">
|
||||||
|
<field name="name">res.partner.form - rma</field>
|
||||||
|
<field name="model">res.partner</field>
|
||||||
|
<field name="inherit_id" ref="base.view_partner_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<div name="button_box" position="inside">
|
||||||
|
<button type="object"
|
||||||
|
name="action_open_partner_rma"
|
||||||
|
class="oe_stat_button"
|
||||||
|
icon="fa-eject"
|
||||||
|
attrs="{'invisible':[('customer', '=', False)]}"
|
||||||
|
groups="rma.group_rma_customer_user,rma.group_rma_supplier_user">
|
||||||
|
<field name="rma_line_count" widget="statinfo"
|
||||||
|
string="RMAs"/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user