Add an web shop URL to sales

Closes #14538
This commit is contained in:
Cédric Krier
2026-01-22 18:32:26 +01:00
parent e7fa8e4461
commit aafdc31cea
8 changed files with 21 additions and 23 deletions
+1
View File
@@ -1,3 +1,4 @@
* Add an URL to sales
Version 7.8.0 - 2025-12-15
--------------------------
+11
View File
@@ -23,6 +23,14 @@ class Sale(metaclass=PoolMeta):
'required': Bool(Eval('web_shop')),
'readonly': ~Eval('web_id'),
})
web_url = fields.Function(
fields.Char(
"Web URL",
states={
'invisible': ~Eval('web_url'),
},
help="The URL of the order on the web shop."),
'get_web_url')
web_status_url = fields.Function(
fields.Char(
"Web Status URL",
@@ -64,6 +72,9 @@ class Sale(metaclass=PoolMeta):
if self.web_shop and not self.web_id:
self.web_id = token_hex(nbytes)
def get_web_url(self, name):
pass
def get_web_status_url(self, name):
pass
+2
View File
@@ -8,6 +8,8 @@ this repository contains the full copyright notices and license terms. -->
<label name="web_id"/>
<field name="web_id"/>
<label name="web_url"/>
<field name="web_url" widget="url" colspan="3"/>
<label name="web_status_url"/>
<field name="web_status_url" widget="url" colspan="3"/>
</xpath>
+1
View File
@@ -5,5 +5,6 @@ this repository contains the full copyright notices and license terms. -->
<xpath expr="//field[@name='reference']" position="after">
<field name="web_shop" expand="1" optional="1"/>
<field name="web_id" expand="1" optional="1"/>
<field name="web_url" widget="url" optional="1"/>
</xpath>
</data>
+6
View File
@@ -166,6 +166,12 @@ class Sale(IdentifierMixin, metaclass=PoolMeta):
'web_shop_shopify.msg_identifier_sale_web_shop_unique'),
]
def get_web_url(self, name):
url = super().get_web_url(name)
if self.shopify_url:
url = self.shopify_url
return url
def get_web_status_url(self, name):
url = super().get_web_status_url(name)
if self.shopify_status_url:
-12
View File
@@ -1,12 +0,0 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="sale_view_form">
<field name="model">sale.sale</field>
<field name="inherit" ref="sale.sale_view_form"/>
<field name="name">sale_form</field>
</record>
</data>
</tryton>
-1
View File
@@ -29,7 +29,6 @@ xml:
product.xml
party.xml
web.xml
sale.xml
stock.xml
carrier.xml
message.xml
@@ -1,10 +0,0 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="//field[@name='web_id']" position="after">
<newline/>
<label name="shopify_url"/>
<field name="shopify_url" widget="url" colspan="3"/>
</xpath>
</data>