This commit is contained in:
oscar alvarez 2022-07-24 10:02:51 -05:00
parent bd3453d21b
commit b47ca9017e
12 changed files with 266 additions and 16 deletions

View File

@ -219,12 +219,10 @@ class Booking(Workflow, ModelSQL, ModelView):
return config.payment_term.id
def get_channel_icon(self, name):
# if self.channel:
# return
# path = os.path.join('icons/channel-house.png')
# with file_open('icons/channel-house.png', mode='r', encoding='utf-8') as fp:
# return fp.read()
pass
name_icon = 'hotel-channel-house'
if self.channel and self.channel.code:
name_icon = f'hotel-channel-{self.channel.code}'
return name_icon
@classmethod
def trigger_create(cls, records):
@ -792,11 +790,6 @@ class Booking(Workflow, ModelSQL, ModelView):
except:
pass
# def add_payments_invoice(self):
# for payment in self.payments:
# for invoice in self.invoices:
# if invoice.
@classmethod
def create_invoice(cls, folios):
pool = Pool()

View File

@ -22,7 +22,7 @@ class SaleChannel(ModelSQL, ModelView):
__name__ = 'hotel.channel'
name = fields.Char('Name', required=True)
code = fields.Selection([
('', ''),
(None, ''),
('booking', 'Booking'),
('despegar', 'Despegar'),
('expedia', 'Expedia'),
@ -92,7 +92,6 @@ class SaleChannel(ModelSQL, ModelView):
return Company(company).currency.id
def compute(self, amount):
print(self)
res = Decimal(round(float(amount) * self.commission / 100, 2))
return res

View File

@ -52,7 +52,19 @@ this repository contains the full copyright notices and license terms. -->
</record>
<record model="ir.ui.icon" id="hotel_channel_house_icon">
<field name="name">hotel-channel-house</field>
<field name="path">icons/channel-house.png</field>
<field name="path">icons/channel-house.svg</field>
</record>
<record model="ir.ui.icon" id="hotel_channel_despegar_icon">
<field name="name">hotel-channel-despegar</field>
<field name="path">icons/channel-despegar.svg</field>
</record>
<record model="ir.ui.icon" id="hotel_channel_expedia_icon">
<field name="name">hotel-channel-expedia</field>
<field name="path">icons/channel-expedia.svg</field>
</record>
<record model="ir.ui.icon" id="hotel_channel_booking_icon">
<field name="name">hotel-channel-booking</field>
<field name="path">icons/channel-booking.svg</field>
</record>
<menuitem name="Hotel" sequence="10" id="menu_hotel"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

58
icons/channel-booking.svg Normal file
View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="92.309967mm"
height="92.43821mm"
viewBox="0 0 92.309969 92.43821"
version="1.1"
id="svg5"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="booking.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="0.90583672"
inkscape:cx="146.82558"
inkscape:cy="136.33804"
inkscape:window-width="1846"
inkscape:window-height="1016"
inkscape:window-x="74"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
fit-margin-top="5"
fit-margin-left="5"
fit-margin-right="5"
fit-margin-bottom="5" />
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-60.715216,-49.817611)">
<ellipse
style="fill:#ffffff;fill-opacity:1;stroke:#cccccc;stroke-width:0.190935"
id="path5708"
cx="107.79934"
cy="97.001511"
rx="29.066414"
ry="29.566366" />
<path
style="fill:#003382;fill-opacity:1;stroke-width:0.264583"
d="m 103.80289,137.17962 c -1.60072,-0.0966 -3.862911,-0.375 -5.027081,-0.61863 -16.408544,-3.43385 -28.78529,-15.66106 -32.482249,-32.08979 -0.50145,-2.22837 -0.578344,-3.36158 -0.578344,-8.523198 0,-5.16163 0.07689,-6.29483 0.578344,-8.5232 3.659969,-16.26436 15.764484,-28.368881 32.028839,-32.028841 2.228371,-0.50145 3.361581,-0.57835 8.523201,-0.57835 5.16163,0 6.29483,0.0769 8.5232,0.57835 16.48542,3.70971 28.54457,15.950691 32.13632,32.620871 0.69342,3.21836 0.69342,12.643968 0,15.862328 -1.24439,5.77553 -3.78199,11.63749 -6.98925,16.14548 -7.05106,9.91068 -18.89638,16.49327 -30.89214,17.16715 -1.60073,0.0899 -4.22011,0.0845 -5.82084,-0.0122 z m 17.3306,-26.0604 c 0.40891,-0.24155 0.99283,-0.88284 1.29759,-1.42508 1.77232,-3.15342 -1.44314,-6.63276 -4.75115,-5.14106 -2.61053,1.17719 -2.86811,5.00429 -0.43659,6.48688 1.04624,0.63793 2.88111,0.67532 3.89015,0.0793 z m -14.46504,-0.60748 c 3.31836,-1.35638 5.45343,-4.20596 5.67432,-7.57329 0.21578,-3.289288 -0.96281,-5.861098 -3.38739,-7.391668 l -0.99631,-0.62895 1.06779,-1.12247 c 1.51765,-1.59539 2.11078,-3.0924 2.12485,-5.36296 0.0235,-3.80242 -2.08234,-6.54161 -5.90104,-7.67564 -1.09386,-0.32484 -2.63629,-0.41707 -6.853611,-0.4098 -5.894891,0.0102 -6.26808,0.0863 -7.176069,1.46367 -0.489731,0.74291 -0.511556,1.3871 -0.513226,15.14849 l -0.0017,14.372568 7.209895,-0.0947 c 6.873861,-0.0903 7.281791,-0.12409 8.752531,-0.72525 z m -9.877011,-8.02618 c 0,-4.806118 0.009,-4.817768 3.747981,-4.817768 2.27352,0 2.88879,0.0908 3.65099,0.53853 1.84889,1.08618 2.50457,3.608508 1.48947,5.729828 -0.80666,1.68574 -1.4208,1.9166 -5.38271,2.02342 l -3.505731,0.0945 z m 0,-12.767288 c 0,-2.89053 0.0349,-3.08965 0.64943,-3.70417 0.57525,-0.57525 0.87845,-0.64943 2.654331,-0.64943 3.33459,0 4.64212,0.88289 4.83992,3.26811 0.14116,1.70224 -0.37814,2.87182 -1.60809,3.62176 -0.70109,0.42748 -1.33718,0.51665 -3.691321,0.51747 l -2.84427,9.9e-4 z"
id="path939" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="51.858791mm"
height="52.779999mm"
viewBox="0 0 51.858791 52.779999"
version="1.1"
id="svg5"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="channel-despegar.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="2"
inkscape:cx="12.5"
inkscape:cy="103.25"
inkscape:window-width="1846"
inkscape:window-height="1016"
inkscape:window-x="74"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
fit-margin-top="5"
fit-margin-left="5"
fit-margin-right="5"
fit-margin-bottom="5" />
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-75.402672,-168.01805)">
<ellipse
style="fill:#cdb7f9;fill-opacity:1;stroke:none;stroke-width:0.25142"
id="path947"
cx="103.21084"
cy="194.40805"
rx="19.050623"
ry="21.389999" />
<rect
style="fill:#cdb7f9;fill-opacity:1;stroke:none;stroke-width:0.232366"
id="rect7371"
width="22.731171"
height="42.760715"
x="80.402672"
y="173.01807" />
<path
id="path947-3"
style="fill:#560fed;fill-opacity:1;stroke-width:0.263843"
d="m 101.80629,194.42786 c 0,11.75704 -9.437844,21.288 -21.080002,21.288 v -42.576 c 11.642158,0 21.080002,9.53095 21.080002,21.288 z"
sodipodi:nodetypes="sccs" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

