From fe3feb10aa941ee7ce2bd8930f3ec7c6942a0a5a Mon Sep 17 00:00:00 2001 From: Steve Campbell Date: Thu, 8 Aug 2019 12:57:43 -0700 Subject: [PATCH 01/47] [ADD] account_brand (#568) --- account_brand/README.rst | 106 +++++ account_brand/__init__.py | 4 + account_brand/__manifest__.py | 22 + account_brand/i18n/account_brand.pot | 25 ++ account_brand/models/__init__.py | 4 + account_brand/models/account_invoice.py | 11 + account_brand/readme/CONFIGURE.rst | 2 + account_brand/readme/CONTRIBUTORS.rst | 3 + account_brand/readme/CREDITS.rst | 1 + account_brand/readme/DESCRIPTION.rst | 3 + account_brand/readme/USAGE.rst | 6 + account_brand/static/description/icon.png | Bin 0 -> 9455 bytes account_brand/static/description/index.html | 449 ++++++++++++++++++++ account_brand/views/account_invoice.xml | 17 + 14 files changed, 653 insertions(+) create mode 100644 account_brand/README.rst create mode 100644 account_brand/__init__.py create mode 100644 account_brand/__manifest__.py create mode 100644 account_brand/i18n/account_brand.pot create mode 100644 account_brand/models/__init__.py create mode 100644 account_brand/models/account_invoice.py create mode 100644 account_brand/readme/CONFIGURE.rst create mode 100644 account_brand/readme/CONTRIBUTORS.rst create mode 100644 account_brand/readme/CREDITS.rst create mode 100644 account_brand/readme/DESCRIPTION.rst create mode 100644 account_brand/readme/USAGE.rst create mode 100644 account_brand/static/description/icon.png create mode 100644 account_brand/static/description/index.html create mode 100644 account_brand/views/account_invoice.xml diff --git a/account_brand/README.rst b/account_brand/README.rst new file mode 100644 index 000000000..e523ee4c1 --- /dev/null +++ b/account_brand/README.rst @@ -0,0 +1,106 @@ +============= +Account Brand +============= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github + :target: https://github.com/OCA/brand/tree/12.0/account_brand + :alt: OCA/brand +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/brand-12-0/brand-12-0-account_brand + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/284/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to send branded invoices to your customers. +It adds a brand field on the invoice and the brand information to the PDF +report. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, please refer to the documentation of +`partner_brand `_. + +Usage +===== + +To use this module, you need to: + +#. Go to Accounting > Customers > Invoices +#. Select or create an invoice +#. Enter the information and select the brand +#. Print the PDF report. It includes the information of the brand. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Open Source Integrators + +Contributors +~~~~~~~~~~~~ + +* Raphael Lee +* Steve Campbell +* Maxime Chambreuil + +Other credits +~~~~~~~~~~~~~ + +* Open Source Integrators + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-osi-scampbell| image:: https://github.com/osi-scampbell.png?size=40px + :target: https://github.com/osi-scampbell + :alt: osi-scampbell + +Current `maintainer `__: + +|maintainer-osi-scampbell| + +This module is part of the `OCA/brand `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_brand/__init__.py b/account_brand/__init__.py new file mode 100644 index 000000000..33c2f06ef --- /dev/null +++ b/account_brand/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py new file mode 100644 index 000000000..86181bc7c --- /dev/null +++ b/account_brand/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Account Brand", + "summary": "Send branded invoices and refunds", + "version": "12.0.1.0.0", + "category": "Accounting Management", + "website": "https://github.com/OCA/account-invoicing", + "author": "Open Source Integrators, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + 'account', + 'partner_brand', + ], + "data": [ + "views/account_invoice.xml", + ], + "installable": True, + "development_status": "Beta", + "maintainers": ["osi-scampbell"], +} diff --git a/account_brand/i18n/account_brand.pot b/account_brand/i18n/account_brand.pot new file mode 100644 index 000000000..5e7bd7214 --- /dev/null +++ b/account_brand/i18n/account_brand.pot @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_brand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +msgid "Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_account_invoice +msgid "Invoice" +msgstr "" + diff --git a/account_brand/models/__init__.py b/account_brand/models/__init__.py new file mode 100644 index 000000000..72e75675d --- /dev/null +++ b/account_brand/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import account_invoice diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py new file mode 100644 index 000000000..a495d5ea6 --- /dev/null +++ b/account_brand/models/account_invoice.py @@ -0,0 +1,11 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class AccountInvoice(models.Model): + _inherit = 'account.invoice' + + brand_id = fields.Many2one('res.partner', string='Brand', + domain="[('type', '=', 'brand')]") diff --git a/account_brand/readme/CONFIGURE.rst b/account_brand/readme/CONFIGURE.rst new file mode 100644 index 000000000..a20e2200f --- /dev/null +++ b/account_brand/readme/CONFIGURE.rst @@ -0,0 +1,2 @@ +To configure this module, please refer to the documentation of +`partner_brand `_. diff --git a/account_brand/readme/CONTRIBUTORS.rst b/account_brand/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..d9fb6931c --- /dev/null +++ b/account_brand/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Raphael Lee +* Steve Campbell +* Maxime Chambreuil diff --git a/account_brand/readme/CREDITS.rst b/account_brand/readme/CREDITS.rst new file mode 100644 index 000000000..dab2345c9 --- /dev/null +++ b/account_brand/readme/CREDITS.rst @@ -0,0 +1 @@ +* Open Source Integrators diff --git a/account_brand/readme/DESCRIPTION.rst b/account_brand/readme/DESCRIPTION.rst new file mode 100644 index 000000000..cb6151133 --- /dev/null +++ b/account_brand/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows you to send branded invoices to your customers. +It adds a brand field on the invoice and the brand information to the PDF +report. diff --git a/account_brand/readme/USAGE.rst b/account_brand/readme/USAGE.rst new file mode 100644 index 000000000..005139f26 --- /dev/null +++ b/account_brand/readme/USAGE.rst @@ -0,0 +1,6 @@ +To use this module, you need to: + +#. Go to Accounting > Customers > Invoices +#. Select or create an invoice +#. Enter the information and select the brand +#. Print the PDF report. It includes the information of the brand. diff --git a/account_brand/static/description/icon.png b/account_brand/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx zOGVPhVRTGPtv0o}RfVP;Nd(|CB)I;*t&QO8h zFfekr30S!-LHmV_Su-W+rEwYXJ^;6&3|L$mMC8*bQptyOo9;>Qb9Q9`ySe3%V$A*9 zeKEe+b0{#KWGp$F+tga)0RtI)nhMa-K@JS}2krK~n8vJ=Ngm?R!9G<~RyuU0d?nz# z-5EK$o(!F?hmX*2Yt6+coY`6jGbb7tF#6nHA zuKk=GGJ;ZwON1iAfG$E#Y7MnZVmrY|j0eVI(DN_MNFJmyZ|;w4tf@=CCDZ#5N_0K= z$;R~bbk?}TpfDjfB&aiQ$VA}s?P}xPERJG{kxk5~R`iRS(SK5d+Xs9swCozZISbnS zk!)I0>t=A<-^z(cmSFz3=jZ23u13X><0b)P)^1T_))Kr`e!-pb#q&J*Q`p+B6la%C zuVl&0duN<;uOsB3%T9Fp8t{ED108<+W(nOZd?gDnfNBC3>M8WE61$So|P zVvqH0SNtDTcsUdzaMDpT=Ty0pDHHNL@Z0w$Y`XO z2M-_r1S+GaH%pz#Uy0*w$Vdl=X=rQXEzO}d6J^R6zjM1u&c9vYLvLp?W7w(?np9x1 zE_0JSAJCPB%i7p*Wvg)pn5T`8k3-uR?*NT|J`eS#_#54p>!p(mLDvmc-3o0mX*mp_ zN*AeS<>#^-{S%W<*mz^!X$w_2dHWpcJ6^j64qFBft-o}o_Vx80o0>}Du;>kLts;$8 zC`7q$QI(dKYG`Wa8#wl@V4jVWBRGQ@1dr-hstpQL)Tl+aqVpGpbSfN>5i&QMXfiZ> zaA?T1VGe?rpQ@;+pkrVdd{klI&jVS@I5_iz!=UMpTsa~mBga?1r}aRBm1WS;TT*s0f0lY=JBl66Upy)-k4J}lh=P^8(SXk~0xW=T9v*B|gzIhN z>qsO7dFd~mgxAy4V?&)=5ieYq?zi?ZEoj)&2o)RLy=@hbCRcfT5jigwtQGE{L*8<@Yd{zg;CsL5mvzfDY}P-wos_6PfprFVaeqNE%h zKZhLtcQld;ZD+>=nqN~>GvROfueSzJD&BE*}XfU|H&(FssBqY=hPCt`d zH?@s2>I(|;fcW&YM6#V#!kUIP8$Nkdh0A(bEVj``-AAyYgwY~jB zT|I7Bf@%;7aL7Wf4dZ%VqF$eiaC38OV6oy3Z#TER2G+fOCd9Iaoy6aLYbPTN{XRPz z;U!V|vBf%H!}52L2gH_+j;`bTcQRXB+y9onc^wLm5wi3-Be}U>k_u>2Eg$=k!(l@I zcCg+flakT2Nej3i0yn+g+}%NYb?ta;R?(g5SnwsQ49U8Wng8d|{B+lyRcEDvR3+`O{zfmrmvFrL6acVP%yG98X zo&+VBg@px@i)%o?dG(`T;n*$S5*rnyiR#=wW}}GsAcfyQpE|>a{=$Hjg=-*_K;UtD z#z-)AXwSRY?OPefw^iI+ z)AXz#PfEjlwTes|_{sB?4(O@fg0AJ^g8gP}ex9Ucf*@_^J(s_5jJV}c)s$`Myn|Kd z$6>}#q^n{4vN@+Os$m7KV+`}c%4)4pv@06af4-x5#wj!KKb%caK{A&Y#Rfs z-po?Dcb1({W=6FKIUirH&(yg=*6aLCekcKwyfK^JN5{wcA3nhO(o}SK#!CINhI`-I z1)6&n7O&ZmyFMuNwvEic#IiOAwNkR=u5it{B9n2sAJV5pNhar=j5`*N!Na;c7g!l$ z3aYBqUkqqTJ=Re-;)s!EOeij=7SQZ3Hq}ZRds%IM*PtM$wV z@;rlc*NRK7i3y5BETSKuumEN`Xu_8GP1Ri=OKQ$@I^ko8>H6)4rjiG5{VBM>B|%`&&s^)jS|-_95&yc=GqjNo{zFkw%%HHhS~e=s zD#sfS+-?*t|J!+ozP6KvtOl!R)@@-z24}`9{QaVLD^9VCSR2b`b!KC#o;Ki<+wXB6 zx3&O0LOWcg4&rv4QG0)4yb}7BFSEg~=IR5#ZRj8kg}dS7_V&^%#Do==#`u zpy6{ox?jWuR(;pg+f@mT>#HGWHAJRRDDDv~@(IDw&R>9643kK#HN`!1vBJHnC+RM&yIh8{gG2q zA%e*U3|N0XSRa~oX-3EAneep)@{h2vvd3Xvy$7og(sayr@95+e6~Xvi1tUqnIxoIH zVWo*OwYElb#uyW{Imam6f2rGbjR!Y3`#gPqkv57dB6K^wRGxc9B(t|aYDGS=m$&S!NmCtrMMaUg(c zc2qC=2Z`EEFMW-me5B)24AqF*bV5Dr-M5ig(l-WPS%CgaPzs6p_gnCIvTJ=Y<6!gT zVt@AfYCzjjsMEGi=rDQHo0yc;HqoRNnNFeWZgcm?f;cp(6CNylj36DoL(?TS7eU#+ z7&mfr#y))+CJOXQKUMZ7QIdS9@#-}7y2K1{8)cCt0~-X0O!O?Qx#E4Og+;A2SjalQ zs7r?qn0H044=sDN$SRG$arw~n=+T_DNdSrarmu)V6@|?1-ZB#hRn`uilTGPJ@fqEy zGt(f0B+^JDP&f=r{#Y_wi#AVDf-y!RIXU^0jXsFpf>=Ji*TeqSY!H~AMbJdCGLhC) zn7Rx+sXw6uYj;WRYrLd^5IZq@6JI1C^YkgnedZEYy<&4(z%Q$5yv#Boo{AH8n$a zhb4Y3PWdr269&?V%uI$xMcUrMzl=;w<_nm*qr=c3Rl@i5wWB;e-`t7D&c-mcQl7x! zZWB`UGcw=Y2=}~wzrfLx=uet<;m3~=8I~ZRuzvMQUQdr+yTV|ATf1Uuomr__nDf=X zZ3WYJtHp_ri(}SQAPjv+Y+0=fH4krOP@S&=zZ-t1jW1o@}z;xk8 z(Nz1co&El^HK^NrhVHa-_;&88vTU>_J33=%{if;BEY*J#1n59=07jrGQ#IP>@u#3A z;!q+E1Rj3ZJ+!4bq9F8PXJ@yMgZL;>&gYA0%_Kbi8?S=XGM~dnQZQ!yBSgcZhY96H zrWnU;k)qy`rX&&xlDyA%(a1Hhi5CWkmg(`Gb%m(HKi-7Z!LKGRP_B8@`7&hdDy5n= z`OIxqxiVfX@OX1p(mQu>0Ai*v_cTMiw4qRt3~NBvr9oBy0)r>w3p~V0SCm=An6@3n)>@z!|o-$HvDK z|3D2ZMJkLE5loMKl6R^ez@Zz%S$&mbeoqH5`Bb){Ei21q&VP)hWS2tjShfFtGE+$z zzCR$P#uktu+#!w)cX!lWN1XU%K-r=s{|j?)Akf@q#3b#{6cZCuJ~gCxuMXRmI$nGtnH+-h z+GEi!*X=AP<|fG`1>MBdTb?28JYc=fGvAi2I<$B(rs$;eoJCyR6_bc~p!XR@O-+sD z=eH`-ye})I5ic1eL~TDmtfJ|8`0VJ*Yr=hNCd)G1p2MMz4C3^Mj?7;!w|Ly%JqmuW zlIEW^Ft%z?*|fpXda>Jr^1noFZEwFgVV%|*XhH@acv8rdGxeEX{M$(vG{Zw+x(ei@ zmfXb22}8-?Fi`vo-YVrTH*C?a8%M=Hv9MqVH7H^J$KsD?>!SFZ;ZsvnHr_gn=7acz z#W?0eCdVhVMWN12VV^$>WlQ?f;P^{(&pYTops|btm6aj>_Uz+hqpGwB)vWp0Cf5y< zft8-je~nn?W11plq}N)4A{l8I7$!ks_x$PXW-2XaRFswX_BnF{R#6YIwMhAgd5F9X zGmwdadS6(a^fjHtXg8=l?Rc0Sm%hk6E9!5cLVloEy4eh(=FwgP`)~I^5~pBEWo+F6 zSf2ncyMurJN91#cJTy_u8Y}@%!bq1RkGC~-bV@SXRd4F{R-*V`bS+6;W5vZ(&+I<9$;-V|eNfLa5n-6% z2(}&uGRF;p92eS*sE*oR$@pexaqr*meB)VhmIg@h{uzkk$9~qh#cHhw#>O%)b@+(| z^IQgqzuj~Sk(J;swEM-3TrJAPCq9k^^^`q{IItKBRXYe}e0Tdr=Huf7da3$l4PdpwWDop%^}n;dD#K4s#DYA8SHZ z&1!riV4W4R7R#C))JH1~axJ)RYnM$$lIR%6fIVA@zV{XVyx}C+a-Dt8Y9M)^KU0+H zR4IUb2CJ{Hg>CuaXtD50jB(_Tcx=Z$^WYu2u5kubqmwp%drJ6 z?Fo40g!Qd<-l=TQxqHEOuPX0;^z7iX?Ke^a%XT<13TA^5`4Xcw6D@Ur&VT&CUe0d} z1GjOVF1^L@>O)l@?bD~$wzgf(nxX1OGD8fEV?TdJcZc2KoUe|oP1#=$$7ee|xbY)A zDZq+cuTpc(fFdj^=!;{k03C69lMQ(|>uhRfRu%+!k&YOi-3|1QKB z z?n?eq1XP>p-IM$Z^C;2L3itnbJZAip*Zo0aw2bs8@(s^~*8T9go!%dHcAz2lM;`yp zD=7&xjFV$S&5uDaiScyD?B-i1ze`+CoRtz`Wn+Zl&#s4&}MO{@N!ufrzjG$B79)Y2d3tBk&)TxUTw@QS0TEL_?njX|@vq?Uz(nBFK5Pq7*xj#u*R&i|?7+6# z+|r_n#SW&LXhtheZdah{ZVoqwyT{D>MC3nkFF#N)xLi{p7J1jXlmVeb;cP5?e(=f# zuT7fvjSbjS781v?7{)-X3*?>tq?)Yd)~|1{BDS(pqC zC}~H#WXlkUW*H5CDOo<)#x7%RY)A;ShGhI5s*#cRDA8YgqG(HeKDx+#(ZQ?386dv! zlXCO)w91~Vw4AmOcATuV653fa9R$fyK8ul%rG z-wfS zihugoZyr38Im?Zuh6@RcF~t1anQu7>#lPpb#}4cOA!EM11`%f*07RqOVkmX{p~KJ9 z^zP;K#|)$`^Rb{rnHGH{~>1(fawV0*Z#)}M`m8-?ZJV<+e}s9wE# z)l&az?w^5{)`S(%MRzxdNqrs1n*-=jS^_jqE*5XDrA0+VE`5^*p3CuM<&dZEeCjoz zR;uu_H9ZPZV|fQq`Cyw4nscrVwi!fE6ciMmX$!_hN7uF;jjKG)d2@aC4ropY)8etW=xJvni)8eHi`H$%#zn^WJ5NLc-rqk|u&&4Z6fD_m&JfSI1Bvb?b<*n&sfl0^t z=HnmRl`XrFvMKB%9}>PaA`m-fK6a0(8=qPkWS5bb4=v?XcWi&hRY?O5HdulRi4?fN zlsJ*N-0Qw+Yic@s0(2uy%F@ib;GjXt01Fmx5XbRo6+n|pP(&nodMoap^z{~q ziEeaUT@Mxe3vJSfI6?uLND(CNr=#^W<1b}jzW58bIfyWTDle$mmS(|x-0|2UlX+9k zQ^EX7Nw}?EzVoBfT(-LT|=9N@^hcn-_p&sqG z&*oVs2JSU+N4ZD`FhCAWaS;>|wH2G*Id|?pa#@>tyxX`+4HyIArWDvVrX)2WAOQff z0qyHu&-S@i^MS-+j--!pr4fPBj~_8({~e1bfcl0wI1kaoN>mJL6KUPQm5N7lB(ui1 zE-o%kq)&djzWJ}ob<-GfDlkB;F31j-VHKvQUGQ3sp`CwyGJk_i!y^sD0fqC@$9|jO zOqN!r!8-p==F@ZVP=U$qSpY(gQ0)59P1&t@y?5rvg<}E+GB}26NYPp4f2YFQrQtot5mn3wu_qprZ=>Ig-$ zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV( z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html new file mode 100644 index 000000000..cc848c511 --- /dev/null +++ b/account_brand/static/description/index.html @@ -0,0 +1,449 @@ + + + + + + +Account Brand + + + +
+

Account Brand

+ + +

Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runbot

+

This module allows you to send branded invoices to your customers. +It adds a brand field on the invoice and the brand information to the PDF +report.

+

Table of contents

+ +
+

Configuration

+

To configure this module, please refer to the documentation of +partner_brand.

+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Accounting > Customers > Invoices
  2. +
  3. Select or create an invoice
  4. +
  5. Enter the information and select the brand
  6. +
  7. Print the PDF report. It includes the information of the brand.
  8. +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Open Source Integrators
  • +
+
+ +
+

Other credits

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

osi-scampbell

+

This module is part of the OCA/brand project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_brand/views/account_invoice.xml b/account_brand/views/account_invoice.xml new file mode 100644 index 000000000..f4d41439b --- /dev/null +++ b/account_brand/views/account_invoice.xml @@ -0,0 +1,17 @@ + + + + + + account.invoice.form.brand + account.invoice + + + + + + + + + From 8d2eac118947efa8d1672d3d590f80ec780c0b0b Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Fri, 16 Aug 2019 14:06:26 +0200 Subject: [PATCH 02/47] [12.0][IMP] - dedicated model for partner brand in account_brand module --- account_brand/__manifest__.py | 2 +- account_brand/i18n/zh_CN.po | 27 +++++++++++++++++++ .../migrations/12.0.2.0.0/post-migration.py | 15 +++++++++++ .../migrations/12.0.2.0.0/pre-migration.py | 16 +++++++++++ account_brand/models/account_invoice.py | 3 +-- 5 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 account_brand/i18n/zh_CN.po create mode 100644 account_brand/migrations/12.0.2.0.0/post-migration.py create mode 100644 account_brand/migrations/12.0.2.0.0/pre-migration.py diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index 86181bc7c..dc89f6546 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "12.0.1.0.0", + "version": "12.0.2.0.0", "category": "Accounting Management", "website": "https://github.com/OCA/account-invoicing", "author": "Open Source Integrators, Odoo Community Association (OCA)", diff --git a/account_brand/i18n/zh_CN.po b/account_brand/i18n/zh_CN.po new file mode 100644 index 000000000..15e011366 --- /dev/null +++ b/account_brand/i18n/zh_CN.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_brand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-09-17 16:24+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.8\n" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +msgid "Brand" +msgstr "品牌" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_account_invoice +msgid "Invoice" +msgstr "发票" diff --git a/account_brand/migrations/12.0.2.0.0/post-migration.py b/account_brand/migrations/12.0.2.0.0/post-migration.py new file mode 100644 index 000000000..f45049cbe --- /dev/null +++ b/account_brand/migrations/12.0.2.0.0/post-migration.py @@ -0,0 +1,15 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging + +_logger = logging.getLogger(__name__) + + +def migrate(cr, version): + _logger.info("Move sale brand to res.brand model") + cr.execute(""" + UPDATE account_invoice SET brand_id = brand.id + FROM res_brand brand + WHERE brand.partner_id=brand_id_tmp""") + cr.execute("""ALTER TABLE account_invoice DROP COLUMN brand_id_tmp""") diff --git a/account_brand/migrations/12.0.2.0.0/pre-migration.py b/account_brand/migrations/12.0.2.0.0/pre-migration.py new file mode 100644 index 000000000..34c49706c --- /dev/null +++ b/account_brand/migrations/12.0.2.0.0/pre-migration.py @@ -0,0 +1,16 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging + +_logger = logging.getLogger(__name__) + + +def migrate(cr, version): + _logger.info("Move invoice brand to res.brand model") + cr.execute( + """ALTER TABLE account_invoice + ADD COLUMN brand_id_tmp INTEGER""" + ) + cr.execute("""UPDATE account_invoice SET brand_id_tmp = brand_id""") + cr.execute("""ALTER TABLE account_invoice DROP COLUMN brand_id""") diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index a495d5ea6..325524cb8 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -7,5 +7,4 @@ class AccountInvoice(models.Model): _inherit = 'account.invoice' - brand_id = fields.Many2one('res.partner', string='Brand', - domain="[('type', '=', 'brand')]") + brand_id = fields.Many2one('res.brand', string='Brand') From fcb2a70f4609779e35d7b22ff199068be9622c1b Mon Sep 17 00:00:00 2001 From: Xavier Brochard Date: Fri, 25 Oct 2019 08:53:38 +0200 Subject: [PATCH 03/47] Fix URL to OCA/brand was on OCA/partner-contact, switch to OCA/brand --- account_brand/README.rst | 2 +- account_brand/readme/CONFIGURE.rst | 2 +- account_brand/static/description/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/account_brand/README.rst b/account_brand/README.rst index e523ee4c1..e423b0bf7 100644 --- a/account_brand/README.rst +++ b/account_brand/README.rst @@ -38,7 +38,7 @@ Configuration ============= To configure this module, please refer to the documentation of -`partner_brand `_. +`partner_brand `_. Usage ===== diff --git a/account_brand/readme/CONFIGURE.rst b/account_brand/readme/CONFIGURE.rst index a20e2200f..bdf04f5e5 100644 --- a/account_brand/readme/CONFIGURE.rst +++ b/account_brand/readme/CONFIGURE.rst @@ -1,2 +1,2 @@ To configure this module, please refer to the documentation of -`partner_brand `_. +`partner_brand `_. diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html index cc848c511..0caaa95ac 100644 --- a/account_brand/static/description/index.html +++ b/account_brand/static/description/index.html @@ -389,7 +389,7 @@

Account Brand

Configuration

To configure this module, please refer to the documentation of -partner_brand.

+partner_brand.

Usage

From 8155345c27fe9f87d060a7d475220019d28c051f Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Thu, 31 Oct 2019 18:05:14 +0100 Subject: [PATCH 04/47] [12.0][REF] - Use brand mixin in branded invoices definition --- account_brand/__manifest__.py | 2 +- account_brand/models/account_invoice.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index dc89f6546..e79fac4f8 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -11,7 +11,7 @@ "license": "AGPL-3", "depends": [ 'account', - 'partner_brand', + 'brand', ], "data": [ "views/account_invoice.xml", diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index 325524cb8..a422ccc11 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -1,10 +1,9 @@ # Copyright (C) 2019 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import models class AccountInvoice(models.Model): - _inherit = 'account.invoice' - - brand_id = fields.Many2one('res.brand', string='Brand') + _name = 'account.invoice' + _inherit = ['account.invoice', 'res.brand.mixin'] From 0b698fcdaad9385b72c1e3c13581ee63f7b1b60f Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 4 Nov 2019 19:30:15 +0100 Subject: [PATCH 05/47] [12.0][IMP] - Improve unit tests --- account_brand/__init__.py | 1 + account_brand/tests/__init__.py | 1 + account_brand/tests/test_brand_mixin.py | 104 ++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 account_brand/tests/__init__.py create mode 100644 account_brand/tests/test_brand_mixin.py diff --git a/account_brand/__init__.py b/account_brand/__init__.py index 33c2f06ef..58b6a7fd9 100644 --- a/account_brand/__init__.py +++ b/account_brand/__init__.py @@ -2,3 +2,4 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models +from . import tests diff --git a/account_brand/tests/__init__.py b/account_brand/tests/__init__.py new file mode 100644 index 000000000..7216aca23 --- /dev/null +++ b/account_brand/tests/__init__.py @@ -0,0 +1 @@ +from . import test_brand_mixin diff --git a/account_brand/tests/test_brand_mixin.py b/account_brand/tests/test_brand_mixin.py new file mode 100644 index 000000000..6c092ac28 --- /dev/null +++ b/account_brand/tests/test_brand_mixin.py @@ -0,0 +1,104 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from lxml import etree +from odoo.tests.common import TransactionCase +from odoo.exceptions import ValidationError +from odoo.addons.brand.models.res_company import BRAND_USE_LEVEL_REQUIRED_LEVEL + + +class TestBrandMixin(TransactionCase): + def setUp(self): + super(TestBrandMixin, self).setUp() + self.partner = self.env.user.partner_id + self.company = self.env.user.company_id + self.other_company = self.env['res.company'].create( + {'name': 'other company', 'parent_id': self.company.id} + ) + self.journal = self.env['account.journal'].create( + {'type': 'sale', 'code': 'SALE', 'name': 'Sale journal'} + ) + self.invoice = self.env['account.invoice'].create( + { + 'name': "Sample invoice", + 'company_id': self.company.id, + 'journal_id': self.journal.id, + 'partner_id': self.partner.id, + } + ) + self.brand = self.env['res.brand'].create({'name': 'brand'}) + self.other_company_brand = self.env['res.brand'].create( + {'name': 'brand', 'company_id': self.other_company.id} + ) + + def test_is_brand_required(self): + self.assertFalse(self.invoice._is_brand_required()) + self.company.brand_use_level = BRAND_USE_LEVEL_REQUIRED_LEVEL + self.assertTrue(self.invoice._is_brand_required()) + + def test_check_brand_requirement(self): + self.env['account.invoice'].create( + { + 'name': "Sample invoice", + 'company_id': self.company.id, + 'journal_id': self.journal.id, + 'partner_id': self.partner.id, + } + ) + self.company.brand_use_level = BRAND_USE_LEVEL_REQUIRED_LEVEL + with self.assertRaises(ValidationError): + self.env['account.invoice'].create( + { + 'name': "Sample invoice", + 'company_id': self.company.id, + 'journal_id': self.journal.id, + 'partner_id': self.partner.id, + } + ) + self.env['account.invoice'].create( + { + 'name': "Sample invoice", + 'company_id': self.company.id, + 'journal_id': self.journal.id, + 'partner_id': self.partner.id, + 'brand_id': self.brand.id, + } + ) + + def test_check_brand_company_id(self): + invoice = self.env['account.invoice'].create( + { + 'name': "Sample invoice", + 'company_id': self.company.id, + 'journal_id': self.journal.id, + 'partner_id': self.partner.id, + 'brand_id': self.brand.id, + } + ) + with self.assertRaises(ValidationError): + invoice.brand_id = self.other_company_brand + + def test_onchange_brand_id(self): + new_invoice = self.env['account.invoice'].new( + { + 'name': "Sample invoice", + 'company_id': self.company.id, + 'journal_id': self.journal.id, + 'partner_id': self.partner.id, + 'brand_id': self.brand.id, + } + ) + self.assertEqual(new_invoice.company_id, self.company) + new_invoice.brand_id = self.other_company_brand + new_invoice._onchange_brand_id() + self.assertEqual(new_invoice.company_id, self.other_company) + + def test_fields_view_get(self): + view = self.env['account.invoice'].fields_view_get( + view_id=self.env.ref( + 'account_brand.account_invoice_view_form_brand' + ).id, + view_type='form', + ) + doc = etree.XML(view['arch']) + self.assertTrue(doc.xpath("//field[@name='brand_use_level']")) From 9106c7b45584ed046d156b53422789a5cebed322 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Tue, 12 Nov 2019 10:47:36 +0100 Subject: [PATCH 06/47] [12.0][IMP] - Improve readme --- account_brand/README.rst | 2 +- account_brand/__manifest__.py | 2 +- account_brand/i18n/account_brand.pot | 5 ---- account_brand/i18n/hr.po | 26 +++++++++++++++++++++ account_brand/i18n/zh_CN.po | 10 ++++---- account_brand/readme/CONFIGURE.rst | 2 +- account_brand/static/description/index.html | 2 +- 7 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 account_brand/i18n/hr.po diff --git a/account_brand/README.rst b/account_brand/README.rst index e423b0bf7..f3c27ac92 100644 --- a/account_brand/README.rst +++ b/account_brand/README.rst @@ -38,7 +38,7 @@ Configuration ============= To configure this module, please refer to the documentation of -`partner_brand `_. +`brand `_. Usage ===== diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index e79fac4f8..9d16222fe 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "12.0.2.0.0", + "version": "12.0.2.1.0", "category": "Accounting Management", "website": "https://github.com/OCA/account-invoicing", "author": "Open Source Integrators, Odoo Community Association (OCA)", diff --git a/account_brand/i18n/account_brand.pot b/account_brand/i18n/account_brand.pot index 5e7bd7214..1787235b1 100644 --- a/account_brand/i18n/account_brand.pot +++ b/account_brand/i18n/account_brand.pot @@ -13,11 +13,6 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: account_brand -#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id -msgid "Brand" -msgstr "" - #. module: account_brand #: model:ir.model,name:account_brand.model_account_invoice msgid "Invoice" diff --git a/account_brand/i18n/hr.po b/account_brand/i18n/hr.po new file mode 100644 index 000000000..f70106ed0 --- /dev/null +++ b/account_brand/i18n/hr.po @@ -0,0 +1,26 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_brand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-11-13 15:34+0000\n" +"Last-Translator: Bole \n" +"Language-Team: none\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 3.8\n" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_account_invoice +msgid "Invoice" +msgstr "Račun" + +#~ msgid "Brand" +#~ msgstr "Brand" diff --git a/account_brand/i18n/zh_CN.po b/account_brand/i18n/zh_CN.po index 15e011366..01fef4647 100644 --- a/account_brand/i18n/zh_CN.po +++ b/account_brand/i18n/zh_CN.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_brand +# * account_brand # msgid "" msgstr "" @@ -16,12 +16,10 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Weblate 3.8\n" -#. module: account_brand -#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id -msgid "Brand" -msgstr "品牌" - #. module: account_brand #: model:ir.model,name:account_brand.model_account_invoice msgid "Invoice" msgstr "发票" + +#~ msgid "Brand" +#~ msgstr "品牌" diff --git a/account_brand/readme/CONFIGURE.rst b/account_brand/readme/CONFIGURE.rst index bdf04f5e5..14f02f8f3 100644 --- a/account_brand/readme/CONFIGURE.rst +++ b/account_brand/readme/CONFIGURE.rst @@ -1,2 +1,2 @@ To configure this module, please refer to the documentation of -`partner_brand `_. +`brand `_. diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html index 0caaa95ac..96d35e342 100644 --- a/account_brand/static/description/index.html +++ b/account_brand/static/description/index.html @@ -389,7 +389,7 @@

Account Brand

Configuration

To configure this module, please refer to the documentation of -partner_brand.

+brand.

Usage

From ac57327d77e27af173d50f67d56c86f90d7f1b98 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Thu, 13 Feb 2020 11:40:15 +0100 Subject: [PATCH 07/47] [12.0][IMP] - Brand field is editable in draft state for invoice and sale object --- account_brand/__manifest__.py | 2 +- account_brand/i18n/account_brand.pot | 10 ++++++++ account_brand/i18n/de.po | 32 +++++++++++++++++++++++++ account_brand/i18n/es.po | 32 +++++++++++++++++++++++++ account_brand/i18n/hr.po | 13 +++++++--- account_brand/i18n/zh_CN.po | 13 +++++++--- account_brand/models/account_invoice.py | 11 ++++++++- 7 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 account_brand/i18n/de.po create mode 100644 account_brand/i18n/es.po diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index 9d16222fe..0b803938e 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "12.0.2.1.0", + "version": "12.0.3.0.0", "category": "Accounting Management", "website": "https://github.com/OCA/account-invoicing", "author": "Open Source Integrators, Odoo Community Association (OCA)", diff --git a/account_brand/i18n/account_brand.pot b/account_brand/i18n/account_brand.pot index 1787235b1..656fe5db5 100644 --- a/account_brand/i18n/account_brand.pot +++ b/account_brand/i18n/account_brand.pot @@ -13,6 +13,16 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +msgid "Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_invoice__brand_id +msgid "Brand to use for this sale" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_invoice msgid "Invoice" diff --git a/account_brand/i18n/de.po b/account_brand/i18n/de.po new file mode 100644 index 000000000..b3f6a8812 --- /dev/null +++ b/account_brand/i18n/de.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_brand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-07-01 22:19+0000\n" +"Last-Translator: Peter Schubert \n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +msgid "Brand" +msgstr "Marke" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_invoice__brand_id +msgid "Brand to use for this sale" +msgstr "zu verwendende Marke für diesen Verkauf" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_account_invoice +msgid "Invoice" +msgstr "Rechnung" diff --git a/account_brand/i18n/es.po b/account_brand/i18n/es.po new file mode 100644 index 000000000..380943062 --- /dev/null +++ b/account_brand/i18n/es.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_brand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-05-22 09:19+0000\n" +"Last-Translator: Daniel Luque \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +msgid "Brand" +msgstr "Marca" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_invoice__brand_id +msgid "Brand to use for this sale" +msgstr "Marca a usar en esta venta" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_account_invoice +msgid "Invoice" +msgstr "Factura" diff --git a/account_brand/i18n/hr.po b/account_brand/i18n/hr.po index f70106ed0..76dee72c2 100644 --- a/account_brand/i18n/hr.po +++ b/account_brand/i18n/hr.po @@ -17,10 +17,17 @@ msgstr "" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 3.8\n" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +msgid "Brand" +msgstr "Brand" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_invoice__brand_id +msgid "Brand to use for this sale" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_invoice msgid "Invoice" msgstr "Račun" - -#~ msgid "Brand" -#~ msgstr "Brand" diff --git a/account_brand/i18n/zh_CN.po b/account_brand/i18n/zh_CN.po index 01fef4647..5c50153a6 100644 --- a/account_brand/i18n/zh_CN.po +++ b/account_brand/i18n/zh_CN.po @@ -16,10 +16,17 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Weblate 3.8\n" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +msgid "Brand" +msgstr "品牌" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_invoice__brand_id +msgid "Brand to use for this sale" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_invoice msgid "Invoice" msgstr "发票" - -#~ msgid "Brand" -#~ msgstr "品牌" diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index a422ccc11..87d6fd48d 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -1,9 +1,18 @@ # Copyright (C) 2019 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models +from odoo import fields, models class AccountInvoice(models.Model): _name = 'account.invoice' _inherit = ['account.invoice', 'res.brand.mixin'] + + brand_id = fields.Many2one( + states={ + 'open': [('readonly', True)], + 'in_payment': [('readonly', True)], + 'paid': [('readonly', True)], + 'cancel': [('readonly', True)], + } + ) From 71bb3adbcf9536a988ceb0320d123868d7536361 Mon Sep 17 00:00:00 2001 From: Quentin Groulard Date: Tue, 11 Aug 2020 17:05:55 +0200 Subject: [PATCH 08/47] [12.0][FIX] Brand not required on vendor bill --- account_brand/models/account_invoice.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index 87d6fd48d..07ad2a548 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -1,7 +1,7 @@ # Copyright (C) 2019 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import api, fields, models class AccountInvoice(models.Model): @@ -16,3 +16,10 @@ class AccountInvoice(models.Model): 'cancel': [('readonly', True)], } ) + + @api.constrains('brand_id', 'company_id') + def _check_brand_requirement(self): + out_invoices = self.filtered( + lambda l: l.type in ('out_invoice', 'out_refund') + ) + return super(AccountInvoice, out_invoices)._check_brand_requirement() From 59960993a5d6e8f9af1d535f54a0b33e0db46d0c Mon Sep 17 00:00:00 2001 From: Quentin Groulard Date: Wed, 12 Aug 2020 09:53:40 +0200 Subject: [PATCH 09/47] [FIX] Check brand requirement constraint --- account_brand/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index 07ad2a548..0ab14ef95 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -17,7 +17,7 @@ class AccountInvoice(models.Model): } ) - @api.constrains('brand_id', 'company_id') + @api.constrains('brand_id', 'company_id', 'type') def _check_brand_requirement(self): out_invoices = self.filtered( lambda l: l.type in ('out_invoice', 'out_refund') From 76450e137cb09b7fd5aba8b8fe168729d6f8f3b5 Mon Sep 17 00:00:00 2001 From: Quentin Groulard Date: Tue, 18 Aug 2020 09:38:34 +0200 Subject: [PATCH 10/47] [FIX] Override is brand required --- account_brand/__manifest__.py | 2 +- account_brand/models/account_invoice.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index 0b803938e..24844fa58 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "12.0.3.0.0", + "version": "12.0.3.0.1", "category": "Accounting Management", "website": "https://github.com/OCA/account-invoicing", "author": "Open Source Integrators, Odoo Community Association (OCA)", diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index 0ab14ef95..4793e0b5e 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -17,9 +17,9 @@ class AccountInvoice(models.Model): } ) - @api.constrains('brand_id', 'company_id', 'type') - def _check_brand_requirement(self): - out_invoices = self.filtered( - lambda l: l.type in ('out_invoice', 'out_refund') - ) - return super(AccountInvoice, out_invoices)._check_brand_requirement() + @api.multi + def _is_brand_required(self): + self.ensure_one() + if self.type in ('in_invoice', 'in_refund'): + return False + return super(AccountInvoice, self)._is_brand_required() From 73b8304728e2fda5c907d1be856392331a9097e2 Mon Sep 17 00:00:00 2001 From: Quentin Groulard Date: Tue, 11 Aug 2020 17:19:21 +0200 Subject: [PATCH 11/47] [12.0][FIX] Create credit note with brand --- account_brand/models/account_invoice.py | 10 ++++++++++ account_brand/tests/test_brand_mixin.py | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index 4793e0b5e..c5212f299 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -23,3 +23,13 @@ def _is_brand_required(self): if self.type in ('in_invoice', 'in_refund'): return False return super(AccountInvoice, self)._is_brand_required() + + @api.model + def _prepare_refund(self, invoice, date_invoice=None, date=None, + description=None, journal_id=None): + values = super(AccountInvoice, self)._prepare_refund( + invoice, date_invoice=date_invoice, date=date, + description=description, journal_id=journal_id) + if invoice.brand_id: + values['brand_id'] = invoice.brand_id.id + return values diff --git a/account_brand/tests/test_brand_mixin.py b/account_brand/tests/test_brand_mixin.py index 6c092ac28..3b8b1c38f 100644 --- a/account_brand/tests/test_brand_mixin.py +++ b/account_brand/tests/test_brand_mixin.py @@ -102,3 +102,16 @@ def test_fields_view_get(self): ) doc = etree.XML(view['arch']) self.assertTrue(doc.xpath("//field[@name='brand_use_level']")) + + def test_refund_invoice(self): + invoice = self.env['account.invoice'].create( + { + 'name': "Sample invoice", + 'company_id': self.company.id, + 'journal_id': self.journal.id, + 'partner_id': self.partner.id, + 'brand_id': self.brand.id, + } + ) + credit_note = invoice.refund() + self.assertEqual(credit_note.brand_id, self.brand) From 18d2e08859647fd5a5a10054c570ea58d549db87 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 25 Aug 2020 15:03:10 +0000 Subject: [PATCH 12/47] account_brand 12.0.3.0.2 --- account_brand/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index 24844fa58..12c25b1e3 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "12.0.3.0.1", + "version": "12.0.3.0.2", "category": "Accounting Management", "website": "https://github.com/OCA/account-invoicing", "author": "Open Source Integrators, Odoo Community Association (OCA)", From 6c7ee5c7193e49c52563615f168f132e23441837 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 30 Dec 2019 14:55:02 +0100 Subject: [PATCH 13/47] [IMP] - set the invoice line analytic account at brand change --- account_brand/__manifest__.py | 1 + account_brand/models/account_invoice.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index 12c25b1e3..d8510b1ef 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -12,6 +12,7 @@ "depends": [ 'account', 'brand', + 'analytic_brand', ], "data": [ "views/account_invoice.xml", diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index c5212f299..dd2146594 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -17,6 +17,17 @@ class AccountInvoice(models.Model): } ) + @api.onchange('brand_id', 'invoice_line_ids') + def _onchange_brand_id(self): + res = super()._onchange_brand_id() + for invoice in self: + if invoice.state == 'draft' and invoice.brand_id: + account_analytic = invoice.brand_id.analytic_account_id + invoice.invoice_line_ids.update( + {'account_analytic_id': account_analytic.id} + ) + return res + @api.multi def _is_brand_required(self): self.ensure_one() From ace9e09041ec2955be2e8e0e562d4c6f2d873785 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 30 Dec 2019 15:00:51 +0100 Subject: [PATCH 14/47] [FIX] - brand_id field in invoice form view is editable only in draft state --- account_brand/views/account_invoice.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_brand/views/account_invoice.xml b/account_brand/views/account_invoice.xml index f4d41439b..f061c8f78 100644 --- a/account_brand/views/account_invoice.xml +++ b/account_brand/views/account_invoice.xml @@ -9,7 +9,7 @@ - + From 5e72c1f26d22e29d19ae393b8d752f95f3b858c5 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 30 Dec 2019 16:19:07 +0100 Subject: [PATCH 15/47] [IMP] - Add unit tests --- account_brand/tests/__init__.py | 1 + .../tests/test_account_analytic_invoice.py | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 account_brand/tests/test_account_analytic_invoice.py diff --git a/account_brand/tests/__init__.py b/account_brand/tests/__init__.py index 7216aca23..6df401fa6 100644 --- a/account_brand/tests/__init__.py +++ b/account_brand/tests/__init__.py @@ -1 +1,2 @@ from . import test_brand_mixin +from . import test_account_analytic_invoice diff --git a/account_brand/tests/test_account_analytic_invoice.py b/account_brand/tests/test_account_analytic_invoice.py new file mode 100644 index 000000000..5be1d9fb5 --- /dev/null +++ b/account_brand/tests/test_account_analytic_invoice.py @@ -0,0 +1,50 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import SavepointCase + + +class TestAccountAnalyticInvoice(SavepointCase): + def setUp(self): + super(TestAccountAnalyticInvoice, self).setUp() + self.invoice = self.env['account.invoice'].create( + { + 'partner_id': self.env.ref('base.res_partner_12').id, + 'type': 'out_invoice', + } + ) + self.env['account.invoice.line'].create( + { + 'product_id': self.env.ref('product.product_product_4').id, + 'quantity': 1, + 'price_unit': 42, + 'invoice_id': self.invoice.id, + 'name': 'something', + 'account_id': self.env['account.account'] + .create( + { + 'name': 'Test sale', + 'code': 'XX_700', + 'user_type_id': self.env.ref( + 'account.data_account_type_revenue' + ).id, + } + ) + .id, + } + ) + self.brand_id = self.env['res.brand'].create({'name': 'Brand'}) + + def test_invoice_analytic_account_onchange_brand(self): + self.brand_id.analytic_account_id = self.env[ + 'account.analytic.account' + ].create({'name': 'analytic account'}) + self.invoice.brand_id = self.brand_id + self.assertFalse( + self.invoice.invoice_line_ids.mapped('account_analytic_id') + ) + self.invoice._onchange_brand_id() + self.assertEqual( + self.invoice.invoice_line_ids.mapped('account_analytic_id'), + self.brand_id.analytic_account_id, + ) From 546782fbe66348c852534610743fa70665852315 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 23 Oct 2020 20:56:31 +0000 Subject: [PATCH 16/47] account_brand 12.0.3.0.3 --- account_brand/__manifest__.py | 9 +- account_brand/models/__init__.py | 1 + account_brand/models/account_invoice.py | 42 +++++++ .../models/res_partner_account_brand.py | 68 +++++++++++ .../security/res_partner_account_brand.xml | 27 +++++ account_brand/tests/__init__.py | 1 + account_brand/tests/test_account_invoice.py | 110 ++++++++++++++++++ .../views/res_partner_account_brand.xml | 32 +++++ 8 files changed, 288 insertions(+), 2 deletions(-) create mode 100644 account_brand/models/res_partner_account_brand.py create mode 100644 account_brand/security/res_partner_account_brand.xml create mode 100644 account_brand/tests/test_account_invoice.py create mode 100644 account_brand/views/res_partner_account_brand.xml diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index d8510b1ef..311f73ed8 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -1,13 +1,16 @@ # Copyright (C) 2019 Open Source Integrators +# Copyright 2019 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "12.0.3.0.2", + "version": "12.0.3.0.3", "category": "Accounting Management", "website": "https://github.com/OCA/account-invoicing", - "author": "Open Source Integrators, Odoo Community Association (OCA)", + "author": "Open Source Integrators," + "ACSONE SA/NV," + "Odoo Community Association (OCA)", "license": "AGPL-3", "depends": [ 'account', @@ -16,6 +19,8 @@ ], "data": [ "views/account_invoice.xml", + "views/res_partner_account_brand.xml", + "security/res_partner_account_brand.xml", ], "installable": True, "development_status": "Beta", diff --git a/account_brand/models/__init__.py b/account_brand/models/__init__.py index 72e75675d..85eb3b08b 100644 --- a/account_brand/models/__init__.py +++ b/account_brand/models/__init__.py @@ -2,3 +2,4 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import account_invoice +from . import res_partner_account_brand diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index dd2146594..9e584cab3 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -1,4 +1,5 @@ # Copyright (C) 2019 Open Source Integrators +# Copyright 2019 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import api, fields, models @@ -17,6 +18,47 @@ class AccountInvoice(models.Model): } ) + @api.onchange("partner_id", "company_id", "brand_id") + def _onchange_partner_id(self): + res = super()._onchange_partner_id() + if not self.brand_id: + return res + partner_account_brand_model = self.env["res.partner.account.brand"] + company_id = self.company_id.id + partner = ( + self.partner_id + if not company_id + else self.partner_id.with_context(force_company=company_id) + ) + invoice_type = self.type or self.env.context.get("type", "out_invoice") + if partner: + rec_account = ( + partner_account_brand_model._get_partner_account_by_brand( + "receivable", self.brand_id, partner + ) + ) + rec_account = ( + rec_account.account_id + if rec_account + else partner.property_account_receivable_id + ) + pay_account = ( + partner_account_brand_model._get_partner_account_by_brand( + "payable", self.brand_id, partner + ) + ) + pay_account = ( + pay_account.account_id + if pay_account + else partner.property_account_payable_id + ) + if invoice_type in ("in_invoice", "in_refund"): + account_id = pay_account + else: + account_id = rec_account + self.account_id = account_id + return res + @api.onchange('brand_id', 'invoice_line_ids') def _onchange_brand_id(self): res = super()._onchange_brand_id() diff --git a/account_brand/models/res_partner_account_brand.py b/account_brand/models/res_partner_account_brand.py new file mode 100644 index 000000000..b49f79f10 --- /dev/null +++ b/account_brand/models/res_partner_account_brand.py @@ -0,0 +1,68 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import _, api, fields, models + + +class ResPartnerAccountBrand(models.Model): + """This model is meant to be used in case we need to define different + receivable/payable accounts for partners""" + + _name = "res.partner.account.brand" + _description = "Receivable/Payable Partner Account By Brand" + + partner_id = fields.Many2one( + comodel_name="res.partner", string="Partner", required=False + ) + account_id = fields.Many2one( + comodel_name="account.account", string="Account", required=True + ) + brand_id = fields.Many2one( + comodel_name='res.brand', + string='Brand', + required=True, + ) + account_type = fields.Selection( + string="Type", + selection=[("payable", "Payable"), ("receivable", "Receivable")], + required=True, + ) + + _sql_constraints = [ + ( + "unique_account_by_partner", + "unique(partner_id, account_id, brand_id, account_type)", + _("Partner has already an account set for this brand!"), + ) + ] + + @api.onchange("account_type") + def _onchange_account_type(self): + self.ensure_one() + self.update({"account_id": False}) + domain = [("id", "=", False)] + if self.account_type == "payable": + domain = [ + ("internal_type", "=", "payable"), + ("deprecated", "=", False), + ] + elif self.account_type == "receivable": + domain = [ + ("internal_type", "=", "receivable"), + ("deprecated", "=", False), + ] + return {"domain": {"account_id": domain}} + + @api.model + def _get_partner_account_by_brand(self, account_type, brand, partner): + domain = [ + ("brand_id", "=", brand.id), + ("account_type", "=", account_type), + ] + default_account = self.search( + domain + [("partner_id", "=", False)], limit=1 + ) + account = False + if partner: + account = self.search(domain + [("partner_id", "=", partner.id)]) + return account or default_account diff --git a/account_brand/security/res_partner_account_brand.xml b/account_brand/security/res_partner_account_brand.xml new file mode 100644 index 000000000..65acc6e1e --- /dev/null +++ b/account_brand/security/res_partner_account_brand.xml @@ -0,0 +1,27 @@ + + + + + + + res.partner.account.brand access + + + + + + + + + + res.partner.account.brand invoice user access + + + + + + + + diff --git a/account_brand/tests/__init__.py b/account_brand/tests/__init__.py index 6df401fa6..82ff43c68 100644 --- a/account_brand/tests/__init__.py +++ b/account_brand/tests/__init__.py @@ -1,2 +1,3 @@ from . import test_brand_mixin +from . import test_account_invoice from . import test_account_analytic_invoice diff --git a/account_brand/tests/test_account_invoice.py b/account_brand/tests/test_account_invoice.py new file mode 100644 index 000000000..81bcce632 --- /dev/null +++ b/account_brand/tests/test_account_invoice.py @@ -0,0 +1,110 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import SavepointCase + + +class TestAccountInvoice(SavepointCase): + def setUp(self): + super(TestAccountInvoice, self).setUp() + account_receivable_type = self.env.ref( + 'account.data_account_type_receivable' + ) + self.account_receivable = self.env['account.account'].create( + { + 'name': 'Partner Receivable', + 'code': 'RCV00', + 'user_type_id': account_receivable_type.id, + 'reconcile': True, + } + ) + self.account_receivable_brand_default = self.env[ + 'account.account' + ].create( + { + 'name': 'Receivable Brand Default', + 'code': 'RCV01', + 'user_type_id': account_receivable_type.id, + 'reconcile': True, + } + ) + self.account_receivable_partner_brand_default = self.env[ + 'account.account' + ].create( + { + 'name': 'Receivable Partner Brand Default', + 'code': 'RCV02', + 'user_type_id': account_receivable_type.id, + 'reconcile': True, + } + ) + self.partner_id = self.env.ref('base.res_partner_12') + self.partner_id.property_account_receivable_id = ( + self.account_receivable + ) + self.invoice = self.env['account.invoice'].create( + {'partner_id': self.partner_id.id, 'type': 'out_invoice'} + ) + type_revenue = self.env.ref('account.data_account_type_revenue') + self.account_revenue = self.env['account.account'].create( + { + 'name': 'Test sale', + 'code': 'XX_700', + 'user_type_id': type_revenue.id, + } + ) + product = self.env.ref('product.product_product_4') + self.env['account.invoice.line'].create( + { + 'product_id': product.id, + 'quantity': 1, + 'price_unit': 42, + 'invoice_id': self.invoice.id, + 'name': 'something', + 'account_id': self.account_revenue.id, + } + ) + self.brand_id = self.env['res.brand'].create( + {'name': 'Brand'} + ) + + def test_on_change_partner_id(self): + self.invoice._onchange_partner_id() + self.assertEqual(self.invoice.account_id, self.account_receivable) + partner_account_brand = self.env['res.partner.account.brand'].create( + { + 'partner_id': False, + 'account_id': self.account_receivable_brand_default.id, + 'brand_id': self.brand_id.id, + 'account_type': 'receivable', + } + ) + self.invoice._onchange_partner_id() + self.assertEqual(self.invoice.account_id, self.account_receivable) + self.invoice.brand_id = self.brand_id + self.invoice._onchange_partner_id() + self.assertEqual( + self.invoice.account_id, self.account_receivable_brand_default + ) + partner_account_brand.update( + { + 'partner_id': self.partner_id.id, + 'account_id': self.account_receivable_partner_brand_default.id, + } + ) + self.invoice._onchange_partner_id() + self.assertEqual( + self.invoice.account_id, + self.account_receivable_partner_brand_default, + ) + invoice = self.env['account.invoice'].create( + { + 'partner_id': self.partner_id.id, + 'brand_id': self.brand_id.id, + 'type': 'out_invoice', + } + ) + self.assertEqual( + invoice.account_id, + self.account_receivable_partner_brand_default, + ) diff --git a/account_brand/views/res_partner_account_brand.xml b/account_brand/views/res_partner_account_brand.xml new file mode 100644 index 000000000..526ae4980 --- /dev/null +++ b/account_brand/views/res_partner_account_brand.xml @@ -0,0 +1,32 @@ + + + + + + + res.partner.account.brand.tree (in account_brand) + res.partner.account.brand + + + + + + + + + + + + Partner Accounts by Brand + res.partner.account.brand + tree + + + + Partner Accounts by Brand + + + + + From e954f81fed1bdb919ace079368cf8ca4a8bfca75 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 18 May 2020 11:17:57 +0200 Subject: [PATCH 17/47] [IMP] - Add account type constrains and domain --- account_brand/models/account_invoice.py | 4 +-- .../models/res_partner_account_brand.py | 36 ++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index 9e584cab3..db5b3e449 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -38,7 +38,7 @@ def _onchange_partner_id(self): ) ) rec_account = ( - rec_account.account_id + rec_account if rec_account else partner.property_account_receivable_id ) @@ -48,7 +48,7 @@ def _onchange_partner_id(self): ) ) pay_account = ( - pay_account.account_id + pay_account if pay_account else partner.property_account_payable_id ) diff --git a/account_brand/models/res_partner_account_brand.py b/account_brand/models/res_partner_account_brand.py index b49f79f10..f5dd1f927 100644 --- a/account_brand/models/res_partner_account_brand.py +++ b/account_brand/models/res_partner_account_brand.py @@ -2,6 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import _, api, fields, models +from odoo.exceptions import ValidationError class ResPartnerAccountBrand(models.Model): @@ -15,12 +16,13 @@ class ResPartnerAccountBrand(models.Model): comodel_name="res.partner", string="Partner", required=False ) account_id = fields.Many2one( - comodel_name="account.account", string="Account", required=True + comodel_name="account.account", + string="Account", + required=True, + domain="[('user_type_id.type', 'in', ('payable', 'receivable'))]", ) brand_id = fields.Many2one( - comodel_name='res.brand', - string='Brand', - required=True, + comodel_name='res.brand', string='Brand', required=True ) account_type = fields.Selection( string="Type", @@ -36,6 +38,18 @@ class ResPartnerAccountBrand(models.Model): ) ] + @api.constrains('account_id', 'account_type') + def _check_account_type(self): + for rec in self: + if ( + rec.account_id + and rec.account_type + and rec.account_id.user_type_id.type != rec.account_type + ): + raise ValidationError( + _("Please select an account of type %s") % rec.account_type + ) + @api.onchange("account_type") def _onchange_account_type(self): self.ensure_one() @@ -59,10 +73,16 @@ def _get_partner_account_by_brand(self, account_type, brand, partner): ("brand_id", "=", brand.id), ("account_type", "=", account_type), ] - default_account = self.search( + default_rule = self.search( domain + [("partner_id", "=", False)], limit=1 ) - account = False + partner_rule = False if partner: - account = self.search(domain + [("partner_id", "=", partner.id)]) - return account or default_account + partner_rule = self.search( + domain + [("partner_id", "=", partner.id)] + ) + return ( + partner_rule.account_id + if partner_rule + else default_rule.account_id + ) From 80d104271951c67d5c8d208786765b9af2f5a96d Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Tue, 2 Jun 2020 16:05:19 +0200 Subject: [PATCH 18/47] [FIX] - Fix brand onchange --- account_brand/models/account_invoice.py | 69 +++++++++++++------------ 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index db5b3e449..79fe88ce9 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -18,46 +18,47 @@ class AccountInvoice(models.Model): } ) - @api.onchange("partner_id", "company_id", "brand_id") + @api.onchange("partner_id", "company_id") def _onchange_partner_id(self): res = super()._onchange_partner_id() - if not self.brand_id: - return res - partner_account_brand_model = self.env["res.partner.account.brand"] - company_id = self.company_id.id - partner = ( - self.partner_id - if not company_id - else self.partner_id.with_context(force_company=company_id) - ) - invoice_type = self.type or self.env.context.get("type", "out_invoice") - if partner: - rec_account = ( - partner_account_brand_model._get_partner_account_by_brand( - "receivable", self.brand_id, partner - ) + self._onchange_partner_brand() + return res + + @api.onchange("partner_id", "company_id", "brand_id") + def _onchange_partner_brand(self): + if self.brand_id: + pab_model = self.env["res.partner.account.brand"] + company_id = self.company_id.id + partner = ( + self.partner_id + if not company_id + else self.partner_id.with_context(force_company=company_id) ) - rec_account = ( - rec_account - if rec_account - else partner.property_account_receivable_id + invoice_type = self.type or self.env.context.get( + "type", "out_invoice" ) - pay_account = ( - partner_account_brand_model._get_partner_account_by_brand( + if partner: + rec_account = pab_model._get_partner_account_by_brand( + "receivable", self.brand_id, partner + ) + rec_account = ( + rec_account + if rec_account + else partner.property_account_receivable_id + ) + pay_account = pab_model._get_partner_account_by_brand( "payable", self.brand_id, partner ) - ) - pay_account = ( - pay_account - if pay_account - else partner.property_account_payable_id - ) - if invoice_type in ("in_invoice", "in_refund"): - account_id = pay_account - else: - account_id = rec_account - self.account_id = account_id - return res + pay_account = ( + pay_account + if pay_account + else partner.property_account_payable_id + ) + if invoice_type in ("in_invoice", "in_refund"): + account_id = pay_account + else: + account_id = rec_account + self.account_id = account_id @api.onchange('brand_id', 'invoice_line_ids') def _onchange_brand_id(self): From d539d846be5d97d3a2aaa5c07cc46c186b712415 Mon Sep 17 00:00:00 2001 From: Quentin Groulard Date: Tue, 16 Jun 2020 11:02:58 +0200 Subject: [PATCH 19/47] [FIX] Invoice account_id --- account_brand/README.rst | 1 + account_brand/__manifest__.py | 2 +- account_brand/i18n/account_brand.pot | 85 ++++++++++++++++++++ account_brand/i18n/de.po | 87 ++++++++++++++++++++- account_brand/i18n/es.po | 87 ++++++++++++++++++++- account_brand/i18n/hr.po | 85 ++++++++++++++++++++ account_brand/i18n/zh_CN.po | 85 ++++++++++++++++++++ account_brand/models/account_invoice.py | 12 +-- account_brand/static/description/index.html | 1 + account_brand/tests/test_account_invoice.py | 8 +- 10 files changed, 441 insertions(+), 12 deletions(-) diff --git a/account_brand/README.rst b/account_brand/README.rst index f3c27ac92..c3cb012f0 100644 --- a/account_brand/README.rst +++ b/account_brand/README.rst @@ -67,6 +67,7 @@ Authors ~~~~~~~ * Open Source Integrators +* ACSONE SA/NV Contributors ~~~~~~~~~~~~ diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index 311f73ed8..1b62a9009 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "12.0.3.0.3", + "version": "12.0.3.1.0", "category": "Accounting Management", "website": "https://github.com/OCA/account-invoicing", "author": "Open Source Integrators," diff --git a/account_brand/i18n/account_brand.pot b/account_brand/i18n/account_brand.pot index 656fe5db5..088f64135 100644 --- a/account_brand/i18n/account_brand.pot +++ b/account_brand/i18n/account_brand.pot @@ -13,8 +13,14 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id +msgid "Account" +msgstr "" + #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "" @@ -23,8 +29,87 @@ msgstr "" msgid "Brand to use for this sale" msgstr "" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid +msgid "Created by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date +msgid "Created on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name +msgid "Display Name" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id +msgid "ID" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_invoice msgid "Invoice" msgstr "" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date +msgid "Last Updated on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id +msgid "Partner" +msgstr "" + +#. module: account_brand +#: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window +#: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu +msgid "Partner Accounts by Brand" +msgstr "" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:37 +#: sql_constraint:res.partner.account.brand:0 +#, python-format +msgid "Partner has already an account set for this brand!" +msgstr "" + +#. module: account_brand +#: selection:res.partner.account.brand,account_type:0 +msgid "Payable" +msgstr "" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:50 +#, python-format +msgid "Please select an account of type %s" +msgstr "" + +#. module: account_brand +#: selection:res.partner.account.brand,account_type:0 +msgid "Receivable" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_res_partner_account_brand +msgid "Receivable/Payable Partner Account By Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type +msgid "Type" +msgstr "" + diff --git a/account_brand/i18n/de.po b/account_brand/i18n/de.po index b3f6a8812..d43c31062 100644 --- a/account_brand/i18n/de.po +++ b/account_brand/i18n/de.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_brand +# * account_brand # msgid "" msgstr "" @@ -16,8 +16,14 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 3.10\n" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id +msgid "Account" +msgstr "" + #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Marke" @@ -26,7 +32,86 @@ msgstr "Marke" msgid "Brand to use for this sale" msgstr "zu verwendende Marke für diesen Verkauf" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid +msgid "Created by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date +msgid "Created on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name +msgid "Display Name" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id +msgid "ID" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_invoice msgid "Invoice" msgstr "Rechnung" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date +msgid "Last Updated on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id +msgid "Partner" +msgstr "" + +#. module: account_brand +#: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window +#: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu +msgid "Partner Accounts by Brand" +msgstr "" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:37 +#: sql_constraint:res.partner.account.brand:0 +#, python-format +msgid "Partner has already an account set for this brand!" +msgstr "" + +#. module: account_brand +#: selection:res.partner.account.brand,account_type:0 +msgid "Payable" +msgstr "" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:50 +#, python-format +msgid "Please select an account of type %s" +msgstr "" + +#. module: account_brand +#: selection:res.partner.account.brand,account_type:0 +msgid "Receivable" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_res_partner_account_brand +msgid "Receivable/Payable Partner Account By Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type +msgid "Type" +msgstr "" diff --git a/account_brand/i18n/es.po b/account_brand/i18n/es.po index 380943062..f87bc3765 100644 --- a/account_brand/i18n/es.po +++ b/account_brand/i18n/es.po @@ -1,6 +1,6 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_brand +# * account_brand # msgid "" msgstr "" @@ -16,8 +16,14 @@ msgstr "" "Plural-Forms: nplurals=2; plural=n != 1;\n" "X-Generator: Weblate 3.10\n" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id +msgid "Account" +msgstr "" + #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Marca" @@ -26,7 +32,86 @@ msgstr "Marca" msgid "Brand to use for this sale" msgstr "Marca a usar en esta venta" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid +msgid "Created by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date +msgid "Created on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name +msgid "Display Name" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id +msgid "ID" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_invoice msgid "Invoice" msgstr "Factura" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date +msgid "Last Updated on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id +msgid "Partner" +msgstr "" + +#. module: account_brand +#: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window +#: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu +msgid "Partner Accounts by Brand" +msgstr "" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:37 +#: sql_constraint:res.partner.account.brand:0 +#, python-format +msgid "Partner has already an account set for this brand!" +msgstr "" + +#. module: account_brand +#: selection:res.partner.account.brand,account_type:0 +msgid "Payable" +msgstr "" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:50 +#, python-format +msgid "Please select an account of type %s" +msgstr "" + +#. module: account_brand +#: selection:res.partner.account.brand,account_type:0 +msgid "Receivable" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_res_partner_account_brand +msgid "Receivable/Payable Partner Account By Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type +msgid "Type" +msgstr "" diff --git a/account_brand/i18n/hr.po b/account_brand/i18n/hr.po index 76dee72c2..5385e322f 100644 --- a/account_brand/i18n/hr.po +++ b/account_brand/i18n/hr.po @@ -17,8 +17,14 @@ msgstr "" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 3.8\n" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id +msgid "Account" +msgstr "" + #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Brand" @@ -27,7 +33,86 @@ msgstr "Brand" msgid "Brand to use for this sale" msgstr "" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid +msgid "Created by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date +msgid "Created on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name +msgid "Display Name" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id +msgid "ID" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_invoice msgid "Invoice" msgstr "Račun" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date +msgid "Last Updated on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id +msgid "Partner" +msgstr "" + +#. module: account_brand +#: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window +#: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu +msgid "Partner Accounts by Brand" +msgstr "" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:37 +#: sql_constraint:res.partner.account.brand:0 +#, python-format +msgid "Partner has already an account set for this brand!" +msgstr "" + +#. module: account_brand +#: selection:res.partner.account.brand,account_type:0 +msgid "Payable" +msgstr "" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:50 +#, python-format +msgid "Please select an account of type %s" +msgstr "" + +#. module: account_brand +#: selection:res.partner.account.brand,account_type:0 +msgid "Receivable" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_res_partner_account_brand +msgid "Receivable/Payable Partner Account By Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type +msgid "Type" +msgstr "" diff --git a/account_brand/i18n/zh_CN.po b/account_brand/i18n/zh_CN.po index 5c50153a6..e49487b05 100644 --- a/account_brand/i18n/zh_CN.po +++ b/account_brand/i18n/zh_CN.po @@ -16,8 +16,14 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Weblate 3.8\n" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id +msgid "Account" +msgstr "" + #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "品牌" @@ -26,7 +32,86 @@ msgstr "品牌" msgid "Brand to use for this sale" msgstr "" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid +msgid "Created by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date +msgid "Created on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name +msgid "Display Name" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id +msgid "ID" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_invoice msgid "Invoice" msgstr "发票" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date +msgid "Last Updated on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id +msgid "Partner" +msgstr "" + +#. module: account_brand +#: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window +#: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu +msgid "Partner Accounts by Brand" +msgstr "" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:37 +#: sql_constraint:res.partner.account.brand:0 +#, python-format +msgid "Partner has already an account set for this brand!" +msgstr "" + +#. module: account_brand +#: selection:res.partner.account.brand,account_type:0 +msgid "Payable" +msgstr "" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:50 +#, python-format +msgid "Please select an account of type %s" +msgstr "" + +#. module: account_brand +#: selection:res.partner.account.brand,account_type:0 +msgid "Receivable" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_res_partner_account_brand +msgid "Receivable/Payable Partner Account By Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type +msgid "Type" +msgstr "" diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py index 79fe88ce9..f60788922 100644 --- a/account_brand/models/account_invoice.py +++ b/account_brand/models/account_invoice.py @@ -2,6 +2,8 @@ # Copyright 2019 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from collections import OrderedDict + from odoo import api, fields, models @@ -18,11 +20,11 @@ class AccountInvoice(models.Model): } ) - @api.onchange("partner_id", "company_id") - def _onchange_partner_id(self): - res = super()._onchange_partner_id() - self._onchange_partner_brand() - return res + def _get_onchange_create(self): + res = super()._get_onchange_create() + return OrderedDict( + [("_onchange_partner_brand", ["account_id"])] + list(res.items()) + ) @api.onchange("partner_id", "company_id", "brand_id") def _onchange_partner_brand(self): diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html index 96d35e342..7795ab496 100644 --- a/account_brand/static/description/index.html +++ b/account_brand/static/description/index.html @@ -415,6 +415,7 @@

Credits

Authors

  • Open Source Integrators
  • +
  • ACSONE SA/NV
diff --git a/account_brand/tests/test_account_invoice.py b/account_brand/tests/test_account_invoice.py index 81bcce632..832d829d8 100644 --- a/account_brand/tests/test_account_invoice.py +++ b/account_brand/tests/test_account_invoice.py @@ -69,7 +69,7 @@ def setUp(self): ) def test_on_change_partner_id(self): - self.invoice._onchange_partner_id() + self.invoice._onchange_partner_brand() self.assertEqual(self.invoice.account_id, self.account_receivable) partner_account_brand = self.env['res.partner.account.brand'].create( { @@ -79,10 +79,10 @@ def test_on_change_partner_id(self): 'account_type': 'receivable', } ) - self.invoice._onchange_partner_id() + self.invoice._onchange_partner_brand() self.assertEqual(self.invoice.account_id, self.account_receivable) self.invoice.brand_id = self.brand_id - self.invoice._onchange_partner_id() + self.invoice._onchange_partner_brand() self.assertEqual( self.invoice.account_id, self.account_receivable_brand_default ) @@ -92,7 +92,7 @@ def test_on_change_partner_id(self): 'account_id': self.account_receivable_partner_brand_default.id, } ) - self.invoice._onchange_partner_id() + self.invoice._onchange_partner_brand() self.assertEqual( self.invoice.account_id, self.account_receivable_partner_brand_default, From 5d4c7b808c8c50e0b20cc75ef49a90788f1d68b5 Mon Sep 17 00:00:00 2001 From: cubells Date: Tue, 28 Apr 2020 08:46:17 +0200 Subject: [PATCH 20/47] [MIG] account_brand: Migration to 13.0 [ADD] - add sbejaoui as maintainer [IMP] - move brand config section outside multi_company section [FIX] - add brand_use_level to fields_view_get fields --- account_brand/README.rst | 21 ++- account_brand/__init__.py | 2 +- account_brand/__manifest__.py | 16 +-- account_brand/i18n/account_brand.pot | 30 ++-- account_brand/i18n/de.po | 28 ++-- account_brand/i18n/es.po | 28 ++-- account_brand/i18n/hr.po | 28 ++-- account_brand/i18n/zh_CN.po | 28 ++-- .../migrations/12.0.2.0.0/post-migration.py | 15 -- .../migrations/12.0.2.0.0/pre-migration.py | 16 --- account_brand/models/__init__.py | 2 +- account_brand/models/account_invoice.py | 91 ------------ account_brand/models/account_move.py | 72 ++++++++++ .../models/res_partner_account_brand.py | 20 +-- account_brand/readme/CONTRIBUTORS.rst | 4 + .../security/res_partner_account_brand.xml | 34 +++-- account_brand/static/description/index.html | 14 +- account_brand/tests/__init__.py | 4 +- .../tests/test_account_analytic_invoice.py | 50 ------- .../tests/test_account_analytic_move.py | 48 +++++++ account_brand/tests/test_account_invoice.py | 110 --------------- account_brand/tests/test_account_move.py | 112 +++++++++++++++ account_brand/tests/test_brand_mixin.py | 132 ++++++++++-------- account_brand/views/account_invoice.xml | 17 --- account_brand/views/account_move_views.xml | 16 +++ .../views/res_partner_account_brand.xml | 19 +-- account_brand/wizards/__init__.py | 1 + .../wizards/account_move_reversal.py | 14 ++ 28 files changed, 494 insertions(+), 478 deletions(-) delete mode 100644 account_brand/migrations/12.0.2.0.0/post-migration.py delete mode 100644 account_brand/migrations/12.0.2.0.0/pre-migration.py delete mode 100644 account_brand/models/account_invoice.py create mode 100644 account_brand/models/account_move.py delete mode 100644 account_brand/tests/test_account_analytic_invoice.py create mode 100644 account_brand/tests/test_account_analytic_move.py delete mode 100644 account_brand/tests/test_account_invoice.py create mode 100644 account_brand/tests/test_account_move.py delete mode 100644 account_brand/views/account_invoice.xml create mode 100644 account_brand/views/account_move_views.xml create mode 100644 account_brand/wizards/__init__.py create mode 100644 account_brand/wizards/account_move_reversal.py diff --git a/account_brand/README.rst b/account_brand/README.rst index c3cb012f0..7f857a8ae 100644 --- a/account_brand/README.rst +++ b/account_brand/README.rst @@ -14,13 +14,13 @@ Account Brand :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github - :target: https://github.com/OCA/brand/tree/12.0/account_brand + :target: https://github.com/OCA/brand/tree/13.0/account_brand :alt: OCA/brand .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/brand-12-0/brand-12-0-account_brand + :target: https://translation.odoo-community.org/projects/brand-13-0/brand-13-0-account_brand :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/284/12.0 + :target: https://runbot.odoo-community.org/runbot/284/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -56,7 +56,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -76,6 +76,10 @@ Contributors * Steve Campbell * Maxime Chambreuil +* `Obertix `_: + + * Vicent Cubells + Other credits ~~~~~~~~~~~~~ @@ -97,11 +101,14 @@ promote its widespread use. .. |maintainer-osi-scampbell| image:: https://github.com/osi-scampbell.png?size=40px :target: https://github.com/osi-scampbell :alt: osi-scampbell +.. |maintainer-sbejaoui| image:: https://github.com/sbejaoui.png?size=40px + :target: https://github.com/sbejaoui + :alt: sbejaoui -Current `maintainer `__: +Current `maintainers `__: -|maintainer-osi-scampbell| +|maintainer-osi-scampbell| |maintainer-sbejaoui| -This module is part of the `OCA/brand `_ project on GitHub. +This module is part of the `OCA/brand `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_brand/__init__.py b/account_brand/__init__.py index 58b6a7fd9..887d8d15b 100644 --- a/account_brand/__init__.py +++ b/account_brand/__init__.py @@ -2,4 +2,4 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models -from . import tests +from . import wizards diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index 1b62a9009..6009114f7 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -5,24 +5,20 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "12.0.3.1.0", + "version": "13.0.1.0.0", "category": "Accounting Management", "website": "https://github.com/OCA/account-invoicing", "author": "Open Source Integrators," - "ACSONE SA/NV," - "Odoo Community Association (OCA)", + "ACSONE SA/NV," + "Odoo Community Association (OCA)", "license": "AGPL-3", - "depends": [ - 'account', - 'brand', - 'analytic_brand', - ], + "depends": ["account", "brand", "analytic_brand"], "data": [ - "views/account_invoice.xml", + "views/account_move_views.xml", "views/res_partner_account_brand.xml", "security/res_partner_account_brand.xml", ], "installable": True, "development_status": "Beta", - "maintainers": ["osi-scampbell"], + "maintainers": ["osi-scampbell", "sbejaoui"], } diff --git a/account_brand/i18n/account_brand.pot b/account_brand/i18n/account_brand.pot index 088f64135..d18bd80cc 100644 --- a/account_brand/i18n/account_brand.pot +++ b/account_brand/i18n/account_brand.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * account_brand +# * account_brand # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,13 +19,18 @@ msgid "Account" msgstr "" #. module: account_brand -#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +#: model:ir.model,name:account_brand.model_account_move_reversal +msgid "Account Move Reversal" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "" #. module: account_brand -#: model:ir.model.fields,help:account_brand.field_account_invoice__brand_id +#: model:ir.model.fields,help:account_brand.field_account_move__brand_id msgid "Brand to use for this sale" msgstr "" @@ -50,8 +55,8 @@ msgid "ID" msgstr "" #. module: account_brand -#: model:ir.model,name:account_brand.model_account_invoice -msgid "Invoice" +#: model:ir.model,name:account_brand.model_account_move +msgid "Journal Entries" msgstr "" #. module: account_brand @@ -81,25 +86,25 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand -#: code:addons/account_brand/models/res_partner_account_brand.py:37 -#: sql_constraint:res.partner.account.brand:0 +#: code:addons/account_brand/models/res_partner_account_brand.py:0 +#: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format msgid "Partner has already an account set for this brand!" msgstr "" #. module: account_brand -#: selection:res.partner.account.brand,account_type:0 +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable msgid "Payable" msgstr "" #. module: account_brand -#: code:addons/account_brand/models/res_partner_account_brand.py:50 +#: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" msgstr "" #. module: account_brand -#: selection:res.partner.account.brand,account_type:0 +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable msgid "Receivable" msgstr "" @@ -112,4 +117,3 @@ msgstr "" #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type msgid "Type" msgstr "" - diff --git a/account_brand/i18n/de.po b/account_brand/i18n/de.po index d43c31062..c35419489 100644 --- a/account_brand/i18n/de.po +++ b/account_brand/i18n/de.po @@ -22,13 +22,18 @@ msgid "Account" msgstr "" #. module: account_brand -#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +#: model:ir.model,name:account_brand.model_account_move_reversal +msgid "Account Move Reversal" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Marke" #. module: account_brand -#: model:ir.model.fields,help:account_brand.field_account_invoice__brand_id +#: model:ir.model.fields,help:account_brand.field_account_move__brand_id msgid "Brand to use for this sale" msgstr "zu verwendende Marke für diesen Verkauf" @@ -53,9 +58,9 @@ msgid "ID" msgstr "" #. module: account_brand -#: model:ir.model,name:account_brand.model_account_invoice -msgid "Invoice" -msgstr "Rechnung" +#: model:ir.model,name:account_brand.model_account_move +msgid "Journal Entries" +msgstr "" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update @@ -84,25 +89,25 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand -#: code:addons/account_brand/models/res_partner_account_brand.py:37 -#: sql_constraint:res.partner.account.brand:0 +#: code:addons/account_brand/models/res_partner_account_brand.py:0 +#: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format msgid "Partner has already an account set for this brand!" msgstr "" #. module: account_brand -#: selection:res.partner.account.brand,account_type:0 +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable msgid "Payable" msgstr "" #. module: account_brand -#: code:addons/account_brand/models/res_partner_account_brand.py:50 +#: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" msgstr "" #. module: account_brand -#: selection:res.partner.account.brand,account_type:0 +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable msgid "Receivable" msgstr "" @@ -115,3 +120,6 @@ msgstr "" #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type msgid "Type" msgstr "" + +#~ msgid "Invoice" +#~ msgstr "Rechnung" diff --git a/account_brand/i18n/es.po b/account_brand/i18n/es.po index f87bc3765..5a9c02afc 100644 --- a/account_brand/i18n/es.po +++ b/account_brand/i18n/es.po @@ -22,13 +22,18 @@ msgid "Account" msgstr "" #. module: account_brand -#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +#: model:ir.model,name:account_brand.model_account_move_reversal +msgid "Account Move Reversal" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Marca" #. module: account_brand -#: model:ir.model.fields,help:account_brand.field_account_invoice__brand_id +#: model:ir.model.fields,help:account_brand.field_account_move__brand_id msgid "Brand to use for this sale" msgstr "Marca a usar en esta venta" @@ -53,9 +58,9 @@ msgid "ID" msgstr "" #. module: account_brand -#: model:ir.model,name:account_brand.model_account_invoice -msgid "Invoice" -msgstr "Factura" +#: model:ir.model,name:account_brand.model_account_move +msgid "Journal Entries" +msgstr "" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update @@ -84,25 +89,25 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand -#: code:addons/account_brand/models/res_partner_account_brand.py:37 -#: sql_constraint:res.partner.account.brand:0 +#: code:addons/account_brand/models/res_partner_account_brand.py:0 +#: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format msgid "Partner has already an account set for this brand!" msgstr "" #. module: account_brand -#: selection:res.partner.account.brand,account_type:0 +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable msgid "Payable" msgstr "" #. module: account_brand -#: code:addons/account_brand/models/res_partner_account_brand.py:50 +#: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" msgstr "" #. module: account_brand -#: selection:res.partner.account.brand,account_type:0 +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable msgid "Receivable" msgstr "" @@ -115,3 +120,6 @@ msgstr "" #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type msgid "Type" msgstr "" + +#~ msgid "Invoice" +#~ msgstr "Factura" diff --git a/account_brand/i18n/hr.po b/account_brand/i18n/hr.po index 5385e322f..b0495828e 100644 --- a/account_brand/i18n/hr.po +++ b/account_brand/i18n/hr.po @@ -23,13 +23,18 @@ msgid "Account" msgstr "" #. module: account_brand -#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +#: model:ir.model,name:account_brand.model_account_move_reversal +msgid "Account Move Reversal" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Brand" #. module: account_brand -#: model:ir.model.fields,help:account_brand.field_account_invoice__brand_id +#: model:ir.model.fields,help:account_brand.field_account_move__brand_id msgid "Brand to use for this sale" msgstr "" @@ -54,9 +59,9 @@ msgid "ID" msgstr "" #. module: account_brand -#: model:ir.model,name:account_brand.model_account_invoice -msgid "Invoice" -msgstr "Račun" +#: model:ir.model,name:account_brand.model_account_move +msgid "Journal Entries" +msgstr "" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update @@ -85,25 +90,25 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand -#: code:addons/account_brand/models/res_partner_account_brand.py:37 -#: sql_constraint:res.partner.account.brand:0 +#: code:addons/account_brand/models/res_partner_account_brand.py:0 +#: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format msgid "Partner has already an account set for this brand!" msgstr "" #. module: account_brand -#: selection:res.partner.account.brand,account_type:0 +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable msgid "Payable" msgstr "" #. module: account_brand -#: code:addons/account_brand/models/res_partner_account_brand.py:50 +#: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" msgstr "" #. module: account_brand -#: selection:res.partner.account.brand,account_type:0 +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable msgid "Receivable" msgstr "" @@ -116,3 +121,6 @@ msgstr "" #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type msgid "Type" msgstr "" + +#~ msgid "Invoice" +#~ msgstr "Račun" diff --git a/account_brand/i18n/zh_CN.po b/account_brand/i18n/zh_CN.po index e49487b05..dc401f696 100644 --- a/account_brand/i18n/zh_CN.po +++ b/account_brand/i18n/zh_CN.po @@ -22,13 +22,18 @@ msgid "Account" msgstr "" #. module: account_brand -#: model:ir.model.fields,field_description:account_brand.field_account_invoice__brand_id +#: model:ir.model,name:account_brand.model_account_move_reversal +msgid "Account Move Reversal" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "品牌" #. module: account_brand -#: model:ir.model.fields,help:account_brand.field_account_invoice__brand_id +#: model:ir.model.fields,help:account_brand.field_account_move__brand_id msgid "Brand to use for this sale" msgstr "" @@ -53,9 +58,9 @@ msgid "ID" msgstr "" #. module: account_brand -#: model:ir.model,name:account_brand.model_account_invoice -msgid "Invoice" -msgstr "发票" +#: model:ir.model,name:account_brand.model_account_move +msgid "Journal Entries" +msgstr "" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update @@ -84,25 +89,25 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand -#: code:addons/account_brand/models/res_partner_account_brand.py:37 -#: sql_constraint:res.partner.account.brand:0 +#: code:addons/account_brand/models/res_partner_account_brand.py:0 +#: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format msgid "Partner has already an account set for this brand!" msgstr "" #. module: account_brand -#: selection:res.partner.account.brand,account_type:0 +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable msgid "Payable" msgstr "" #. module: account_brand -#: code:addons/account_brand/models/res_partner_account_brand.py:50 +#: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" msgstr "" #. module: account_brand -#: selection:res.partner.account.brand,account_type:0 +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable msgid "Receivable" msgstr "" @@ -115,3 +120,6 @@ msgstr "" #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type msgid "Type" msgstr "" + +#~ msgid "Invoice" +#~ msgstr "发票" diff --git a/account_brand/migrations/12.0.2.0.0/post-migration.py b/account_brand/migrations/12.0.2.0.0/post-migration.py deleted file mode 100644 index f45049cbe..000000000 --- a/account_brand/migrations/12.0.2.0.0/post-migration.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2019 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import logging - -_logger = logging.getLogger(__name__) - - -def migrate(cr, version): - _logger.info("Move sale brand to res.brand model") - cr.execute(""" - UPDATE account_invoice SET brand_id = brand.id - FROM res_brand brand - WHERE brand.partner_id=brand_id_tmp""") - cr.execute("""ALTER TABLE account_invoice DROP COLUMN brand_id_tmp""") diff --git a/account_brand/migrations/12.0.2.0.0/pre-migration.py b/account_brand/migrations/12.0.2.0.0/pre-migration.py deleted file mode 100644 index 34c49706c..000000000 --- a/account_brand/migrations/12.0.2.0.0/pre-migration.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2019 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import logging - -_logger = logging.getLogger(__name__) - - -def migrate(cr, version): - _logger.info("Move invoice brand to res.brand model") - cr.execute( - """ALTER TABLE account_invoice - ADD COLUMN brand_id_tmp INTEGER""" - ) - cr.execute("""UPDATE account_invoice SET brand_id_tmp = brand_id""") - cr.execute("""ALTER TABLE account_invoice DROP COLUMN brand_id""") diff --git a/account_brand/models/__init__.py b/account_brand/models/__init__.py index 85eb3b08b..a438e0dec 100644 --- a/account_brand/models/__init__.py +++ b/account_brand/models/__init__.py @@ -1,5 +1,5 @@ # Copyright (C) 2019 Open Source Integrators # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import account_invoice +from . import account_move from . import res_partner_account_brand diff --git a/account_brand/models/account_invoice.py b/account_brand/models/account_invoice.py deleted file mode 100644 index f60788922..000000000 --- a/account_brand/models/account_invoice.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (C) 2019 Open Source Integrators -# Copyright 2019 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from collections import OrderedDict - -from odoo import api, fields, models - - -class AccountInvoice(models.Model): - _name = 'account.invoice' - _inherit = ['account.invoice', 'res.brand.mixin'] - - brand_id = fields.Many2one( - states={ - 'open': [('readonly', True)], - 'in_payment': [('readonly', True)], - 'paid': [('readonly', True)], - 'cancel': [('readonly', True)], - } - ) - - def _get_onchange_create(self): - res = super()._get_onchange_create() - return OrderedDict( - [("_onchange_partner_brand", ["account_id"])] + list(res.items()) - ) - - @api.onchange("partner_id", "company_id", "brand_id") - def _onchange_partner_brand(self): - if self.brand_id: - pab_model = self.env["res.partner.account.brand"] - company_id = self.company_id.id - partner = ( - self.partner_id - if not company_id - else self.partner_id.with_context(force_company=company_id) - ) - invoice_type = self.type or self.env.context.get( - "type", "out_invoice" - ) - if partner: - rec_account = pab_model._get_partner_account_by_brand( - "receivable", self.brand_id, partner - ) - rec_account = ( - rec_account - if rec_account - else partner.property_account_receivable_id - ) - pay_account = pab_model._get_partner_account_by_brand( - "payable", self.brand_id, partner - ) - pay_account = ( - pay_account - if pay_account - else partner.property_account_payable_id - ) - if invoice_type in ("in_invoice", "in_refund"): - account_id = pay_account - else: - account_id = rec_account - self.account_id = account_id - - @api.onchange('brand_id', 'invoice_line_ids') - def _onchange_brand_id(self): - res = super()._onchange_brand_id() - for invoice in self: - if invoice.state == 'draft' and invoice.brand_id: - account_analytic = invoice.brand_id.analytic_account_id - invoice.invoice_line_ids.update( - {'account_analytic_id': account_analytic.id} - ) - return res - - @api.multi - def _is_brand_required(self): - self.ensure_one() - if self.type in ('in_invoice', 'in_refund'): - return False - return super(AccountInvoice, self)._is_brand_required() - - @api.model - def _prepare_refund(self, invoice, date_invoice=None, date=None, - description=None, journal_id=None): - values = super(AccountInvoice, self)._prepare_refund( - invoice, date_invoice=date_invoice, date=date, - description=description, journal_id=journal_id) - if invoice.brand_id: - values['brand_id'] = invoice.brand_id.id - return values diff --git a/account_brand/models/account_move.py b/account_brand/models/account_move.py new file mode 100644 index 000000000..de9a5003a --- /dev/null +++ b/account_brand/models/account_move.py @@ -0,0 +1,72 @@ +# Copyright (C) 2019 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + + +from odoo import api, fields, models + + +class AccountMove(models.Model): + _name = "account.move" + _inherit = ["account.move", "res.brand.mixin"] + + brand_id = fields.Many2one( + states={ + "open": [("readonly", True)], + "in_payment": [("readonly", True)], + "paid": [("readonly", True)], + "cancel": [("readonly", True)], + } + ) + + def _is_brand_required(self): + self.ensure_one() + if self.type in ("in_invoice", "in_refund"): + return False + return super()._is_brand_required() + + def _recompute_payment_terms_lines(self): + super()._recompute_payment_terms_lines() + if self.brand_id: + pab_model = self.env["res.partner.account.brand"] + company_id = self.company_id.id + partner = ( + self.partner_id + if not company_id + else self.partner_id.with_context(force_company=company_id) + ) + invoice_type = self.type or self.env.context.get("type", "out_invoice") + if partner: + rec_account = pab_model._get_partner_account_by_brand( + "receivable", self.brand_id, partner + ) + rec_account = ( + rec_account + if rec_account + else partner.property_account_receivable_id + ) + pay_account = pab_model._get_partner_account_by_brand( + "payable", self.brand_id, partner + ) + pay_account = ( + pay_account if pay_account else partner.property_account_payable_id + ) + if invoice_type in ("in_invoice", "in_refund"): + account_id = pay_account + else: + account_id = rec_account + if account_id: + self.line_ids.filtered( + lambda l, a=account_id: l.account_id.user_type_id + == a.user_type_id + ).update({"account_id": account_id.id}) + + @api.onchange("brand_id", "invoice_line_ids") + def _onchange_brand_id(self): + res = super()._onchange_brand_id() + for invoice in self: + if invoice.state == "draft" and invoice.brand_id: + account_analytic = invoice.brand_id.analytic_account_id + invoice.invoice_line_ids.update( + {"analytic_account_id": account_analytic.id} + ) + return res diff --git a/account_brand/models/res_partner_account_brand.py b/account_brand/models/res_partner_account_brand.py index f5dd1f927..6a2a5e989 100644 --- a/account_brand/models/res_partner_account_brand.py +++ b/account_brand/models/res_partner_account_brand.py @@ -21,9 +21,7 @@ class ResPartnerAccountBrand(models.Model): required=True, domain="[('user_type_id.type', 'in', ('payable', 'receivable'))]", ) - brand_id = fields.Many2one( - comodel_name='res.brand', string='Brand', required=True - ) + brand_id = fields.Many2one(comodel_name="res.brand", string="Brand", required=True) account_type = fields.Selection( string="Type", selection=[("payable", "Payable"), ("receivable", "Receivable")], @@ -38,7 +36,7 @@ class ResPartnerAccountBrand(models.Model): ) ] - @api.constrains('account_id', 'account_type') + @api.constrains("account_id", "account_type") def _check_account_type(self): for rec in self: if ( @@ -73,16 +71,8 @@ def _get_partner_account_by_brand(self, account_type, brand, partner): ("brand_id", "=", brand.id), ("account_type", "=", account_type), ] - default_rule = self.search( - domain + [("partner_id", "=", False)], limit=1 - ) + default_rule = self.search(domain + [("partner_id", "=", False)], limit=1) partner_rule = False if partner: - partner_rule = self.search( - domain + [("partner_id", "=", partner.id)] - ) - return ( - partner_rule.account_id - if partner_rule - else default_rule.account_id - ) + partner_rule = self.search(domain + [("partner_id", "=", partner.id)]) + return partner_rule.account_id if partner_rule else default_rule.account_id diff --git a/account_brand/readme/CONTRIBUTORS.rst b/account_brand/readme/CONTRIBUTORS.rst index d9fb6931c..be2101c94 100644 --- a/account_brand/readme/CONTRIBUTORS.rst +++ b/account_brand/readme/CONTRIBUTORS.rst @@ -1,3 +1,7 @@ * Raphael Lee * Steve Campbell * Maxime Chambreuil + +* `Obertix `_: + + * Vicent Cubells diff --git a/account_brand/security/res_partner_account_brand.xml b/account_brand/security/res_partner_account_brand.xml index 65acc6e1e..50961bfd2 100644 --- a/account_brand/security/res_partner_account_brand.xml +++ b/account_brand/security/res_partner_account_brand.xml @@ -1,27 +1,25 @@ - + - - res.partner.account.brand access - - - - - + + + + + - - - + res.partner.account.brand invoice user access - - - - - - + + + + + + diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html index 7795ab496..20f05067b 100644 --- a/account_brand/static/description/index.html +++ b/account_brand/static/description/index.html @@ -367,7 +367,7 @@

Account Brand

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runbot

This module allows you to send branded invoices to your customers. It adds a brand field on the invoice and the brand information to the PDF report.

@@ -406,7 +406,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -424,6 +424,10 @@

Contributors

  • Raphael Lee <rlee@opensourceintegrators.com>
  • Steve Campbell <scampbell@opensourceintegrators.com>
  • Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
  • +
  • Obertix:
      +
    • Vicent Cubells
    • +
    +
  • @@ -439,9 +443,9 @@

    Maintainers

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    -

    Current maintainer:

    -

    osi-scampbell

    -

    This module is part of the OCA/brand project on GitHub.

    +

    Current maintainers:

    +

    osi-scampbell sbejaoui

    +

    This module is part of the OCA/brand project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/account_brand/tests/__init__.py b/account_brand/tests/__init__.py index 82ff43c68..adad8688d 100644 --- a/account_brand/tests/__init__.py +++ b/account_brand/tests/__init__.py @@ -1,3 +1,3 @@ from . import test_brand_mixin -from . import test_account_invoice -from . import test_account_analytic_invoice +from . import test_account_move +from . import test_account_analytic_move diff --git a/account_brand/tests/test_account_analytic_invoice.py b/account_brand/tests/test_account_analytic_invoice.py deleted file mode 100644 index 5be1d9fb5..000000000 --- a/account_brand/tests/test_account_analytic_invoice.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2019 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo.tests.common import SavepointCase - - -class TestAccountAnalyticInvoice(SavepointCase): - def setUp(self): - super(TestAccountAnalyticInvoice, self).setUp() - self.invoice = self.env['account.invoice'].create( - { - 'partner_id': self.env.ref('base.res_partner_12').id, - 'type': 'out_invoice', - } - ) - self.env['account.invoice.line'].create( - { - 'product_id': self.env.ref('product.product_product_4').id, - 'quantity': 1, - 'price_unit': 42, - 'invoice_id': self.invoice.id, - 'name': 'something', - 'account_id': self.env['account.account'] - .create( - { - 'name': 'Test sale', - 'code': 'XX_700', - 'user_type_id': self.env.ref( - 'account.data_account_type_revenue' - ).id, - } - ) - .id, - } - ) - self.brand_id = self.env['res.brand'].create({'name': 'Brand'}) - - def test_invoice_analytic_account_onchange_brand(self): - self.brand_id.analytic_account_id = self.env[ - 'account.analytic.account' - ].create({'name': 'analytic account'}) - self.invoice.brand_id = self.brand_id - self.assertFalse( - self.invoice.invoice_line_ids.mapped('account_analytic_id') - ) - self.invoice._onchange_brand_id() - self.assertEqual( - self.invoice.invoice_line_ids.mapped('account_analytic_id'), - self.brand_id.analytic_account_id, - ) diff --git a/account_brand/tests/test_account_analytic_move.py b/account_brand/tests/test_account_analytic_move.py new file mode 100644 index 000000000..85e4ba39b --- /dev/null +++ b/account_brand/tests/test_account_analytic_move.py @@ -0,0 +1,48 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import SavepointCase + + +class TestAccountAnalyticMove(SavepointCase): + def setUp(self): + super().setUp() + self.account = self.env["account.account"].create( + { + "name": "Test sale", + "code": "XX_700", + "user_type_id": self.env.ref("account.data_account_type_revenue").id, + } + ) + self.move = self.env["account.move"].create( + { + "partner_id": self.env.ref("base.res_partner_12").id, + "type": "out_invoice", + "invoice_line_ids": [ + ( + 0, + 0, + { + "product_id": self.env.ref("product.product_product_4").id, + "quantity": 1, + "price_unit": 42, + "name": "something", + "account_id": self.account.id, + }, + ) + ], + } + ) + self.brand_id = self.env["res.brand"].create({"name": "Brand"}) + + def test_move_analytic_account_onchange_brand(self): + self.brand_id.analytic_account_id = self.env["account.analytic.account"].create( + {"name": "analytic account"} + ) + self.move.brand_id = self.brand_id + self.assertFalse(self.move.invoice_line_ids.mapped("analytic_account_id")) + self.move._onchange_brand_id() + self.assertEqual( + self.move.invoice_line_ids.mapped("analytic_account_id"), + self.brand_id.analytic_account_id, + ) diff --git a/account_brand/tests/test_account_invoice.py b/account_brand/tests/test_account_invoice.py deleted file mode 100644 index 832d829d8..000000000 --- a/account_brand/tests/test_account_invoice.py +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright 2019 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo.tests.common import SavepointCase - - -class TestAccountInvoice(SavepointCase): - def setUp(self): - super(TestAccountInvoice, self).setUp() - account_receivable_type = self.env.ref( - 'account.data_account_type_receivable' - ) - self.account_receivable = self.env['account.account'].create( - { - 'name': 'Partner Receivable', - 'code': 'RCV00', - 'user_type_id': account_receivable_type.id, - 'reconcile': True, - } - ) - self.account_receivable_brand_default = self.env[ - 'account.account' - ].create( - { - 'name': 'Receivable Brand Default', - 'code': 'RCV01', - 'user_type_id': account_receivable_type.id, - 'reconcile': True, - } - ) - self.account_receivable_partner_brand_default = self.env[ - 'account.account' - ].create( - { - 'name': 'Receivable Partner Brand Default', - 'code': 'RCV02', - 'user_type_id': account_receivable_type.id, - 'reconcile': True, - } - ) - self.partner_id = self.env.ref('base.res_partner_12') - self.partner_id.property_account_receivable_id = ( - self.account_receivable - ) - self.invoice = self.env['account.invoice'].create( - {'partner_id': self.partner_id.id, 'type': 'out_invoice'} - ) - type_revenue = self.env.ref('account.data_account_type_revenue') - self.account_revenue = self.env['account.account'].create( - { - 'name': 'Test sale', - 'code': 'XX_700', - 'user_type_id': type_revenue.id, - } - ) - product = self.env.ref('product.product_product_4') - self.env['account.invoice.line'].create( - { - 'product_id': product.id, - 'quantity': 1, - 'price_unit': 42, - 'invoice_id': self.invoice.id, - 'name': 'something', - 'account_id': self.account_revenue.id, - } - ) - self.brand_id = self.env['res.brand'].create( - {'name': 'Brand'} - ) - - def test_on_change_partner_id(self): - self.invoice._onchange_partner_brand() - self.assertEqual(self.invoice.account_id, self.account_receivable) - partner_account_brand = self.env['res.partner.account.brand'].create( - { - 'partner_id': False, - 'account_id': self.account_receivable_brand_default.id, - 'brand_id': self.brand_id.id, - 'account_type': 'receivable', - } - ) - self.invoice._onchange_partner_brand() - self.assertEqual(self.invoice.account_id, self.account_receivable) - self.invoice.brand_id = self.brand_id - self.invoice._onchange_partner_brand() - self.assertEqual( - self.invoice.account_id, self.account_receivable_brand_default - ) - partner_account_brand.update( - { - 'partner_id': self.partner_id.id, - 'account_id': self.account_receivable_partner_brand_default.id, - } - ) - self.invoice._onchange_partner_brand() - self.assertEqual( - self.invoice.account_id, - self.account_receivable_partner_brand_default, - ) - invoice = self.env['account.invoice'].create( - { - 'partner_id': self.partner_id.id, - 'brand_id': self.brand_id.id, - 'type': 'out_invoice', - } - ) - self.assertEqual( - invoice.account_id, - self.account_receivable_partner_brand_default, - ) diff --git a/account_brand/tests/test_account_move.py b/account_brand/tests/test_account_move.py new file mode 100644 index 000000000..afd83d501 --- /dev/null +++ b/account_brand/tests/test_account_move.py @@ -0,0 +1,112 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import SavepointCase + + +class TestAccountMove(SavepointCase): + def setUp(self): + super(TestAccountMove, self).setUp() + self.product = self.env.ref("product.product_product_4") + account_receivable_type = self.env.ref("account.data_account_type_receivable") + self.account_receivable = self.env["account.account"].create( + { + "name": "Partner Receivable", + "code": "RCV00", + "user_type_id": account_receivable_type.id, + "reconcile": True, + } + ) + self.account_receivable_brand_default = self.env["account.account"].create( + { + "name": "Receivable Brand Default", + "code": "RCV01", + "user_type_id": account_receivable_type.id, + "reconcile": True, + } + ) + self.account_receivable_partner_brand_default = self.env[ + "account.account" + ].create( + { + "name": "Receivable Partner Brand Default", + "code": "RCV02", + "user_type_id": account_receivable_type.id, + "reconcile": True, + } + ) + self.partner_id = self.env.ref("base.res_partner_12") + self.partner_id.property_account_receivable_id = self.account_receivable + type_revenue = self.env.ref("account.data_account_type_revenue") + self.account_revenue = self.env["account.account"].create( + {"name": "Test sale", "code": "XX_700", "user_type_id": type_revenue.id} + ) + self.move = self.env["account.move"].create( + { + "partner_id": self.partner_id.id, + "type": "out_invoice", + "invoice_line_ids": [ + ( + 0, + 0, + { + "product_id": self.product.id, + "quantity": 1, + "price_unit": 42, + "name": "something", + "account_id": self.account_revenue.id, + }, + ) + ], + } + ) + + self.brand_id = self.env["res.brand"].create({"name": "Brand"}) + + def _get_receivable_account(self, move): + user_type_receivable = self.env.ref("account.data_account_type_receivable") + return self.move.line_ids.filtered( + lambda l, u_type=user_type_receivable: l.account_id.user_type_id == u_type + ).account_id + + def test_on_change_partner_id(self): + + account = self._get_receivable_account(self.move) + self.assertEqual(account, self.account_receivable) + partner_account_brand = self.env["res.partner.account.brand"].create( + { + "partner_id": False, + "account_id": self.account_receivable_brand_default.id, + "brand_id": self.brand_id.id, + "account_type": "receivable", + } + ) + self.move._onchange_partner_id() + account = self._get_receivable_account(self.move) + self.assertEqual(account, self.account_receivable) + self.move.brand_id = self.brand_id + self.move._onchange_partner_id() + account = self._get_receivable_account(self.move) + self.assertEqual(account, self.account_receivable_brand_default) + partner_account_brand.update( + { + "partner_id": self.partner_id.id, + "account_id": self.account_receivable_partner_brand_default.id, + } + ) + self.move._onchange_partner_id() + account = self._get_receivable_account(self.move) + self.assertEqual( + account, self.account_receivable_partner_brand_default, + ) + move = self.env["account.move"].create( + { + "partner_id": self.partner_id.id, + "brand_id": self.brand_id.id, + "type": "out_invoice", + } + ) + account = self._get_receivable_account(move) + self.assertEqual( + account, self.account_receivable_partner_brand_default, + ) diff --git a/account_brand/tests/test_brand_mixin.py b/account_brand/tests/test_brand_mixin.py index 3b8b1c38f..545f643ae 100644 --- a/account_brand/tests/test_brand_mixin.py +++ b/account_brand/tests/test_brand_mixin.py @@ -2,8 +2,10 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from lxml import etree -from odoo.tests.common import TransactionCase + from odoo.exceptions import ValidationError +from odoo.tests.common import Form, TransactionCase + from odoo.addons.brand.models.res_company import BRAND_USE_LEVEL_REQUIRED_LEVEL @@ -12,23 +14,23 @@ def setUp(self): super(TestBrandMixin, self).setUp() self.partner = self.env.user.partner_id self.company = self.env.user.company_id - self.other_company = self.env['res.company'].create( - {'name': 'other company', 'parent_id': self.company.id} + self.other_company = self.env["res.company"].create( + {"name": "other company", "parent_id": self.company.id} ) - self.journal = self.env['account.journal'].create( - {'type': 'sale', 'code': 'SALE', 'name': 'Sale journal'} + self.journal = self.env["account.journal"].create( + {"type": "sale", "code": "SALE", "name": "Sale journal"} ) - self.invoice = self.env['account.invoice'].create( + self.invoice = self.env["account.move"].create( { - 'name': "Sample invoice", - 'company_id': self.company.id, - 'journal_id': self.journal.id, - 'partner_id': self.partner.id, + "name": "Sample invoice", + "company_id": self.company.id, + "journal_id": self.journal.id, + "partner_id": self.partner.id, } ) - self.brand = self.env['res.brand'].create({'name': 'brand'}) - self.other_company_brand = self.env['res.brand'].create( - {'name': 'brand', 'company_id': self.other_company.id} + self.brand = self.env["res.brand"].create({"name": "brand"}) + self.other_company_brand = self.env["res.brand"].create( + {"name": "brand", "company_id": self.other_company.id} ) def test_is_brand_required(self): @@ -37,55 +39,55 @@ def test_is_brand_required(self): self.assertTrue(self.invoice._is_brand_required()) def test_check_brand_requirement(self): - self.env['account.invoice'].create( + self.env["account.move"].create( { - 'name': "Sample invoice", - 'company_id': self.company.id, - 'journal_id': self.journal.id, - 'partner_id': self.partner.id, + "name": "Sample invoice", + "company_id": self.company.id, + "journal_id": self.journal.id, + "partner_id": self.partner.id, } ) self.company.brand_use_level = BRAND_USE_LEVEL_REQUIRED_LEVEL with self.assertRaises(ValidationError): - self.env['account.invoice'].create( + self.env["account.move"].create( { - 'name': "Sample invoice", - 'company_id': self.company.id, - 'journal_id': self.journal.id, - 'partner_id': self.partner.id, + "name": "Sample invoice", + "company_id": self.company.id, + "journal_id": self.journal.id, + "partner_id": self.partner.id, } ) - self.env['account.invoice'].create( + self.env["account.move"].create( { - 'name': "Sample invoice", - 'company_id': self.company.id, - 'journal_id': self.journal.id, - 'partner_id': self.partner.id, - 'brand_id': self.brand.id, + "name": "Sample invoice", + "company_id": self.company.id, + "journal_id": self.journal.id, + "partner_id": self.partner.id, + "brand_id": self.brand.id, } ) def test_check_brand_company_id(self): - invoice = self.env['account.invoice'].create( + invoice = self.env["account.move"].create( { - 'name': "Sample invoice", - 'company_id': self.company.id, - 'journal_id': self.journal.id, - 'partner_id': self.partner.id, - 'brand_id': self.brand.id, + "name": "Sample invoice", + "company_id": self.company.id, + "journal_id": self.journal.id, + "partner_id": self.partner.id, + "brand_id": self.brand.id, } ) with self.assertRaises(ValidationError): invoice.brand_id = self.other_company_brand def test_onchange_brand_id(self): - new_invoice = self.env['account.invoice'].new( + new_invoice = self.env["account.move"].new( { - 'name': "Sample invoice", - 'company_id': self.company.id, - 'journal_id': self.journal.id, - 'partner_id': self.partner.id, - 'brand_id': self.brand.id, + "name": "Sample invoice", + "company_id": self.company.id, + "journal_id": self.journal.id, + "partner_id": self.partner.id, + "brand_id": self.brand.id, } ) self.assertEqual(new_invoice.company_id, self.company) @@ -94,24 +96,44 @@ def test_onchange_brand_id(self): self.assertEqual(new_invoice.company_id, self.other_company) def test_fields_view_get(self): - view = self.env['account.invoice'].fields_view_get( - view_id=self.env.ref( - 'account_brand.account_invoice_view_form_brand' - ).id, - view_type='form', + view = self.env["account.move"].fields_view_get( + view_id=self.env.ref("account.view_move_form").id, view_type="form", ) - doc = etree.XML(view['arch']) + doc = etree.XML(view["arch"]) self.assertTrue(doc.xpath("//field[@name='brand_use_level']")) - def test_refund_invoice(self): - invoice = self.env['account.invoice'].create( + def test_reverse_move(self): + move = self.env["account.move"].create( { - 'name': "Sample invoice", - 'company_id': self.company.id, - 'journal_id': self.journal.id, - 'partner_id': self.partner.id, - 'brand_id': self.brand.id, + "name": "Sample invoice", + "type": "out_invoice", + "company_id": self.company.id, + "journal_id": self.journal.id, + "partner_id": self.partner.id, + "brand_id": self.brand.id, + "invoice_line_ids": [ + ( + 0, + 0, + { + "product_id": self.env.ref("product.product_product_1").id, + "quantity": 40.0, + "name": "product test 1", + "discount": 10.00, + "price_unit": 2.27, + }, + ) + ], } ) - credit_note = invoice.refund() + move.action_post() + reverse_wizard = Form( + self.env["account.move.reversal"].with_context( + active_ids=move.ids, active_model="account.move" + ) + ) + reverse_wizard.reason = "modify" + reverse = reverse_wizard.save() + action = reverse.reverse_moves() + credit_note = self.env["account.move"].browse(action.get("res_id")) self.assertEqual(credit_note.brand_id, self.brand) diff --git a/account_brand/views/account_invoice.xml b/account_brand/views/account_invoice.xml deleted file mode 100644 index f061c8f78..000000000 --- a/account_brand/views/account_invoice.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - account.invoice.form.brand - account.invoice - - - - - - - - - diff --git a/account_brand/views/account_move_views.xml b/account_brand/views/account_move_views.xml new file mode 100644 index 000000000..2318fcc51 --- /dev/null +++ b/account_brand/views/account_move_views.xml @@ -0,0 +1,16 @@ + + + + account.move + + + + + + + + diff --git a/account_brand/views/res_partner_account_brand.xml b/account_brand/views/res_partner_account_brand.xml index 526ae4980..2e739df02 100644 --- a/account_brand/views/res_partner_account_brand.xml +++ b/account_brand/views/res_partner_account_brand.xml @@ -1,32 +1,27 @@ - + - - res.partner.account.brand.tree (in account_brand) res.partner.account.brand - - - - + + + + - Partner Accounts by Brand res.partner.account.brand tree - Partner Accounts by Brand - - + + - diff --git a/account_brand/wizards/__init__.py b/account_brand/wizards/__init__.py new file mode 100644 index 000000000..715d1bd6d --- /dev/null +++ b/account_brand/wizards/__init__.py @@ -0,0 +1 @@ +from . import account_move_reversal diff --git a/account_brand/wizards/account_move_reversal.py b/account_brand/wizards/account_move_reversal.py new file mode 100644 index 000000000..fa87ad46f --- /dev/null +++ b/account_brand/wizards/account_move_reversal.py @@ -0,0 +1,14 @@ +# Copyright 2020 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class AccountMoveReversal(models.TransientModel): + + _inherit = "account.move.reversal" + + def _prepare_default_reversal(self, move): + res = super()._prepare_default_reversal(move) + res["brand_id"] = move.brand_id.id + return res From 81207cec2cee5dd700c410f743e850f904cafacd Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 30 Dec 2019 16:19:07 +0100 Subject: [PATCH 21/47] [IMP] - Add unit tests --- account_brand/__manifest__.py | 2 +- account_brand/i18n/nl.po | 122 ++++++++++++++++++ .../tests/test_account_analytic_invoice.py | 48 +++++++ 3 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 account_brand/i18n/nl.po create mode 100644 account_brand/tests/test_account_analytic_invoice.py diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index 6009114f7..7d2394e5e 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "13.0.1.0.0", + "version": "13.0.1.0.1", "category": "Accounting Management", "website": "https://github.com/OCA/account-invoicing", "author": "Open Source Integrators," diff --git a/account_brand/i18n/nl.po b/account_brand/i18n/nl.po new file mode 100644 index 000000000..9cd100c18 --- /dev/null +++ b/account_brand/i18n/nl.po @@ -0,0 +1,122 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_brand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-12-13 23:19+0000\n" +"Last-Translator: Bosd \n" +"Language-Team: none\n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id +msgid "Account" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_account_move_reversal +msgid "Account Move Reversal" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id +msgid "Brand" +msgstr "Merk" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_move__brand_id +msgid "Brand to use for this sale" +msgstr "Merk voor deze verkoop" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid +msgid "Created by" +msgstr "Aangemaakt door" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date +msgid "Created on" +msgstr "Aangemaakt op" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name +msgid "Display Name" +msgstr "Weergavenaam" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id +msgid "ID" +msgstr "ID" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_account_move +msgid "Journal Entries" +msgstr "Journaal ingave" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update +msgid "Last Modified on" +msgstr "Laatst gewijzigt op" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid +msgid "Last Updated by" +msgstr "Laatste wijziging door" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date +msgid "Last Updated on" +msgstr "Laatste wijziging op" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id +msgid "Partner" +msgstr "Partner" + +#. module: account_brand +#: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window +#: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu +msgid "Partner Accounts by Brand" +msgstr "" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:0 +#: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner +#, python-format +msgid "Partner has already an account set for this brand!" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable +msgid "Payable" +msgstr "Te betalen" + +#. module: account_brand +#: code:addons/account_brand/models/res_partner_account_brand.py:0 +#, python-format +msgid "Please select an account of type %s" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable +msgid "Receivable" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_res_partner_account_brand +msgid "Receivable/Payable Partner Account By Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type +msgid "Type" +msgstr "Type" diff --git a/account_brand/tests/test_account_analytic_invoice.py b/account_brand/tests/test_account_analytic_invoice.py new file mode 100644 index 000000000..8e8e42b59 --- /dev/null +++ b/account_brand/tests/test_account_analytic_invoice.py @@ -0,0 +1,48 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import SavepointCase + + +class TestAccountAnalyticInvoice(SavepointCase): + def setUp(self): + super(TestAccountAnalyticInvoice, self).setUp() + self.invoice = self.env["account.invoice"].create( + { + "partner_id": self.env.ref("base.res_partner_12").id, + "type": "out_invoice", + } + ) + self.env["account.invoice.line"].create( + { + "product_id": self.env.ref("product.product_product_4").id, + "quantity": 1, + "price_unit": 42, + "invoice_id": self.invoice.id, + "name": "something", + "account_id": self.env["account.account"] + .create( + { + "name": "Test sale", + "code": "XX_700", + "user_type_id": self.env.ref( + "account.data_account_type_revenue" + ).id, + } + ) + .id, + } + ) + self.brand_id = self.env["res.brand"].create({"name": "Brand"}) + + def test_invoice_analytic_account_onchange_brand(self): + self.brand_id.analytic_account_id = self.env["account.analytic.account"].create( + {"name": "analytic account"} + ) + self.invoice.brand_id = self.brand_id + self.assertFalse(self.invoice.invoice_line_ids.mapped("account_analytic_id")) + self.invoice._onchange_brand_id() + self.assertEqual( + self.invoice.invoice_line_ids.mapped("account_analytic_id"), + self.brand_id.analytic_account_id, + ) From d3881b0458489be7844a67eea022e7da8c05c364 Mon Sep 17 00:00:00 2001 From: Freni-OSI Date: Fri, 16 Jul 2021 12:49:25 +0530 Subject: [PATCH 22/47] [14.0][FIX] Travis --- account_brand/__manifest__.py | 4 ++-- account_brand/tests/test_account_move.py | 6 ++++-- account_brand/tests/test_brand_mixin.py | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index 7d2394e5e..bf1c61625 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -5,9 +5,9 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "13.0.1.0.1", + "version": "14.0.1.0.0", "category": "Accounting Management", - "website": "https://github.com/OCA/account-invoicing", + "website": "https://github.com/OCA/brand", "author": "Open Source Integrators," "ACSONE SA/NV," "Odoo Community Association (OCA)", diff --git a/account_brand/tests/test_account_move.py b/account_brand/tests/test_account_move.py index afd83d501..a3c745041 100644 --- a/account_brand/tests/test_account_move.py +++ b/account_brand/tests/test_account_move.py @@ -97,7 +97,8 @@ def test_on_change_partner_id(self): self.move._onchange_partner_id() account = self._get_receivable_account(self.move) self.assertEqual( - account, self.account_receivable_partner_brand_default, + account, + self.account_receivable_partner_brand_default, ) move = self.env["account.move"].create( { @@ -108,5 +109,6 @@ def test_on_change_partner_id(self): ) account = self._get_receivable_account(move) self.assertEqual( - account, self.account_receivable_partner_brand_default, + account, + self.account_receivable_partner_brand_default, ) diff --git a/account_brand/tests/test_brand_mixin.py b/account_brand/tests/test_brand_mixin.py index 545f643ae..17581fa18 100644 --- a/account_brand/tests/test_brand_mixin.py +++ b/account_brand/tests/test_brand_mixin.py @@ -97,7 +97,8 @@ def test_onchange_brand_id(self): def test_fields_view_get(self): view = self.env["account.move"].fields_view_get( - view_id=self.env.ref("account.view_move_form").id, view_type="form", + view_id=self.env.ref("account.view_move_form").id, + view_type="form", ) doc = etree.XML(view["arch"]) self.assertTrue(doc.xpath("//field[@name='brand_use_level']")) From 6b6043ef2d3c0a74644fabf4f530380b138d6495 Mon Sep 17 00:00:00 2001 From: Freni-OSI Date: Fri, 16 Jul 2021 12:52:19 +0530 Subject: [PATCH 23/47] [14.0][MIG] account_brand --- account_brand/README.rst | 11 +++-- account_brand/i18n/account_brand.pot | 24 +++++++++- account_brand/models/account_move.py | 8 ++-- account_brand/readme/CONTRIBUTORS.rst | 1 + account_brand/static/description/index.html | 7 +-- .../tests/test_account_analytic_invoice.py | 48 ------------------- .../tests/test_account_analytic_move.py | 2 +- account_brand/tests/test_account_move.py | 4 +- account_brand/tests/test_brand_mixin.py | 2 +- account_brand/views/account_move_views.xml | 2 +- 10 files changed, 43 insertions(+), 66 deletions(-) delete mode 100644 account_brand/tests/test_account_analytic_invoice.py diff --git a/account_brand/README.rst b/account_brand/README.rst index 7f857a8ae..8cfffb7d9 100644 --- a/account_brand/README.rst +++ b/account_brand/README.rst @@ -14,13 +14,13 @@ Account Brand :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github - :target: https://github.com/OCA/brand/tree/13.0/account_brand + :target: https://github.com/OCA/brand/tree/14.0/account_brand :alt: OCA/brand .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/brand-13-0/brand-13-0-account_brand + :target: https://translation.odoo-community.org/projects/brand-14-0/brand-14-0-account_brand :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/284/13.0 + :target: https://runbot.odoo-community.org/runbot/284/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -56,7 +56,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -79,6 +79,7 @@ Contributors * `Obertix `_: * Vicent Cubells +* Ammar Officewala Other credits ~~~~~~~~~~~~~ @@ -109,6 +110,6 @@ Current `maintainers `__: |maintainer-osi-scampbell| |maintainer-sbejaoui| -This module is part of the `OCA/brand `_ project on GitHub. +This module is part of the `OCA/brand `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_brand/i18n/account_brand.pot b/account_brand/i18n/account_brand.pot index d18bd80cc..0093d3465 100644 --- a/account_brand/i18n/account_brand.pot +++ b/account_brand/i18n/account_brand.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -24,16 +24,30 @@ msgid "Account Move Reversal" msgstr "" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id +#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level +msgid "Brand Use Level" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id +#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__company_id +msgid "Company" +msgstr "" + #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid msgid "Created by" @@ -45,21 +59,27 @@ msgid "Created on" msgstr "" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__display_name +#: model:ir.model.fields,field_description:account_brand.field_account_move_reversal__display_name #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name msgid "Display Name" msgstr "" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__id +#: model:ir.model.fields,field_description:account_brand.field_account_move_reversal__id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id msgid "ID" msgstr "" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move -msgid "Journal Entries" +msgid "Journal Entry" msgstr "" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move____last_update +#: model:ir.model.fields,field_description:account_brand.field_account_move_reversal____last_update #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update msgid "Last Modified on" msgstr "" diff --git a/account_brand/models/account_move.py b/account_brand/models/account_move.py index de9a5003a..d3469ce42 100644 --- a/account_brand/models/account_move.py +++ b/account_brand/models/account_move.py @@ -20,7 +20,7 @@ class AccountMove(models.Model): def _is_brand_required(self): self.ensure_one() - if self.type in ("in_invoice", "in_refund"): + if self.move_type in ("in_invoice", "in_refund"): return False return super()._is_brand_required() @@ -32,9 +32,11 @@ def _recompute_payment_terms_lines(self): partner = ( self.partner_id if not company_id - else self.partner_id.with_context(force_company=company_id) + else self.partner_id.with_company(company_id) + ) + invoice_type = self.move_type or self.env.context.get( + "move_type", "out_invoice" ) - invoice_type = self.type or self.env.context.get("type", "out_invoice") if partner: rec_account = pab_model._get_partner_account_by_brand( "receivable", self.brand_id, partner diff --git a/account_brand/readme/CONTRIBUTORS.rst b/account_brand/readme/CONTRIBUTORS.rst index be2101c94..1194917f2 100644 --- a/account_brand/readme/CONTRIBUTORS.rst +++ b/account_brand/readme/CONTRIBUTORS.rst @@ -5,3 +5,4 @@ * `Obertix `_: * Vicent Cubells +* Ammar Officewala diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html index 20f05067b..8c602c7b4 100644 --- a/account_brand/static/description/index.html +++ b/account_brand/static/description/index.html @@ -367,7 +367,7 @@

    Account Brand

    !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

    Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runbot

    +

    Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runbot

    This module allows you to send branded invoices to your customers. It adds a brand field on the invoice and the brand information to the PDF report.

    @@ -406,7 +406,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -428,6 +428,7 @@

    Contributors

  • Vicent Cubells
  • +
  • Ammar Officewala <aofficewala@opensourceintegrators.com>
  • @@ -445,7 +446,7 @@

    Maintainers

    promote its widespread use.

    Current maintainers:

    osi-scampbell sbejaoui

    -

    This module is part of the OCA/brand project on GitHub.

    +

    This module is part of the OCA/brand project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/account_brand/tests/test_account_analytic_invoice.py b/account_brand/tests/test_account_analytic_invoice.py deleted file mode 100644 index 8e8e42b59..000000000 --- a/account_brand/tests/test_account_analytic_invoice.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2019 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo.tests.common import SavepointCase - - -class TestAccountAnalyticInvoice(SavepointCase): - def setUp(self): - super(TestAccountAnalyticInvoice, self).setUp() - self.invoice = self.env["account.invoice"].create( - { - "partner_id": self.env.ref("base.res_partner_12").id, - "type": "out_invoice", - } - ) - self.env["account.invoice.line"].create( - { - "product_id": self.env.ref("product.product_product_4").id, - "quantity": 1, - "price_unit": 42, - "invoice_id": self.invoice.id, - "name": "something", - "account_id": self.env["account.account"] - .create( - { - "name": "Test sale", - "code": "XX_700", - "user_type_id": self.env.ref( - "account.data_account_type_revenue" - ).id, - } - ) - .id, - } - ) - self.brand_id = self.env["res.brand"].create({"name": "Brand"}) - - def test_invoice_analytic_account_onchange_brand(self): - self.brand_id.analytic_account_id = self.env["account.analytic.account"].create( - {"name": "analytic account"} - ) - self.invoice.brand_id = self.brand_id - self.assertFalse(self.invoice.invoice_line_ids.mapped("account_analytic_id")) - self.invoice._onchange_brand_id() - self.assertEqual( - self.invoice.invoice_line_ids.mapped("account_analytic_id"), - self.brand_id.analytic_account_id, - ) diff --git a/account_brand/tests/test_account_analytic_move.py b/account_brand/tests/test_account_analytic_move.py index 85e4ba39b..2949e6762 100644 --- a/account_brand/tests/test_account_analytic_move.py +++ b/account_brand/tests/test_account_analytic_move.py @@ -17,7 +17,7 @@ def setUp(self): self.move = self.env["account.move"].create( { "partner_id": self.env.ref("base.res_partner_12").id, - "type": "out_invoice", + "move_type": "out_invoice", "invoice_line_ids": [ ( 0, diff --git a/account_brand/tests/test_account_move.py b/account_brand/tests/test_account_move.py index a3c745041..4854db929 100644 --- a/account_brand/tests/test_account_move.py +++ b/account_brand/tests/test_account_move.py @@ -44,7 +44,7 @@ def setUp(self): self.move = self.env["account.move"].create( { "partner_id": self.partner_id.id, - "type": "out_invoice", + "move_type": "out_invoice", "invoice_line_ids": [ ( 0, @@ -104,7 +104,7 @@ def test_on_change_partner_id(self): { "partner_id": self.partner_id.id, "brand_id": self.brand_id.id, - "type": "out_invoice", + "move_type": "out_invoice", } ) account = self._get_receivable_account(move) diff --git a/account_brand/tests/test_brand_mixin.py b/account_brand/tests/test_brand_mixin.py index 17581fa18..94bcc3cb5 100644 --- a/account_brand/tests/test_brand_mixin.py +++ b/account_brand/tests/test_brand_mixin.py @@ -107,7 +107,7 @@ def test_reverse_move(self): move = self.env["account.move"].create( { "name": "Sample invoice", - "type": "out_invoice", + "move_type": "out_invoice", "company_id": self.company.id, "journal_id": self.journal.id, "partner_id": self.partner.id, diff --git a/account_brand/views/account_move_views.xml b/account_brand/views/account_move_views.xml index 2318fcc51..cbdf8752a 100644 --- a/account_brand/views/account_move_views.xml +++ b/account_brand/views/account_move_views.xml @@ -8,7 +8,7 @@ From cae34f310dc487807585df181a91907d49d5a6af Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Thu, 17 Mar 2022 15:02:01 +0100 Subject: [PATCH 24/47] [15.0][MIG] - account_brand --- account_brand/README.rst | 10 +++++----- account_brand/__manifest__.py | 2 +- account_brand/i18n/account_brand.pot | 8 +------- account_brand/models/account_move.py | 3 ++- account_brand/static/description/index.html | 6 +++--- account_brand/tests/test_account_analytic_move.py | 4 ++-- account_brand/tests/test_account_move.py | 4 ++-- 7 files changed, 16 insertions(+), 21 deletions(-) diff --git a/account_brand/README.rst b/account_brand/README.rst index 8cfffb7d9..8f8d61aae 100644 --- a/account_brand/README.rst +++ b/account_brand/README.rst @@ -14,13 +14,13 @@ Account Brand :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github - :target: https://github.com/OCA/brand/tree/14.0/account_brand + :target: https://github.com/OCA/brand/tree/15.0/account_brand :alt: OCA/brand .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/brand-14-0/brand-14-0-account_brand + :target: https://translation.odoo-community.org/projects/brand-15-0/brand-15-0-account_brand :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/284/14.0 + :target: https://runbot.odoo-community.org/runbot/284/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -56,7 +56,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -110,6 +110,6 @@ Current `maintainers `__: |maintainer-osi-scampbell| |maintainer-sbejaoui| -This module is part of the `OCA/brand `_ project on GitHub. +This module is part of the `OCA/brand `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index bf1c61625..e2f689b97 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "category": "Accounting Management", "website": "https://github.com/OCA/brand", "author": "Open Source Integrators," diff --git a/account_brand/i18n/account_brand.pot b/account_brand/i18n/account_brand.pot index 0093d3465..0c7260d60 100644 --- a/account_brand/i18n/account_brand.pot +++ b/account_brand/i18n/account_brand.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -59,15 +59,11 @@ msgid "Created on" msgstr "" #. module: account_brand -#: model:ir.model.fields,field_description:account_brand.field_account_move__display_name -#: model:ir.model.fields,field_description:account_brand.field_account_move_reversal__display_name #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name msgid "Display Name" msgstr "" #. module: account_brand -#: model:ir.model.fields,field_description:account_brand.field_account_move__id -#: model:ir.model.fields,field_description:account_brand.field_account_move_reversal__id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id msgid "ID" msgstr "" @@ -78,8 +74,6 @@ msgid "Journal Entry" msgstr "" #. module: account_brand -#: model:ir.model.fields,field_description:account_brand.field_account_move____last_update -#: model:ir.model.fields,field_description:account_brand.field_account_move_reversal____last_update #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update msgid "Last Modified on" msgstr "" diff --git a/account_brand/models/account_move.py b/account_brand/models/account_move.py index d3469ce42..318345729 100644 --- a/account_brand/models/account_move.py +++ b/account_brand/models/account_move.py @@ -25,7 +25,7 @@ def _is_brand_required(self): return super()._is_brand_required() def _recompute_payment_terms_lines(self): - super()._recompute_payment_terms_lines() + res = super()._recompute_payment_terms_lines() if self.brand_id: pab_model = self.env["res.partner.account.brand"] company_id = self.company_id.id @@ -61,6 +61,7 @@ def _recompute_payment_terms_lines(self): lambda l, a=account_id: l.account_id.user_type_id == a.user_type_id ).update({"account_id": account_id.id}) + return res @api.onchange("brand_id", "invoice_line_ids") def _onchange_brand_id(self): diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html index 8c602c7b4..cec1a10e3 100644 --- a/account_brand/static/description/index.html +++ b/account_brand/static/description/index.html @@ -367,7 +367,7 @@

    Account Brand

    !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

    Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runbot

    +

    Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runbot

    This module allows you to send branded invoices to your customers. It adds a brand field on the invoice and the brand information to the PDF report.

    @@ -406,7 +406,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -446,7 +446,7 @@

    Maintainers

    promote its widespread use.

    Current maintainers:

    osi-scampbell sbejaoui

    -

    This module is part of the OCA/brand project on GitHub.

    +

    This module is part of the OCA/brand project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/account_brand/tests/test_account_analytic_move.py b/account_brand/tests/test_account_analytic_move.py index 2949e6762..49db9e504 100644 --- a/account_brand/tests/test_account_analytic_move.py +++ b/account_brand/tests/test_account_analytic_move.py @@ -1,10 +1,10 @@ # Copyright 2019 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.tests.common import SavepointCase +from odoo.tests.common import TransactionCase -class TestAccountAnalyticMove(SavepointCase): +class TestAccountAnalyticMove(TransactionCase): def setUp(self): super().setUp() self.account = self.env["account.account"].create( diff --git a/account_brand/tests/test_account_move.py b/account_brand/tests/test_account_move.py index 4854db929..733eccfe8 100644 --- a/account_brand/tests/test_account_move.py +++ b/account_brand/tests/test_account_move.py @@ -1,10 +1,10 @@ # Copyright 2019 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.tests.common import SavepointCase +from odoo.tests.common import TransactionCase -class TestAccountMove(SavepointCase): +class TestAccountMove(TransactionCase): def setUp(self): super(TestAccountMove, self).setUp() self.product = self.env.ref("product.product_product_4") From d0b18616ba1b97fbee6b20626eae98f2bec4f913 Mon Sep 17 00:00:00 2001 From: Vimal Patel Date: Wed, 16 Mar 2022 18:45:20 +0530 Subject: [PATCH 25/47] [IMP]account_brand: If we can't set analytic account in brand then user can't fill up analytic account on invoice lines --- account_brand/__manifest__.py | 2 +- account_brand/models/account_move.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index e2f689b97..5cb9fddc9 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "15.0.1.0.0", + "version": "15.0.1.0.1", "category": "Accounting Management", "website": "https://github.com/OCA/brand", "author": "Open Source Integrators," diff --git a/account_brand/models/account_move.py b/account_brand/models/account_move.py index 318345729..529ec790f 100644 --- a/account_brand/models/account_move.py +++ b/account_brand/models/account_move.py @@ -69,7 +69,8 @@ def _onchange_brand_id(self): for invoice in self: if invoice.state == "draft" and invoice.brand_id: account_analytic = invoice.brand_id.analytic_account_id - invoice.invoice_line_ids.update( - {"analytic_account_id": account_analytic.id} - ) + if account_analytic: + invoice.invoice_line_ids.update( + {"analytic_account_id": account_analytic.id} + ) return res From 52133fd4065969f98df88033669aec983d873b40 Mon Sep 17 00:00:00 2001 From: sbejaoui Date: Mon, 10 Oct 2022 11:11:36 +0200 Subject: [PATCH 26/47] [16.0][MIG] - migration brand & account_brand to 16.0 --- account_brand/README.rst | 10 ++-- account_brand/__manifest__.py | 4 +- account_brand/i18n/account_brand.pot | 6 +-- account_brand/i18n/de.po | 20 ++++++-- account_brand/i18n/es.po | 20 ++++++-- account_brand/i18n/hr.po | 20 ++++++-- account_brand/i18n/nl.po | 25 ++++++++-- account_brand/i18n/zh_CN.po | 20 ++++++-- account_brand/models/account_move.py | 25 +++------- .../models/res_partner_account_brand.py | 9 ++-- account_brand/static/description/index.html | 6 +-- account_brand/tests/__init__.py | 1 - .../tests/test_account_analytic_move.py | 48 ------------------- account_brand/tests/test_account_move.py | 15 +++--- account_brand/tests/test_brand_mixin.py | 4 +- 15 files changed, 123 insertions(+), 110 deletions(-) delete mode 100644 account_brand/tests/test_account_analytic_move.py diff --git a/account_brand/README.rst b/account_brand/README.rst index 8f8d61aae..f07cec270 100644 --- a/account_brand/README.rst +++ b/account_brand/README.rst @@ -14,13 +14,13 @@ Account Brand :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github - :target: https://github.com/OCA/brand/tree/15.0/account_brand + :target: https://github.com/OCA/brand/tree/16.0/account_brand :alt: OCA/brand .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/brand-15-0/brand-15-0-account_brand + :target: https://translation.odoo-community.org/projects/brand-16-0/brand-16-0-account_brand :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/284/15.0 + :target: https://runbot.odoo-community.org/runbot/284/16.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -56,7 +56,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -110,6 +110,6 @@ Current `maintainers `__: |maintainer-osi-scampbell| |maintainer-sbejaoui| -This module is part of the `OCA/brand `_ project on GitHub. +This module is part of the `OCA/brand `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index 5cb9fddc9..edec0c66e 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -5,14 +5,14 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "15.0.1.0.1", + "version": "16.0.1.0.0", "category": "Accounting Management", "website": "https://github.com/OCA/brand", "author": "Open Source Integrators," "ACSONE SA/NV," "Odoo Community Association (OCA)", "license": "AGPL-3", - "depends": ["account", "brand", "analytic_brand"], + "depends": ["account", "brand"], "data": [ "views/account_move_views.xml", "views/res_partner_account_brand.xml", diff --git a/account_brand/i18n/account_brand.pot b/account_brand/i18n/account_brand.pot index 0c7260d60..c7d1f0785 100644 --- a/account_brand/i18n/account_brand.pot +++ b/account_brand/i18n/account_brand.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -107,7 +107,7 @@ msgid "Partner has already an account set for this brand!" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable msgid "Payable" msgstr "" @@ -118,7 +118,7 @@ msgid "Please select an account of type %s" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable msgid "Receivable" msgstr "" diff --git a/account_brand/i18n/de.po b/account_brand/i18n/de.po index c35419489..13b64b14c 100644 --- a/account_brand/i18n/de.po +++ b/account_brand/i18n/de.po @@ -27,16 +27,30 @@ msgid "Account Move Reversal" msgstr "" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id +#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Marke" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level +msgid "Brand Use Level" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id +#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "zu verwendende Marke für diesen Verkauf" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__company_id +msgid "Company" +msgstr "" + #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid msgid "Created by" @@ -59,7 +73,7 @@ msgstr "" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move -msgid "Journal Entries" +msgid "Journal Entry" msgstr "" #. module: account_brand @@ -96,7 +110,7 @@ msgid "Partner has already an account set for this brand!" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable msgid "Payable" msgstr "" @@ -107,7 +121,7 @@ msgid "Please select an account of type %s" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable msgid "Receivable" msgstr "" diff --git a/account_brand/i18n/es.po b/account_brand/i18n/es.po index 5a9c02afc..c019ed636 100644 --- a/account_brand/i18n/es.po +++ b/account_brand/i18n/es.po @@ -27,16 +27,30 @@ msgid "Account Move Reversal" msgstr "" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id +#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Marca" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level +msgid "Brand Use Level" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id +#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "Marca a usar en esta venta" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__company_id +msgid "Company" +msgstr "" + #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid msgid "Created by" @@ -59,7 +73,7 @@ msgstr "" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move -msgid "Journal Entries" +msgid "Journal Entry" msgstr "" #. module: account_brand @@ -96,7 +110,7 @@ msgid "Partner has already an account set for this brand!" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable msgid "Payable" msgstr "" @@ -107,7 +121,7 @@ msgid "Please select an account of type %s" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable msgid "Receivable" msgstr "" diff --git a/account_brand/i18n/hr.po b/account_brand/i18n/hr.po index b0495828e..8adfafe43 100644 --- a/account_brand/i18n/hr.po +++ b/account_brand/i18n/hr.po @@ -28,16 +28,30 @@ msgid "Account Move Reversal" msgstr "" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id +#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Brand" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level +msgid "Brand Use Level" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id +#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__company_id +msgid "Company" +msgstr "" + #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid msgid "Created by" @@ -60,7 +74,7 @@ msgstr "" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move -msgid "Journal Entries" +msgid "Journal Entry" msgstr "" #. module: account_brand @@ -97,7 +111,7 @@ msgid "Partner has already an account set for this brand!" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable msgid "Payable" msgstr "" @@ -108,7 +122,7 @@ msgid "Please select an account of type %s" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable msgid "Receivable" msgstr "" diff --git a/account_brand/i18n/nl.po b/account_brand/i18n/nl.po index 9cd100c18..c46c69aa7 100644 --- a/account_brand/i18n/nl.po +++ b/account_brand/i18n/nl.po @@ -27,16 +27,30 @@ msgid "Account Move Reversal" msgstr "" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id +#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Merk" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level +msgid "Brand Use Level" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id +#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "Merk voor deze verkoop" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__company_id +msgid "Company" +msgstr "" + #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid msgid "Created by" @@ -59,8 +73,8 @@ msgstr "ID" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move -msgid "Journal Entries" -msgstr "Journaal ingave" +msgid "Journal Entry" +msgstr "" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update @@ -96,7 +110,7 @@ msgid "Partner has already an account set for this brand!" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable msgid "Payable" msgstr "Te betalen" @@ -107,7 +121,7 @@ msgid "Please select an account of type %s" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable msgid "Receivable" msgstr "" @@ -120,3 +134,6 @@ msgstr "" #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type msgid "Type" msgstr "Type" + +#~ msgid "Journal Entries" +#~ msgstr "Journaal ingave" diff --git a/account_brand/i18n/zh_CN.po b/account_brand/i18n/zh_CN.po index dc401f696..6bed6f43c 100644 --- a/account_brand/i18n/zh_CN.po +++ b/account_brand/i18n/zh_CN.po @@ -27,16 +27,30 @@ msgid "Account Move Reversal" msgstr "" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id +#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "品牌" #. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level +msgid "Brand Use Level" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id +#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__company_id +msgid "Company" +msgstr "" + #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid msgid "Created by" @@ -59,7 +73,7 @@ msgstr "" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move -msgid "Journal Entries" +msgid "Journal Entry" msgstr "" #. module: account_brand @@ -96,7 +110,7 @@ msgid "Partner has already an account set for this brand!" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__payable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable msgid "Payable" msgstr "" @@ -107,7 +121,7 @@ msgid "Please select an account of type %s" msgstr "" #. module: account_brand -#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__receivable +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable msgid "Receivable" msgstr "" diff --git a/account_brand/models/account_move.py b/account_brand/models/account_move.py index 529ec790f..46e8c96d2 100644 --- a/account_brand/models/account_move.py +++ b/account_brand/models/account_move.py @@ -24,8 +24,9 @@ def _is_brand_required(self): return False return super()._is_brand_required() - def _recompute_payment_terms_lines(self): - res = super()._recompute_payment_terms_lines() + @api.onchange("partner_id") + def _onchange_partner_id(self): + res = super()._onchange_partner_id() if self.brand_id: pab_model = self.env["res.partner.account.brand"] company_id = self.company_id.id @@ -39,7 +40,7 @@ def _recompute_payment_terms_lines(self): ) if partner: rec_account = pab_model._get_partner_account_by_brand( - "receivable", self.brand_id, partner + "asset_receivable", self.brand_id, partner ) rec_account = ( rec_account @@ -47,7 +48,7 @@ def _recompute_payment_terms_lines(self): else partner.property_account_receivable_id ) pay_account = pab_model._get_partner_account_by_brand( - "payable", self.brand_id, partner + "liability_payable", self.brand_id, partner ) pay_account = ( pay_account if pay_account else partner.property_account_payable_id @@ -58,19 +59,7 @@ def _recompute_payment_terms_lines(self): account_id = rec_account if account_id: self.line_ids.filtered( - lambda l, a=account_id: l.account_id.user_type_id - == a.user_type_id + lambda l, a=account_id: l.account_id.account_type + == a.account_type ).update({"account_id": account_id.id}) return res - - @api.onchange("brand_id", "invoice_line_ids") - def _onchange_brand_id(self): - res = super()._onchange_brand_id() - for invoice in self: - if invoice.state == "draft" and invoice.brand_id: - account_analytic = invoice.brand_id.analytic_account_id - if account_analytic: - invoice.invoice_line_ids.update( - {"analytic_account_id": account_analytic.id} - ) - return res diff --git a/account_brand/models/res_partner_account_brand.py b/account_brand/models/res_partner_account_brand.py index 6a2a5e989..6a5fdb42a 100644 --- a/account_brand/models/res_partner_account_brand.py +++ b/account_brand/models/res_partner_account_brand.py @@ -19,12 +19,15 @@ class ResPartnerAccountBrand(models.Model): comodel_name="account.account", string="Account", required=True, - domain="[('user_type_id.type', 'in', ('payable', 'receivable'))]", + domain="[('account_type', 'in', ('liability_payable', 'asset_receivable'))]", ) brand_id = fields.Many2one(comodel_name="res.brand", string="Brand", required=True) account_type = fields.Selection( string="Type", - selection=[("payable", "Payable"), ("receivable", "Receivable")], + selection=[ + ("liability_payable", "Payable"), + ("asset_receivable", "Receivable"), + ], required=True, ) @@ -42,7 +45,7 @@ def _check_account_type(self): if ( rec.account_id and rec.account_type - and rec.account_id.user_type_id.type != rec.account_type + and rec.account_id.account_type != rec.account_type ): raise ValidationError( _("Please select an account of type %s") % rec.account_type diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html index cec1a10e3..2aa48d0ba 100644 --- a/account_brand/static/description/index.html +++ b/account_brand/static/description/index.html @@ -367,7 +367,7 @@

    Account Brand

    !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

    Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runbot

    +

    Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runbot

    This module allows you to send branded invoices to your customers. It adds a brand field on the invoice and the brand information to the PDF report.

    @@ -406,7 +406,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -446,7 +446,7 @@

    Maintainers

    promote its widespread use.

    Current maintainers:

    osi-scampbell sbejaoui

    -

    This module is part of the OCA/brand project on GitHub.

    +

    This module is part of the OCA/brand project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/account_brand/tests/__init__.py b/account_brand/tests/__init__.py index adad8688d..66f862e41 100644 --- a/account_brand/tests/__init__.py +++ b/account_brand/tests/__init__.py @@ -1,3 +1,2 @@ from . import test_brand_mixin from . import test_account_move -from . import test_account_analytic_move diff --git a/account_brand/tests/test_account_analytic_move.py b/account_brand/tests/test_account_analytic_move.py deleted file mode 100644 index 49db9e504..000000000 --- a/account_brand/tests/test_account_analytic_move.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2019 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo.tests.common import TransactionCase - - -class TestAccountAnalyticMove(TransactionCase): - def setUp(self): - super().setUp() - self.account = self.env["account.account"].create( - { - "name": "Test sale", - "code": "XX_700", - "user_type_id": self.env.ref("account.data_account_type_revenue").id, - } - ) - self.move = self.env["account.move"].create( - { - "partner_id": self.env.ref("base.res_partner_12").id, - "move_type": "out_invoice", - "invoice_line_ids": [ - ( - 0, - 0, - { - "product_id": self.env.ref("product.product_product_4").id, - "quantity": 1, - "price_unit": 42, - "name": "something", - "account_id": self.account.id, - }, - ) - ], - } - ) - self.brand_id = self.env["res.brand"].create({"name": "Brand"}) - - def test_move_analytic_account_onchange_brand(self): - self.brand_id.analytic_account_id = self.env["account.analytic.account"].create( - {"name": "analytic account"} - ) - self.move.brand_id = self.brand_id - self.assertFalse(self.move.invoice_line_ids.mapped("analytic_account_id")) - self.move._onchange_brand_id() - self.assertEqual( - self.move.invoice_line_ids.mapped("analytic_account_id"), - self.brand_id.analytic_account_id, - ) diff --git a/account_brand/tests/test_account_move.py b/account_brand/tests/test_account_move.py index 733eccfe8..39883ef79 100644 --- a/account_brand/tests/test_account_move.py +++ b/account_brand/tests/test_account_move.py @@ -8,12 +8,11 @@ class TestAccountMove(TransactionCase): def setUp(self): super(TestAccountMove, self).setUp() self.product = self.env.ref("product.product_product_4") - account_receivable_type = self.env.ref("account.data_account_type_receivable") self.account_receivable = self.env["account.account"].create( { "name": "Partner Receivable", "code": "RCV00", - "user_type_id": account_receivable_type.id, + "account_type": "asset_receivable", "reconcile": True, } ) @@ -21,7 +20,7 @@ def setUp(self): { "name": "Receivable Brand Default", "code": "RCV01", - "user_type_id": account_receivable_type.id, + "account_type": "asset_receivable", "reconcile": True, } ) @@ -31,15 +30,14 @@ def setUp(self): { "name": "Receivable Partner Brand Default", "code": "RCV02", - "user_type_id": account_receivable_type.id, + "account_type": "asset_receivable", "reconcile": True, } ) self.partner_id = self.env.ref("base.res_partner_12") self.partner_id.property_account_receivable_id = self.account_receivable - type_revenue = self.env.ref("account.data_account_type_revenue") self.account_revenue = self.env["account.account"].create( - {"name": "Test sale", "code": "XX_700", "user_type_id": type_revenue.id} + {"name": "Test sale", "code": "XX.700", "account_type": "income"} ) self.move = self.env["account.move"].create( { @@ -64,9 +62,8 @@ def setUp(self): self.brand_id = self.env["res.brand"].create({"name": "Brand"}) def _get_receivable_account(self, move): - user_type_receivable = self.env.ref("account.data_account_type_receivable") return self.move.line_ids.filtered( - lambda l, u_type=user_type_receivable: l.account_id.user_type_id == u_type + lambda l: l.account_id.account_type == "asset_receivable" ).account_id def test_on_change_partner_id(self): @@ -78,7 +75,7 @@ def test_on_change_partner_id(self): "partner_id": False, "account_id": self.account_receivable_brand_default.id, "brand_id": self.brand_id.id, - "account_type": "receivable", + "account_type": "asset_receivable", } ) self.move._onchange_partner_id() diff --git a/account_brand/tests/test_brand_mixin.py b/account_brand/tests/test_brand_mixin.py index 94bcc3cb5..9c8443573 100644 --- a/account_brand/tests/test_brand_mixin.py +++ b/account_brand/tests/test_brand_mixin.py @@ -95,8 +95,8 @@ def test_onchange_brand_id(self): new_invoice._onchange_brand_id() self.assertEqual(new_invoice.company_id, self.other_company) - def test_fields_view_get(self): - view = self.env["account.move"].fields_view_get( + def test_get_view(self): + view = self.env["account.move"].get_view( view_id=self.env.ref("account.view_move_form").id, view_type="form", ) From 15960256175012dbb0b885e1d9ca123015d701d4 Mon Sep 17 00:00:00 2001 From: Maria Sparenberg Date: Fri, 4 Nov 2022 11:11:29 +0000 Subject: [PATCH 27/47] Translated using Weblate (German) Currently translated at 86.3% (19 of 22 strings) Translation: brand-16.0/brand-16.0-account_brand Translate-URL: https://translation.odoo-community.org/projects/brand-16-0/brand-16-0-account_brand/de/ --- account_brand/i18n/account_brand.pot | 2 ++ account_brand/i18n/de.po | 42 +++++++++++++++------------- account_brand/i18n/es.po | 2 ++ account_brand/i18n/hr.po | 2 ++ account_brand/i18n/nl.po | 2 ++ account_brand/i18n/zh_CN.po | 2 ++ 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/account_brand/i18n/account_brand.pot b/account_brand/i18n/account_brand.pot index c7d1f0785..d92368954 100644 --- a/account_brand/i18n/account_brand.pot +++ b/account_brand/i18n/account_brand.pot @@ -100,6 +100,7 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format @@ -112,6 +113,7 @@ msgid "Payable" msgstr "" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" diff --git a/account_brand/i18n/de.po b/account_brand/i18n/de.po index 13b64b14c..9c3643b12 100644 --- a/account_brand/i18n/de.po +++ b/account_brand/i18n/de.po @@ -6,20 +6,20 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2020-07-01 22:19+0000\n" -"Last-Translator: Peter Schubert \n" +"PO-Revision-Date: 2022-11-04 13:45+0000\n" +"Last-Translator: Maria Sparenberg \n" "Language-Team: none\n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 3.10\n" +"X-Generator: Weblate 4.14.1\n" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id msgid "Account" -msgstr "" +msgstr "Konto" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move_reversal @@ -49,52 +49,52 @@ msgstr "zu verwendende Marke für diesen Verkauf" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__company_id msgid "Company" -msgstr "" +msgstr "Unternehmen" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid msgid "Created by" -msgstr "" +msgstr "Erstellt von" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date msgid "Created on" -msgstr "" +msgstr "Erstellt am" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name msgid "Display Name" -msgstr "" +msgstr "Anzeigename" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id msgid "ID" -msgstr "" +msgstr "ID" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" -msgstr "" +msgstr "Buchungssatz" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update msgid "Last Modified on" -msgstr "" +msgstr "Zuletzt geändert am" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid msgid "Last Updated by" -msgstr "" +msgstr "Zuletzt aktualisiert von" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date msgid "Last Updated on" -msgstr "" +msgstr "Zuletzt aktualisiert am" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id msgid "Partner" -msgstr "" +msgstr "Partner" #. module: account_brand #: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window @@ -103,37 +103,39 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format msgid "Partner has already an account set for this brand!" -msgstr "" +msgstr "Der Partner hat für diese Marke bereits ein Konto!" #. module: account_brand #: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable msgid "Payable" -msgstr "" +msgstr "Kreditor" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" -msgstr "" +msgstr "Bitte ein Konto vom Typ %s wählen." #. module: account_brand #: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable msgid "Receivable" -msgstr "" +msgstr "Debitor" #. module: account_brand #: model:ir.model,name:account_brand.model_res_partner_account_brand msgid "Receivable/Payable Partner Account By Brand" -msgstr "" +msgstr "Debitoren-/Kreditorenkonto nach Marke" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type msgid "Type" -msgstr "" +msgstr "Typ" #~ msgid "Invoice" #~ msgstr "Rechnung" diff --git a/account_brand/i18n/es.po b/account_brand/i18n/es.po index c019ed636..a93701e39 100644 --- a/account_brand/i18n/es.po +++ b/account_brand/i18n/es.po @@ -103,6 +103,7 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format @@ -115,6 +116,7 @@ msgid "Payable" msgstr "" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" diff --git a/account_brand/i18n/hr.po b/account_brand/i18n/hr.po index 8adfafe43..0c9eb9f9a 100644 --- a/account_brand/i18n/hr.po +++ b/account_brand/i18n/hr.po @@ -104,6 +104,7 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format @@ -116,6 +117,7 @@ msgid "Payable" msgstr "" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" diff --git a/account_brand/i18n/nl.po b/account_brand/i18n/nl.po index c46c69aa7..77e5aa9fa 100644 --- a/account_brand/i18n/nl.po +++ b/account_brand/i18n/nl.po @@ -103,6 +103,7 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format @@ -115,6 +116,7 @@ msgid "Payable" msgstr "Te betalen" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" diff --git a/account_brand/i18n/zh_CN.po b/account_brand/i18n/zh_CN.po index 6bed6f43c..85f3be330 100644 --- a/account_brand/i18n/zh_CN.po +++ b/account_brand/i18n/zh_CN.po @@ -103,6 +103,7 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format @@ -115,6 +116,7 @@ msgid "Payable" msgstr "" #. module: account_brand +#. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" From 10fba175aac238b88dca7582a6865d7f643d12ff Mon Sep 17 00:00:00 2001 From: Bole Date: Fri, 6 Jan 2023 11:10:42 +0000 Subject: [PATCH 28/47] Translated using Weblate (Croatian) Currently translated at 72.7% (16 of 22 strings) Translation: brand-16.0/brand-16.0-account_brand Translate-URL: https://translation.odoo-community.org/projects/brand-16-0/brand-16-0-account_brand/hr/ --- account_brand/i18n/hr.po | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/account_brand/i18n/hr.po b/account_brand/i18n/hr.po index 0c9eb9f9a..a71687e3a 100644 --- a/account_brand/i18n/hr.po +++ b/account_brand/i18n/hr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2019-11-13 15:34+0000\n" +"PO-Revision-Date: 2023-01-06 13:44+0000\n" "Last-Translator: Bole \n" "Language-Team: none\n" "Language: hr\n" @@ -15,12 +15,12 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 3.8\n" +"X-Generator: Weblate 4.14.1\n" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id msgid "Account" -msgstr "" +msgstr "Konto" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move_reversal @@ -45,47 +45,47 @@ msgstr "" #: model:ir.model.fields,help:account_brand.field_account_move__brand_id #: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" -msgstr "" +msgstr "Brand za ovu prodaju" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__company_id msgid "Company" -msgstr "" +msgstr "Tvrtka" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid msgid "Created by" -msgstr "" +msgstr "Kreirao" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date msgid "Created on" -msgstr "" +msgstr "Kreirano" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name msgid "Display Name" -msgstr "" +msgstr "Naziv za prikaz" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id msgid "ID" -msgstr "" +msgstr "ID" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" -msgstr "" +msgstr "Stavka dnevnika" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update msgid "Last Modified on" -msgstr "" +msgstr "Zadnje modificirano" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid msgid "Last Updated by" -msgstr "" +msgstr "Zadnje ažurirano" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date @@ -109,24 +109,24 @@ msgstr "" #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format msgid "Partner has already an account set for this brand!" -msgstr "" +msgstr "Partner već ima postavljen konto za ovaj brand!" #. module: account_brand #: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable msgid "Payable" -msgstr "" +msgstr "Dugovno" #. module: account_brand #. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" -msgstr "" +msgstr "Molimo odaberite konto tipa %s" #. module: account_brand #: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable msgid "Receivable" -msgstr "" +msgstr "Potražno" #. module: account_brand #: model:ir.model,name:account_brand.model_res_partner_account_brand @@ -136,7 +136,7 @@ msgstr "" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type msgid "Type" -msgstr "" +msgstr "Tip" #~ msgid "Invoice" #~ msgstr "Račun" From e2d85b940f0119e5d7c38320ff17170b9aa7e771 Mon Sep 17 00:00:00 2001 From: Bole Date: Thu, 16 Feb 2023 12:12:32 +0000 Subject: [PATCH 29/47] Translated using Weblate (Croatian) Currently translated at 100.0% (22 of 22 strings) Translation: brand-16.0/brand-16.0-account_brand Translate-URL: https://translation.odoo-community.org/projects/brand-16-0/brand-16-0-account_brand/hr/ --- account_brand/i18n/hr.po | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/account_brand/i18n/hr.po b/account_brand/i18n/hr.po index a71687e3a..7308ce362 100644 --- a/account_brand/i18n/hr.po +++ b/account_brand/i18n/hr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-01-06 13:44+0000\n" +"PO-Revision-Date: 2023-02-16 14:23+0000\n" "Last-Translator: Bole \n" "Language-Team: none\n" "Language: hr\n" @@ -25,7 +25,7 @@ msgstr "Konto" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move_reversal msgid "Account Move Reversal" -msgstr "" +msgstr "Storno temeljnice" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id @@ -38,7 +38,7 @@ msgstr "Brand" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level msgid "Brand Use Level" -msgstr "" +msgstr "Razina uporabe brenda" #. module: account_brand #: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id @@ -90,18 +90,18 @@ msgstr "Zadnje ažurirano" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date msgid "Last Updated on" -msgstr "" +msgstr "Zadnje ažurirano" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id msgid "Partner" -msgstr "" +msgstr "Partner" #. module: account_brand #: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window #: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu msgid "Partner Accounts by Brand" -msgstr "" +msgstr "Konta partnera po brendu" #. module: account_brand #. odoo-python @@ -131,7 +131,7 @@ msgstr "Potražno" #. module: account_brand #: model:ir.model,name:account_brand.model_res_partner_account_brand msgid "Receivable/Payable Partner Account By Brand" -msgstr "" +msgstr "Potražna/Dugovna konta partnera po brendu" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type From ff87d3d9d2c4ec91f80f29724d944e0283a47895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?gelo=20joga=20Rodr=C3=ADguez?= Date: Thu, 4 May 2023 06:57:06 +0000 Subject: [PATCH 30/47] Translated using Weblate (Spanish) Currently translated at 100.0% (22 of 22 strings) Translation: brand-16.0/brand-16.0-account_brand Translate-URL: https://translation.odoo-community.org/projects/brand-16-0/brand-16-0-account_brand/es/ --- account_brand/i18n/es.po | 46 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/account_brand/i18n/es.po b/account_brand/i18n/es.po index a93701e39..cffde24a8 100644 --- a/account_brand/i18n/es.po +++ b/account_brand/i18n/es.po @@ -6,25 +6,25 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2020-05-22 09:19+0000\n" -"Last-Translator: Daniel Luque \n" +"PO-Revision-Date: 2023-05-04 12:19+0000\n" +"Last-Translator: gelo joga Rodríguez \n" "Language-Team: none\n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 3.10\n" +"X-Generator: Weblate 4.14.1\n" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id msgid "Account" -msgstr "" +msgstr "Cuenta" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move_reversal msgid "Account Move Reversal" -msgstr "" +msgstr "Asiento de reversión" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id @@ -37,7 +37,7 @@ msgstr "Marca" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level msgid "Brand Use Level" -msgstr "" +msgstr "Uso del campo Marca" #. module: account_brand #: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id @@ -49,58 +49,58 @@ msgstr "Marca a usar en esta venta" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__company_id msgid "Company" -msgstr "" +msgstr "Compañía" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid msgid "Created by" -msgstr "" +msgstr "Creado por" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date msgid "Created on" -msgstr "" +msgstr "Creado el" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name msgid "Display Name" -msgstr "" +msgstr "Nombre mostrado" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id msgid "ID" -msgstr "" +msgstr "ID" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" -msgstr "" +msgstr "Asiento contable" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update msgid "Last Modified on" -msgstr "" +msgstr "Última modificación el" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid msgid "Last Updated by" -msgstr "" +msgstr "Última actualización por" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date msgid "Last Updated on" -msgstr "" +msgstr "Última actualización el" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id msgid "Partner" -msgstr "" +msgstr "Partner" #. module: account_brand #: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window #: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu msgid "Partner Accounts by Brand" -msgstr "" +msgstr "Cuentas de clientes/proveedores por marca" #. module: account_brand #. odoo-python @@ -108,34 +108,34 @@ msgstr "" #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format msgid "Partner has already an account set for this brand!" -msgstr "" +msgstr "¡El cliente/proveedor ya tiene establecida una cuenta para esta marca!" #. module: account_brand #: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable msgid "Payable" -msgstr "" +msgstr "A pagar" #. module: account_brand #. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" -msgstr "" +msgstr "Por favor selecciona una cuenta de tipo %s" #. module: account_brand #: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable msgid "Receivable" -msgstr "" +msgstr "Por cobrar" #. module: account_brand #: model:ir.model,name:account_brand.model_res_partner_account_brand msgid "Receivable/Payable Partner Account By Brand" -msgstr "" +msgstr "Cuentas Por Cobrar/A Pagar de clientes y proveedores por marca" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type msgid "Type" -msgstr "" +msgstr "Tipo" #~ msgid "Invoice" #~ msgstr "Factura" From 4917ebea5eeb21e7a08f9886175be9b50ae1bff7 Mon Sep 17 00:00:00 2001 From: Ignacio Buioli Date: Sun, 25 Jun 2023 15:23:51 +0000 Subject: [PATCH 31/47] Added translation using Weblate (Spanish (Argentina)) --- account_brand/i18n/es_AR.po | 136 ++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 account_brand/i18n/es_AR.po diff --git a/account_brand/i18n/es_AR.po b/account_brand/i18n/es_AR.po new file mode 100644 index 000000000..faf2efdf4 --- /dev/null +++ b/account_brand/i18n/es_AR.po @@ -0,0 +1,136 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_brand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: es_AR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id +msgid "Account" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_account_move_reversal +msgid "Account Move Reversal" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id +#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id +msgid "Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level +msgid "Brand Use Level" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id +#: model:ir.model.fields,help:account_brand.field_account_move__brand_id +#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id +msgid "Brand to use for this sale" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__company_id +msgid "Company" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid +msgid "Created by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date +msgid "Created on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name +msgid "Display Name" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id +msgid "ID" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date +msgid "Last Updated on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id +msgid "Partner" +msgstr "" + +#. module: account_brand +#: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window +#: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu +msgid "Partner Accounts by Brand" +msgstr "" + +#. module: account_brand +#. odoo-python +#: code:addons/account_brand/models/res_partner_account_brand.py:0 +#: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner +#, python-format +msgid "Partner has already an account set for this brand!" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable +msgid "Payable" +msgstr "" + +#. module: account_brand +#. odoo-python +#: code:addons/account_brand/models/res_partner_account_brand.py:0 +#, python-format +msgid "Please select an account of type %s" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable +msgid "Receivable" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_res_partner_account_brand +msgid "Receivable/Payable Partner Account By Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type +msgid "Type" +msgstr "" From 41904e809a90f626b45b8cc5d6d99ee7509f290e Mon Sep 17 00:00:00 2001 From: Ignacio Buioli Date: Sun, 25 Jun 2023 15:24:34 +0000 Subject: [PATCH 32/47] Translated using Weblate (Spanish (Argentina)) Currently translated at 100.0% (22 of 22 strings) Translation: brand-16.0/brand-16.0-account_brand Translate-URL: https://translation.odoo-community.org/projects/brand-16-0/brand-16-0-account_brand/es_AR/ --- account_brand/README.rst | 15 ++++--- account_brand/i18n/es_AR.po | 48 +++++++++++---------- account_brand/static/description/index.html | 48 +++++++++++---------- 3 files changed, 59 insertions(+), 52 deletions(-) diff --git a/account_brand/README.rst b/account_brand/README.rst index f07cec270..c38025d87 100644 --- a/account_brand/README.rst +++ b/account_brand/README.rst @@ -2,10 +2,13 @@ Account Brand ============= -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:6dbc0d8cfac63a97b25a76fe68e37d6fb3505a5d38929edbfbab7bd6bf6bf5ff + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Account Brand .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/brand-16-0/brand-16-0-account_brand :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/284/16.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/brand&target_branch=16.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This module allows you to send branded invoices to your customers. It adds a brand field on the invoice and the brand information to the PDF @@ -55,7 +58,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed +If you spotted it first, help us to smash it by providing a detailed and welcomed `feedback `_. Do not contact contributors directly about support or help with technical issues. diff --git a/account_brand/i18n/es_AR.po b/account_brand/i18n/es_AR.po index faf2efdf4..dd8da324c 100644 --- a/account_brand/i18n/es_AR.po +++ b/account_brand/i18n/es_AR.po @@ -6,23 +6,25 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2023-06-25 15:26+0000\n" +"Last-Translator: Ignacio Buioli \n" "Language-Team: none\n" "Language: es_AR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id msgid "Account" -msgstr "" +msgstr "Cuenta" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move_reversal msgid "Account Move Reversal" -msgstr "" +msgstr "Reversión de Movimiento de Cuenta" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id @@ -30,75 +32,75 @@ msgstr "" #: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" -msgstr "" +msgstr "Marca" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level msgid "Brand Use Level" -msgstr "" +msgstr "Nivel de Uso de Marca" #. module: account_brand #: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id #: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" -msgstr "" +msgstr "Marca a utilizar para este venta" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__company_id msgid "Company" -msgstr "" +msgstr "Compañía" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid msgid "Created by" -msgstr "" +msgstr "Creado por" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date msgid "Created on" -msgstr "" +msgstr "Creado el" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name msgid "Display Name" -msgstr "" +msgstr "Nombre Mostrado" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id msgid "ID" -msgstr "" +msgstr "ID" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" -msgstr "" +msgstr "Asiento Contable" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand____last_update msgid "Last Modified on" -msgstr "" +msgstr "Última modificación el" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid msgid "Last Updated by" -msgstr "" +msgstr "Última actualización por" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date msgid "Last Updated on" -msgstr "" +msgstr "Última modificación el" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id msgid "Partner" -msgstr "" +msgstr "Contacto" #. module: account_brand #: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window #: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu msgid "Partner Accounts by Brand" -msgstr "" +msgstr "Cuentas de Contacto por Marca" #. module: account_brand #. odoo-python @@ -106,31 +108,31 @@ msgstr "" #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner #, python-format msgid "Partner has already an account set for this brand!" -msgstr "" +msgstr "¡El contacto ya tiene una cuenta configurada para esta marca!" #. module: account_brand #: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable msgid "Payable" -msgstr "" +msgstr "A Pagar" #. module: account_brand #. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 #, python-format msgid "Please select an account of type %s" -msgstr "" +msgstr "Por favor, selecciones una cuenta de tipo %s" #. module: account_brand #: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable msgid "Receivable" -msgstr "" +msgstr "A Cobrar" #. module: account_brand #: model:ir.model,name:account_brand.model_res_partner_account_brand msgid "Receivable/Payable Partner Account By Brand" -msgstr "" +msgstr "Cuenta de contacto a Cobrar/Pagar por Marca" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type msgid "Type" -msgstr "" +msgstr "Tipo" diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html index 2aa48d0ba..4592c140b 100644 --- a/account_brand/static/description/index.html +++ b/account_brand/static/description/index.html @@ -1,20 +1,20 @@ - + - + Account Brand -
    -

    Account Brand

    +
    + + +Odoo Community Association + +
    +

    Account Brand

    -

    Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runboat

    +

    Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runboat

    This module allows you to send branded invoices to your customers. It adds a brand field on the invoice and the brand information to the PDF report.

    @@ -389,7 +394,7 @@

    Account Brand

    -

    Configuration

    +

    Configuration

    It is important to note that the “brand use level” should be set to Optional or Required. The brand use level is configured in the Users & Companies settings. By default it is set to ‘Do not use brands @@ -402,7 +407,7 @@

    Configuration

    Required

    -

    Usage

    +

    Usage

    To use this module, you need to:

    1. Go to Accounting > Customers > Invoices
    2. @@ -416,7 +421,7 @@

      Usage

      OCA module must be installed.

    -

    Bug Tracker

    +

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -424,16 +429,16 @@

    Bug Tracker

    Do not contact contributors directly about support or help with technical issues.

    -

    Credits

    +

    Credits

    -

    Authors

    +

    Authors

    • Open Source Integrators
    • ACSONE SA/NV
    -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    Odoo Community Association @@ -468,5 +473,6 @@

    Maintainers

    +
    diff --git a/account_brand/tests/test_brand_mixin.py b/account_brand/tests/test_brand_mixin.py index bd209fe2f..33e0c2bd5 100644 --- a/account_brand/tests/test_brand_mixin.py +++ b/account_brand/tests/test_brand_mixin.py @@ -24,6 +24,7 @@ def setUp(self): self.invoice = self.env["account.move"].create( { "name": "Sample invoice", + "move_type": "out_invoice", "company_id": self.company.id, "journal_id": self.journal.id, "partner_id": self.partner.id, @@ -53,6 +54,7 @@ def test_check_brand_requirement(self): self.env["account.move"].create( { "name": "Sample invoice", + "move_type": "out_invoice", "company_id": self.company.id, "journal_id": self.journal.id, "partner_id": self.partner.id, diff --git a/account_brand/views/account_move_views.xml b/account_brand/views/account_move_views.xml index bc402fe57..b98116743 100644 --- a/account_brand/views/account_move_views.xml +++ b/account_brand/views/account_move_views.xml @@ -11,6 +11,7 @@ name="brand_id" invisible="move_type not in ['out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt']" readonly="state != 'draft'" + required="is_brand_required" /> From 505bcaaff6a656d37d9a7b97d6ca3aba92534d0b Mon Sep 17 00:00:00 2001 From: Weblate Date: Mon, 15 Sep 2025 09:01:46 +0000 Subject: [PATCH 41/47] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: brand-18.0/brand-18.0-account_brand Translate-URL: https://translation.odoo-community.org/projects/brand-18-0/brand-18-0-account_brand/ --- account_brand/i18n/de.po | 11 +++++------ account_brand/i18n/es.po | 11 +++++------ account_brand/i18n/es_AR.po | 11 +++++------ account_brand/i18n/hr.po | 11 +++++------ account_brand/i18n/it.po | 11 +++++------ account_brand/i18n/nl.po | 11 +++++------ account_brand/i18n/zh_CN.po | 11 +++++------ 7 files changed, 35 insertions(+), 42 deletions(-) diff --git a/account_brand/i18n/de.po b/account_brand/i18n/de.po index 98dc65bc6..2ae6c67a9 100644 --- a/account_brand/i18n/de.po +++ b/account_brand/i18n/de.po @@ -29,7 +29,6 @@ msgstr "" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id -#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Marke" @@ -42,7 +41,6 @@ msgstr "" #. module: account_brand #: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id -#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "zu verwendende Marke für diesen Verkauf" @@ -71,6 +69,11 @@ msgstr "Anzeigename" msgid "ID" msgstr "ID" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__is_brand_required +msgid "Is Brand Required" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" @@ -98,10 +101,7 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand -#. odoo-python -#: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner -#, python-format msgid "Partner has already an account set for this brand!" msgstr "Der Partner hat für diese Marke bereits ein Konto!" @@ -113,7 +113,6 @@ msgstr "Kreditor" #. module: account_brand #. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 -#, python-format msgid "Please select an account of type %s" msgstr "Bitte ein Konto vom Typ %s wählen." diff --git a/account_brand/i18n/es.po b/account_brand/i18n/es.po index 6a4b78590..08f5b758d 100644 --- a/account_brand/i18n/es.po +++ b/account_brand/i18n/es.po @@ -29,7 +29,6 @@ msgstr "Asiento de reversión" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id -#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Marca" @@ -42,7 +41,6 @@ msgstr "Uso del campo Marca" #. module: account_brand #: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id -#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "Marca a usar en esta venta" @@ -71,6 +69,11 @@ msgstr "Nombre mostrado" msgid "ID" msgstr "ID" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__is_brand_required +msgid "Is Brand Required" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" @@ -98,10 +101,7 @@ msgid "Partner Accounts by Brand" msgstr "Cuentas de clientes/proveedores por marca" #. module: account_brand -#. odoo-python -#: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner -#, python-format msgid "Partner has already an account set for this brand!" msgstr "¡El cliente/proveedor ya tiene establecida una cuenta para esta marca!" @@ -113,7 +113,6 @@ msgstr "A pagar" #. module: account_brand #. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 -#, python-format msgid "Please select an account of type %s" msgstr "Por favor selecciona una cuenta de tipo %s" diff --git a/account_brand/i18n/es_AR.po b/account_brand/i18n/es_AR.po index 6c0110b32..9f2dd6167 100644 --- a/account_brand/i18n/es_AR.po +++ b/account_brand/i18n/es_AR.po @@ -29,7 +29,6 @@ msgstr "Reversión de Movimiento de Cuenta" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id -#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Marca" @@ -42,7 +41,6 @@ msgstr "Nivel de Uso de Marca" #. module: account_brand #: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id -#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "Marca a utilizar para este venta" @@ -71,6 +69,11 @@ msgstr "Nombre Mostrado" msgid "ID" msgstr "ID" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__is_brand_required +msgid "Is Brand Required" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" @@ -98,10 +101,7 @@ msgid "Partner Accounts by Brand" msgstr "Cuentas de Contacto por Marca" #. module: account_brand -#. odoo-python -#: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner -#, python-format msgid "Partner has already an account set for this brand!" msgstr "¡El contacto ya tiene una cuenta configurada para esta marca!" @@ -113,7 +113,6 @@ msgstr "A Pagar" #. module: account_brand #. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 -#, python-format msgid "Please select an account of type %s" msgstr "Por favor, selecciones una cuenta de tipo %s" diff --git a/account_brand/i18n/hr.po b/account_brand/i18n/hr.po index 41cb4ac1a..4d84e15db 100644 --- a/account_brand/i18n/hr.po +++ b/account_brand/i18n/hr.po @@ -30,7 +30,6 @@ msgstr "Storno temeljnice" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id -#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Brand" @@ -43,7 +42,6 @@ msgstr "Razina uporabe brenda" #. module: account_brand #: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id -#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "Brand za ovu prodaju" @@ -72,6 +70,11 @@ msgstr "Naziv za prikaz" msgid "ID" msgstr "ID" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__is_brand_required +msgid "Is Brand Required" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" @@ -99,10 +102,7 @@ msgid "Partner Accounts by Brand" msgstr "Konta partnera po brendu" #. module: account_brand -#. odoo-python -#: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner -#, python-format msgid "Partner has already an account set for this brand!" msgstr "Partner već ima postavljen konto za ovaj brand!" @@ -114,7 +114,6 @@ msgstr "Dugovno" #. module: account_brand #. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 -#, python-format msgid "Please select an account of type %s" msgstr "Molimo odaberite konto tipa %s" diff --git a/account_brand/i18n/it.po b/account_brand/i18n/it.po index b99238d6e..a4b8ff2d1 100644 --- a/account_brand/i18n/it.po +++ b/account_brand/i18n/it.po @@ -29,7 +29,6 @@ msgstr "Storno movimento conto" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id -#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Marca" @@ -42,7 +41,6 @@ msgstr "Livello uso marca" #. module: account_brand #: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id -#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "Marca da usare per questa vendita" @@ -71,6 +69,11 @@ msgstr "Nome visualizzato" msgid "ID" msgstr "ID" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__is_brand_required +msgid "Is Brand Required" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" @@ -98,10 +101,7 @@ msgid "Partner Accounts by Brand" msgstr "Conti partner per marca" #. module: account_brand -#. odoo-python -#: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner -#, python-format msgid "Partner has already an account set for this brand!" msgstr "Il partner ha già un conto impostato per questa marca!" @@ -113,7 +113,6 @@ msgstr "Debito" #. module: account_brand #. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 -#, python-format msgid "Please select an account of type %s" msgstr "Selezionare un conto di tipo %s" diff --git a/account_brand/i18n/nl.po b/account_brand/i18n/nl.po index 683c71d09..06a453606 100644 --- a/account_brand/i18n/nl.po +++ b/account_brand/i18n/nl.po @@ -30,7 +30,6 @@ msgstr "Boeking terugdraaien" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id -#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "Merk" @@ -43,7 +42,6 @@ msgstr "Merk gebruiks niveau" #. module: account_brand #: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id -#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "Merk voor deze verkoop" @@ -72,6 +70,11 @@ msgstr "Weergavenaam" msgid "ID" msgstr "ID" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__is_brand_required +msgid "Is Brand Required" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" @@ -99,10 +102,7 @@ msgid "Partner Accounts by Brand" msgstr "Partneraccounts per merk" #. module: account_brand -#. odoo-python -#: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner -#, python-format msgid "Partner has already an account set for this brand!" msgstr "Partner heeft al een account voor dit merk!" @@ -114,7 +114,6 @@ msgstr "Te betalen" #. module: account_brand #. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 -#, python-format msgid "Please select an account of type %s" msgstr "Selecteer een account van het type %s" diff --git a/account_brand/i18n/zh_CN.po b/account_brand/i18n/zh_CN.po index 6cf0d7898..dba1f8220 100644 --- a/account_brand/i18n/zh_CN.po +++ b/account_brand/i18n/zh_CN.po @@ -29,7 +29,6 @@ msgstr "" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id -#: model:ir.model.fields,field_description:account_brand.field_account_payment__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" msgstr "品牌" @@ -42,7 +41,6 @@ msgstr "" #. module: account_brand #: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id -#: model:ir.model.fields,help:account_brand.field_account_payment__brand_id msgid "Brand to use for this sale" msgstr "" @@ -71,6 +69,11 @@ msgstr "" msgid "ID" msgstr "" +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__is_brand_required +msgid "Is Brand Required" +msgstr "" + #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" @@ -98,10 +101,7 @@ msgid "Partner Accounts by Brand" msgstr "" #. module: account_brand -#. odoo-python -#: code:addons/account_brand/models/res_partner_account_brand.py:0 #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner -#, python-format msgid "Partner has already an account set for this brand!" msgstr "" @@ -113,7 +113,6 @@ msgstr "" #. module: account_brand #. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 -#, python-format msgid "Please select an account of type %s" msgstr "" From 7c76640c813dbc0c2bd0b0192ee3e2cb33fa319b Mon Sep 17 00:00:00 2001 From: mymage Date: Tue, 16 Sep 2025 08:44:02 +0000 Subject: [PATCH 42/47] Translated using Weblate (Italian) Currently translated at 100.0% (22 of 22 strings) Translation: brand-18.0/brand-18.0-account_brand Translate-URL: https://translation.odoo-community.org/projects/brand-18-0/brand-18-0-account_brand/it/ --- account_brand/i18n/it.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/account_brand/i18n/it.po b/account_brand/i18n/it.po index a4b8ff2d1..d2824a862 100644 --- a/account_brand/i18n/it.po +++ b/account_brand/i18n/it.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2025-01-02 19:06+0000\n" +"PO-Revision-Date: 2025-09-16 11:42+0000\n" "Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.6.2\n" +"X-Generator: Weblate 5.10.4\n" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id @@ -72,7 +72,7 @@ msgstr "ID" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__is_brand_required msgid "Is Brand Required" -msgstr "" +msgstr "La marca è richiesta" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move From 12d3ebc86348cc52580fb30aca0edb3ac3ff37e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bet=C3=BCl=20=C3=96=C4=9Fmen?= Date: Tue, 7 Apr 2026 11:42:10 +0000 Subject: [PATCH 43/47] Added translation using Weblate (Turkish) --- account_brand/i18n/tr.po | 130 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 account_brand/i18n/tr.po diff --git a/account_brand/i18n/tr.po b/account_brand/i18n/tr.po new file mode 100644 index 000000000..2f6fa13f5 --- /dev/null +++ b/account_brand/i18n/tr.po @@ -0,0 +1,130 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_brand +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id +msgid "Account" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_account_move_reversal +msgid "Account Move Reversal" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id +msgid "Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level +msgid "Brand Use Level" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id +#: model:ir.model.fields,help:account_brand.field_account_move__brand_id +msgid "Brand to use for this sale" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__company_id +msgid "Company" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid +msgid "Created by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date +msgid "Created on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name +msgid "Display Name" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id +msgid "ID" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_account_move__is_brand_required +msgid "Is Brand Required" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date +msgid "Last Updated on" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id +msgid "Partner" +msgstr "" + +#. module: account_brand +#: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window +#: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu +msgid "Partner Accounts by Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner +msgid "Partner has already an account set for this brand!" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable +msgid "Payable" +msgstr "" + +#. module: account_brand +#. odoo-python +#: code:addons/account_brand/models/res_partner_account_brand.py:0 +msgid "Please select an account of type %s" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable +msgid "Receivable" +msgstr "" + +#. module: account_brand +#: model:ir.model,name:account_brand.model_res_partner_account_brand +msgid "Receivable/Payable Partner Account By Brand" +msgstr "" + +#. module: account_brand +#: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type +msgid "Type" +msgstr "" From e071c5e492d3b7d288412fbef904ea7831f91a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bet=C3=BCl=20=C3=96=C4=9Fmen?= Date: Tue, 7 Apr 2026 11:44:57 +0000 Subject: [PATCH 44/47] Translated using Weblate (Turkish) Currently translated at 95.4% (21 of 22 strings) Translation: brand-18.0/brand-18.0-account_brand Translate-URL: https://translation.odoo-community.org/projects/brand-18-0/brand-18-0-account_brand/tr/ --- account_brand/i18n/tr.po | 46 +++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/account_brand/i18n/tr.po b/account_brand/i18n/tr.po index 2f6fa13f5..6354c5c91 100644 --- a/account_brand/i18n/tr.po +++ b/account_brand/i18n/tr.po @@ -6,61 +6,63 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2026-04-07 13:45+0000\n" +"Last-Translator: Betül Öğmen \n" "Language-Team: none\n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.15.2\n" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id msgid "Account" -msgstr "" +msgstr "Hesap" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move_reversal msgid "Account Move Reversal" -msgstr "" +msgstr "Yevmiye Kaydı Geri Alma" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_id #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__brand_id msgid "Brand" -msgstr "" +msgstr "Marka" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__brand_use_level msgid "Brand Use Level" -msgstr "" +msgstr "Marka Kullanım Seviyesi" #. module: account_brand #: model:ir.model.fields,help:account_brand.field_account_bank_statement_line__brand_id #: model:ir.model.fields,help:account_brand.field_account_move__brand_id msgid "Brand to use for this sale" -msgstr "" +msgstr "Bu satış için kullanılacak marka" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__company_id msgid "Company" -msgstr "" +msgstr "Şirket" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_uid msgid "Created by" -msgstr "" +msgstr "Oluşturan" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__create_date msgid "Created on" -msgstr "" +msgstr "Oluşturulma" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__display_name msgid "Display Name" -msgstr "" +msgstr "Görünüm Adı" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__id @@ -70,61 +72,61 @@ msgstr "" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__is_brand_required msgid "Is Brand Required" -msgstr "" +msgstr "Marka Gerekli mi" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move msgid "Journal Entry" -msgstr "" +msgstr "Yevmiye Kaydı" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_uid msgid "Last Updated by" -msgstr "" +msgstr "Son Güncelleyen" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__write_date msgid "Last Updated on" -msgstr "" +msgstr "Son Güncelleme" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__partner_id msgid "Partner" -msgstr "" +msgstr "İş Ortağı" #. module: account_brand #: model:ir.actions.act_window,name:account_brand.res_partner_account_brand_act_window #: model:ir.ui.menu,name:account_brand.res_partner_account_brand_menu msgid "Partner Accounts by Brand" -msgstr "" +msgstr "Markaya Göre Ortak Hesapları" #. module: account_brand #: model:ir.model.constraint,message:account_brand.constraint_res_partner_account_brand_unique_account_by_partner msgid "Partner has already an account set for this brand!" -msgstr "" +msgstr "Ortağın bu marka için zaten bir hesabı var!" #. module: account_brand #: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__liability_payable msgid "Payable" -msgstr "" +msgstr "Ödenecek" #. module: account_brand #. odoo-python #: code:addons/account_brand/models/res_partner_account_brand.py:0 msgid "Please select an account of type %s" -msgstr "" +msgstr "Lütfen %s tipinde bir hesap seçin" #. module: account_brand #: model:ir.model.fields.selection,name:account_brand.selection__res_partner_account_brand__account_type__asset_receivable msgid "Receivable" -msgstr "" +msgstr "Alacaklı" #. module: account_brand #: model:ir.model,name:account_brand.model_res_partner_account_brand msgid "Receivable/Payable Partner Account By Brand" -msgstr "" +msgstr "Markaya Göre Alacaklı/Ödenecek Ortak Hesabı" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_type msgid "Type" -msgstr "" +msgstr "Tür" From 7bfa37d2d0be168e41e8d0196e47e851cb8158ba Mon Sep 17 00:00:00 2001 From: Ed-Spain Date: Mon, 20 Apr 2026 15:55:56 +0000 Subject: [PATCH 45/47] Translated using Weblate (Spanish) Currently translated at 100.0% (22 of 22 strings) Translation: brand-18.0/brand-18.0-account_brand Translate-URL: https://translation.odoo-community.org/projects/brand-18-0/brand-18-0-account_brand/es/ --- account_brand/i18n/es.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/account_brand/i18n/es.po b/account_brand/i18n/es.po index 08f5b758d..1d48453cb 100644 --- a/account_brand/i18n/es.po +++ b/account_brand/i18n/es.po @@ -6,15 +6,15 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-05-04 12:19+0000\n" -"Last-Translator: gelo joga Rodríguez \n" +"PO-Revision-Date: 2026-04-20 15:59+0000\n" +"Last-Translator: Ed-Spain \n" "Language-Team: none\n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.14.1\n" +"X-Generator: Weblate 5.15.2\n" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_res_partner_account_brand__account_id @@ -72,7 +72,7 @@ msgstr "ID" #. module: account_brand #: model:ir.model.fields,field_description:account_brand.field_account_move__is_brand_required msgid "Is Brand Required" -msgstr "" +msgstr "¿Se Requiere la Marca?" #. module: account_brand #: model:ir.model,name:account_brand.model_account_move From 46393511bfecbc47e9c3605b73816c020c1a2289 Mon Sep 17 00:00:00 2001 From: Bhavesh Heliconia Date: Fri, 15 May 2026 17:48:42 +0530 Subject: [PATCH 46/47] [IMP] account_brand: pre-commit auto fixes --- account_brand/README.rst | 10 +++++----- account_brand/__manifest__.py | 4 +--- account_brand/models/res_partner_account_brand.py | 4 ++-- account_brand/static/description/index.html | 6 +++--- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/account_brand/README.rst b/account_brand/README.rst index 61bca7f34..97c8a07a0 100644 --- a/account_brand/README.rst +++ b/account_brand/README.rst @@ -21,13 +21,13 @@ Account Brand :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbrand-lightgray.png?logo=github - :target: https://github.com/OCA/brand/tree/18.0/account_brand + :target: https://github.com/OCA/brand/tree/19.0/account_brand :alt: OCA/brand .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/brand-18-0/brand-18-0-account_brand + :target: https://translation.odoo-community.org/projects/brand-19-0/brand-19-0-account_brand :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/brand&target_branch=18.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/brand&target_branch=19.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -78,7 +78,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -133,6 +133,6 @@ Current `maintainers `__: |maintainer-osi-scampbell| |maintainer-sbejaoui| -This module is part of the `OCA/brand `_ project on GitHub. +This module is part of the `OCA/brand `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index a5325011b..8aa91be7a 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -8,9 +8,7 @@ "version": "18.0.1.0.1", "category": "Accounting Management", "website": "https://github.com/OCA/brand", - "author": "Open Source Integrators," - "ACSONE SA/NV," - "Odoo Community Association (OCA)", + "author": "Open Source Integrators,ACSONE SA/NV,Odoo Community Association (OCA)", "license": "AGPL-3", "depends": ["account", "brand"], "data": [ diff --git a/account_brand/models/res_partner_account_brand.py b/account_brand/models/res_partner_account_brand.py index c4c793f1a..b4862e1ee 100644 --- a/account_brand/models/res_partner_account_brand.py +++ b/account_brand/models/res_partner_account_brand.py @@ -1,7 +1,7 @@ # Copyright 2019 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import ValidationError @@ -48,7 +48,7 @@ def _check_account_type(self): and rec.account_id.account_type != rec.account_type ): raise ValidationError( - _("Please select an account of type %s") % rec.account_type + self.env._("Please select an account of type %s", rec.account_type) ) @api.onchange("account_type") diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html index fc5ea3a09..57463d1fd 100644 --- a/account_brand/static/description/index.html +++ b/account_brand/static/description/index.html @@ -374,7 +374,7 @@

    Account Brand

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:ab166f2c569da3845bb4a2f1562ba1e9ae6a00d27b93432b5fd578bd7cb2726e !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

    Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runboat

    +

    Beta License: AGPL-3 OCA/brand Translate me on Weblate Try me on Runboat

    This module allows you to send branded invoices to your customers. It adds a brand field on the invoice and the brand information to the PDF report.

    @@ -425,7 +425,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -468,7 +468,7 @@

    Maintainers

    promote its widespread use.

    Current maintainers:

    osi-scampbell sbejaoui

    -

    This module is part of the OCA/brand project on GitHub.

    +

    This module is part of the OCA/brand project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    From 022767a0b3599a5de60a385fd8f6e153fe4e39f2 Mon Sep 17 00:00:00 2001 From: Bhavesh Heliconia Date: Fri, 15 May 2026 17:51:52 +0530 Subject: [PATCH 47/47] [MIG] account_brand: Migration to 19.0 --- account_brand/README.rst | 3 ++ account_brand/__manifest__.py | 2 +- .../models/res_partner_account_brand.py | 19 +++---- account_brand/readme/CONTRIBUTORS.md | 2 + account_brand/static/description/index.html | 4 ++ account_brand/tests/test_account_move.py | 51 +++++++++++-------- account_brand/tests/test_brand_mixin.py | 46 +++++++++++++++-- 7 files changed, 90 insertions(+), 37 deletions(-) diff --git a/account_brand/README.rst b/account_brand/README.rst index 97c8a07a0..a0fbd9de2 100644 --- a/account_brand/README.rst +++ b/account_brand/README.rst @@ -103,6 +103,9 @@ Contributors - Ammar Officewala - bosd < +- `Heliconia Solutions Pvt. Ltd. `__ + + - Bhavesh Heliconia Other credits ------------- diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index 8aa91be7a..08f4d808c 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "18.0.1.0.1", + "version": "19.0.1.0.0", "category": "Accounting Management", "website": "https://github.com/OCA/brand", "author": "Open Source Integrators,ACSONE SA/NV,Odoo Community Association (OCA)", diff --git a/account_brand/models/res_partner_account_brand.py b/account_brand/models/res_partner_account_brand.py index b4862e1ee..955b9cadc 100644 --- a/account_brand/models/res_partner_account_brand.py +++ b/account_brand/models/res_partner_account_brand.py @@ -31,13 +31,10 @@ class ResPartnerAccountBrand(models.Model): required=True, ) - _sql_constraints = [ - ( - "unique_account_by_partner", - "unique(partner_id, account_id, brand_id, account_type)", - "Partner has already an account set for this brand!", - ) - ] + _unique_account_by_partner = models.Constraint( + "unique(partner_id, account_id, brand_id, account_type)", + "Partner has already an account set for this brand!", + ) @api.constrains("account_id", "account_type") def _check_account_type(self): @@ -56,14 +53,14 @@ def _onchange_account_type(self): self.ensure_one() self.update({"account_id": False}) domain = [("id", "=", False)] - if self.account_type == "payable": + if self.account_type == "liability_payable": domain = [ - ("internal_type", "=", "payable"), + ("account_type", "=", "liability_payable"), ("deprecated", "=", False), ] - elif self.account_type == "receivable": + elif self.account_type == "asset_receivable": domain = [ - ("internal_type", "=", "receivable"), + ("account_type", "=", "asset_receivable"), ("deprecated", "=", False), ] return {"domain": {"account_id": domain}} diff --git a/account_brand/readme/CONTRIBUTORS.md b/account_brand/readme/CONTRIBUTORS.md index bf1dc5ed8..693fd541e 100644 --- a/account_brand/readme/CONTRIBUTORS.md +++ b/account_brand/readme/CONTRIBUTORS.md @@ -5,3 +5,5 @@ - Vicent Cubells - Ammar Officewala \<\> - bosd \< +- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) + - Bhavesh Heliconia diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html index 57463d1fd..ef728edd7 100644 --- a/account_brand/static/description/index.html +++ b/account_brand/static/description/index.html @@ -449,6 +449,10 @@

    Contributors

  • Ammar Officewala <aofficewala@opensourceintegrators.com>
  • bosd <<c5e2fd43-d292-4c90-9d1f-74ff3436329a@anonaddy.me>
  • +
  • Heliconia Solutions Pvt. Ltd.
      +
    • Bhavesh Heliconia
    • +
    +
  • diff --git a/account_brand/tests/test_account_move.py b/account_brand/tests/test_account_move.py index 7c3835e42..d7e218796 100644 --- a/account_brand/tests/test_account_move.py +++ b/account_brand/tests/test_account_move.py @@ -1,14 +1,17 @@ # Copyright 2019 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.tests.common import TransactionCase +from odoo import Command +from odoo.addons.base.tests.common import BaseCommon -class TestAccountMove(TransactionCase): - def setUp(self): - super().setUp() - self.product = self.env.ref("product.product_product_4") - self.account_receivable = self.env["account.account"].create( + +class TestAccountMove(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product = cls.env["product.product"].create({"name": "Test Product"}) + cls.account_receivable = cls.env["account.account"].create( { "name": "Partner Receivable", "code": "RCV00", @@ -16,7 +19,7 @@ def setUp(self): "reconcile": True, } ) - self.account_receivable_brand_default = self.env["account.account"].create( + cls.account_receivable_brand_default = cls.env["account.account"].create( { "name": "Receivable Brand Default", "code": "RCV01", @@ -24,7 +27,7 @@ def setUp(self): "reconcile": True, } ) - self.account_receivable_partner_brand_default = self.env[ + cls.account_receivable_partner_brand_default = cls.env[ "account.account" ].create( { @@ -34,32 +37,38 @@ def setUp(self): "reconcile": True, } ) - self.partner_id = self.env.ref("base.res_partner_12") - self.partner_id.property_account_receivable_id = self.account_receivable - self.account_revenue = self.env["account.account"].create( + cls.partner.property_account_receivable_id = cls.account_receivable + cls.account_revenue = cls.env["account.account"].create( {"name": "Test sale", "code": "XX.700", "account_type": "income"} ) - self.move = self.env["account.move"].create( + cls.journal = cls.env["account.journal"].create( + { + "name": "Sale Journal", + "code": "SAL", + "type": "sale", + "company_id": cls.env.company.id, + } + ) + cls.move = cls.env["account.move"].create( { - "partner_id": self.partner_id.id, + "journal_id": cls.journal.id, + "partner_id": cls.partner.id, "move_type": "out_invoice", "invoice_line_ids": [ - ( - 0, - 0, + Command.create( { - "product_id": self.product.id, + "product_id": cls.product.id, "quantity": 1, "price_unit": 42, "name": "something", - "account_id": self.account_revenue.id, + "account_id": cls.account_revenue.id, }, ) ], } ) - self.brand_id = self.env["res.brand"].create({"name": "Brand"}) + cls.brand_id = cls.env["res.brand"].create({"name": "Brand"}) def _get_receivable_account(self, move): return self.move.line_ids.filtered( @@ -86,7 +95,7 @@ def test_on_change_partner_id(self): self.assertEqual(account, self.account_receivable_brand_default) partner_account_brand.update( { - "partner_id": self.partner_id.id, + "partner_id": self.partner.id, "account_id": self.account_receivable_partner_brand_default.id, } ) @@ -98,7 +107,7 @@ def test_on_change_partner_id(self): ) move = self.env["account.move"].create( { - "partner_id": self.partner_id.id, + "partner_id": self.partner.id, "brand_id": self.brand_id.id, "move_type": "out_invoice", } diff --git a/account_brand/tests/test_brand_mixin.py b/account_brand/tests/test_brand_mixin.py index 33e0c2bd5..87a707e1f 100644 --- a/account_brand/tests/test_brand_mixin.py +++ b/account_brand/tests/test_brand_mixin.py @@ -3,6 +3,7 @@ from lxml import etree +from odoo import Command from odoo.exceptions import ValidationError from odoo.tests import Form from odoo.tests.common import TransactionCase @@ -14,6 +15,44 @@ class TestBrandMixin(TransactionCase): def setUp(self): super().setUp() self.partner = self.env.user.partner_id + self.account_receivable = self.env["account.account"].search( + [ + ("account_type", "=", "asset_receivable"), + ("company_ids", "in", self.env.company.id), + ], + limit=1, + ) + if not self.account_receivable: + self.account_receivable = self.env["account.account"].create( + { + "name": "Receivable", + "code": "RCV001", + "account_type": "asset_receivable", + "reconcile": True, + } + ) + self.account_payable = self.env["account.account"].search( + [ + ("account_type", "=", "liability_payable"), + ("company_ids", "in", self.env.company.id), + ], + limit=1, + ) + if not self.account_payable: + self.account_payable = self.env["account.account"].create( + { + "name": "Payable", + "code": "PAY001", + "account_type": "liability_payable", + "reconcile": True, + } + ) + self.partner.property_account_receivable_id = self.account_receivable + self.partner.property_account_payable_id = self.account_payable + self.product = self.env["product.product"].create({"name": "Test Product"}) + self.account_revenue = self.env["account.account"].create( + {"name": "Test sale", "code": "XX.700", "account_type": "income"} + ) self.company = self.env.user.company_id self.other_company = self.env["res.company"].create( {"name": "other company", "parent_id": self.company.id} @@ -116,15 +155,14 @@ def test_reverse_move(self): "partner_id": self.partner.id, "brand_id": self.brand.id, "invoice_line_ids": [ - ( - 0, - 0, + Command.create( { - "product_id": self.env.ref("product.product_product_1").id, + "product_id": self.product.id, "quantity": 40.0, "name": "product test 1", "discount": 10.00, "price_unit": 2.27, + "account_id": self.account_revenue.id, }, ) ],