-
-
Notifications
You must be signed in to change notification settings - Fork 707
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aceecc9
commit cdb6dc6
Showing
10 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2023 Ows - Henrik Norlin | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Contact -> Products with the contact's prices", | ||
"summary": "", | ||
"author": "Ows, Odoo Community Association (OCA)", | ||
"category": "Product", | ||
"data": [ | ||
"data/ir_actions_server.xml", | ||
"views/product_product_views.xml", | ||
], | ||
"depends": [ | ||
"product", | ||
], | ||
"development_status": "Alpha", | ||
"license": "AGPL-3", | ||
"maintainers": ["ows-cloud"], | ||
"version": "16.0.1.0.0", | ||
"website": "https://github.com/OCA/product-attribute", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo noupdate="1"> | ||
<record id="action_product_price_list_report" model="ir.actions.server"> | ||
<field name="name">Products</field> | ||
<field name="groups_id" eval="[(4, ref('resource_booking.group_user'))]" /> | ||
<field name="model_id" ref="base.model_res_partner" /> | ||
<field name="binding_model_id" ref="base.model_res_partner" /> | ||
<field name="state">code</field> | ||
<field name="code"> | ||
action = env["ir.actions.actions"]._for_xml_id("product.product_normal_action_sell") | ||
# action["domain"] = [("resource_booking_type_id", "!=", False)] | ||
action["context"] = {'partner_id': record.id} | ||
</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import product_product |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class ProductProduct(models.Model): | ||
_inherit = "product.product" | ||
|
||
def _compute_partner_and_price(self): | ||
partner_id = self.env.context.get("partner_id") | ||
partner = self.env["res.partner"].browse(partner_id) | ||
pricelist = None | ||
if partner: | ||
pricelist = partner.property_product_pricelist | ||
|
||
for product in self: | ||
product.partner_id = partner_id | ||
product.partner_price = pricelist._get_product_price(product, quantity=1) | ||
|
||
partner_id = fields.Many2one( | ||
"res.partner", | ||
string="Contact", | ||
compute="_compute_partner_and_price", | ||
) | ||
partner_price = fields.Float( | ||
"Contact's Price", | ||
compute="_compute_partner_and_price", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Henrik Norlin (Ows) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module will show products with the pricelist of a contact. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- Open a contact. | ||
- Click Actions - Products. | ||
- In list view, show the fields **Contact** and **Contact's Price**. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="product_product_tree_view" model="ir.ui.view"> | ||
<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="arch" type="xml"> | ||
<tree position="inside"> | ||
<field name="partner_id" optional="hide" /> | ||
<field name="partner_price" optional="hide" /> | ||
</tree> | ||
</field> | ||
</record> | ||
</odoo> |