58
icons/channel-expedia.svg Normal file
View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="80.000008mm"
height="79.929916mm"
viewBox="0 0 80.000008 79.929916"
version="1.1"
id="svg24172"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="channel-expedia.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview24174"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
fit-margin-top="5"
fit-margin-left="5"
fit-margin-right="5"
fit-margin-bottom="5"
inkscape:zoom="1.9275802"
inkscape:cx="66.404499"
inkscape:cy="181.31541"
inkscape:window-width="1846"
inkscape:window-height="1016"
inkscape:window-x="74"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs24169" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-59.096972,-44.736849)">
<ellipse
style="opacity:1;fill:#fbc108;fill-opacity:1;stroke:none;stroke-width:0.26822"
id="path27688"
ry="31.719"
rx="34.999729"
cy="84.701805"
cx="99.096977" />
<path
style="fill:#072f54;fill-opacity:1;stroke-width:0.383944"
d="m 94.261969,119.43457 c -3.89875,-0.53917 -9.53802,-2.54711 -13.00422,-4.63036 -6.12813,-3.68311 -10.43955,-8.37372 -13.54295,-14.73404 -1.680698,-3.444539 -3.139374,-7.746535 -2.756448,-8.129463 0.110921,-0.11092 7.081098,-1.8207 15.489278,-3.7995 8.40818,-1.97881 17.62007,-4.27088 20.470861,-5.09351 5.9075,-1.70469 5.71399,-1.76234 6.0335,1.79765 0.16624,1.85221 -0.53272,12.039864 -1.28788,18.771563 l -0.22558,2.01094 1.18469,-0.41299 c 1.10032,-0.38358 1.28415,-0.73181 2.58142,-4.89053 5.54685,-17.781703 6.66128,-21.280703 6.8323,-21.451723 0.10633,-0.10633 3.18405,-1.05312 6.83936,-2.10397 3.65532,-1.05084 7.22512,-2.26676 7.9329,-2.70205 1.57856,-0.97082 1.64838,-0.88162 2.58268,3.29915 1.05044,4.70048 0.91571,11.28976 -0.3274,16.012228 -3.95869,15.038765 -16.96454,25.547595 -32.49009,26.252255 -2.028031,0.0921 -4.868621,0.004 -6.312421,-0.19565 z M 64.218034,88.076577 c -0.146234,-0.97517 -0.162274,-3.42685 -0.03564,-5.44818 0.877778,-14.01136 9.831845,-25.99158 23.024865,-30.80643 12.931451,-4.7194 27.568411,-1.27041 37.155371,8.75513 2.67003,2.79216 4.33649,5.05331 5.69088,7.72169 l 0.82823,1.63177 h -1.27905 c -0.98965,0 -8.50933,1.92524 -14.48053,3.70742 -0.35171,0.10492 -4.59197,-3.29428 -10.82556,-8.67843 -5.636051,-4.86804 -10.559131,-8.84834 -10.940161,-8.8451 -1.9678,0.0166 -1.65889,0.63069 4.33138,8.60918 5.679101,7.56403 7.653891,10.95394 6.828591,11.7219 -0.18392,0.17114 -2.58047,0.94293 -5.325671,1.71508 -2.74521,0.77215 -8.01485,2.45241 -11.71031,3.73391 -3.69547,1.2815 -10.38146,3.59563 -14.85777,5.14253 l -8.138741,2.81255 z"
id="path24404" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

