Merge pull request #361 from ForgeFlow/15.0-fp-359

[15.0][IMP] rma: rma groups improvements (add description, clean views, add lots to reports)
This commit is contained in:
Lois Rilo
2023-01-09 17:09:46 +01:00
committed by GitHub
15 changed files with 91 additions and 195 deletions

View File

@@ -11,6 +11,7 @@ class RmaOrder(models.Model):
_name = "rma.order"
_description = "RMA Group"
_inherit = ["mail.thread"]
_order = "id desc"
@api.model
def _get_default_type(self):
@@ -84,6 +85,7 @@ class RmaOrder(models.Model):
reference = fields.Char(
string="Partner Reference", help="The partner reference of this RMA order."
)
description = fields.Text()
comment = fields.Text("Additional Information")
date_rma = fields.Datetime(
string="Order Date", index=True, default=lambda self: self._default_date_rma()

View File

@@ -13,6 +13,7 @@ class RmaOrderLine(models.Model):
_name = "rma.order.line"
_description = "RMA"
_inherit = ["mail.thread"]
_order = "id desc"
@api.model
def _get_default_type(self):

View File

@@ -212,11 +212,19 @@
</div>
<table class="table table-condensed">
<t
t-set="print_lot_column"
t-value="any(l.lot_id for l in doc.rma_line_ids)"
/>
<thead>
<tr>
<th>Origin</th>
<th>Operation</th>
<th>Product</th>
<th
name="lot"
t-if="print_lot_column"
>Lot/Serial Number</th>
<th class="text-right">Quantity</th>
<th class="text-right">Unit Price</th>
</tr>
@@ -226,6 +234,9 @@
<td><span t-field="l.origin" /></td>
<td><span t-field="l.operation_id.name" /></td>
<td><span t-field="l.product_id" /></td>
<td name="lot" t-if="print_lot_column"><span
t-field="l.lot_id"
/></td>
<td class="text-right">
<span t-field="l.product_qty" />
<span t-field="l.uom_id" groups="uom.group_uom" />

View File

@@ -91,20 +91,29 @@
</div>
<group>
<group name="info">
<field name="type" readonly="1" invisible="1" />
<field
name="partner_id"
context="{'res_partner_search_mode': 'customer'}"
string="Customer"
colspan="4"
/>
<field
name="reference"
attrs="{'invisible':[('type', '!=', 'supplier')]}"
/>
<field
name="date_rma"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
</group>
<group name="comments">
<field name="comment" />
<field name="type" readonly="1" invisible="1" />
<group name="contact">
<field name="requested_by" readonly="1" />
<field
name="assigned_to"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
<field name="company_id" groups="base.group_multi_company" />
</group>
</group>
<group>
@@ -115,9 +124,10 @@
/>
<field
name="customer_to_supplier"
attrs="{'readonly':[('state', '!=', 'draft')]}"
attrs="{'readonly':[('state', '!=', 'draft')],
'invisible':[('type', '!=', 'customer')]}"
/>
<field name="state" invisible="True" />
<field name="state" invisible="1" />
<field
name="supplier_address_id"
context="{'show_address': 1}"
@@ -129,13 +139,15 @@
</group>
</group>
<group>
<group name="contact" string="Contact">
<field name="requested_by" readonly="1" />
<group name="comments" string="Description" colspan="2">
<field
name="assigned_to"
attrs="{'readonly':[('state', '!=', 'draft')]}"
name="description"
placeholder="This description will be copied to RMA lines."
/>
<field
name="comment"
placeholder="Additional information will be printed in RMA group report."
/>
<field name="company_id" groups="base.group_multi_company" />
</group>
</group>
<notebook colspan="4">
@@ -146,7 +158,12 @@
'default_partner_id': partner_id,
'hide_title': True}"
>
<tree name="lines" editable="bottom">
<tree
name="lines"
editable="bottom"
default_order="id asc"
create="0"
>
<field name="sequence" widget="handle" />
<field name="state" invisible="True" />
<field name="partner_id" invisible="True" />
@@ -167,6 +184,8 @@
<field name="out_warehouse_id" invisible="True" />
<field name="customer_to_supplier" invisible="True" />
<field name="supplier_address_id" invisible="True" />
<field name="supplier_to_customer" invisible="True" />
<field name="customer_address_id" invisible="True" />
<field name="receipt_policy" invisible="True" />
<field name="delivery_policy" invisible="True" />
<field name="delivery_address_id" invisible="True" />
@@ -192,151 +211,43 @@
<record id="view_rma_supplier_form" model="ir.ui.view">
<field name="name">rma.order.supplier.form</field>
<field name="model">rma.order</field>
<field name="inherit_id" ref="rma.view_rma_form" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<form string="RMA">
<header />
<sheet string="RMA">
<div class="oe_button_box" name="button_box">
<button
type="object"
name="action_view_in_shipments"
class="oe_stat_button"
icon="fa-truck"
groups="stock.group_stock_user"
>
<field
name="in_shipment_count"
widget="statinfo"
string="Shipments"
/>
</button>
<button
type="object"
name="action_view_out_shipments"
class="oe_stat_button"
icon="fa-truck"
groups="stock.group_stock_user"
>
<field
name="out_shipment_count"
widget="statinfo"
string="Deliveries"
/>
</button>
<button
type="object"
name="action_view_lines"
class="oe_stat_button"
icon="fa-list"
groups="rma.group_rma_supplier_user"
>
<field name="line_count" widget="statinfo" string="RMA Lines" />
</button>
</div>
<div class="oe_title" name="title">
<h1>
<field name="name" readonly="1" />
</h1>
</div>
<group>
<group name="partner">
<field name="state" invisible="1" />
<field
name="partner_id"
context="{'res_partner_search_mode': 'supplier'}"
string="Supplier"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
<field name="reference" />
<field
name="date_rma"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
</group>
<group>
<field name="comment" />
<field name="type" readonly="1" invisible="1" />
</group>
</group>
<group name="route">
<group name="inbound_route" string="Inbound">
<field
name="in_warehouse_id"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
</group>
<group name="outbound_route" string="Outbound">
<field
name="supplier_to_customer"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
<field
name="customer_address_id"
context="{'show_address': 1}"
options="{'always_reload': 1}"
attrs="{'required':[('supplier_to_customer', '=', True)],
'invisible':[('supplier_to_customer', '=', False)],
'readonly':[('state', '!=', 'draft')]}"
/>
</group>
</group>
<group>
<group name="contact" string="Contact">
<field name="requested_by" readonly="1" />
<field
name="assigned_to"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
<field name="company_id" groups="base.group_multi_company" />
</group>
</group>
<notebook colspan="4">
<page string="RMA Lines" name="lines">
<field
name="rma_line_ids"
context="{'form_view_ref':'rma.view_rma_line_supplier_form',
'default_rma_id': active_id,
'default_partner_id': partner_id,
'supplier': 1,
'hide_title': True}"
>
<tree name="RMA Lines" editable="bottom">
<field name="sequence" widget="handle" />
<field name="state" invisible="True" />
<field name="name" />
<field name="partner_id" invisible="True" />
<field name="product_id" />
<field
name="lot_id"
groups="stock.group_production_lot"
domain="[('product_id', '=', product_id)]"
context="{'default_product_id': product_id}"
/>
<field name="uom_id" groups="uom.group_uom" />
<field name="operation_id" />
<field name="location_id" invisible="True" />
<field name="in_route_id" invisible="True" />
<field name="out_route_id" invisible="True" />
<field name="in_warehouse_id" invisible="True" />
<field name="out_warehouse_id" invisible="True" />
<field name="supplier_to_customer" invisible="True" />
<field name="customer_address_id" invisible="True" />
<field name="product_qty" />
<field name="price_unit" />
</tree>
</field>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field
name="message_follower_ids"
widget="mail_followers"
groups="base.group_user"
<xpath expr="//button[@name='action_view_lines']" position="attributes">
<attribute name="groups">rma.group_rma_supplier_user</attribute>
</xpath>
<field name="partner_id" position="attributes">
<attribute name="string">Supplier</attribute>
<attribute
name="context"
>{'res_partner_search_mode': 'supplier'}</attribute>
</field>
<group name="inbound_route" position="after">
<group name="outbound_route" string="Outbound">
<field
name="supplier_to_customer"
attrs="{'readonly':[('state', '!=', 'draft')]}"
/>
<field name="message_ids" widget="mail_thread" />
</div>
</form>
<field
name="customer_address_id"
context="{'show_address': 1}"
options="{'always_reload': 1}"
attrs="{'required':[('supplier_to_customer', '=', True)],
'invisible':[('supplier_to_customer', '=', False)],
'readonly':[('state', '!=', 'draft')]}"
/>
</group>
</group>
<field name="rma_line_ids" position="attributes">
<attribute name="context">{
'form_view_ref':'rma.view_rma_line_supplier_form',
'default_rma_id': active_id,
'default_partner_id': partner_id,
'supplier': 1,
'hide_title': True}
</attribute>
</field>
</field>
</record>

