Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stock_ux/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
from . import stock_scrap
from . import stock_location
from . import stock_forecasted
from . import ir_actions_client
16 changes: 16 additions & 0 deletions stock_ux/models/ir_actions_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from odoo import models
from odoo.tools.safe_eval import safe_eval


class IRActionsClient(models.Model):
_inherit = "ir.actions.client"

def read(self, fields=None, load='_classic_read'):
res = super().read(fields=fields, load=load)
company = self.env.company
if company and company.country_code:
for i, action in enumerate(res):
ctx = safe_eval(action.get("context") or "{}")
ctx["company_country_code"] = company.country_code
res[i]["context"] = ctx
return res
14 changes: 8 additions & 6 deletions stock_ux/static/src/forecasted_buttons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
<templates xml:space="preserve">
<t name="stock_ux.ForecastedButtons" owl="1" t-inherit="stock.ForecastedButtons" t-inherit-mode="extension">
<xpath expr="//button[@title='Replenish']" position="after">
<button t-name="Movements"
class="btn btn-primary"
type="button" title="Product Movements"
t-on-click="_onClickTrace">
Movements
</button>
<t t-if="context.company_country_code == 'AR'">
<button t-name="Movements"
class="btn btn-primary"
type="button" title="Product Movements"
t-on-click="_onClickTrace">
Movements
</button>
</t>
</xpath>
</t>
</templates>
Loading