64
icons/channel-house.svg Normal file
View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="154.49777mm"
height="154.49777mm"
viewBox="0 0 154.49777 154.49777"
version="1.1"
id="svg23906"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
sodipodi:docname="channel-house.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview23908"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
fit-margin-top="5"
fit-margin-left="5"
fit-margin-right="5"
fit-margin-bottom="5"
inkscape:zoom="0.68150253"
inkscape:cx="123.25706"
inkscape:cy="160.67439"
inkscape:window-width="1846"
inkscape:window-height="1016"
inkscape:window-x="74"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs23903" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-27.574642,-71.251114)">
<rect
style="fill:#ffcc00;fill-opacity:1;stroke-width:0.280733"
id="rect8720"
width="57.878113"
height="103.6951"
x="94.677055"
y="85.354462" />
<path
style="fill:#ffcc00;stroke-width:0.282222"
d="m 55.669315,215.87403 c -11.33851,-18.06759 -19.39315,-33.9353 -21.55801,-42.46943 -3.152208,-12.42637 4.5086,-25.06982 17.60125,-29.04921 2.17205,-0.66017 2.942,-0.74863 6.55344,-0.75292 3.35149,-0.004 4.5009,0.10735 6.35,0.61506 4.45449,1.22308 8.38385,3.5284 11.67335,6.84866 2.0936,2.11317 3.40269,4.03737 4.83972,7.11379 1.67796,3.5922 2.07911,5.43806 2.09709,9.6496 0.0138,3.23244 -0.0792,3.98784 -0.78146,6.35 -2.25748,7.5929 -7.64392,18.71581 -15.5121,32.03222 -2.18346,3.69538 -8.1815,13.48831 -8.51085,13.89557 -0.0297,0.0367 -1.26825,-1.86833 -2.75243,-4.23334 z m 8.00533,-31.73752 c 6.24196,-2.10727 10.70361,-7.94497 11.14581,-14.58336 0.60174,-9.03358 -6.2151,-16.81936 -15.36499,-17.54897 -7.78599,-0.62084 -15.31599,4.93922 -17.13448,12.6519 -0.49344,2.0928 -0.54349,5.24541 -0.11623,7.32239 0.1692,0.82256 0.81534,2.55883 1.43587,3.85839 1.8509,3.87632 5.64655,7.13088 9.90429,8.49239 2.73664,0.8751 7.21933,0.78981 10.12973,-0.19274 z m -7.17049,-8.27161 c -3.33323,-0.83476 -5.64749,-3.8888 -5.64557,-7.45021 0.001,-2.07069 0.51163,-3.38112 1.92795,-4.94882 4.61012,-5.10285 13.12313,-1.89646 13.08431,4.92816 -0.0117,2.06136 -0.46413,3.40602 -1.64949,4.90265 -1.62709,2.05437 -5.12321,3.21785 -7.7172,2.56822 z"
id="path24091-6"
sodipodi:nodetypes="sssssssscsssssssssssscssss" />
<path
style="fill:#4d4d4d;stroke-width:0.282222"
d="m 65.233853,206.99223 c -9.151369,-206.12036454 -4.575685,-103.06018 0,0 z m 7.702281,8.76119 v -4.07993 l 2.994795,-5.30396 c 7.647376,-13.54396 12.612097,-24.70439 14.061447,-31.60938 1.39896,-6.66497 0.4321,-13.67892 -2.797981,-20.29752 -2.655886,-5.44203 -6.937101,-10.32601 -11.870489,-13.54175 l -2.387772,-1.55643 V 112.43001 85.495575 h 9.031111 9.031111 v -4.51556 -4.51556 h 32.589484 32.5895 l 0.0777,4.445 0.0777,4.445 8.96055,0.0745 8.96056,0.0745 v 67.164935 67.16492 h -22.85729 -22.85729 l -0.0733,-13.61723 -0.0733,-13.61722 -4.445,-0.0777 -4.445,-0.0777 v 13.6949 13.69495 H 96.219466 72.936134 Z m 37.535546,-37.26563 v -4.37444 h -4.37445 -4.37445 v 4.37444 4.37445 h 4.37445 4.37445 z m 18.06222,0 v -4.37444 h -4.51556 -4.51555 v 4.37444 4.37445 h 4.51555 4.51556 z m 17.78,0 v -4.37444 h -4.51556 -4.51555 v 4.37444 4.37445 h 4.51555 4.51556 z m -35.84222,-17.78 v -4.37444 h -4.37445 -4.37445 v 4.37444 4.37445 h 4.37445 4.37445 z m 18.06222,0 v -4.37444 h -4.51556 -4.51555 v 4.37444 4.37445 h 4.51555 4.51556 z m 17.78,0 v -4.37444 h -4.51556 -4.51555 v 4.37444 4.37445 h 4.51555 4.51556 z m -35.84222,-17.35666 v -4.51556 h -4.37445 -4.37445 v 4.51556 4.51555 h 4.37445 4.37445 z m 17.99883,-0.0706 0.0777,-4.445 h -4.52272 -4.52272 v 4.52272 4.52273 l 4.445,-0.0777 4.445,-0.0777 z m 17.78,0 0.0777,-4.445 h -4.52272 -4.52272 v 4.32741 c 0,2.38007 0.0878,4.41525 0.1952,4.52261 0.10737,0.10737 2.10762,0.16028 4.445,0.1176 l 4.2498,-0.0776 z m -26.74772,-21.51944 v -5.22111 h 4.36807 4.36808 l 0.0769,5.15055 0.0769,5.15056 4.445,0.0777 4.445,0.0777 V 112.17274 97.348905 h -4.51556 -4.51555 v 5.080005 5.08 h -4.37445 -4.37444 v -5.08 -5.080005 h -4.51556 -4.51555 v 14.816665 14.81667 h 4.51555 4.51556 z"
id="path24091-3"
sodipodi:nodetypes="ccccssssccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccsssccccccccccccccccccccccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

View File

@ -2,12 +2,12 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="channel_icon"/>
<field name="channel" icon="channel_icon" expand="1"/>
<field name="number"/>
<field name="party" expand="1"/>
<field name="contact" expand="1"/>
<field name="booking_date" widget="date"/>
<field name="channel" expand="1"/>
<!-- <field name="channel" expand="1"/> -->
<field name="ota_booking_code"/>
<field name="media"/>
<field name="total_amount"/>