FoodcoopBCN/foodcoopbcn#167 add pos_product_available_link
This commit is contained in:
parent
dab4123379
commit
bf02699b61
6 changed files with 111 additions and 0 deletions
32
pos_product_available_link/models/product.py
Normal file
32
pos_product_available_link/models/product.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Copyright 2026 Your Name
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = "product.template"
|
||||
|
||||
@api.onchange("sale_ok")
|
||||
def _onchange_sale_ok_link_available_in_pos(self):
|
||||
for product in self:
|
||||
product.available_in_pos = product.sale_ok
|
||||
|
||||
def write(self, vals):
|
||||
if "sale_ok" in vals:
|
||||
vals["available_in_pos"] = vals["sale_ok"]
|
||||
return super().write(vals)
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = "product.product"
|
||||
|
||||
@api.onchange("sale_ok")
|
||||
def _onchange_sale_ok_link_available_in_pos(self):
|
||||
for product in self:
|
||||
product.available_in_pos = product.sale_ok
|
||||
|
||||
def write(self, vals):
|
||||
if "sale_ok" in vals:
|
||||
vals["available_in_pos"] = vals["sale_ok"]
|
||||
return super().write(vals)
|
||||
Loading…
Add table
Add a link
Reference in a new issue