Skip to content

Commit

Permalink
[FIX] partner_product_price: suggestions in PR, partner button, dedic…
Browse files Browse the repository at this point in the history
…ated action (to save favorite filters)
  • Loading branch information
norlinhenrik committed Sep 25, 2023
1 parent d1dc1d4 commit 723ed28
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 21 deletions.
3 changes: 2 additions & 1 deletion partner_product_price/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"author": "Ows, Odoo Community Association (OCA)",
"category": "Product",
"data": [
"data/ir_actions_server.xml",
"views/res_partner_views.xml",
"views/product_product_views.xml",
],
"depends": [
"partner_stage", # inherit header
"product",
],
"development_status": "Alpha",
Expand Down
15 changes: 0 additions & 15 deletions partner_product_price/data/ir_actions_server.xml

This file was deleted.

1 change: 1 addition & 0 deletions partner_product_price/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import product_product
from . import res_partner
1 change: 1 addition & 0 deletions partner_product_price/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ def _compute_partner_and_price(self):
partner_price = fields.Float(
"Contact's Price",
compute="_compute_partner_and_price",
digits=2,
)
11 changes: 11 additions & 0 deletions partner_product_price/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from odoo import models


class ResPartner(models.Model):
_inherit = "res.partner"

def action_partner_product_price(self):
# Return a unique database action so filters may be saved towards the action.
return self.env["ir.actions.actions"]._for_xml_id(
"partner_product_price.product_product_action_sell"
)
2 changes: 1 addition & 1 deletion partner_product_price/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* Henrik Norlin (Ows)
* Henrik Norlin (https://ows.cloud)
20 changes: 16 additions & 4 deletions partner_product_price/views/product_product_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@
<field name="name">product.product.tree.inherit.partner.product.price</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_product_tree_view" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<tree position="inside">
<field name="partner_id" optional="hide" />
<field name="partner_price" optional="hide" />
</tree>
<field name="lst_price" position="before">
<field name="partner_id" optional="show" />
<field name="partner_price" optional="show" />
</field>
</field>
</record>
<record id="product_product_action_sell" model="ir.actions.act_window">
<field name="name">Product Variants with Contact's Price</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_mode">kanban,tree,form,activity</field>
<field
name="context"
>{"search_default_filter_to_sell": 1, "partner_id": active_id}</field>
<field name="view_id" ref="product_product_tree_view" />
<field name="search_view_id" ref="product.product_search_form_view" />
</record>
</odoo>
18 changes: 18 additions & 0 deletions partner_product_price/views/res_partner_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_partner_form" model="ir.ui.view">
<field name="name">res.partner.form.inherit.partner_product_price</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_stage.view_partner_form" />
<field name="arch" type="xml">
<field name="stage_id" position="before">
<button
class="btn btn-primary"
type="object"
name="action_partner_product_price"
string="See product prices"
/>
</field>
</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions setup/partner_product_price/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 723ed28

Please sign in to comment.