mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[MIG] rma_sale: Migration to 12.0
This commit is contained in:
committed by
ahenriquez
parent
7c03d96015
commit
d6e7e85a54
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'RMA Sale',
|
'name': 'RMA Sale',
|
||||||
'version': '11.0.1.0.0',
|
'version': '12.0.1.0.0',
|
||||||
'license': 'LGPL-3',
|
'license': 'LGPL-3',
|
||||||
'category': 'RMA',
|
'category': 'RMA',
|
||||||
'summary': 'Links RMA with Sales Orders',
|
'summary': 'Links RMA with Sales Orders',
|
||||||
|
|||||||
@@ -6,14 +6,15 @@ from odoo import api, fields, models
|
|||||||
class RmaOrder(models.Model):
|
class RmaOrder(models.Model):
|
||||||
_inherit = "rma.order"
|
_inherit = "rma.order"
|
||||||
|
|
||||||
@api.multi
|
@api.depends('rma_line_ids', 'rma_line_ids.sale_line_id',
|
||||||
|
'rma_line_ids.sale_line_id.order_id')
|
||||||
def _compute_sales_count(self):
|
def _compute_sales_count(self):
|
||||||
for rma in self:
|
for rma in self:
|
||||||
sales = rma.mapped('rma_line_ids.sale_line_id.order_id')
|
sales = rma.mapped('rma_line_ids.sale_line_id.order_id')
|
||||||
rma.sale_count = len(sales)
|
rma.sale_count = len(sales)
|
||||||
|
|
||||||
sale_count = fields.Integer(
|
sale_count = fields.Integer(
|
||||||
compute=_compute_sales_count, string='# of Sales')
|
compute='_compute_sales_count', string='# of Sales')
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_line_domain(self, rma_id, line):
|
def _get_line_domain(self, rma_id, line):
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class RmaOrderLine(models.Model):
|
|||||||
for rec in self:
|
for rec in self:
|
||||||
rec.qty_sold = rec._get_rma_sold_qty()
|
rec.qty_sold = rec._get_rma_sold_qty()
|
||||||
|
|
||||||
@api.multi
|
@api.depends('sale_line_ids', 'sale_line_ids.order_id')
|
||||||
def _compute_sales_count(self):
|
def _compute_sales_count(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
sales = line.mapped('sale_line_ids.order_id')
|
sales = line.mapped('sale_line_ids.order_id')
|
||||||
@@ -40,7 +40,6 @@ class RmaOrderLine(models.Model):
|
|||||||
)
|
)
|
||||||
sale_id = fields.Many2one(
|
sale_id = fields.Many2one(
|
||||||
string="Source Sales Order", related='sale_line_id.order_id',
|
string="Source Sales Order", related='sale_line_id.order_id',
|
||||||
readonly=True,
|
|
||||||
)
|
)
|
||||||
sale_line_ids = fields.One2many(
|
sale_line_ids = fields.One2many(
|
||||||
comodel_name='sale.order.line', inverse_name='rma_line_id',
|
comodel_name='sale.order.line', inverse_name='rma_line_id',
|
||||||
@@ -49,12 +48,12 @@ class RmaOrderLine(models.Model):
|
|||||||
qty_to_sell = fields.Float(
|
qty_to_sell = fields.Float(
|
||||||
string='Qty To Sell', copy=False,
|
string='Qty To Sell', copy=False,
|
||||||
digits=dp.get_precision('Product Unit of Measure'),
|
digits=dp.get_precision('Product Unit of Measure'),
|
||||||
readonly=True, compute=_compute_qty_to_sell,
|
readonly=True, compute='_compute_qty_to_sell',
|
||||||
store=True)
|
store=True)
|
||||||
qty_sold = fields.Float(
|
qty_sold = fields.Float(
|
||||||
string='Qty Sold', copy=False,
|
string='Qty Sold', copy=False,
|
||||||
digits=dp.get_precision('Product Unit of Measure'),
|
digits=dp.get_precision('Product Unit of Measure'),
|
||||||
readonly=True, compute=_compute_qty_sold,
|
readonly=True, compute='_compute_qty_sold',
|
||||||
store=True)
|
store=True)
|
||||||
sale_policy = fields.Selection(selection=[
|
sale_policy = fields.Selection(selection=[
|
||||||
('no', 'Not required'), ('ordered', 'Based on Ordered Quantities'),
|
('no', 'Not required'), ('ordered', 'Based on Ordered Quantities'),
|
||||||
@@ -62,7 +61,7 @@ class RmaOrderLine(models.Model):
|
|||||||
string="Sale Policy", default='no', required=True,
|
string="Sale Policy", default='no', required=True,
|
||||||
readonly=True, states={'draft': [('readonly', False)]})
|
readonly=True, states={'draft': [('readonly', False)]})
|
||||||
sales_count = fields.Integer(
|
sales_count = fields.Integer(
|
||||||
compute=_compute_sales_count, string='# of Sales')
|
compute='_compute_sales_count', string='# of Sales')
|
||||||
|
|
||||||
@api.onchange('product_id', 'partner_id')
|
@api.onchange('product_id', 'partner_id')
|
||||||
def _onchange_product_id(self):
|
def _onchange_product_id(self):
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
<record id="rma_operation_tree" model="ir.ui.view">
|
<record id="rma_operation_tree" model="ir.ui.view">
|
||||||
<field name="name">rma.operation.tree</field>
|
<field name="name">rma.operation.tree</field>
|
||||||
@@ -24,5 +23,4 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -103,8 +103,8 @@
|
|||||||
<field name="inherit_id" ref="rma.view_rma_rma_line_filter"/>
|
<field name="inherit_id" ref="rma.view_rma_rma_line_filter"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<group name="stock_quantities" position="after">
|
<group name="stock_quantities" position="after">
|
||||||
<group name="sale_quantities" groups="base.group_sale_salesman">
|
<group name="sale_quantities" groups="sales_team.group_sale_salesman">
|
||||||
<filter domain="[('state','!=', 'done'),('qty_to_sell','>',0.0)]" help="To Sell"/>
|
<filter domain="[('state','!=', 'done'),('qty_to_sell','>',0.0)]" help="To Sell" name="to_sell"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
|
||||||
<record id="view_rma_form" model="ir.ui.view">
|
<record id="view_rma_form" model="ir.ui.view">
|
||||||
<field name="name">rma.order.form</field>
|
<field name="name">rma.order.form</field>
|
||||||
<field name="model">rma.order</field>
|
<field name="model">rma.order</field>
|
||||||
@@ -10,12 +9,11 @@
|
|||||||
<button type="object" name="action_view_sale_order"
|
<button type="object" name="action_view_sale_order"
|
||||||
class="oe_stat_button"
|
class="oe_stat_button"
|
||||||
icon="fa-pencil-square-o"
|
icon="fa-pencil-square-o"
|
||||||
groups="base.group_sale_salesman">
|
groups="sales_team.group_sale_salesman">
|
||||||
<field name="sale_count" widget="statinfo"
|
<field name="sale_count" widget="statinfo"
|
||||||
string="Origin SO"/>
|
string="Origin SO"/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
|
||||||
<record id="view_order_form" model="ir.ui.view">
|
<record id="view_order_form" model="ir.ui.view">
|
||||||
<field name="name">sale.order.form</field>
|
<field name="name">sale.order.form</field>
|
||||||
<field name="model">sale.order</field>
|
<field name="model">sale.order</field>
|
||||||
@@ -15,5 +14,4 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<field name="qty_delivered"/>
|
<field name="qty_delivered"/>
|
||||||
<field name="qty_invoiced"/>
|
<field name="qty_invoiced"/>
|
||||||
<field name="qty_to_invoice"/>
|
<field name="qty_to_invoice"/>
|
||||||
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
|
<field name="product_uom" string="Unit of Measure" groups="uom.group_uom"/>
|
||||||
<field name="price_subtotal" sum="Total" widget="monetary"/>
|
<field name="price_subtotal" sum="Total" widget="monetary"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
||||||
|
|||||||
@@ -132,14 +132,14 @@ class RmaLineMakeSaleOrderItem(models.TransientModel):
|
|||||||
line_id = fields.Many2one(
|
line_id = fields.Many2one(
|
||||||
comodel_name='rma.order.line', string='RMA Line')
|
comodel_name='rma.order.line', string='RMA Line')
|
||||||
rma_id = fields.Many2one(
|
rma_id = fields.Many2one(
|
||||||
comodel_name='rma.order', related='line_id.rma_id')
|
comodel_name='rma.order', related='line_id.rma_id', readonly=False)
|
||||||
product_id = fields.Many2one(
|
product_id = fields.Many2one(
|
||||||
comodel_name='product.product', string='Product')
|
comodel_name='product.product', string='Product')
|
||||||
name = fields.Char(string='Description')
|
name = fields.Char(string='Description')
|
||||||
product_qty = fields.Float(
|
product_qty = fields.Float(
|
||||||
string='Quantity to sell', digits=dp.get_precision('Product UoS'))
|
string='Quantity to sell', digits=dp.get_precision('Product UoS'))
|
||||||
product_uom_id = fields.Many2one(
|
product_uom_id = fields.Many2one(
|
||||||
comodel_name='product.uom', string='UoM')
|
comodel_name='uom.uom', string='UoM')
|
||||||
out_warehouse_id = fields.Many2one(
|
out_warehouse_id = fields.Many2one(
|
||||||
comodel_name='stock.warehouse', string='Outbound Warehouse')
|
comodel_name='stock.warehouse', string='Outbound Warehouse')
|
||||||
free_of_charge = fields.Boolean(string='Free of Charge')
|
free_of_charge = fields.Boolean(string='Free of Charge')
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Copyright 2016 Eficent Business and IT Consulting Services S.L.
|
<!-- Copyright 2016 Eficent Business and IT Consulting Services S.L.
|
||||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
|
||||||
<openerp>
|
<odoo>
|
||||||
<data>
|
|
||||||
<record id="view_rma_order_line_make_sale_order" model="ir.ui.view">
|
<record id="view_rma_order_line_make_sale_order" model="ir.ui.view">
|
||||||
<field name="name">RMA Line Make Sale Order</field>
|
<field name="name">RMA Line Make Sale Order</field>
|
||||||
<field name="model">rma.order.line.make.sale.order</field>
|
<field name="model">rma.order.line.make.sale.order</field>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="product_qty"/>
|
<field name="product_qty"/>
|
||||||
<field name="product_uom_id"
|
<field name="product_uom_id"
|
||||||
groups="product.group_uom"/>
|
groups="uom.group_uom"/>
|
||||||
<field name="free_of_charge"/>
|
<field name="free_of_charge"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
@@ -59,6 +59,5 @@
|
|||||||
<field name="target">new</field>
|
<field name="target">new</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
</odoo>
|
||||||
</openerp>
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user