View File

@@ -102,6 +102,7 @@ class RmaAddSerialWiz(models.TransientModel):
vals = {
"partner_id": self.partner_id.id,
"description": self.rma_id.description,
"product_id": lot.product_id.id,
"lot_id": lot.id,
"uom_id": lot.product_id.uom_id.id,

View File

@@ -55,6 +55,7 @@
name="%(action_rma_add_serial_wiz_customer)d"
string="Add Lot/Serial Numbers"
type="action"
attrs="{'invisible':[('type', '!=', 'customer')]}"
/>
</xpath>
</field>
@@ -92,6 +93,7 @@
name="%(action_rma_add_serial_wiz_supplier)d"
string="Add Lot/Serial numbers"
type="action"
attrs="{'invisible':[('type', '!=', 'supplier')]}"
/>
</xpath>
</field>

View File

@@ -122,6 +122,7 @@ class RmaAddStockMove(models.TransientModel):
)
data = {
"partner_id": self.partner_id.id,
"description": self.rma_id.description,
"reference_move_id": sm.id,
"product_id": sm.product_id.id,
"lot_id": lot and lot.id or False,

View File

@@ -101,6 +101,7 @@
name="%(action_rma_add_stock_move_customer)d"
string="Add From Stock Move"
type="action"
attrs="{'invisible':[('type', '!=', 'customer')]}"
/>
</xpath>
</field>
@@ -155,6 +156,7 @@
name="%(action_rma_add_stock_move_supplier)d"
string="Add From Stock Move"
type="action"
attrs="{'invisible':[('type', '!=', 'supplier')]}"
/>
</xpath>
</field>

View File

@@ -113,6 +113,7 @@ class RmaLineMakeSupplierRma(models.TransientModel):
)
data = {
"partner_id": self.partner_id.id,
"description": self.supplier_rma_id.description,
"type": "supplier",
"origin": item.line_id.rma_id.name,
"customer_address_id": item.line_id.delivery_address_id.id

View File

@@ -35,45 +35,4 @@
</field>
</record>
<record id="view_rma_supplier_form" model="ir.ui.view">
<field name="name">rma.order.supplier.form</field>
<field name="model">rma.order</field>
<field name="inherit_id" ref="rma.view_rma_supplier_form" />
<field name="arch" type="xml">
<button name="action_view_out_shipments" position="after">
<button
type="object"
name="action_view_invoice_refund"
class="oe_stat_button"
icon="fa-pencil-square-o"
groups="account.group_account_invoice"
>
<field
name="invoice_refund_count"
widget="statinfo"
string="Refunds"
/>
</button>
<button
type="object"
name="action_view_invoice"
class="oe_stat_button"
icon="fa-pencil-square-o"
groups="account.group_account_invoice"
>
<field
name="invoice_count"
widget="statinfo"
string="Origin Inv"
/>
</button>
</button>
<!--
<xpath expr="//field[@name='rma_line_ids']/tree"
position="inside">
<field name="account_move_line_id" invisible="True"/>
</xpath>
-->
</field>
</record>
</odoo>

View File

@@ -78,6 +78,7 @@ class RmaAddPurchase(models.TransientModel):
)
data = {
"partner_id": self.partner_id.id,
"description": self.rma_id.description,
"purchase_order_line_id": line.id,
"product_id": line.product_id.id,
"origin": line.order_id.name,

View File

@@ -13,6 +13,7 @@
class="oe_stat_button"
icon="fa-wrench"
groups="stock.group_stock_user"
attrs="{'invisible':[('type', '!=', 'customer')]}"
>
<field
name="repair_count"

View File

@@ -12,6 +12,7 @@
class="oe_stat_button"
icon="fa-pencil-square-o"
groups="sales_team.group_sale_salesman"
attrs="{'invisible':[('type', '!=', 'customer')]}"
>
<field name="sale_count" widget="statinfo" string="Origin SO" />
</button>

View File

@@ -123,6 +123,7 @@ class RmaAddSale(models.TransientModel):
)
data = {
"partner_id": self.partner_id.id,
"description": self.rma_id.description,
"sale_line_id": line.id,
"product_id": line.product_id.id,
"lot_id": lot and lot.id or False,

View File

@@ -114,6 +114,7 @@
name="%(action_rma_add_sale)d"
string="Add From Sale Order"
type="action"
attrs="{'invisible':[('type', '!=', 'customer')]}"
/>
</xpath>
</field>